Browse Source

[fix] 销售管理

按照万材调整:
重写导出出货箱单1模板的后端接口
修改 导出销售出货箱单模板数据实体类
按照新模板修改出货箱单1.xlsx文件
重写导出出货箱单2模板的后端接口
按照新模板修改出货箱单2.xlsx文件
dev
liuxiaoxu 3 months ago
parent
commit
034ada3f32
  1. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingPackingDto.java
  2. 119
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  3. BIN
      ruoyi-admin/src/main/resources/static/attachments/销售出货箱单1.xlsx
  4. BIN
      ruoyi-admin/src/main/resources/static/attachments/销售出货箱单2.xlsx

10
ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingPackingDto.java

@ -18,5 +18,15 @@ public class ExportShippingPackingDto {
private Integer materialNum;
private String box;
private String oneBox;
private String twoBox;
private String totalNW;
private String totalGW;
private String meas;
}

119
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java

@ -853,9 +853,11 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
String shippingInformationType = "0";
String shippingTemplateType = "销售出货箱单1";
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
//生成出货资料
insertShippingInformation(outOrderCode,shippingInformationType,shippingTemplateType,sysSalesShippingInform);
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
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.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());
map.put("customerContact",sysSalesShippingInform.getCustomerContact());
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress());
//生产订主表的数据
List<SysMakeOrder> sysMakeOrders = sysMakeOrderMapper.selectMakeOrderListBySalesOrderCodes(salesOrderCodes);
//获取销售订单的明细
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<>();
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.setIndex(index.getAndIncrement());
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe());
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode());
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo());
exportShippingPackingDto.setMaterialNum(1);
exportShippingPackingDto.setMaterialDescribe(sysSalesOrderChild.getDescribe());
exportShippingPackingDto.setMaterialModel(sysSalesOrderChild.getMaterialModel());
exportShippingPackingDto.setMakeNo(sysMakeOrder.getMakeNo());
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);
}
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();
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.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());
map.put("customerContact",sysSalesShippingInform.getCustomerContact());
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress());
//生产订主表的数据
List<SysMakeOrder> sysMakeOrders = sysMakeOrderMapper.selectMakeOrderListBySalesOrderCodes(salesOrderCodes);
//获取销售订单的明细
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<>();
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.setIndex(index.getAndIncrement());
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe());
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode());
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo());
exportShippingPackingDto.setMaterialNum(1);
exportShippingPackingDto.setMaterialDescribe(sysSalesOrderChild.getDescribe());
exportShippingPackingDto.setMaterialModel(sysSalesOrderChild.getMaterialModel());
exportShippingPackingDto.setMakeNo(sysMakeOrder.getMakeNo());
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);
}
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();
WriteSheet sheet = EasyExcel.writerSheet().build();

BIN
ruoyi-admin/src/main/resources/static/attachments/销售出货箱单1.xlsx

Binary file not shown.

BIN
ruoyi-admin/src/main/resources/static/attachments/销售出货箱单2.xlsx

Binary file not shown.
Loading…
Cancel
Save