From bd4265e0e78ba83d87914e20aea4a034de5c1141 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 17 Jun 2024 17:10:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[fix]=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=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E7=9A=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8C=E6=A0=B9=E6=8D=AE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=20=E8=BF=9B=E8=A1=8C=E6=8E=92=E5=BA=8F=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=90=88=E8=AE=A1=E6=95=B0=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20Double=20->=20Long=20=E6=96=B0=E5=A2=9E=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=94=9F=E4=BA=A7=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=96=B9=E6=B3=95=20=E4=BF=AE=E5=A4=8D=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BD=9C=E5=BA=9F=20?= =?UTF-8?q?=E5=89=8D=E7=AB=AFurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/SysSalesOrderController.java | 2 ++ .../java/com/ruoyi/system/domain/SysSalesOrder.java | 6 +++--- .../service/impl/SysMakeOrderServiceImpl.java | 9 +++++++++ .../resources/mapper/system/SysSalesOrderMapper.xml | 2 +- .../templates/system/makeorder/bmzgqr.html | 13 +++++++------ .../templates/system/salesOrder/salesOrder.html | 6 ++++++ 6 files changed, 28 insertions(+), 10 deletions(-) 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 f2742678..57a1bdc5 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 @@ -453,6 +453,8 @@ public class SysSalesOrderController extends BaseController SysSalesOrderVo sysSalesOrderVo1 = sysSalesOrderService.selectSysSalesOrderById(sysSalesOrderVo.getSalesOrderId()); //生产订单生成 sysMakeOrderService.generateMakeOrderBySalesOrderCode(sysSalesOrderVo1.getSalesOrderCode()); + + // 提交 if("submit".equals(instanceType)){ // 使用状态-是 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java index 39759ba4..098637d0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java @@ -57,7 +57,7 @@ public class SysSalesOrder extends BaseEntity { /*客户电话*/ private String customerPhone; /*物料合计*/ - private Double materialSum; + private Long materialSum; /*数量合计*/ private Long enterpriseSum; /*不含税单价(RMB)*/ @@ -297,11 +297,11 @@ public class SysSalesOrder extends BaseEntity { this.customerPhone = customerPhone; } - public Double getMaterialSum() { + public Long getMaterialSum() { return materialSum; } - public void setMaterialSum(Double materialSum) { + public void setMaterialSum(Long materialSum) { this.materialSum = materialSum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java index ed3c3f43..1d4c5b5e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java @@ -195,6 +195,15 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService // 是 makeOrder.setUseStatus("1"); makeOrder.setSaleNo(salesOrderCode); + makeOrder.setMakeStatus("0"); + makeOrder.setSalesman(sysSalesOrderVo.getBusinessMembers()); + makeOrder.setSaleNo(sysSalesOrderVo.getSalesOrderCode()); + makeOrder.setOrderType(sysSalesOrderVo.getSalesOrderType()); + makeOrder.setCustomerId(sysSalesOrderVo.getEnterpriseCode()); + makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); + makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber()); + makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum()); + makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum())); String makeNo = redisCache.generateBillNo("PO"); makeOrder.setMakeNo(makeNo); insertSysMakeOrder(makeOrder); diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml index a96caab6..67b49c24 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml @@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and s.apply_time = #{applyTime} and s.apply_title = #{applyTitle} - order by s.apply_time desc + order by s.create_time desc - -
-
-
-
+
+
+
+
+
-
+ +
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 f3576170..4c603bcf 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html @@ -228,6 +228,7 @@ updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", exportUrl: prefix + "/export", + cancelUrl: prefix + "/cancel/{id}", detailUrl: prefix + "/detail/{id}", pagination: true, pageList: [5, 10, 25, 50], @@ -353,6 +354,11 @@ // 进度查看 actions.push(' 进度查看 '); } + + if (row.makeStatus == "0" || row.makeStatus == "1"){ + actions.push(' 出货 '); + } + // 详情 actions.push(' 详情 '); return actions.join(''); From 518edcc1780288356404a02804be2e8a5b615943 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 17 Jun 2024 20:27:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[feat]=E8=B4=A2=E5=8A=A1=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20=E8=B4=A2=E5=8A=A1=E5=BA=94=E6=94=B6=E8=B4=A6=E6=AC=BE=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E5=AE=A1=E6=A0=B8=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=90=8E=E7=94=9F=E6=88=90=E8=B4=A2=E5=8A=A1=E5=BA=94?= =?UTF-8?q?=E6=94=B6=E8=B4=A6=E6=AC=BE=E6=95=B0=E6=8D=AE=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E7=94=9F=E6=88=90=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E5=BA=94=E6=94=B6=E8=B4=A6=E6=AC=BE=E6=95=B0=E6=8D=AE=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=B4=A2=E5=8A=A1=E5=BA=94=E6=94=B6=E8=B4=A6=E6=AC=BE?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E6=97=B6=E7=94=9F=E6=88=90=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E5=BA=94=E6=94=B6=E8=B4=A6=E6=AC=BE=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/IFinancialReceivablesService.java | 5 ++ .../impl/FinancialReceivablesServiceImpl.java | 61 +++++++++++++++++++ .../controller/SysSalesOrderController.java | 7 +++ 3 files changed, 73 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java index 14cc6725..1e0a6295 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java @@ -82,4 +82,9 @@ public interface IFinancialReceivablesService * 应收账款详情 * */ int financialReceivablesDetail(FinancialReceivables financialReceivables); + + /* + * 销售订单审批完成后根据销售单号生成财务应收账款 + * */ + int generateReceivablesBySalesOrderCode(String salesOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java index 808b4816..26a621a7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.financial.service.impl; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -12,6 +13,11 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.financial.domain.FinancialReceivablesRecords; import com.ruoyi.financial.domain.VO.FinancialReceivablesRecordsVO; import com.ruoyi.financial.mapper.FinancialReceivablesRecordsMapper; +import com.ruoyi.system.domain.SysCustomerVo; +import com.ruoyi.system.domain.SysSalesOrderVo; +import com.ruoyi.system.mapper.SysCustomerMapper; +import com.ruoyi.system.mapper.SysSalesOrderMapper; +import com.ruoyi.system.service.ISysSalesOrderService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -34,8 +40,15 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer @Autowired private FinancialReceivablesMapper financialReceivablesMapper; + @Autowired + private SysSalesOrderMapper sysSalesOrderMapper; + @Autowired private FinancialReceivablesRecordsMapper receivablesRecordsMapper; + + @Autowired + private SysCustomerMapper sysCustomerMapper; + /** * 查询财务应收账款 * @@ -137,6 +150,54 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer } + /* + * 销售订单审批完成后根据销售单号生成财务应收账款 + * */ + @Override + public int generateReceivablesBySalesOrderCode(String salesOrderCode) { + FinancialReceivables financialReceivables = new FinancialReceivables(); + FinancialReceivablesRecords receivablesRecords = new FinancialReceivablesRecords(); + // 更改日期格式以提高可读性 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + String datePart = df.format(new Date()); + // 移除日期中的分隔符以便于后续处理 + String prefix = "YS" + datePart.replace("-", ""); + + // 查询数据库中当前最大编号 + String maxCode = financialReceivablesMapper.findMaxRoundCode(prefix); + String newCode = generateNewCode(prefix, maxCode); + + SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(salesOrderCode); + SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(sysSalesOrderVo.getEnterpriseCode()); + financialReceivables.setSalesOrderCode(salesOrderCode); + //自动生成 应收单号 + financialReceivables.setFinancialReceivablesCode(newCode); + financialReceivables.setReceivablesClosingStatus("0"); + financialReceivables.setCreditAccount("客户"); + financialReceivables.setCreditDetail(sysCustomerVo.getEnterpriseName()); + financialReceivables.setOpenBank(sysCustomerVo.getDepositBank()); + financialReceivables.setOpenAccount(sysCustomerVo.getBankAccount()); + financialReceivables.setCustomerId(sysCustomerVo.getEnterpriseCode()); + financialReceivables.setCurrencyType(sysSalesOrderVo.getCommonCurrency()); + financialReceivables.setPriceExcludingTax(BigDecimal.valueOf(sysSalesOrderVo.getNoRmbSum())); + financialReceivables.setPriceIncludesTax(BigDecimal.valueOf(sysSalesOrderVo.getRmbTaxSum())); + financialReceivables.setPaymentCondition(sysSalesOrderVo.getPaymentTerms()); + financialReceivables.setBusinessMembers(sysSalesOrderVo.getBusinessMembers()); + financialReceivables.setFinancialDeliverStatus("0"); + financialReceivables.setCreateTime(new Date()); + financialReceivables.setCreateBy(ShiroUtils.getLoginName()); + + //插入数据到应收款明细中 + receivablesRecords.setFinancialReceivablesCode(newCode); + receivablesRecords.setReceivablesClosingStatus("0"); + receivablesRecords.setSalesOrderCode(salesOrderCode); + receivablesRecords.setCreateTime(new Date()); + receivablesRecords.setCreateBy(ShiroUtils.getLoginName()); + receivablesRecordsMapper.insertFinancialReceivablesRecords(receivablesRecords); + return financialReceivablesMapper.insertFinancialReceivables(financialReceivables); + + } + /** * 删除财务应收账款对象 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 57a1bdc5..ed2aa5ee 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 @@ -21,6 +21,7 @@ import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.erp.domain.ErpMaterialVo; +import com.ruoyi.financial.service.IFinancialReceivablesService; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.exportDto.SysSalesFinishDto; @@ -90,6 +91,10 @@ public class SysSalesOrderController extends BaseController @Autowired private SysSalesOrderMapper sysSalesOrderMapper; + @Autowired + private IFinancialReceivablesService financialReceivablesService; + + @RequiresPermissions("system:salesOrder:view") @GetMapping() public String salesOrder(ModelMap mmap) @@ -454,6 +459,8 @@ public class SysSalesOrderController extends BaseController //生产订单生成 sysMakeOrderService.generateMakeOrderBySalesOrderCode(sysSalesOrderVo1.getSalesOrderCode()); + //生成财务应收账款 + financialReceivablesService.generateReceivablesBySalesOrderCode(sysSalesOrderVo1.getSalesOrderCode()); // 提交 if("submit".equals(instanceType)){