|
@ -695,7 +695,7 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//totalMakeNum
|
|
|
//totalMakeNum
|
|
|
String totalMakeNum = String.valueOf(salesShippingInformDetails.stream().mapToInt(SysSalesShippingInformDetail::getMakeNum).sum()); |
|
|
String totalMakeNum = String.valueOf(sysSalesOrderChildren.stream().mapToInt(SysSalesOrderChild::getMaterialNum).sum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
@ -732,7 +732,7 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
public void exportShippingOrderTwo(String outOrderCode, HttpServletResponse response) { |
|
|
public void exportShippingOrderTwo(String outOrderCode, HttpServletResponse response) { |
|
|
|
|
|
|
|
|
String fileName = "销售出货单2.xlsx"; |
|
|
String fileName = "销售出货单2.xlsx"; |
|
|
|
|
|
String shippingOrderCode = redisCache.generateBillNo("shd"); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
String fileAbsolutePath = FileDownloadUtils.getFileAbsolutePath(fileName); |
|
|
String fileAbsolutePath = FileDownloadUtils.getFileAbsolutePath(fileName); |
|
@ -746,6 +746,22 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
SysSalesShippingInform salesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode); |
|
|
SysSalesShippingInform salesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String salesOrderCode = salesShippingInform.getSalesOrderCode(); |
|
|
|
|
|
|
|
|
|
|
|
List<String> salesOrderCodes = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(salesOrderCode)){ |
|
|
|
|
|
String[] splitSalesOrderCode = salesOrderCode.split(","); |
|
|
|
|
|
salesOrderCodes = Arrays.asList(splitSalesOrderCode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysSalesOrder> sysSalesOrders = sysSalesOrderMapper.selectSysSalesOrderListByCodeList(salesOrderCodes); |
|
|
|
|
|
HashMap<String, SysSalesOrder> salesOrderHashMap = new HashMap<>(); |
|
|
|
|
|
for (SysSalesOrder sysSalesOrder : sysSalesOrders) { |
|
|
|
|
|
salesOrderHashMap.put(sysSalesOrder.getSalesOrderCode(),sysSalesOrder); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//销售出货单
|
|
|
//销售出货单
|
|
|
String shippingInformationType = "2"; |
|
|
String shippingInformationType = "2"; |
|
|
String shippingTemplateType = "销售出货单2"; |
|
|
String shippingTemplateType = "销售出货单2"; |
|
@ -753,33 +769,42 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
insertShippingInformation(outOrderCode,shippingInformationType,shippingTemplateType,salesShippingInform); |
|
|
insertShippingInformation(outOrderCode,shippingInformationType,shippingTemplateType,salesShippingInform); |
|
|
|
|
|
|
|
|
List<SysSalesShippingInformDetail> salesShippingInformDetails = shippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode); |
|
|
List<SysSalesShippingInformDetail> salesShippingInformDetails = shippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode); |
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
String deliverTime = dateFormat.format(salesShippingInform.getDeliverTime()); |
|
|
|
|
|
String realFileName = salesShippingInform.getSalesOrderCode() +"-"+ fileName.substring(0, fileName.lastIndexOf("."))+ ".xlsx"; |
|
|
String realFileName = salesShippingInform.getSalesOrderCode() +"-"+ fileName.substring(0, fileName.lastIndexOf("."))+ ".xlsx"; |
|
|
// 设置响应头,指定文件名和文件类型
|
|
|
// 设置响应头,指定文件名和文件类型
|
|
|
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"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysSalesOrderChild> sysSalesOrderChildren = salesOrderChildMapper.selectBatchOrderChildListBySalesOrderCode(salesOrderCodes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
|
|
|
|
|
|
//处理物料数据
|
|
|
//处理物料数据
|
|
|
List<ExportShippingOrderDto> exportShippingOrderDtos = new ArrayList<>(); |
|
|
List<ExportShippingOrderDto> exportShippingOrderDtos = new ArrayList<>(); |
|
|
|
|
|
|
|
|
for (SysSalesShippingInformDetail salesShippingInformDetail : salesShippingInformDetails) { |
|
|
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildren) { |
|
|
|
|
|
SysSalesOrder sysSalesOrder = salesOrderHashMap.get(sysSalesOrderChild.getQuoteId()); |
|
|
|
|
|
|
|
|
ExportShippingOrderDto exportShippingOrderDto = new ExportShippingOrderDto(); |
|
|
ExportShippingOrderDto exportShippingOrderDto = new ExportShippingOrderDto(); |
|
|
exportShippingOrderDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingOrderDto.setIndex(index.getAndIncrement()); |
|
|
exportShippingOrderDto.setMaterialName(salesShippingInformDetail.getMaterialName()); |
|
|
exportShippingOrderDto.setMaterialName(sysSalesOrderChild.getMaterialName()); |
|
|
exportShippingOrderDto.setMaterialUnit(salesShippingInformDetail.getMaterialUnit()); |
|
|
exportShippingOrderDto.setMaterialModel(sysSalesOrderChild.getMaterialModel()); |
|
|
exportShippingOrderDto.setMakeNum(salesShippingInformDetail.getMakeNum()); |
|
|
exportShippingOrderDto.setMaterialUnit(sysSalesOrderChild.getUnit()); |
|
|
exportShippingOrderDto.setSalesOrderNumber(salesShippingInform.getSalesOrderNumber()); |
|
|
exportShippingOrderDto.setMakeNum(sysSalesOrderChild.getMaterialNum()); |
|
|
exportShippingOrderDto.setRemark(salesShippingInform.getRemark()); |
|
|
exportShippingOrderDto.setSalesOrderNumber(sysSalesOrder.getSalesOrderNumber()); |
|
|
|
|
|
exportShippingOrderDto.setRemark(sysSalesOrder.getRemark()); |
|
|
|
|
|
exportShippingOrderDto.setEnterpriseMaterialNo(sysSalesOrder.getEnterpriseMaterialNo()); |
|
|
exportShippingOrderDtos.add(exportShippingOrderDto); |
|
|
exportShippingOrderDtos.add(exportShippingOrderDto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//totalMakeNum
|
|
|
//totalMakeNum
|
|
|
String totalMakeNum = String.valueOf(salesShippingInformDetails.stream().mapToInt(SysSalesShippingInformDetail::getMakeNum).sum()); |
|
|
String totalMakeNum = String.valueOf(sysSalesOrderChildren.stream().mapToInt(SysSalesOrderChild::getMaterialNum).sum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileAbsolutePath).build(); |
|
@ -789,10 +814,14 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build(); |
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build(); |
|
|
|
|
|
|
|
|
HashMap<String, Object> map = MapUtils.newHashMap(); |
|
|
HashMap<String, Object> map = MapUtils.newHashMap(); |
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
String shippingDate = dateFormat.format(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("customerId",salesShippingInform.getCustomerId()); |
|
|
map.put("customerId",salesShippingInform.getCustomerId()); |
|
|
map.put("deliverTime",deliverTime); |
|
|
map.put("shippingDate",shippingDate); |
|
|
map.put("businessMembers",salesShippingInform.getBusinessMembers()); |
|
|
|
|
|
map.put("totalMakeNum",totalMakeNum); |
|
|
map.put("totalMakeNum",totalMakeNum); |
|
|
|
|
|
map.put("shippingOrderCode",shippingOrderCode); |
|
|
|
|
|
|
|
|
// 写入数据
|
|
|
// 写入数据
|
|
|
workBook.fill(map, sheet); |
|
|
workBook.fill(map, sheet); |
|
|