diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java index 682e12ee..67fbcd6a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java @@ -309,6 +309,7 @@ public class SysMakeOrderController extends BaseController * @param makeorderDeptDto * @return */ + @RequiresPermissions("system:makeorder:review") @PostMapping("/deptReview") @ResponseBody public AjaxResult deptReview(SysMakeorderDeptDto makeorderDeptDto){ @@ -325,6 +326,7 @@ public class SysMakeOrderController extends BaseController * @param makeorderDeptDto * @return */ + @RequiresPermissions("system:makeorder:confirm") @PostMapping("/deptLeaderConfirm") @ResponseBody public AjaxResult deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto){ @@ -342,6 +344,7 @@ public class SysMakeOrderController extends BaseController * @param sysMakeOrder * @return */ + @RequiresPermissions("system:makeorder:engineer") @PostMapping("/gcReview") @ResponseBody public AjaxResult gcReview(SysMakeOrder sysMakeOrder){ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java index a18d5396..aadbe548 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java @@ -94,6 +94,12 @@ public class SysMakeorderBom extends BaseEntity // 已委外数量 private int hasOutNum; +// 可用库存数 + private BigDecimal storageNum; + +// 已领料数 + private int hasPickNum; + public void setId(Long id) { this.id = id; @@ -281,6 +287,22 @@ public class SysMakeorderBom extends BaseEntity this.hasOutNum = hasOutNum; } + public BigDecimal getStorageNum() { + return storageNum; + } + + public void setStorageNum(BigDecimal storageNum) { + this.storageNum = storageNum; + } + + public int getHasPickNum() { + return hasPickNum; + } + + public void setHasPickNum(int hasPickNum) { + this.hasPickNum = hasPickNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java index 559df62c..72c632f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java @@ -1,11 +1,18 @@ package com.ruoyi.system.service.impl; +import java.math.BigDecimal; import java.util.List; + +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.OutsourceMaterial; +import com.ruoyi.system.domain.SysMakeorderPickDetail; import com.ruoyi.system.mapper.OutsourceMaterialMapper; +import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper; +import com.ruoyi.warehouse.domain.WarehouseInventoryInquiry; +import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper; import org.apache.poi.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -29,6 +36,12 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService @Autowired private OutsourceMaterialMapper outsourceMaterialMapper; + @Autowired + private WarehouseInventoryInquiryMapper inquiryMapper; + + @Autowired + private SysMakeorderPickDetailMapper pickDetailMapper; + /** * 查询生产订单BOM信息 * @@ -52,6 +65,27 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService { List makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomList(sysMakeorderBom); for (SysMakeorderBom bom:makeorderBoms) { +// 获取已领料数 + SysMakeorderPickDetail tempDetail = new SysMakeorderPickDetail(); + tempDetail.setMakeNo(sysMakeorderBom.getMakeNo()); + tempDetail.setMaterialNo(bom.getMaterialNo()); + List pickDetails = pickDetailMapper.selectSysMakeorderPickDetailList(tempDetail); + if(CollectionUtil.isEmpty(pickDetails)){ + bom.setHasPickNum(0); + }else{ + int pickNum = pickDetails.stream() + .mapToInt(detail -> Math.toIntExact(detail.getPickNum() != null ? Math.toIntExact(detail.getPickNum()) : 0)) + .sum(); + bom.setHasPickNum(pickNum); + } +// 获取可用库存数 + WarehouseInventoryInquiry inquiry = inquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(bom.getMaterialNo()); + if(inquiry == null){ + bom.setStorageNum(BigDecimal.ZERO); + }else{ + bom.setStorageNum(inquiry.getAvailableStockNum()); + } +// 处理委外加工类型物料,获取委外工序数 if(bom.getProcessMethod().equals("2")){ List materials = outsourceMaterialMapper.selectProcessNoByNo(bom.getMaterialNo()); if(StringUtils.isEmpty(materials)){ diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html index dc6c6d17..7040af1d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html @@ -34,14 +34,21 @@ -
-
+
+
+ + + + + + +
@@ -294,11 +301,15 @@ title: '损耗率', }, { - field: 'materialNum', + field: 'orderNum', title: '订单用量', formatter: function (value,row,index){ return parentRow.materialNum * row.useNum; } + }, + { + field: 'storageNum', + title: '可用库存数', }, { field: 'hasPickNum', @@ -309,7 +320,8 @@ title: '本次领料数量', formatter: function (value,row,index){ var curIndex = row.sortNo-1; - return ''; + var inputValue = parentRow.materialNum * row.useNum; + return ''; } }, { diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html index 837db243..558c9fe9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html @@ -103,6 +103,9 @@ var cancelFlag = [[${@permission.hasPermi('system:makeorder:cancel')}]]; var detailFlag = [[${@permission.hasPermi('system:makeorder:detail')}]]; var restoreFlag = [[${@permission.hasPermi('system:makeorder:restore')}]]; + var reviewFlag = [[${@permission.hasPermi('system:makeorder:review')}]]; + var confirmFlag = [[${@permission.hasPermi('system:makeorder:confirm')}]]; + var engineerFlag = [[${@permission.hasPermi('system:makeorder:engineer')}]]; var makeStatusDatas = [[${@dict.getType('sys_erp_makeStatus')}]]; var eceiptStatusDatas = [[${@dict.getType('eceiptStatus')}]]; var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]]; @@ -131,6 +134,14 @@ title: '生产订单id', visible: false }, + { + field: 'makeNo', + title: '生产订单号' + }, + { + field: 'materialSum', + title: '数量合计' + }, { field: 'makeStatus', title: '生产状态', @@ -138,6 +149,15 @@ return $.table.selectDictLabel(makeStatusDatas, value); } }, + { + field: 'finishNum', + title: '已完成数量' + }, + { + field: 'eceiptNum', + title: '已入库数量' + }, + { field: 'eceiptStatus', title: '入库状态', @@ -159,10 +179,7 @@ return $.table.selectDictLabel(useStatusDatas, value); } }, - { - field: 'makeNo', - title: '生产订单号' - }, + { field: 'saleNo', title: '关联销售订单号' @@ -194,18 +211,6 @@ field: 'material', title: '物料合计' }, - { - field: 'materialSum', - title: '数量合计' - }, - { - field: 'finishNum', - title: '已完成数量' - }, - { - field: 'eceiptNum', - title: '已入库数量' - }, { field: 'noRate', title: '不含税生产成本(RMB)' @@ -250,15 +255,15 @@ actions.push('详情 '); // 评审 if(row.makeStatus == '0'){ - actions.push('评审 '); + actions.push('评审 '); } // 部门主管确认 if(row.deptLeaderConfirmStatus == '0'){ - actions.push('确认时间 '); + actions.push('确认时间 '); } // 工程审核 if(row.makeStatus == '2'){ - actions.push('工程审核 '); + actions.push('工程审核 '); } // 领料 if((row.makeStatus == '3' || row.makeStatus == '4' || row.makeStatus == '5') &&