From 993c9498f702dcb73df0d1722a57b17334b5811b Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 6 Nov 2024 10:19:06 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E6=94=B9=E5=87=86=E5=A4=87?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=92=8C=E8=AF=A6=E6=83=85=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A4=9A=E4=BD=99=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=B8=8A=E7=89=A9=E6=96=99=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E7=89=A9=E6=96=99=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=92=8C=E5=8A=A0=E6=96=B9=E5=BC=8F=E5=BC=95=E7=94=A8=E5=AD=97?= =?UTF-8?q?=E5=85=B8=EF=BC=9B=E5=87=86=E5=A4=87=E5=87=BA=E5=BA=93=E6=95=B0?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=A0=A1=E9=AA=8C=EF=BC=9A=E5=87=86=E5=A4=87?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=95=B0=E4=B8=8D=E8=83=BD=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E3=80=81=E8=AF=B7=E8=BE=93=E5=85=A5=E6=9C=89=E6=95=88=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E3=80=81=E5=87=86=E5=A4=87=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E6=95=B0=E5=BF=85=E9=A1=BB=E5=A4=A7=E4=BA=8E0=E3=80=81?= =?UTF-8?q?=E5=87=86=E5=A4=87=E5=87=BA=E5=BA=93=E6=95=B0=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E5=B0=8F=E6=95=B0=EF=BC=9B=E6=B2=A1=E6=9C=89=E5=80=BC?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BAempty=20=E4=BF=AE=E6=94=B9=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=87=86=E5=A4=87=E7=89=A9=E6=96=99=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9B=E5=8A=A0=E4=B8=8A=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=8E=89=E5=87=86=E5=A4=87=E5=87=BA=E5=BA=93=E6=95=B0=E4=B8=BA?= =?UTF-8?q?0=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=8C=E7=9B=B8=E5=BD=93?= =?UTF-8?q?=E4=BA=8E=E6=9C=AC=E6=AC=A1=E4=B8=8D=E5=87=BA=E5=BA=93=EF=BC=9B?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=A0=A1=E9=AA=8C=20=E5=87=86=E5=A4=87?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=95=B0=E5=BF=85=E9=A1=BB=E7=AD=89=E4=BA=8E?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=87=BA=E5=BA=93=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WarehouseOutOrderServiceImpl.java | 10 ++- .../warehouseOutOrder/prepareMaterial.html | 76 +++++++++++++++---- .../prepareMaterialDetail.html | 37 ++++++--- 3 files changed, 95 insertions(+), 28 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java index 0083cfae..3480711b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java @@ -214,10 +214,18 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService if (StringUtils.isEmpty(warehouseOutOrderDetailList)){ log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder); } - for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) { + //过滤掉准备出库数为0的数据,相当于本次不出库 + List filterOutOrderDetailList = warehouseOutOrderDetailList.stream().filter(item -> item.getPrepareOutOrderSum() != 0).collect(Collectors.toList()); + for (WarehouseOutOrderDetail warehouseOutOrderDetail : filterOutOrderDetailList) { warehouseOutOrderDetail.setUpdateBy(loginName); warehouseOutOrderDetail.setUpdateTime(new Date()); warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark()); + Integer prepareOutOrderSum = warehouseOutOrderDetail.getPrepareOutOrderSum(); + Integer applyOutOrderSum = warehouseOutOrderDetail.getApplyOutOrderSum(); + //准备出库数 必须等于 申请出库数 + if (!Objects.equals(prepareOutOrderSum, applyOutOrderSum)){ + throw new BusinessException("准备出库数必须等于申请出库数"); + } //更新数据库记录 int updateOutOrderDetail = outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail); if (updateOutOrderDetail <= 0){ diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html index e4d267b2..048aca10 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html @@ -22,24 +22,24 @@ -
- -
- -
-
+ + + + + +
-
- -
- -
-
+ + + + + +
@@ -94,6 +94,9 @@ var warehouseOutOrder = [[${warehouseOutOrder}]]; + var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; + var processMethodDatas = [[${@dict.getType('processMethod')}]]; + var prefix = ctx + "warehouse/warehouseOutOrder"; $("#form-prepareMaterial-edit").validate({ @@ -121,11 +124,10 @@ "materialType": item.materialType, "materialPhotourl": item.materialPhotourl, "materialDescribe": item.materialDescribe, + "materialModel": item.materialModel, "materialBrand": item.materialBrand, "materialUnit": item.materialUnit, "materialProcessMethod": item.materialProcessMethod, - "makeNum": item.makeNum, - "hasOutOrderSum": item.hasOutOrderSum, "applyOutOrderSum": item.applyOutOrderSum, "prepareOutOrderSum": item.prepareOutOrderSum, // ...其他字段 @@ -183,11 +185,18 @@ { title: '物料类型', field: 'materialType', + formatter: function(value, row, index) { + return $.table.selectCategoryLabel(materialTypeDatas, value); + } }, { title: '描述', field: 'materialDescribe', }, + { + title: '型号', + field: 'materialModel', + }, { title: '品牌', field: 'materialBrand', @@ -199,6 +208,9 @@ { title: '加工方式', field: 'materialProcessMethod', + formatter: function(value, row, index) { + return $.table.selectDictLabel(processMethodDatas, value); + } }, { title: '订单数量', @@ -215,7 +227,41 @@ { title: '准备出库数', field: 'prepareOutOrderSum', - editable:true, + editable: { + validate: function(value) { + if ($.trim(value) === '') { + return '准备出库数不能为空'; + } + if (isNaN(value)) { + return '请输入有效的数字'; + } + if (value <= 0) { + return '准备出库数必须大于0'; + } + //不能为小数 + if (value % 1 !== 0) { + return '准备出库数不能为小数'; + } + }, + }, + formatter: function (value, row) { + // 检查 row 是否存在 + if (!row) { + return ""; + } + + // 检查 prepareOutOrderSum 是否存在 + if (row.prepareOutOrderSum === undefined || row.prepareOutOrderSum === null) { + return ""; + } + + // 根据 prepareOutOrderSum 的值决定返回值 + if (row.prepareOutOrderSum) { + return row.prepareOutOrderSum; + } else { + return value; + } + } }, ] }; diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html index 320119c6..0cf63bd8 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html @@ -22,24 +22,24 @@
-
- -
- -
-
+ + + + + +
-
- -
- -
-
+ + + + + +
@@ -94,6 +94,9 @@ var warehouseOutOrder = [[${warehouseOutOrder}]]; + var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; + var processMethodDatas = [[${@dict.getType('processMethod')}]]; + var prefix = ctx + "warehouse/warehouseOutOrder"; $("#form-prepareMaterialDetail-edit").validate({ @@ -173,11 +176,18 @@ { title: '物料类型', field: 'materialType', + formatter: function(value, row, index) { + return $.table.selectCategoryLabel(materialTypeDatas, value); + } }, { title: '描述', field: 'materialDescribe', }, + { + title: '型号', + field: 'materialModel', + }, { title: '品牌', field: 'materialBrand', @@ -189,6 +199,9 @@ { title: '加工方式', field: 'materialProcessMethod', + formatter: function(value, row, index) { + return $.table.selectDictLabel(processMethodDatas, value); + } }, { title: '订单数量',