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: '订单数量',