From b9ff0115fb121a1349e701ae37e1d76f646a551e Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 28 Aug 2024 15:49:22 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=87=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=92=8Cjs=E6=96=B9=E6=B3=95=EF=BC=9A=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=89=8D=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E4=BD=9C=E5=BA=9F=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E6=A8=A1=E6=9D=BF=E7=B1=BB=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=B1=BB=20=E6=96=B0=E5=A2=9E=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E6=A8=A1=E6=9D=BF=E5=89=8D?= =?UTF-8?q?=EF=BC=9B=E7=BC=96=E8=BE=91=E5=AF=BC=E5=87=BA=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE=E7=9A=84=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E6=96=B0=E5=A2=9E=20=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E5=AF=BC=E5=87=BA=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=AF=BC=E5=87=BA=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=E5=AD=90=E8=A1=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=87=91=E9=A2=9D=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=AD=97=E6=AE=B5=E7=9A=84=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysSalesOrderController.java | 48 +++- .../domain/Vo/ExportSalesOrderChildVo.java | 69 +++++ .../system/domain/Vo/ExportSalesOrderVo.java | 53 ++++ .../system/service/ISysSalesOrderService.java | 13 + .../impl/SysSalesOrderServiceImpl.java | 112 ++++++++ .../system/SysSalesOrderChildMapper.xml | 3 +- .../system/salesOrder/exportSalesOrder.html | 248 ++++++++++++++++++ .../system/salesOrder/salesOrder.html | 38 +++ 8 files changed, 577 insertions(+), 7 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderChildVo.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderVo.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/salesOrder/exportSalesOrder.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java index dcdef904..58a7b50a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java @@ -30,6 +30,8 @@ import com.ruoyi.financial.service.IFinancialTaxInvoiceHistoryService; import com.ruoyi.financial.service.IFinancialTaxInvoiceService; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.system.domain.*; +import com.ruoyi.system.domain.Vo.ExportSalesOrderChildVo; +import com.ruoyi.system.domain.Vo.ExportSalesOrderVo; import com.ruoyi.system.domain.exportDto.SysSalesFinishDto; import com.ruoyi.system.domain.exportDto.SysSalesOrderDto; import com.ruoyi.system.mapper.SysSalesOrderMapper; @@ -162,6 +164,21 @@ public class SysSalesOrderController extends BaseController } + + /** + * 修改保存销售订单 + * */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) + { + SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(id); + mmap.put("sysSalesOrder", sysSalesOrder); + return prefix + "/edit"; + } + + + + /** * 新增销售订单 */ @@ -187,15 +204,34 @@ public class SysSalesOrderController extends BaseController } /** - * 修改销售订单 + * 加载填写导出销售订单模板数据页面 */ - @GetMapping("/edit/{id}") - public String edit(@PathVariable("id") Long id, ModelMap mmap) + @GetMapping("/exportSalesOrder/{salesOrderId}") + public String exportSalesOrder(@PathVariable("salesOrderId") Long salesOrderId, ModelMap mmap) { - SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(id); - mmap.put("sysSalesOrder", sysSalesOrder); - return prefix + "/edit"; + ExportSalesOrderVo exportSalesOrderVo = sysSalesOrderService.selectExportSalesOrderById(salesOrderId); + mmap.put("exportSalesOrderVo", exportSalesOrderVo); + return prefix + "/exportSalesOrder"; + } + + + + + /** + * 展示导出销售订单列表子表数据 + */ + @ResponseBody + @PostMapping("/showExportSalesOrderChildList") + public TableDataInfo showExportSalesOrderChildList(@RequestParam("salesOrderCode") String salesOrderCode) + { + startPage(); + List exportSalesOrderChildVoList = sysSalesOrderService.showExportSalesOrderChildListByICode(salesOrderCode); + + return getDataTable(exportSalesOrderChildVoList); } + + + @GetMapping("/detail/{id}") public String detail(@PathVariable("id") Long id, ModelMap mmap) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderChildVo.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderChildVo.java new file mode 100644 index 00000000..c0033332 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderChildVo.java @@ -0,0 +1,69 @@ +package com.ruoyi.system.domain.Vo; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 导出销售订单子表模板类 + */ +@Data +public class ExportSalesOrderChildVo { + + + /*索引*/ + private Integer index; + + /** 物料表中的编号 */ + private String materialCode; + + /** 物料的名称 */ + private String materialName; + + //订单数量 + private Integer materialNum; + + + /** 国内税率 */ + private BigDecimal countTax; + + + /** 物料的含税单价 */ + private BigDecimal materialTaxMoney; + + /** 物料的不含税单价 */ + private BigDecimal materialNoTaxMoney; + + /** 物料的含税单价(RMB) */ + private BigDecimal materialRmb; + + /** 物料的不含税单价(RMB) */ + private BigDecimal materialNoRmb; + + + /** 物料的不含税总价(RMB) */ + private BigDecimal materialNoRmbSum; + + /** 物料的含税总价(RMB) */ + private BigDecimal materialRmbSum; + + + /** 物料的不含税单价(USD) */ + private BigDecimal materialNoUsd; + + /** 物料的含税单价(USD) */ + private BigDecimal materialUsd; + + /** 物料的含税总价(USD) */ + private BigDecimal materialUsdSum; + + /** 物料的不含税总价(USD) */ + private BigDecimal materialNoUsdSum; + + /** 计划交付时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private String deliveryTime; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderVo.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderVo.java new file mode 100644 index 00000000..87e57646 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/ExportSalesOrderVo.java @@ -0,0 +1,53 @@ +package com.ruoyi.system.domain.Vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 导出销售订单模板类 + */ +@Data +public class ExportSalesOrderVo { + + //销售订单id + private Long salesOrderId; + + //销售订单号 + private String salesOrderCode; + + // 销售订单类型 + private String salesOrderType; + + // 企业编码 + private String enterpriseCode; + + // 客户订单编号 + private String salesOrderNumber; + + + //付款条款 + private String paymentTerms; + + //国际贸易条款 + private String tradeClause; + + //是否开票 + private String invoice; + + //货币 1RMB、2美元 + private String commonCurrency; + + //订单含税总额 + private BigDecimal taxMoneySum; + + //订单不含税总额 + private BigDecimal noTaxMoneySum; + + //质保日期 + private String warrantyDate; + + //备注 + private String remark; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java index 91657cc7..08129197 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java @@ -3,6 +3,8 @@ package com.ruoyi.system.service; import com.ruoyi.system.domain.SysSalesOrderVo; import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesOrderVo; +import com.ruoyi.system.domain.Vo.ExportSalesOrderChildVo; +import com.ruoyi.system.domain.Vo.ExportSalesOrderVo; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.transaction.annotation.Transactional; @@ -92,4 +94,15 @@ public interface ISysSalesOrderService * 修改保存发起出货 */ int updateSalesDeliverGoods(SysSalesOrder sysSalesOrder); + + /** + * 查询填充导出销售订单模板类数据 + * */ + ExportSalesOrderVo selectExportSalesOrderById(Long salesOrderId); + + /** + * 通过销售订单号查询导出销售订单页面子表数据 + * */ + List showExportSalesOrderChildListByICode(String salesOrderCode); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java index 628191fc..52ee9e47 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java @@ -15,11 +15,14 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.system.domain.*; +import com.ruoyi.system.domain.Vo.ExportSalesOrderChildVo; +import com.ruoyi.system.domain.Vo.ExportSalesOrderVo; import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.*; import com.ruoyi.warehouse.service.IWarehouseOutOrderService; +import lombok.extern.slf4j.Slf4j; import org.activiti.engine.TaskService; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.runtime.ProcessInstance; @@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -39,6 +43,7 @@ import java.util.stream.Collectors; * @author ruoyi * @date 2022-12-15 */ +@Slf4j @Service public class SysSalesOrderServiceImpl implements ISysSalesOrderService { @@ -86,6 +91,10 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService @Autowired private ISysUserService sysUserService; + private final static String RMB = "1"; //RMB + + private final static String USD = "2"; //美元 + /** * 查询销售订单 * @@ -446,4 +455,107 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService variables.put("authority",1); } } + + + /** + * 查询填充导出销售订单模板类数据 + * */ + @Override + public ExportSalesOrderVo selectExportSalesOrderById(Long salesOrderId) { + + SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderById(salesOrderId); + if (sysSalesOrderVo == null){ + throw new BusinessException("该销售订单不存在"); + } + ExportSalesOrderVo exportSalesOrderVo = new ExportSalesOrderVo(); + + exportSalesOrderVo.setSalesOrderId(salesOrderId); + exportSalesOrderVo.setSalesOrderCode(sysSalesOrderVo.getSalesOrderCode()); + exportSalesOrderVo.setSalesOrderNumber(sysSalesOrderVo.getSalesOrderNumber()); + exportSalesOrderVo.setInvoice(sysSalesOrderVo.getInvoice()); + exportSalesOrderVo.setSalesOrderType(sysSalesOrderVo.getSalesOrderType()); + exportSalesOrderVo.setTradeClause(sysSalesOrderVo.getTradeClause()); + exportSalesOrderVo.setEnterpriseCode(sysSalesOrderVo.getEnterpriseCode()); + exportSalesOrderVo.setCommonCurrency(sysSalesOrderVo.getCommonCurrency()); + //设置含税和不含税金额 + setOrderPrice(sysSalesOrderVo, exportSalesOrderVo); + exportSalesOrderVo.setPaymentTerms(sysSalesOrderVo.getPaymentTerms()); + + return exportSalesOrderVo; + } + + private void setOrderPrice(SysSalesOrderVo sysSalesOrderVo, ExportSalesOrderVo exportSalesOrderVo) { + if (RMB.equals(sysSalesOrderVo.getCommonCurrency())) { + // RMB + BigDecimal rmbTaxSum = sysSalesOrderVo.getRmbTaxSum() != null ? BigDecimal.valueOf(sysSalesOrderVo.getRmbTaxSum()) : BigDecimal.ZERO; + BigDecimal noRmbSum = sysSalesOrderVo.getNoRmbSum() != null ? BigDecimal.valueOf(sysSalesOrderVo.getNoRmbSum()) : BigDecimal.ZERO; + + exportSalesOrderVo.setTaxMoneySum(rmbTaxSum); + exportSalesOrderVo.setNoTaxMoneySum(noRmbSum); + } else { + // USD + BigDecimal usdTaxSum = sysSalesOrderVo.getUsdTaxSum() != null ? BigDecimal.valueOf(sysSalesOrderVo.getUsdTaxSum()) : BigDecimal.ZERO; + BigDecimal noUsdSum = sysSalesOrderVo.getNoUsdSum() != null ? BigDecimal.valueOf(sysSalesOrderVo.getNoUsdSum()) : BigDecimal.ZERO; + + exportSalesOrderVo.setTaxMoneySum(usdTaxSum); + exportSalesOrderVo.setNoTaxMoneySum(noUsdSum); + } + } + + + /** + * 通过销售订单号查询导出销售订单页面子表数据 + * */ + @Override + public List showExportSalesOrderChildListByICode(String salesOrderCode) { + if (StringUtils.isBlank(salesOrderCode)) { + log.warn("销售订单号为空: {}", salesOrderCode); + return Collections.emptyList(); // 直接返回空列表 + } + + List exportSalesOrderChildVos = new ArrayList<>(); + SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(salesOrderCode); + List sysSalesOrderChildren = salesOrderChildMapper.selectOrderChildListBySalesOrderCode(salesOrderCode); + + for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildren) { + ExportSalesOrderChildVo exportSalesOrderChildVo = new ExportSalesOrderChildVo(); + + // 设置基本字段 + exportSalesOrderChildVo.setMaterialCode(sysSalesOrderChild.getMaterialCode()); + exportSalesOrderChildVo.setMaterialName(sysSalesOrderChild.getMaterialName()); + exportSalesOrderChildVo.setMaterialNum(sysSalesOrderChild.getMaterialNum()); + + // 设置税率 + BigDecimal countTax = sysSalesOrderChild.getCountTax() != null ? BigDecimal.valueOf(sysSalesOrderChild.getCountTax()) : BigDecimal.ZERO; + exportSalesOrderChildVo.setCountTax(countTax); + + // 设置交付时间 + exportSalesOrderChildVo.setDeliveryTime(sysSalesOrderChild.getDeliveryTime()); + + // 设置价格,根据货币类型 + setMaterialPrice(exportSalesOrderChildVo, sysSalesOrderVo, sysSalesOrderChild); + + exportSalesOrderChildVos.add(exportSalesOrderChildVo); + } + + return exportSalesOrderChildVos; + } + + private void setMaterialPrice(ExportSalesOrderChildVo vo, SysSalesOrderVo sysSalesOrderVo, SysSalesOrderChild child) { + if (RMB.equals(sysSalesOrderVo.getCommonCurrency())) { + // RMB + BigDecimal noTax = child.getMaterialNoRmb() != null ? BigDecimal.valueOf(child.getMaterialNoRmb()) : BigDecimal.ZERO; + BigDecimal tax = child.getMaterialRmb() != null ? BigDecimal.valueOf(child.getMaterialRmb()) : BigDecimal.ZERO; + + vo.setMaterialNoTaxMoney(noTax); + vo.setMaterialTaxMoney(tax); + } else { + // USD + BigDecimal noTax = child.getMaterialNoUsd() != null ? BigDecimal.valueOf(child.getMaterialNoUsd()) : BigDecimal.ZERO; + BigDecimal tax = child.getUsdTax() != null ? BigDecimal.valueOf(child.getUsdTax()) : BigDecimal.ZERO; + + vo.setMaterialNoTaxMoney(noTax); + vo.setMaterialTaxMoney(tax); + } + } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml index c6a1c319..0218c523 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml @@ -107,7 +107,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/exportSalesOrder.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/exportSalesOrder.html new file mode 100644 index 00000000..01619893 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/exportSalesOrder.html @@ -0,0 +1,248 @@ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html index 1efec8c4..61a1059a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html @@ -185,6 +185,11 @@
+ + + 导出 + + 添加 @@ -394,6 +399,39 @@ $.table.init(options); }); + /*导出销售订单模板*/ + function exportSalesOrder(){ + + const selectRows = $("#bootstrap-table").bootstrapTable('getSelections'); + // 定义状态码常量 + const AUDIT_STATUS_APPROVED = "1";//审核通过 + const DELETE_FLAG = "2"; //作废 + + if (selectRows.length === 1){ + const row = selectRows[0]; + // 检查是否已作废 + if (row.useStatus === DELETE_FLAG) { + showWarning("该订单已作废"); + + }else { + // 检查是否已审核 + if (row.auditStatus === AUDIT_STATUS_APPROVED) { + var salesOrderId = row.salesOrderId; + var url = prefix + "/exportSalesOrder/" + salesOrderId; + $.modal.open("导出",url); + } else { + showWarning("请先审核"); + } + } + + }else { + $.modal.alertWarning("请选择一条数据"); + return; + } + + } + + /*下载*/ function downloadFile(filepath) { window.location.href =prefix + "/downloadFile?filepath="+ filepath;