jx mes 物料信息导入

tags/yfai-mes-ext-v1.0
王杰 1 year ago
parent 37885c1962
commit d59e25ada9

@ -25,10 +25,7 @@ import cn.estsh.i3plus.pojo.mes.bean.MesPartCategory;
import cn.estsh.i3plus.pojo.mes.repository.MesPartCategoryRepository; import cn.estsh.i3plus.pojo.mes.repository.MesPartCategoryRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesPartProduceTypeRepository; import cn.estsh.i3plus.pojo.mes.repository.MesPartProduceTypeRepository;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -139,307 +136,269 @@ public class PartExtExcelService implements IExcelImportExtService {
String errorInfo = ""; //错误信息 String errorInfo = ""; //错误信息
//物料代码 //物料代码
String partNo = null; String partNo;
try { try {
row.getCell(0).setCellType(CellType.STRING); partNo = new DataFormatter().formatCellValue(row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
partNo = row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var88) {
continue; continue;
} }
//物料名称 //物料名称
String partName = null; String partName = null;
try { try {
row.getCell(1).setCellType(CellType.STRING); partName = new DataFormatter().formatCellValue(row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
partName = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var80) {
} }
//物料简称 //物料简称
String briefText = null; String briefText = null;
try { try {
row.getCell(2).setCellType(CellType.STRING); briefText = new DataFormatter().formatCellValue(row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
briefText = row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var79) {
} }
//单位 //单位
String unit = null; String unit = null;
try { try {
row.getCell(3).setCellType(CellType.STRING); unit = new DataFormatter().formatCellValue(row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
unit = row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var77) {
} }
//物料类型1 //物料类型1
String categoryCode1 = null; String categoryCode1 = null;
try { try {
row.getCell(4).setCellType(CellType.STRING); categoryCode1 = new DataFormatter().formatCellValue(row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
categoryCode1 = row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var76) {
} }
//物料类型2 //物料类型2
String categoryCode2 = null; String categoryCode2 = null;
try { try {
row.getCell(5).setCellType(CellType.STRING); categoryCode2 = new DataFormatter().formatCellValue(row.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
categoryCode2 = row.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var75) {
} }
//物料类型3 //物料类型3
String categoryCode3 = null; String categoryCode3 = null;
try { try {
row.getCell(6).setCellType(CellType.STRING); categoryCode3 = new DataFormatter().formatCellValue(row.getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
categoryCode3 = row.getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var74) {
} }
//产品编码匹配类型 //产品编码匹配类型
String processMatchType = null; String processMatchType = null;
try { try {
row.getCell(7).setCellType(CellType.STRING); processMatchType = new DataFormatter().formatCellValue(row.getCell(7, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
processMatchType = row.getCell(7, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var70) {
} }
//产品编码匹配类型 //产品编码匹配类型
String productMatchType = null; String productMatchType = null;
try { try {
row.getCell(8).setCellType(CellType.STRING); productMatchType = new DataFormatter().formatCellValue(row.getCell(8, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
productMatchType = row.getCell(8, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var68) {
} }
// //包装编码匹配类型 //包装编码匹配类型
// String packageMatchType = null; String packageMatchType = null;
// try { try {
// row.getCell(8).setCellType(CellType.STRING); packageMatchType = new DataFormatter().formatCellValue(row.getCell(9, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
// packageMatchType = row.getCell(8, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
// } catch (Exception var68) { }
// }
//包装数量 //包装数量
String qty2 = null; String qty2 = null;
try { try {
row.getCell(9).setCellType(CellType.STRING); qty2 = new DataFormatter().formatCellValue(row.getCell(10, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
qty2 = row.getCell(9, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var67) {
} }
//产品生产类型 //产品生产类型
String pptCode = null; String pptCode = null;
try { try {
row.getCell(10).setCellType(CellType.STRING); pptCode = new DataFormatter().formatCellValue(row.getCell(11, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
pptCode = row.getCell(10, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var66) {
} }
//颜色代码 //颜色代码
String colorCode = null; String colorCode = null;
try { try {
row.getCell(11).setCellType(CellType.STRING); colorCode = new DataFormatter().formatCellValue(row.getCell(12, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
colorCode = row.getCell(11, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var64) {
} }
//颜色名称 //颜色名称
String colorName = null; String colorName = null;
try { try {
row.getCell(12).setCellType(CellType.STRING); colorName = new DataFormatter().formatCellValue(row.getCell(13, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
colorName = row.getCell(12, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var63) {
} }
//销售向 //销售向
String salesTo = null; String salesTo = null;
try { try {
row.getCell(13).setCellType(CellType.STRING); salesTo = new DataFormatter().formatCellValue(row.getCell(14, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
salesTo = row.getCell(13, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var62) {
} }
//是否出货检验 //是否出货检验
String isOqc = null; String isOqc = null;
try { try {
row.getCell(14).setCellType(CellType.STRING); isOqc = new DataFormatter().formatCellValue(row.getCell(15, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isOqc = row.getCell(14, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var61) {
} }
//是否生成条码 //是否生成条码
String isCreateSn = null; String isCreateSn = null;
try { try {
row.getCell(15).setCellType(CellType.STRING); isCreateSn = new DataFormatter().formatCellValue(row.getCell(16, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isCreateSn = row.getCell(15, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var60) {
} }
//是否PS部件 //是否PS部件
String isPSParts = null; String isPSParts = null;
try { try {
row.getCell(16).setCellType(CellType.STRING); isPSParts = new DataFormatter().formatCellValue(row.getCell(17, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isPSParts = row.getCell(16, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var59) {
} }
//标准工数(min) //标准工数(min)
String standardWork = null; String standardWork = null;
try { try {
row.getCell(17).setCellType(CellType.STRING); standardWork = new DataFormatter().formatCellValue(row.getCell(18, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
standardWork = row.getCell(17, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//日文描述 //日文描述
String japanDesc = null; String japanDesc = null;
try { try {
row.getCell(18).setCellType(CellType.STRING); japanDesc = new DataFormatter().formatCellValue(row.getCell(19, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
japanDesc = row.getCell(18, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//商品码 //商品码
String goodsCode = null; String goodsCode = null;
try { try {
row.getCell(19).setCellType(CellType.STRING); goodsCode = new DataFormatter().formatCellValue(row.getCell(20, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
goodsCode = row.getCell(19, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//前缀 //前缀
String prefix = null; String prefix = null;
try { try {
row.getCell(20).setCellType(CellType.STRING); prefix = new DataFormatter().formatCellValue(row.getCell(21, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
prefix = row.getCell(20, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//质保书码 //质保书码
String qualityAssureCode = null; String qualityAssureCode = null;
try { try {
row.getCell(21).setCellType(CellType.STRING); qualityAssureCode = new DataFormatter().formatCellValue(row.getCell(22, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
qualityAssureCode = row.getCell(21, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//物料识别码 //物料识别码
String identifyCode = null; String identifyCode = null;
try { try {
row.getCell(22).setCellType(CellType.STRING); identifyCode = new DataFormatter().formatCellValue(row.getCell(23, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
identifyCode = row.getCell(22, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//条码末位数 //条码末位数
String snLastCode = null; String snLastCode = null;
try { try {
row.getCell(23).setCellType(CellType.STRING); snLastCode = new DataFormatter().formatCellValue(row.getCell(24, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
snLastCode = row.getCell(23, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); } catch (Exception e) {
} catch (Exception var58) {
} }
//文件原名 //文件原名
String fileOriginName = null; String fileOriginName = null;
try { try {
row.getCell(24).setCellType(CellType.STRING); fileOriginName = new DataFormatter().formatCellValue(row.getCell(25, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
fileOriginName = row.getCell(24, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//包装条码打印张数 //包装条码打印张数
String packNoPrintTimes = null; String packNoPrintTimes = null;
try { try {
row.getCell(25).setCellType(CellType.STRING); packNoPrintTimes = new DataFormatter().formatCellValue(row.getCell(26, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
packNoPrintTimes = row.getCell(25, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//本体条码打印张数 //本体条码打印张数
String snPrintTimes = null; String snPrintTimes = null;
try { try {
row.getCell(26).setCellType(CellType.STRING); snPrintTimes = new DataFormatter().formatCellValue(row.getCell(27, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
snPrintTimes = row.getCell(26, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//本体条码打印列数 //本体条码打印列数
String printColumnNumber = null; String printColumnNumber = null;
try { try {
row.getCell(27).setCellType(CellType.STRING); printColumnNumber = new DataFormatter().formatCellValue(row.getCell(28, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
printColumnNumber = row.getCell(27, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//大本体条码匹配类型 //大本体条码匹配类型
String bigProcessMatchType = null; String bigProcessMatchType = null;
try { try {
row.getCell(28).setCellType(CellType.STRING); bigProcessMatchType = new DataFormatter().formatCellValue(row.getCell(29, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
bigProcessMatchType = row.getCell(28, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//是否打印质保书 //是否打印质保书
String isPrintQualityAssureIndia = null; String isPrintQualityAssureIndia = null;
try { try {
row.getCell(29).setCellType(CellType.STRING); isPrintQualityAssureIndia = new DataFormatter().formatCellValue(row.getCell(30, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isPrintQualityAssureIndia = row.getCell(29, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//仕向地代码 //仕向地代码
String shiXiangDiCode = null; String shiXiangDiCode = null;
try { try {
row.getCell(30).setCellType(CellType.STRING); shiXiangDiCode = new DataFormatter().formatCellValue(row.getCell(31, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
shiXiangDiCode = row.getCell(30, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//型号 //型号
String model = null; String model = null;
try { try {
row.getCell(31).setCellType(CellType.STRING); model = new DataFormatter().formatCellValue(row.getCell(32, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
model = row.getCell(31, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//品番 //品番
String productNumber = null; String productNumber = null;
try { try {
row.getCell(32).setCellType(CellType.STRING); productNumber = new DataFormatter().formatCellValue(row.getCell(33, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
productNumber = row.getCell(32, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//大包装条码张数 //大包装条码张数
String snPackagePrintColumnNumber = null; String snPackagePrintColumnNumber = null;
try { try {
row.getCell(33).setCellType(CellType.STRING); snPackagePrintColumnNumber = new DataFormatter().formatCellValue(row.getCell(34, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
snPackagePrintColumnNumber = row.getCell(33, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//大包装条码匹配类型 //大包装条码匹配类型
String bigPackageMatchType = null; String bigPackageMatchType = null;
try { try {
row.getCell(34).setCellType(CellType.STRING); bigPackageMatchType = new DataFormatter().formatCellValue(row.getCell(35, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
bigPackageMatchType = row.getCell(34, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//是否补件确认 //是否补件确认
String isRepairWorkReport = null; String isRepairWorkReport = null;
try { try {
row.getCell(35).setCellType(CellType.STRING); isRepairWorkReport = new DataFormatter().formatCellValue(row.getCell(36, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isRepairWorkReport = row.getCell(35, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
//是否可手动报工 //是否可手动报工
String isManualReport = null; String isManualReport = null;
try { try {
row.getCell(36).setCellType(CellType.STRING); isManualReport = new DataFormatter().formatCellValue(row.getCell(37, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
isRepairWorkReport = row.getCell(36, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
} catch (Exception e) { } catch (Exception e) {
} }
@ -485,28 +444,22 @@ public class PartExtExcelService implements IExcelImportExtService {
errorInfo = errorInfo + "第G列数据无效;"; errorInfo = errorInfo + "第G列数据无效;";
} }
if (StringUtils.isEmpty(processMatchType)) { if (!StringUtils.isEmpty(processMatchType) && StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType))) {
++errorNum;
cellNum = cellNum + "H;";
errorInfo = errorInfo + "第H列数据必填;";
} else {
if (StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType))) {
++errorNum; ++errorNum;
cellNum = cellNum + "H;"; cellNum = cellNum + "H;";
errorInfo = errorInfo + "第H列数据无效;"; errorInfo = errorInfo + "第H列数据无效;";
} }
}
if (StringUtils.isEmpty(productMatchType)) { if (!StringUtils.isEmpty(productMatchType) && StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType))) {
++errorNum;
cellNum = cellNum + "I;";
errorInfo = errorInfo + "第I列数据必填;";
} else {
if (StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType))) {
++errorNum; ++errorNum;
cellNum = cellNum + "I;"; cellNum = cellNum + "I;";
errorInfo = errorInfo + "第I列数据无效;"; errorInfo = errorInfo + "第I列数据无效;";
} }
if (!StringUtils.isEmpty(packageMatchType) && StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(packageMatchType))) {
++errorNum;
cellNum = cellNum + "J;";
errorInfo = errorInfo + "第J列数据无效;";
} }
if (!StringUtils.isEmpty(qty2)) { if (!StringUtils.isEmpty(qty2)) {
@ -514,56 +467,56 @@ public class PartExtExcelService implements IExcelImportExtService {
Integer.valueOf(qty2); Integer.valueOf(qty2);
} catch (NumberFormatException var83) { } catch (NumberFormatException var83) {
++errorNum; ++errorNum;
cellNum = cellNum + "J;"; cellNum = cellNum + "K;";
errorInfo = errorInfo + "第J列数据无效;"; errorInfo = errorInfo + "第K列数据无效;";
} }
} }
if (!StringUtils.isEmpty(pptCode) && (CollectionUtils.isEmpty(partProduceTypeEntityMap) || !CollectionUtils.isEmpty(partProduceTypeEntityMap) && !partProduceTypeEntityMap.containsKey(pptCode))) { if (!StringUtils.isEmpty(pptCode) && (CollectionUtils.isEmpty(partProduceTypeEntityMap) || !CollectionUtils.isEmpty(partProduceTypeEntityMap) && !partProduceTypeEntityMap.containsKey(pptCode))) {
++errorNum; ++errorNum;
cellNum = cellNum + "K;"; cellNum = cellNum + "L;";
errorInfo = errorInfo + "第K列数据无效;"; errorInfo = errorInfo + "第L列数据无效;";
} }
if (!StringUtils.isEmpty(salesTo) && StringUtils.isEmpty(MesExtEnumUtil.SALES_TO.descriptionOfValue(salesTo))) { if (!StringUtils.isEmpty(salesTo) && StringUtils.isEmpty(MesExtEnumUtil.SALES_TO.descriptionOfValue(salesTo))) {
++errorNum; ++errorNum;
cellNum = cellNum + "N;"; cellNum = cellNum + "O;";
errorInfo = errorInfo + "第N列数据无效;"; errorInfo = errorInfo + "第O列数据无效;";
} }
if (StringUtils.isEmpty(isOqc)) { if (StringUtils.isEmpty(isOqc)) {
++errorNum; ++errorNum;
cellNum = cellNum + "O;"; cellNum = cellNum + "P;";
errorInfo = errorInfo + "第O列数据必填;"; errorInfo = errorInfo + "第P列数据必填;";
} else { } else {
if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isOqc))) { if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isOqc))) {
++errorNum; ++errorNum;
cellNum = cellNum + "O"; cellNum = cellNum + "P";
errorInfo = errorInfo + "第O列数据无效;"; errorInfo = errorInfo + "第P列数据无效;";
} }
} }
if (StringUtils.isEmpty(isCreateSn)) { if (StringUtils.isEmpty(isCreateSn)) {
++errorNum; ++errorNum;
cellNum = cellNum + "P;"; cellNum = cellNum + "Q;";
errorInfo = errorInfo + "第P列数据必填;"; errorInfo = errorInfo + "第Q列数据必填;";
} else { } else {
if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isCreateSn))) { if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isCreateSn))) {
++errorNum; ++errorNum;
cellNum = cellNum + "P"; cellNum = cellNum + "Q";
errorInfo = errorInfo + "第P列数据无效;"; errorInfo = errorInfo + "第Q列数据无效;";
} }
} }
if (StringUtils.isEmpty(isPSParts)) { if (StringUtils.isEmpty(isPSParts)) {
++errorNum; ++errorNum;
cellNum = cellNum + "Q;"; cellNum = cellNum + "R;";
errorInfo = errorInfo + "第Q列数据必填;"; errorInfo = errorInfo + "第R列数据必填;";
} else { } else {
if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isPSParts))) { if (StringUtils.isEmpty(CommonEnumUtil.TRUE_OR_FALSE.descriptionOfValue(isPSParts))) {
++errorNum; ++errorNum;
cellNum = cellNum + "Q"; cellNum = cellNum + "R";
errorInfo = errorInfo + "第Q列数据无效;"; errorInfo = errorInfo + "第R列数据无效;";
} }
} }
@ -571,19 +524,19 @@ public class PartExtExcelService implements IExcelImportExtService {
try { try {
if (MathOperation.compareTo(Double.valueOf(standardWork), new Double(0)) < 0) { if (MathOperation.compareTo(Double.valueOf(standardWork), new Double(0)) < 0) {
errorNum++; errorNum++;
cellNum += "R;"; cellNum += "S;";
errorInfo += "第R列数据不能小于0;"; errorInfo += "第S列数据不能小于0;";
} }
String[] standardWorkArr = standardWork.split(MesExtConstWords.DECIMAL_POINT); String[] standardWorkArr = standardWork.split(MesExtConstWords.DECIMAL_POINT);
if (null != standardWorkArr && standardWorkArr.length == 2 && standardWorkArr[1].length() > 2) { if (null != standardWorkArr && standardWorkArr.length == 2 && standardWorkArr[1].length() > 2) {
errorNum++; errorNum++;
cellNum += "R;"; cellNum += "S;";
errorInfo += "第R列数据无效,最多2位小数;"; errorInfo += "第S列数据无效,最多2位小数;";
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
errorNum ++; errorNum ++;
cellNum += "R;"; cellNum += "S;";
errorInfo += "第R列数据无效;"; errorInfo += "第S列数据无效;";
} }
} }
@ -591,14 +544,14 @@ public class PartExtExcelService implements IExcelImportExtService {
if (!StringUtils.isEmpty(fileOriginName)) { if (!StringUtils.isEmpty(fileOriginName)) {
if (!fileOriginName.contains(".")) { if (!fileOriginName.contains(".")) {
errorNum ++; errorNum ++;
cellNum += "Y;"; cellNum += "Z;";
errorInfo += "第Y列数据无效;"; errorInfo += "第Z列数据无效;";
} else { } else {
String fileType = fileOriginName.substring(fileOriginName.lastIndexOf(".")); String fileType = fileOriginName.substring(fileOriginName.lastIndexOf("."));
if (StringUtils.isEmpty(fileType) || (!fileType.equals(".jpg") && !fileType.equals(".jpeg") && !fileType.equals(".png"))) { if (StringUtils.isEmpty(fileType) || (!fileType.equals(".jpg") && !fileType.equals(".jpeg") && !fileType.equals(".png"))) {
errorNum ++; errorNum ++;
cellNum += "Y;"; cellNum += "Z;";
errorInfo += "第Y列数据无效;"; errorInfo += "第Z列数据无效;";
} }
} }
} }
@ -608,13 +561,13 @@ public class PartExtExcelService implements IExcelImportExtService {
Integer packNoPrintTimesNumber = Integer.valueOf(packNoPrintTimes); Integer packNoPrintTimesNumber = Integer.valueOf(packNoPrintTimes);
if(packNoPrintTimesNumber <= 0){ if(packNoPrintTimesNumber <= 0){
++errorNum; ++errorNum;
cellNum = cellNum + "Z;"; cellNum = cellNum + "AA;";
errorInfo = errorInfo + "第Z列数据无效;"; errorInfo = errorInfo + "第AA列数据无效;";
} }
} catch (NumberFormatException var83) { } catch (NumberFormatException var83) {
++errorNum; ++errorNum;
cellNum = cellNum + "Z;"; cellNum = cellNum + "AA;";
errorInfo = errorInfo + "第Z列数据无效;"; errorInfo = errorInfo + "第AA列数据无效;";
} }
} }
@ -623,13 +576,13 @@ public class PartExtExcelService implements IExcelImportExtService {
Integer snPrintTimesNumber = Integer.valueOf(snPrintTimes); Integer snPrintTimesNumber = Integer.valueOf(snPrintTimes);
if(snPrintTimesNumber <= 0){ if(snPrintTimesNumber <= 0){
++errorNum; ++errorNum;
cellNum = cellNum + "AA;"; cellNum = cellNum + "AB;";
errorInfo = errorInfo + "第AA列数据无效;"; errorInfo = errorInfo + "第AB列数据无效;";
} }
} catch (NumberFormatException var83) { } catch (NumberFormatException var83) {
++errorNum; ++errorNum;
cellNum = cellNum + "AA;"; cellNum = cellNum + "AB;";
errorInfo = errorInfo + "第AA列数据无效;"; errorInfo = errorInfo + "第AB列数据无效;";
} }
} }
@ -638,32 +591,32 @@ public class PartExtExcelService implements IExcelImportExtService {
Integer snPrintTimesNumber = Integer.valueOf(printColumnNumber); Integer snPrintTimesNumber = Integer.valueOf(printColumnNumber);
if(snPrintTimesNumber <= 0){ if(snPrintTimesNumber <= 0){
++errorNum; ++errorNum;
cellNum = cellNum + "AB;"; cellNum = cellNum + "AC;";
errorInfo = errorInfo + "第AB列数据无效;"; errorInfo = errorInfo + "第AC列数据无效;";
} }
} catch (NumberFormatException var83) { } catch (NumberFormatException var83) {
++errorNum; ++errorNum;
cellNum = cellNum + "AB;"; cellNum = cellNum + "AC;";
errorInfo = errorInfo + "第AB列数据无效;"; errorInfo = errorInfo + "第AC列数据无效;";
} }
} }
if (!StringUtils.isEmpty(bigProcessMatchType)) { if (!StringUtils.isEmpty(bigProcessMatchType)) {
if (StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(bigProcessMatchType))) { if (StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(bigProcessMatchType))) {
++errorNum; ++errorNum;
cellNum = cellNum + "AC;"; cellNum = cellNum + "AD;";
errorInfo = errorInfo + "第AC列数据无效;"; errorInfo = errorInfo + "第AD列数据无效;";
} }
} }
if(StringUtils.isEmpty(isPrintQualityAssureIndia)){ if(StringUtils.isEmpty(isPrintQualityAssureIndia)){
++errorNum; ++errorNum;
cellNum = cellNum + "AD;"; cellNum = cellNum + "AE;";
errorInfo = errorInfo + "第AD列数据必填;"; errorInfo = errorInfo + "第AE列数据必填;";
}else if (StringUtils.isEmpty(MesExtEnumUtil.IS_PRINT_QUALITY_ASSURE_INDIA.valueOfDescription(Integer.parseInt(isPrintQualityAssureIndia)))){ }else if (StringUtils.isEmpty(MesExtEnumUtil.IS_PRINT_QUALITY_ASSURE_INDIA.valueOfDescription(Integer.parseInt(isPrintQualityAssureIndia)))){
++errorNum; ++errorNum;
cellNum = cellNum + "AD;"; cellNum = cellNum + "AE;";
errorInfo = errorInfo + "第AD列数据无效;"; errorInfo = errorInfo + "第AE列数据无效;";
} }
if (!StringUtils.isEmpty(snPackagePrintColumnNumber)) { if (!StringUtils.isEmpty(snPackagePrintColumnNumber)) {
@ -671,37 +624,32 @@ public class PartExtExcelService implements IExcelImportExtService {
Integer snPrintTimesNumber = Integer.valueOf(snPackagePrintColumnNumber); Integer snPrintTimesNumber = Integer.valueOf(snPackagePrintColumnNumber);
if(snPrintTimesNumber <= 0){ if(snPrintTimesNumber <= 0){
++errorNum; ++errorNum;
cellNum = cellNum + "AH;"; cellNum = cellNum + "AI;";
errorInfo = errorInfo + "第AH列数据无效;"; errorInfo = errorInfo + "第AI列数据无效;";
} }
} catch (NumberFormatException var83) { } catch (NumberFormatException var83) {
++errorNum; ++errorNum;
cellNum = cellNum + "AH;"; cellNum = cellNum + "AI;";
errorInfo = errorInfo + "第AH列数据无效;"; errorInfo = errorInfo + "第AI列数据无效;";
} }
} }
if (!StringUtils.isEmpty(bigPackageMatchType)) { if (!StringUtils.isEmpty(bigPackageMatchType) && StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(bigPackageMatchType))) {
if (StringUtils.isEmpty(MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(bigPackageMatchType))) {
++errorNum;
cellNum = cellNum + "AC;";
errorInfo = errorInfo + "第AC列数据无效;";
}
}
if (!StringUtils.isEmpty(isRepairWorkReport)) {
if (StringUtils.isEmpty(MesExtEnumUtil.IS_REPAIR_WORK_REPORT.valueOfDescription(Integer.parseInt(isRepairWorkReport)))) {
++errorNum; ++errorNum;
cellNum = cellNum + "AJ;"; cellNum = cellNum + "AJ;";
errorInfo = errorInfo + "第AJ列数据无效;"; errorInfo = errorInfo + "第AJ列数据无效;";
} }
}
if (!StringUtils.isEmpty(isRepairWorkReport)) { if (!StringUtils.isEmpty(isRepairWorkReport) && StringUtils.isEmpty(MesExtEnumUtil.IS_REPAIR_WORK_REPORT.valueOfDescription(Integer.parseInt(isRepairWorkReport)))) {
if (StringUtils.isEmpty(MesExtEnumUtil.IS_REPAIR_WORK_REPORT.valueOfDescription(Integer.parseInt(isRepairWorkReport)))) {
++errorNum; ++errorNum;
cellNum = cellNum + "AJ;"; cellNum = cellNum + "AK;";
errorInfo = errorInfo + "第AJ列数据无效;"; errorInfo = errorInfo + "第AK列数据无效;";
} }
if (!StringUtils.isEmpty(isManualReport) && StringUtils.isEmpty(MesExtEnumUtil.IS_MANUAL_REPORT.valueOfDescription(Integer.parseInt(isManualReport)))) {
++errorNum;
cellNum = cellNum + "AL;";
errorInfo = errorInfo + "第AL列数据无效;";
} }
if (errorNum == 0) { if (errorNum == 0) {
@ -720,7 +668,7 @@ public class PartExtExcelService implements IExcelImportExtService {
newPartExt.setCategoryCode3(StringUtils.isEmpty(categoryCode3) ? null : categoryCode3); newPartExt.setCategoryCode3(StringUtils.isEmpty(categoryCode3) ? null : categoryCode3);
newPartExt.setProcessMatchType(StringUtils.isEmpty(processMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType)); newPartExt.setProcessMatchType(StringUtils.isEmpty(processMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType));
newPartExt.setProductMatchType(StringUtils.isEmpty(productMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType)); newPartExt.setProductMatchType(StringUtils.isEmpty(productMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType));
// newPartExt.setPackageMatchType(StringUtils.isEmpty(packageMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(packageMatchType)); newPartExt.setPackageMatchType(StringUtils.isEmpty(packageMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(packageMatchType));
newPartExt.setQty2(StringUtils.isEmpty(qty2) ? null : Double.parseDouble(qty2)); newPartExt.setQty2(StringUtils.isEmpty(qty2) ? null : Double.parseDouble(qty2));
newPartExt.setPptCode(pptCode); newPartExt.setPptCode(pptCode);
newPartExt.setColorCode(colorCode); newPartExt.setColorCode(colorCode);
@ -767,7 +715,7 @@ public class PartExtExcelService implements IExcelImportExtService {
mesPart.setCategoryCode3(StringUtils.isEmpty(categoryCode3) ? null : categoryCode3); mesPart.setCategoryCode3(StringUtils.isEmpty(categoryCode3) ? null : categoryCode3);
mesPart.setProcessMatchType(StringUtils.isEmpty(processMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType)); mesPart.setProcessMatchType(StringUtils.isEmpty(processMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(processMatchType));
mesPart.setProductMatchType(StringUtils.isEmpty(productMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType)); mesPart.setProductMatchType(StringUtils.isEmpty(productMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(productMatchType));
// mesPart.setPackageMatchType(StringUtils.isEmpty(packageMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(packageMatchType)); mesPart.setPackageMatchType(StringUtils.isEmpty(packageMatchType) ? null : MesExtEnumUtil.ENCODE_MATCH_TYPE.descriptionOfValue(packageMatchType));
mesPart.setQty2(StringUtils.isEmpty(qty2) ? null : Double.parseDouble(qty2)); mesPart.setQty2(StringUtils.isEmpty(qty2) ? null : Double.parseDouble(qty2));
mesPart.setPptCode(pptCode); mesPart.setPptCode(pptCode);
mesPart.setColorCode(colorCode); mesPart.setColorCode(colorCode);

Loading…
Cancel
Save