Browse Source

[feat] 销售管理

新增 导出出货单箱单2模板后端接口,新增导出出货单箱单2模板后端接口具体实现类
销售出货通知前端列表新增 导出销售出货箱单2按钮和js方法
附件目录新增:销售出货箱单2.xlsx文件模板
dev
liuxiaoxu 3 months ago
parent
commit
3825df1f97
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java
  2. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  3. 72
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  4. BIN
      ruoyi-admin/src/main/resources/attachments/销售出货箱单2.xlsx

11
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java

@ -126,6 +126,17 @@ public class SysSalesShippingInformController extends BaseController
/**
* 导出出货箱单2模板
* */
@RequiresPermissions("system:salesShippingInform:exportShippingPackingTwo")
@Log(title = "销售出货单", businessType = BusinessType.EXPORT)
@GetMapping("/exportShippingPackingTwo/{outOrderCode}")
public void exportShippingPackingTwo(@PathVariable("outOrderCode") String outOrderCode,HttpServletResponse response) {
sysSalesShippingInformService.exportShippingPackingTwo(outOrderCode, response);
}
/**
* 导出出货单通知单模板

8
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java

@ -127,10 +127,16 @@ public interface ISysSalesShippingInformService
* */
void exportShippingPackingOne(String outOrderCode, HttpServletResponse response);
/**
* 导出出货单箱单2模板
* */
void exportShippingPackingTwo(String outOrderCode, HttpServletResponse response);
/**
* 导出出货通知单模板
* */
void exportShippingInformOrder(String outOrderCode, HttpServletResponse response);
}

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

@ -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);
}
}
/**
* 导出出货通知单模板
* */

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

Binary file not shown.
Loading…
Cancel
Save