Browse Source

[fix]

修改准备物料和详情前端页面多余的字段,加上物料型号字段,物料类型和加方式引用字典;准备出库数加上校验:准备出库数不能为空、请输入有效的数字、准备出库数必须大于0、准备出库数不能为小数;没有值默认为empty
修改保存准备物料后端接口;加上过滤掉准备出库数为0的数据,相当于本次不出库;加上校验 准备出库数必须等于申请出库数
dev
liuxiaoxu 3 weeks ago
parent
commit
993c9498f7
  1. 10
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  2. 76
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html
  3. 37
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html

10
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)){ if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder); log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder);
} }
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) { //过滤掉准备出库数为0的数据,相当于本次不出库
List<WarehouseOutOrderDetail> filterOutOrderDetailList = warehouseOutOrderDetailList.stream().filter(item -> item.getPrepareOutOrderSum() != 0).collect(Collectors.toList());
for (WarehouseOutOrderDetail warehouseOutOrderDetail : filterOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName); warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date()); warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark()); 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); int updateOutOrderDetail = outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
if (updateOutOrderDetail <= 0){ if (updateOutOrderDetail <= 0){

76
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html

@ -22,24 +22,24 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">销售订单号:</label> <!-- <label class="col-sm-3 control-label">销售订单号:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly> <!-- <input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label> <label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" readonly> <input name="applyName" th:field="*{applyName}" class="form-control" type="text" readonly>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">生产单号:</label> <!-- <label class="col-sm-3 control-label">生产单号:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" readonly> <!-- <input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" readonly>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label> <label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -94,6 +94,9 @@
var warehouseOutOrder = [[${warehouseOutOrder}]]; var warehouseOutOrder = [[${warehouseOutOrder}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "warehouse/warehouseOutOrder"; var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-prepareMaterial-edit").validate({ $("#form-prepareMaterial-edit").validate({
@ -121,11 +124,10 @@
"materialType": item.materialType, "materialType": item.materialType,
"materialPhotourl": item.materialPhotourl, "materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe, "materialDescribe": item.materialDescribe,
"materialModel": item.materialModel,
"materialBrand": item.materialBrand, "materialBrand": item.materialBrand,
"materialUnit": item.materialUnit, "materialUnit": item.materialUnit,
"materialProcessMethod": item.materialProcessMethod, "materialProcessMethod": item.materialProcessMethod,
"makeNum": item.makeNum,
"hasOutOrderSum": item.hasOutOrderSum,
"applyOutOrderSum": item.applyOutOrderSum, "applyOutOrderSum": item.applyOutOrderSum,
"prepareOutOrderSum": item.prepareOutOrderSum, "prepareOutOrderSum": item.prepareOutOrderSum,
// ...其他字段 // ...其他字段
@ -183,11 +185,18 @@
{ {
title: '物料类型', title: '物料类型',
field: 'materialType', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
}, },
{ {
title: '描述', title: '描述',
field: 'materialDescribe', field: 'materialDescribe',
}, },
{
title: '型号',
field: 'materialModel',
},
{ {
title: '品牌', title: '品牌',
field: 'materialBrand', field: 'materialBrand',
@ -199,6 +208,9 @@
{ {
title: '加工方式', title: '加工方式',
field: 'materialProcessMethod', field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
}, },
{ {
title: '订单数量', title: '订单数量',
@ -215,7 +227,41 @@
{ {
title: '准备出库数', title: '准备出库数',
field: 'prepareOutOrderSum', 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;
}
}
}, },
] ]
}; };

37
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterialDetail.html

@ -22,24 +22,24 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">销售订单号:</label> <!-- <label class="col-sm-3 control-label">销售订单号:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" disabled> <!-- <input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" disabled>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label> <label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled> <input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">生产单号:</label> <!-- <label class="col-sm-3 control-label">生产单号:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" disabled> <!-- <input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" disabled>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label> <label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -94,6 +94,9 @@
var warehouseOutOrder = [[${warehouseOutOrder}]]; var warehouseOutOrder = [[${warehouseOutOrder}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "warehouse/warehouseOutOrder"; var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-prepareMaterialDetail-edit").validate({ $("#form-prepareMaterialDetail-edit").validate({
@ -173,11 +176,18 @@
{ {
title: '物料类型', title: '物料类型',
field: 'materialType', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
}, },
{ {
title: '描述', title: '描述',
field: 'materialDescribe', field: 'materialDescribe',
}, },
{
title: '型号',
field: 'materialModel',
},
{ {
title: '品牌', title: '品牌',
field: 'materialBrand', field: 'materialBrand',
@ -189,6 +199,9 @@
{ {
title: '加工方式', title: '加工方式',
field: 'materialProcessMethod', field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
}, },
{ {
title: '订单数量', title: '订单数量',

Loading…
Cancel
Save