diff --git a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java index 9741cd6e..3551ae69 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java @@ -156,7 +156,8 @@ public class CoDelServiceImpl implements CoDelService { boolean isEmptyRow = true; if (row != null) { for (Cell cell : row) { - if (cell.getCellType() != CellType.BLANK) { + if (cell.getCellType() != CellType.BLANK && cell.getCellType() != CellType.ERROR && + !StringUtils.isBlank(String.valueOf(cell))) { isEmptyRow = false; break; } @@ -175,37 +176,37 @@ public class CoDelServiceImpl implements CoDelService { // 获得该行 XSSFRow row = sheet.getRow(j); if (row.getCell(0) == null ) { - throw new RuntimeException("第" + j + "行的Ready Date不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Ready Date不能为空!"); } if (row.getCell(1) == null || StringUtils.isBlank(String.valueOf(row.getCell(1)))) { - throw new RuntimeException("第" + j + "行的Customer Code不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Customer Code不能为空!"); } if (row.getCell(3) == null) { - throw new RuntimeException("第" + j + "行的PO#不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的PO#不能为空!"); } /* if (row.getCell(3) == null) { throw new RuntimeException("第" + j + "行的SalesOrder不能为空!"); }*/ if (row.getCell(9) == null) { - throw new RuntimeException("第" + j + "行的PN不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的PN不能为空!"); } if (row.getCell(11) == null) { - throw new RuntimeException("第" + j + "行的Qty不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Qty不能为空!"); } if (row.getCell(13) == null) { - throw new RuntimeException("第" + j + "行的CMC Invoice不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的CMC Invoice不能为空!"); } if (row.getCell(15) == null) { - throw new RuntimeException("第" + j + "行的Destination不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Destination不能为空!"); } if (row.getCell(19) == null) { - throw new RuntimeException("第" + j + "行的Shipping Mode不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Shipping Mode不能为空!"); } if (row.getCell(21) == null) { - throw new RuntimeException("第" + j + "行的Currency不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的Currency不能为空!"); } if (row.getCell(22) == null) { - throw new RuntimeException("第" + j + "行的TP不能为空!"); + throw new RuntimeException("第" + (j+1) + "行的TP不能为空!"); } List customerInfo = coDelMapper.getCustomerInfo(null, getStringCellValue(row, 1)); if (customerInfo.isEmpty()) { @@ -222,7 +223,7 @@ public class CoDelServiceImpl implements CoDelService { String date = getStringCellValue(row, 0); readDate = DateUtils.getDateByParten(date, "yyyy-MM-dd"); } catch (ParseException e) { - throw new RuntimeException("第" + j + "行的ReadyDate格式有误!"); + throw new RuntimeException("第" + (j+1) + "行的ReadyDate格式有误!"); } task.setReadyDate(readDate); task.setCustomerPO(getStringCellValue(row, 3)); @@ -724,7 +725,8 @@ public class CoDelServiceImpl implements CoDelService { boolean isEmptyRow = true; if (row != null) { for (Cell cell : row) { - if (cell.getCellType() != CellType.BLANK) { + if (cell.getCellType() != CellType.BLANK && cell.getCellType() != CellType.ERROR && + !StringUtils.isBlank(String.valueOf(cell))) { isEmptyRow = false; break; } @@ -2103,18 +2105,23 @@ public class CoDelServiceImpl implements CoDelService { } int seq = 0; int seqNo = coDelMapper.getCoDelPalletHeaderSeqNo(inData); + StringBuilder partNos = new StringBuilder(); for (String partNo : palletItemMap.keySet()) { List partList = coDelMapper.getPartInfo(inData.getSite(),partNo); - /* List packageDataList = coDelMapper.getPackage(inData.getSite(),inData.getBuNo(),partList.get(0).getPackageNo()); - if (packageDataList.isEmpty()) { - throw new RuntimeException("物料["+partList.get(0).getSku()+"]未维护包装箱信息!"); - }*/ PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 if (propertiesRollQty==null||propertiesBoxRolls==null||propertiesBoxWeight==null) { - throw new RuntimeException("请先维护物料["+partList.get(0).getSku()+"]基本信息!"); + partNos.append(partList.get(0).getSku()).append(" "); } + } + if (!StringUtils.isBlank(partNos.toString())) { + throw new RuntimeException("请先维护物料["+partNos+"]基本信息(每卷数量、每箱卷数、箱重量)!"); + } + for (String partNo : palletItemMap.keySet()) { + PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 + PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 + PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 EcssCoDelPalletHeaderData headerData = new EcssCoDelPalletHeaderData(); BeanUtils.copyProperties(inData, headerData); headerData.setSeqNo(seqNo+seq);