|
|
|
@ -445,6 +445,26 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void recoverEcssDelHeader(EcssCoDelNotifyHeaderData data) { |
|
|
|
data.setNotifyStatus("已计划"); |
|
|
|
coDelMapper.changeEcssDelStatus(data); |
|
|
|
// 恢复明细状态为正常 |
|
|
|
coDelMapper.recoverEcssDelDetailStatus(data); |
|
|
|
// 取消废弃 通知仓库和单证人员 |
|
|
|
//设置邮件内容 |
|
|
|
String text = "<!DOCTYPE>" + "<div>发货通知单" +data.getDelNo()+"【发票:"+ |
|
|
|
data.getCmcInvoice()+"】<span style='color:green'>取消废弃,恢复正常</span>" + "</div>"; |
|
|
|
String textHead = data.getCmcInvoice()+"【发票:"+ data.getCmcInvoice()+"】取消废弃"; |
|
|
|
String[] mailAddress = coDelMapper.queryUsersByRoleName("关务仓库",data.getSite()).stream().map(SysUserEntity::getEmail).toArray(String[]::new); |
|
|
|
String[] mailAddress2 = new String[]{coDelMapper.queryByUserName(data.getCreateBy()).getEmail()}; |
|
|
|
String[] mailAddressAll = ArrayUtils.addAll(mailAddress, mailAddress2); |
|
|
|
if (mailAddressAll.length>0) { |
|
|
|
sendMailUtil(textHead, text,mailAddressAll, data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String getStringCellValue(XSSFRow row, int columnIndex) { |
|
|
|
Cell cell = row.getCell(columnIndex); |
|
|
|
if (cell == null || cell.getCellType() == CellType.BLANK) { |
|
|
|
@ -660,11 +680,14 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException("导入失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
for (EcssCoDelNotifyData data:excelList) { |
|
|
|
if (!inData.getCmcInvoice().equals(data.getCmcInvoice())) { |
|
|
|
throw new RuntimeException("导入失败:Excel中存在与发货通知单["+inData.getCmcInvoice()+"]不一致的发票号"); |
|
|
|
} |
|
|
|
// 过滤掉发票号不一致的数据 |
|
|
|
excelList.removeIf(data -> !inData.getCmcInvoice().equals(data.getCmcInvoice())); |
|
|
|
|
|
|
|
// 检查过滤后是否还有数据 |
|
|
|
if (excelList.isEmpty()) { |
|
|
|
throw new RuntimeException("导入失败:Excel中没有与发货通知单["+inData.getCmcInvoice()+"]一致的发票号数据"); |
|
|
|
} |
|
|
|
|
|
|
|
List<EcssCoDelNotifyHeaderData> notifyHeader = coDelMapper.checkIfHasHeader(excelList.get(0).getCmcInvoice()); |
|
|
|
EcssCoDelNotifyHeaderData headerData; |
|
|
|
if (notifyHeader.isEmpty()) { |
|
|
|
@ -1604,38 +1627,38 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
XSSFWorkbook workbook = null; |
|
|
|
try { |
|
|
|
ExcelTemplate template = ExcelTemplate.load(new ClassPathResource(xlsx).getInputStream()); |
|
|
|
|
|
|
|
|
|
|
|
// 第一个sheet - 出口货物委托书 |
|
|
|
extractedExportGoods(data, template); |
|
|
|
workbook = template.render(0); |
|
|
|
|
|
|
|
|
|
|
|
// 第二个sheet - 发票 |
|
|
|
template.clearAll(); |
|
|
|
extractedInvoice(data, template, notifyHeader); |
|
|
|
template.render(1); |
|
|
|
|
|
|
|
|
|
|
|
// 第三个sheet - 箱单 |
|
|
|
template.clearAll(); |
|
|
|
exportPackingList(data, template, notifyHeader, 0); |
|
|
|
template.render(2); |
|
|
|
|
|
|
|
|
|
|
|
// 第四个sheet - 报关单 |
|
|
|
template.clearAll(); |
|
|
|
extractedDeclaration(data, template); |
|
|
|
template.render(3); |
|
|
|
|
|
|
|
|
|
|
|
// 第五个sheet - 申报要素 |
|
|
|
template.clearAll(); |
|
|
|
extractedElements(data, template); |
|
|
|
template.render(4); |
|
|
|
|
|
|
|
|
|
|
|
// 第六个sheet - 合同 (仅特定BU需要) |
|
|
|
if (notifyHeader.getBuNo().equals("04-MHM") || notifyHeader.getBuNo().equals("02-Hardtag")) { |
|
|
|
template.clearAll(); |
|
|
|
extractedContract(data, template); |
|
|
|
template.render(5); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=\"单证信息.xlsx\""); |
|
|
|
workbook.write(response.getOutputStream()); |
|
|
|
@ -2035,7 +2058,7 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
if (!palletHeaderDataList.isEmpty()) { |
|
|
|
plt = "PLT"; |
|
|
|
} else { |
|
|
|
totalPlt = totalQty; |
|
|
|
totalPlt = totalCartons.setScale(0, RoundingMode.HALF_UP).intValue(); |
|
|
|
} |
|
|
|
template.addVar("total_plt", totalPlt+plt); |
|
|
|
template.addVar("total:", "total:"); |
|
|
|
|