|
|
@ -118,7 +118,7 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
if (row.getCell(0) == null ) { |
|
|
if (row.getCell(0) == null ) { |
|
|
throw new RuntimeException("第" + j + "行的Ready Date不能为空!"); |
|
|
throw new RuntimeException("第" + j + "行的Ready Date不能为空!"); |
|
|
} |
|
|
} |
|
|
if (row.getCell(1) == null) { |
|
|
|
|
|
|
|
|
if (row.getCell(1) == null || StringUtils.isBlank(row.getCell(1).getStringCellValue())) { |
|
|
throw new RuntimeException("第" + j + "行的Customer Name不能为空!"); |
|
|
throw new RuntimeException("第" + j + "行的Customer Name不能为空!"); |
|
|
} |
|
|
} |
|
|
if (row.getCell(2) == null) { |
|
|
if (row.getCell(2) == null) { |
|
|
@ -580,6 +580,9 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
if ((inData.getWalMartOrderFlag()==null || inData.getWalMartOrderFlag().equals("N")) && row.getCell(0) == null) { |
|
|
if ((inData.getWalMartOrderFlag()==null || inData.getWalMartOrderFlag().equals("N")) && row.getCell(0) == null) { |
|
|
throw new RuntimeException("第" + j + "行的序号不能为空!"); |
|
|
throw new RuntimeException("第" + j + "行的序号不能为空!"); |
|
|
} |
|
|
} |
|
|
|
|
|
if (row.getCell(1) != null && !inData.getCmcInvoice().equals(row.getCell(1).getStringCellValue())) { |
|
|
|
|
|
throw new RuntimeException("第" + j + "行的发票号与发货通知单的发票号不一致!"); |
|
|
|
|
|
} |
|
|
if (row.getCell(4) == null) { |
|
|
if (row.getCell(4) == null) { |
|
|
throw new RuntimeException("第" + j + "行的PN不能为空!"); |
|
|
throw new RuntimeException("第" + j + "行的PN不能为空!"); |
|
|
} |
|
|
} |
|
|
@ -610,11 +613,14 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
excelData.setGrossWeight(getNumericCellValueOrDefault(row, 13)); |
|
|
excelData.setGrossWeight(getNumericCellValueOrDefault(row, 13)); |
|
|
excelData.setNetWeight(getNumericCellValueOrDefault(row, 14)); |
|
|
excelData.setNetWeight(getNumericCellValueOrDefault(row, 14)); |
|
|
List<PartData> checkPart = coDelMapper.checkPart(excelData.getSite(), excelData.getPartNo()); |
|
|
List<PartData> checkPart = coDelMapper.checkPart(excelData.getSite(), excelData.getPartNo()); |
|
|
if (checkPart.size() == 0) { |
|
|
|
|
|
|
|
|
if (checkPart.isEmpty()) { |
|
|
throw new RuntimeException("导入失败:物料:" + excelData.getPartNo() + "在当前工厂不存在!"); |
|
|
throw new RuntimeException("导入失败:物料:" + excelData.getPartNo() + "在当前工厂不存在!"); |
|
|
} |
|
|
} |
|
|
excelList.add(excelData); |
|
|
excelList.add(excelData); |
|
|
} |
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException("导入失败:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
// 如果是沃尔玛订单,按照pn分组,同一个pn是一个EcssCoDelPalletHeaderData, |
|
|
// 如果是沃尔玛订单,按照pn分组,同一个pn是一个EcssCoDelPalletHeaderData, |
|
|
// 如果是非沃尔玛订单,按照序号分组,同一个序号是一个EcssCoDelPalletHeaderData, |
|
|
// 如果是非沃尔玛订单,按照序号分组,同一个序号是一个EcssCoDelPalletHeaderData, |
|
|
Map<Integer, List<EcssCoDelPalletData>> palletListMap = new HashMap<>(); |
|
|
Map<Integer, List<EcssCoDelPalletData>> palletListMap = new HashMap<>(); |
|
|
@ -630,7 +636,7 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if (excelList.get(0).getPalletQty() == 0 || excelList.get(0).getPalletQty() == null) { |
|
|
|
|
|
|
|
|
if (excelList.get(0).getPalletQty() == null || excelList.get(0).getPalletQty() == 0) { |
|
|
throw new RuntimeException("导入失败:第一行的托数不能为0!"); |
|
|
throw new RuntimeException("导入失败:第一行的托数不能为0!"); |
|
|
} |
|
|
} |
|
|
for (EcssCoDelPalletData itemData : excelList){ |
|
|
for (EcssCoDelPalletData itemData : excelList){ |
|
|
@ -749,16 +755,16 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
detailList.add(detailData); |
|
|
detailList.add(detailData); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
for (int i = 0; i < headerList.size(); i++) { |
|
|
|
|
|
coDelMapper.saveCodelPalletHeader(headerList.get(i)); |
|
|
|
|
|
|
|
|
for (EcssCoDelPalletHeaderData ecssCoDelPalletHeaderData : headerList) { |
|
|
|
|
|
coDelMapper.saveCodelPalletHeader(ecssCoDelPalletHeaderData); |
|
|
} |
|
|
} |
|
|
Map<String, BigDecimal> palletDetailMap = new HashMap<>(); |
|
|
Map<String, BigDecimal> palletDetailMap = new HashMap<>(); |
|
|
for (int i = 0; i < detailList.size(); i++) { |
|
|
|
|
|
coDelMapper.saveCodelPalletDetail(detailList.get(i)); |
|
|
|
|
|
if (!palletDetailMap.containsKey(detailList.get(i).getPn())) { |
|
|
|
|
|
palletDetailMap.put(detailList.get(i).getPn(), detailList.get(i).getQty()); |
|
|
|
|
|
|
|
|
for (EcssCoDelPalletDetailData ecssCoDelPalletDetailData : detailList) { |
|
|
|
|
|
coDelMapper.saveCodelPalletDetail(ecssCoDelPalletDetailData); |
|
|
|
|
|
if (!palletDetailMap.containsKey(ecssCoDelPalletDetailData.getPn())) { |
|
|
|
|
|
palletDetailMap.put(ecssCoDelPalletDetailData.getPn(), ecssCoDelPalletDetailData.getQty()); |
|
|
} else { |
|
|
} else { |
|
|
palletDetailMap.put(detailList.get(i).getPn(), palletDetailMap.get(detailList.get(i).getPn()).add(detailList.get(i).getQty())); |
|
|
|
|
|
|
|
|
palletDetailMap.put(ecssCoDelPalletDetailData.getPn(), palletDetailMap.get(ecssCoDelPalletDetailData.getPn()).add(ecssCoDelPalletDetailData.getQty())); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
List<EcssCoDelNotifyDetailData> ecssCoDelNotifyDetail = coDelMapper.searchEcssCoDelNotifyDetail(inData); |
|
|
List<EcssCoDelNotifyDetailData> ecssCoDelNotifyDetail = coDelMapper.searchEcssCoDelNotifyDetail(inData); |
|
|
@ -775,9 +781,6 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
throw new RuntimeException("物料["+entry.getKey()+"]的数量和发货通知单数量不一致!"); |
|
|
throw new RuntimeException("物料["+entry.getKey()+"]的数量和发货通知单数量不一致!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException("导入失败:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|