|
|
@ -525,6 +525,9 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出出货单箱单1模板 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void exportShippingPackingOne(String outOrderCode, HttpServletResponse response) { |
|
|
|
|
|
|
@ -594,6 +597,75 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 导出出货单箱单2模板 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void exportShippingPackingTwo(String outOrderCode, HttpServletResponse response) { |
|
|
|
String fileName = "销售出货箱单2.xlsx"; |
|
|
|
|
|
|
|
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils(); |
|
|
|
try { |
|
|
|
String fileRelativePath = fileDownloadUtils.getFileAbsolutePath(fileName); |
|
|
|
|
|
|
|
|
|
|
|
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode); |
|
|
|
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode(); |
|
|
|
if (StringUtils.isEmpty(salesOrderCode)){ |
|
|
|
log.warn("销售订单号为空,请检查:{}", salesOrderCode); |
|
|
|
throw new RuntimeException("销售订单号为空,请检查"); |
|
|
|
} |
|
|
|
|
|
|
|
String realFileName = salesOrderCode + "-" + fileName.substring(0, fileName.lastIndexOf(".")) + ".xlsx"; |
|
|
|
|
|
|
|
//设置响应头,指定文件和文件类型
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
|
|
|
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode); |
|
|
|
|
|
|
|
if (sysMakeOrder == null){ |
|
|
|
log.warn("未找到对应的生产订单,请检查:{}", salesOrderCode); |
|
|
|
throw new RuntimeException("未找到对应的生产订单,请检查"); |
|
|
|
} |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>(); |
|
|
|
|
|
|
|
AtomicInteger index = new AtomicInteger(1); |
|
|
|
|
|
|
|
List<AfterSalesShippingDevice> shippingDeviceList = salesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode); |
|
|
|
for (AfterSalesShippingDevice shippingDevice : shippingDeviceList) { |
|
|
|
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto(); |
|
|
|
exportShippingPackingDto.setIndex(index.getAndIncrement()); |
|
|
|
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe()); |
|
|
|
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode()); |
|
|
|
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo()); |
|
|
|
exportShippingPackingDto.setMaterialNum(1); |
|
|
|
shippingPackingDtos.add(exportShippingPackingDto); |
|
|
|
} |
|
|
|
|
|
|
|
//构建模板
|
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileRelativePath).build(); |
|
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build(); |
|
|
|
|
|
|
|
//写入数据
|
|
|
|
workBook.fill(map, sheet); |
|
|
|
workBook.fill(shippingPackingDtos, fillConfig, sheet); |
|
|
|
workBook.finish(); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException("文件处理失败",e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出出货通知单模板 |
|
|
|
* */ |
|
|
|