From 229e484451941c30fd4494873971c207487406d0 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 5 Nov 2024 09:01:08 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E6=96=B0=E5=A2=9E=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=E5=87=BA=E8=B4=A7=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95id?= =?UTF-8?q?=E9=9B=86=E5=90=88=E6=9F=A5=E8=AF=A2=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=9B=86=E5=90=88=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E5=87=BA=E8=B4=A7=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=B2=A1=E6=9C=89=E5=80=BC=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=BA=E2=80=9Dempty=E2=80=9C=EF=BC=9B=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E4=B8=87=E6=9D=90=E8=B0=83=E6=95=B4=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=94=80=E5=94=AE=E5=8D=95=E5=8F=B7=E5=92=8C?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=B1=BB=E5=9E=8B=E6=A0=B9=E6=8D=AE=E5=9C=A8?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E6=97=B6=E5=80=99=E5=8A=A8=E6=80=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=20=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9=E5=87=BA=E8=B4=A7=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=9A=E4=BB=8E=E8=A1=A8=E6=A0=BC=E5=86=85=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=88=B0=E8=A1=A8=E5=A4=B4=EF=BC=9B=E5=B9=B6=E4=B8=94=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=A6=82=E4=B8=8B=EF=BC=9A=20=20=20=201=E3=80=81=20?= =?UTF-8?q?=E9=9C=80=E5=8B=BE=E9=80=89=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=89=8D=E8=83=BD=E5=8F=91=E8=B5=B7=E3=80=90?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E3=80=91=20=20=20=202=E3=80=81=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E9=80=89=E6=8B=A9=E5=A4=9A=E6=9D=A1=E9=94=80=E5=94=AE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=AA=E8=83=BD=E9=80=89=E6=8B=A9=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=AE=A2=E6=88=B7=E7=9A=84=E9=94=80=E5=94=AE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=EF=BC=8C=E5=90=A6=E5=88=99=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E2=80=9D=E8=AF=B7=E9=80=89=E6=8B=A9=E5=90=8C=E4=B8=AA=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E4=B8=8B=E7=9A=84=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E2=80=9C=EF=BC=8C=20=20=20=203=20=E6=94=B6=E6=AC=BE=E7=BB=93?= =?UTF-8?q?=E6=A1=88:=E9=99=A4=E4=BA=86=E5=B7=B2=E7=BB=8F=E7=BB=93?= =?UTF-8?q?=E6=A1=88=E7=9A=84=E9=83=BD=E5=8F=AF=E4=BB=A5=E9=80=89=E6=8B=A9?= =?UTF-8?q?=20=20=20=204=E3=80=81=E5=87=BA=E8=B4=A7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E9=99=A4=E4=BA=86=E5=85=A8=E9=83=A8=E5=87=BA=E8=B4=A7=E3=80=81?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=AA=8C=E6=94=B6=E3=80=81=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E9=83=BD=E5=8F=AF=E4=BB=A5=E9=80=89=E6=8B=A9?= =?UTF-8?q?=20=20=20=20=E4=B8=8A=E9=9D=A2=E8=A6=81=E9=83=BD=E8=A6=81?= =?UTF-8?q?=E6=BB=A1=E8=B6=B3=20bom=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=B2=A1=E6=9C=89=E5=80=BC=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=BA=E2=80=9Dempty=E2=80=9C=20=E9=94=80=E5=94=AE?= =?UTF-8?q?=E4=BC=B0=E4=BB=B7=E9=87=87=E8=B4=AD=E6=96=B0=E5=A2=9E=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=B2=A1=E6=9C=89=E5=80=BC?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BA=E2=80=9Dempty=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysSalesOrderController.java | 25 ++++-- .../system/mapper/SysSalesOrderMapper.java | 6 ++ .../system/service/ISysSalesOrderService.java | 6 ++ .../impl/SysSalesOrderServiceImpl.java | 10 +++ .../mapper/system/SysSalesOrderMapper.xml | 8 ++ .../main/resources/templates/erp/bom/add.html | 10 +-- .../templates/sales/estimate/purchaseAdd.html | 20 ++--- .../system/salesOrder/salesDeliverGoods.html | 50 ++++++++--- .../system/salesOrder/salesOrder.html | 87 ++++++++++++++++--- 9 files changed, 179 insertions(+), 43 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 d700016c..70b4adb4 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 @@ -536,15 +536,30 @@ public class SysSalesOrderController extends BaseController return getDataTable(list); } +// /** +// * 发起出货 +// */ +// @GetMapping("/salesDeliverGoods/{salesOrderId}") +// public String salesDeliverGoods(@PathVariable("salesOrderId") Long salesOrderId, ModelMap mmap) +// { +// SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(salesOrderId); +// mmap.put("sysSalesOrder", sysSalesOrder); +// return prefix + "/salesDeliverGoods"; +// } + + + /** * 发起出货 */ - @GetMapping("/salesDeliverGoods/{salesOrderId}") - public String salesDeliverGoods(@PathVariable("salesOrderId") Long salesOrderId, ModelMap mmap) - { - SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(salesOrderId); + @GetMapping("/salesDeliverGoods") + public String deliverGoods(@RequestParam List salesOrderIds, ModelMap mmap) { + + List salesOrders = sysSalesOrderService.selectBatchSalesOrderById(salesOrderIds); + SysSalesOrder sysSalesOrder = salesOrders.get(0); + mmap.put("salesOrders", salesOrders); mmap.put("sysSalesOrder", sysSalesOrder); - return prefix + "/salesDeliverGoods"; + return prefix + "/salesDeliverGoods"; } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java index def16c1b..c78dd551 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java @@ -86,4 +86,10 @@ public interface SysSalesOrderMapper * 导出查询所有的销售订单 * */ List selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder); + + /** + * 通过销售订单id批量查询销售订单 + * */ + List selectBatchSalesOrderById(List salesOrderIds); + } 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 7673babf..14c71045 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 @@ -137,4 +137,10 @@ public interface ISysSalesOrderService * 根据销售订单对象对象作废销售订单 * */ int cancelSysSalesOrderByObject(SysSalesOrder sysSalesOrder); + + + /** + * 通过销售订单id批量查询销售订单 + * */ + List selectBatchSalesOrderById(List salesOrderIds); } 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 69783825..ae74a4c0 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 @@ -131,6 +131,16 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService return null; } + + /** + * 通过销售订单id批量查询销售订单 + * */ + @Override + public List selectBatchSalesOrderById(List salesOrderIds) { + List sysSalesOrders = sysSalesOrderMapper.selectBatchSalesOrderById(salesOrderIds); + return sysSalesOrders; + } + /** * 查询销售订单列表 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml index 8be99f97..baed8650 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml @@ -220,6 +220,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into sys_sales_order diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html index 1f7b53c6..356d11f3 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html @@ -409,14 +409,14 @@ return ""; } - // 检查 storageLocation 是否存在 - if (row.storageLocation === undefined || row.storageLocation === null) { + // 检查 remark 是否存在 + if (row.remark === undefined || row.remark === null) { return ""; } - // 根据 storageLocation 的值决定返回值 - if (row.storageLocation) { - return row.storageLocation; + // 根据 remark 的值决定返回值 + if (row.remark) { + return row.remark; } else { return value; } diff --git a/ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html b/ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html index 3c7ad3de..0be1ea22 100644 --- a/ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html +++ b/ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html @@ -414,14 +414,14 @@ return ""; } - // 检查 storageLocation 是否存在 - if (row.storageLocation === undefined || row.storageLocation === null) { + // 检查 noTaxPurchaseRmb 是否存在 + if (row.noTaxPurchaseRmb === undefined || row.noTaxPurchaseRmb === null) { return ""; } - // 根据 storageLocation 的值决定返回值 - if (row.storageLocation) { - return row.storageLocation; + // 根据 noTaxPurchaseRmb 的值决定返回值 + if (row.noTaxPurchaseRmb) { + return row.noTaxPurchaseRmb; } else { return value; } @@ -445,14 +445,14 @@ return ""; } - // 检查 storageLocation 是否存在 - if (row.storageLocation === undefined || row.storageLocation === null) { + // 检查 taxPurchaseRmb 是否存在 + if (row.taxPurchaseRmb === undefined || row.taxPurchaseRmb === null) { return ""; } - // 根据 storageLocation 的值决定返回值 - if (row.storageLocation) { - return row.storageLocation; + // 根据 taxPurchaseRmb 的值决定返回值 + if (row.taxPurchaseRmb) { + return row.taxPurchaseRmb; } else { return value; } diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html index ef72a4e5..cd86f05b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html @@ -4,27 +4,33 @@ +
- -
- -
- +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
+
@@ -366,6 +372,24 @@ title: '申请出货数', field: 'applyShippingNum', editable:true, + formatter: function (value, row) { + // 检查 row 是否存在 + if (!row) { + return ""; + } + + // 检查 storageLocation 是否存在 + if (row.applyShippingNum === undefined || row.applyShippingNum === null) { + return ""; + } + + // 根据 storageLocation 的值决定返回值 + if (row.applyShippingNum) { + return row.applyShippingNum; + } else { + return value; + } + } }, ] }; 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 0855626b..fad1156f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html @@ -116,9 +116,13 @@ 导出销售订单模板 + + 出货 + 开票 +
@@ -408,11 +412,6 @@ // 进度查看 actions.push(' 进度查看 '); } - - // 生产状态部分完成/全部完成 - if (row.makeStatus == "5" || row.makeStatus == "6"){ - actions.push('出货 '); - } if (row.closeStatus == 3){ actions.push('售后 '); } @@ -581,11 +580,6 @@ window.location.href =prefix + "/downloadFile?filepath="+ filepath; } - //出货 - function salesDeliverGoods(salesOrderId){ - var url = prefix + "/salesDeliverGoods/" + salesOrderId; - $.modal.open("出货",url); - } //售后 function startAftersales(salesOrderId){ @@ -593,6 +587,79 @@ $.modal.open("售后",url); } + + + //出货 + function salesDeliverGoods() { + // 获取选中的行 + const selectedRows = $("#bootstrap-table").bootstrapTable('getSelections'); + + // 定义状态码常量 + const AUDIT_STATUS_APPROVED = "1";//审核通过 + const DELETE_FLAG = "2"; //作废 + // const ALL_SHIPPING = "6"; //全部出货 + // const PART_CHECK = "7"; //部分验收 + // const ALL_CHECK = "8";//全部验收 + // const HAS_CLOSE= "3";//已结案 + + var enterpriseCode; //客户id + + let valid = true;//自定义验证状态 + let validSalesOrderIds = []; // 存储有效的销售订单ID + //检查是否有选中行 + if (selectedRows.length < 1){ + showWarning("请先选择一条销售订单"); + return; + } + + //检查选中的订单是否同属于一个客户并且状态是否符合要求 + selectedRows.forEach((row,index) =>{ + if (index === 0){ + enterpriseCode = row.enterpriseCode; + }else if (row.enterpriseCode !== enterpriseCode){ + showWarning("请先选择同一客户下的销售订单"); + valid = false; + return; + } + //检查是否作废 + if (row.useStatus === DELETE_FLAG) { + showWarning("该订单已作废"); + valid = false; + return; + } + //检查是否已审核 + if (row.auditStatus !== AUDIT_STATUS_APPROVED){ + showWarning("存在未审核的订单,请先审核"); + valid = false; + return; + } + + // //检查出货状态 + // if ([ALL_SHIPPING,PART_CHECK,ALL_CHECK,HAS_CLOSE].includes(row.deliveryStatus)){ + // showWarning("存在已出货的订单,请先取消出货"); + // valid = false; + // return; + // } + // //检查结案状态 + // if (row.closeStatus === HAS_CLOSE) { + // showWarning("存在已结案的订单"); + // valid = false; + // return; + // } + // 如果所有条件都满足,将销售订单ID添加到有效列表中 + validSalesOrderIds.push(row.salesOrderId); + }); + + //如果所有验证都通过,可以出货 + if (valid && validSalesOrderIds.length > 0) { + var url = prefix + "/salesDeliverGoods?salesOrderIds=" + validSalesOrderIds.join(","); + $.modal.open("出货", url); + } + + } + + + //开票 function makeInvoice() { // 获取选中的行