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() { // 获取选中的行