|
@ -853,9 +853,11 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode); |
|
|
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode); |
|
|
String shippingInformationType = "0"; |
|
|
String shippingInformationType = "0"; |
|
|
String shippingTemplateType = "销售出货箱单1"; |
|
|
String shippingTemplateType = "销售出货箱单1"; |
|
|
|
|
|
|
|
|
|
|
|
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode(); |
|
|
|
|
|
|
|
|
//生成出货资料
|
|
|
//生成出货资料
|
|
|
insertShippingInformation(outOrderCode,shippingInformationType,shippingTemplateType,sysSalesShippingInform); |
|
|
insertShippingInformation(outOrderCode,shippingInformationType,shippingTemplateType,sysSalesShippingInform); |
|
|
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode(); |
|
|
|
|
|
|
|
|
|
|
|
String realFileName = salesOrderCode + "-" + fileName.substring(0, fileName.lastIndexOf(".")) + ".xlsx"; |
|
|
String realFileName = salesOrderCode + "-" + fileName.substring(0, fileName.lastIndexOf(".")) + ".xlsx"; |
|
|
|
|
|
|
|
@ -863,35 +865,65 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
response.setContentType("application/octet-stream"); |
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
|
|
|
|
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode); |
|
|
|
|
|
|
|
|
|
|
|
if (sysMakeOrder == null){ |
|
|
|
|
|
log.warn("未找到对应的生产订单,请检查:{}", salesOrderCode); |
|
|
|
|
|
throw new RuntimeException("未找到对应的生产订单,请检查"); |
|
|
List<String> salesOrderCodes = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(salesOrderCode)){ |
|
|
|
|
|
String[] splitSalesOrderCode = salesOrderCode.split(","); |
|
|
|
|
|
salesOrderCodes = Arrays.asList(splitSalesOrderCode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto()); |
|
|
//生产订主表的数据
|
|
|
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto()); |
|
|
List<SysMakeOrder> sysMakeOrders = sysMakeOrderMapper.selectMakeOrderListBySalesOrderCodes(salesOrderCodes); |
|
|
map.put("customerContact",sysSalesShippingInform.getCustomerContact()); |
|
|
|
|
|
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress()); |
|
|
//获取销售订单的明细
|
|
|
|
|
|
List<SysSalesOrderChild> sysSalesOrderChildren = salesOrderChildMapper.selectBatchOrderChildListBySalesOrderCode(salesOrderCodes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SysMakeOrder> makeOrderMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (SysMakeOrder sysMakeOrder : sysMakeOrders) { |
|
|
|
|
|
makeOrderMap.put(sysMakeOrder.getSaleNo(),sysMakeOrder); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>(); |
|
|
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>(); |
|
|
|
|
|
|
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
|
|
|
|
|
|
List<AfterSalesShippingDevice> shippingDeviceList = salesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode); |
|
|
|
|
|
for (AfterSalesShippingDevice shippingDevice : shippingDeviceList) { |
|
|
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildren) { |
|
|
|
|
|
SysMakeOrder sysMakeOrder = makeOrderMap.get(sysSalesOrderChild.getQuoteId()); |
|
|
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto(); |
|
|
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto(); |
|
|
exportShippingPackingDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingPackingDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe()); |
|
|
exportShippingPackingDto.setMaterialDescribe(sysSalesOrderChild.getDescribe()); |
|
|
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode()); |
|
|
exportShippingPackingDto.setMaterialModel(sysSalesOrderChild.getMaterialModel()); |
|
|
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo()); |
|
|
exportShippingPackingDto.setMakeNo(sysMakeOrder.getMakeNo()); |
|
|
exportShippingPackingDto.setMaterialNum(1); |
|
|
exportShippingPackingDto.setMaterialNum(sysSalesOrderChild.getMaterialNum()); |
|
|
|
|
|
exportShippingPackingDto.setBox(null); |
|
|
|
|
|
exportShippingPackingDto.setOneBox(null); |
|
|
|
|
|
exportShippingPackingDto.setMeas(null); |
|
|
|
|
|
exportShippingPackingDto.setTwoBox(null); |
|
|
|
|
|
exportShippingPackingDto.setTotalGW(null); |
|
|
|
|
|
exportShippingPackingDto.setTotalNW(null); |
|
|
shippingPackingDtos.add(exportShippingPackingDto); |
|
|
shippingPackingDtos.add(exportShippingPackingDto); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto()); |
|
|
|
|
|
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto()); |
|
|
|
|
|
map.put("customerContact",sysSalesShippingInform.getCustomerContact()); |
|
|
|
|
|
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//构建模板
|
|
|
//构建模板
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
@ -944,35 +976,60 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
response.setContentType("application/octet-stream"); |
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
|
|
|
|
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode); |
|
|
|
|
|
|
|
|
|
|
|
if (sysMakeOrder == null){ |
|
|
List<String> salesOrderCodes = new ArrayList<>(); |
|
|
log.warn("未找到对应的生产订单,请检查:{}", salesOrderCode); |
|
|
|
|
|
throw new RuntimeException("未找到对应的生产订单,请检查"); |
|
|
if (StringUtils.isNotEmpty(salesOrderCode)){ |
|
|
|
|
|
String[] splitSalesOrderCode = salesOrderCode.split(","); |
|
|
|
|
|
salesOrderCodes = Arrays.asList(splitSalesOrderCode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto()); |
|
|
//生产订主表的数据
|
|
|
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto()); |
|
|
List<SysMakeOrder> sysMakeOrders = sysMakeOrderMapper.selectMakeOrderListBySalesOrderCodes(salesOrderCodes); |
|
|
map.put("customerContact",sysSalesShippingInform.getCustomerContact()); |
|
|
|
|
|
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress()); |
|
|
//获取销售订单的明细
|
|
|
|
|
|
List<SysSalesOrderChild> sysSalesOrderChildren = salesOrderChildMapper.selectBatchOrderChildListBySalesOrderCode(salesOrderCodes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SysMakeOrder> makeOrderMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (SysMakeOrder sysMakeOrder : sysMakeOrders) { |
|
|
|
|
|
makeOrderMap.put(sysMakeOrder.getSaleNo(),sysMakeOrder); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>(); |
|
|
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>(); |
|
|
|
|
|
|
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
|
|
|
|
|
|
List<AfterSalesShippingDevice> shippingDeviceList = salesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode); |
|
|
|
|
|
for (AfterSalesShippingDevice shippingDevice : shippingDeviceList) { |
|
|
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildren) { |
|
|
|
|
|
SysMakeOrder sysMakeOrder = makeOrderMap.get(sysSalesOrderChild.getQuoteId()); |
|
|
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto(); |
|
|
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto(); |
|
|
exportShippingPackingDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingPackingDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe()); |
|
|
exportShippingPackingDto.setMaterialDescribe(sysSalesOrderChild.getDescribe()); |
|
|
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode()); |
|
|
exportShippingPackingDto.setMaterialModel(sysSalesOrderChild.getMaterialModel()); |
|
|
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo()); |
|
|
exportShippingPackingDto.setMakeNo(sysMakeOrder.getMakeNo()); |
|
|
exportShippingPackingDto.setMaterialNum(1); |
|
|
exportShippingPackingDto.setMaterialNum(sysSalesOrderChild.getMaterialNum()); |
|
|
|
|
|
exportShippingPackingDto.setBox(null); |
|
|
|
|
|
exportShippingPackingDto.setOneBox(null); |
|
|
|
|
|
exportShippingPackingDto.setMeas(null); |
|
|
|
|
|
exportShippingPackingDto.setTwoBox(null); |
|
|
|
|
|
exportShippingPackingDto.setTotalGW(null); |
|
|
|
|
|
exportShippingPackingDto.setTotalNW(null); |
|
|
shippingPackingDtos.add(exportShippingPackingDto); |
|
|
shippingPackingDtos.add(exportShippingPackingDto); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto()); |
|
|
|
|
|
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto()); |
|
|
|
|
|
map.put("customerContact",sysSalesShippingInform.getCustomerContact()); |
|
|
|
|
|
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress()); |
|
|
|
|
|
|
|
|
//构建模板
|
|
|
//构建模板
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
|