From 29765c15ef5c2341aeae0750d806c5f28bff25b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Tue, 15 Oct 2024 14:08:57 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F=EF=BC=8C=E8=A1=A5=E5=85=A8=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E8=AE=A2=E5=8D=95=E7=94=A8=E9=87=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E3=80=81=E6=9C=AC=E6=AC=A1=E9=A2=86=E6=96=99=E6=95=B0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A1=AB=E5=85=85=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E5=BA=93=E5=AD=98=E6=95=B0=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=81=E7=A1=AE=E8=AE=A4=E6=97=B6=E9=97=B4=E3=80=81=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E8=AF=84=E5=AE=A1=E6=9D=83=E9=99=90=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7=E8=AE=A2?= =?UTF-8?q?=E5=8D=95bom=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8F=AF=E7=94=A8=E5=BA=93=E5=AD=98=E6=95=B0=E3=80=81?= =?UTF-8?q?=E5=B7=B2=E9=A2=86=E6=96=99=E6=95=B0=E5=AD=97=E6=AE=B5=EF=BC=9B?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95bom?= =?UTF-8?q?=E8=8E=B7=E5=8F=96service=E6=96=B9=E6=B3=95=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=8E=B7=E5=8F=96=E5=B7=B2=E9=A2=86=E6=96=99=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E5=8F=AF=E7=94=A8=E5=BA=93=E5=AD=98=E6=95=B0=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E6=97=B6=E9=97=B4=E3=80=81?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=AF=84=E5=AE=A1controller=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysMakeOrderController.java | 3 ++ .../ruoyi/system/domain/SysMakeorderBom.java | 22 ++++++++++ .../impl/SysMakeorderBomServiceImpl.java | 34 +++++++++++++++ .../templates/system/makeorder/addpick.html | 20 +++++++-- .../templates/system/makeorder/makeorder.html | 43 +++++++++++-------- 5 files changed, 99 insertions(+), 23 deletions(-) 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') &&