From e66705b1a4b764f99c75f03aed7a29aa7e1a8a69 Mon Sep 17 00:00:00 2001 From: xs Date: Wed, 16 Oct 2024 16:01:27 +0800 Subject: [PATCH] =?UTF-8?q?3.2.1=20=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=92=8C?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E7=BB=91=E5=AE=9A=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=EF=BC=8C=E5=90=88=E5=B9=B6=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E4=B8=8D=E8=83=BD=E7=BB=91=E5=AE=9A=EF=BC=8C=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E7=9A=84=E4=B9=9F=E4=B8=8D=E8=83=BD=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/common/core/constant/MesConstants.java | 2 + .../impl/MesPurchaseOrderServiceImpl.java | 65 +++++++++++++++++-- .../mapper/mes/MesPurchaseOrderMapper.xml | 1 + .../mapper/mes/MesSaleOrderMapper.xml | 3 +- hw-ui/src/views/mes/purchaseOrder/index.vue | 8 ++- .../mes/purchaseOrder/selectSaleOrder.vue | 1 + .../views/mes/saleOrder/bindingPurchase.vue | 1 + hw-ui/src/views/mes/saleOrder/index.vue | 1 + .../src/views/wms/base/wmslocation/index.vue | 22 +++---- 9 files changed, 86 insertions(+), 18 deletions(-) diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index 77bd981..d33b32e 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -219,6 +219,8 @@ public class MesConstants { * 采购订单采购状态 */ public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购 + + public static final String MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE = "3";//采购完成 public static final String MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE = "4";//自动出库完成 /** diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java index 63509a1..735061f 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java @@ -16,6 +16,7 @@ import com.hw.common.core.utils.StringUtils; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesOrderBind; +import com.hw.mes.api.domain.MesSaleOrderRelate; import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.mapper.*; import com.hw.wms.api.RemoteWmsService; @@ -46,7 +47,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; @Autowired - private MesSaleOrderMapper mesSaleOrderMapper; + private MesSaleOrderRelateMapper mesSaleOrderRelateMapper; @Autowired private MesOrderBindMapper mesOrderBindMapper; @@ -161,7 +162,27 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { throw new ServiceException("此物料为常备物料,不需要绑定"); } + Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId(); + MesPurchaseOrder dbPurchaseOrder = mesPurchaseOrderMapper.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId); + if (dbPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE)) { + throw new ServiceException("此采购订单已经采购完成,无需再绑定"); + } + + if (dbPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE)) { + throw new ServiceException("此采购订单已经自动出库完成,无需再绑定"); + } + + + //校验此采购订单有没有合并过 + MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate(); + querySaleOrderRelate.setPurchaseOrderId(purchaseOrderId); + List mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate); + if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) { + throw new ServiceException("此采购订单已经合并过,不能绑定"); + } + + MesOrderBind queryOrderBind = new MesOrderBind(); queryOrderBind.setPurchaseOrderId(purchaseOrderId); List dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind); @@ -217,9 +238,18 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { if (StringUtils.isEmpty(orderBind.getSafeFlag())) { throw new ServiceException("请全部选择安全标识"); } - if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO) - && orderBind.getSaleOrderId() == null) { - throw new ServiceException("安全库存标识为否的请选择销售订单"); + if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO)) { + if (orderBind.getSaleOrderId() == null) { + throw new ServiceException("安全库存标识为否的请选择销售订单"); + } + + //校验选择的销售订单有没有合并过 + MesSaleOrderRelate querySaleOrderRelateBySale = new MesSaleOrderRelate(); + querySaleOrderRelateBySale.setRelateSaleOrderId(orderBind.getSaleOrderId()); + List mesSaleOrderRelatesBySale = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateBySale); + if (mesSaleOrderRelatesBySale != null && !mesSaleOrderRelatesBySale.isEmpty()) { + throw new ServiceException("选择的销售订单已经合并过,不能绑定"); + } } if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES) @@ -301,6 +331,15 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { @Override @Transactional(rollbackFor = ServiceException.class) public int saveSalesBindPurchase(MesSaleOrder mesSaleOrder) { + Long saleOrderId = mesSaleOrder.getSaleOrderId(); + MesSaleOrderRelate querySaleOrderRelateBySale = new MesSaleOrderRelate(); + querySaleOrderRelateBySale.setRelateSaleOrderId(saleOrderId); + List mesSaleOrderRelatesBySale = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateBySale); + if (mesSaleOrderRelatesBySale != null && !mesSaleOrderRelatesBySale.isEmpty()) { + throw new ServiceException("此销售订单已经合并过,不能再绑定"); + } + + Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); List mesPurchaseOrderList = mesSaleOrder.getMesPurchaseOrderList(); @@ -312,6 +351,22 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { throw new ServiceException("数据有变化,请重新更新"); } + if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE)) { + throw new ServiceException("此采购订单已经采购完成,无需再绑定"); + } + + if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE)) { + throw new ServiceException("此采购订单已经自动出库完成,无需再绑定"); + } + + + MesSaleOrderRelate querySaleOrderRelateByPurchase = new MesSaleOrderRelate(); + querySaleOrderRelateByPurchase.setPurchaseOrderId(purchaseOrderId); + List mesSaleOrderRelatesByPurchase = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateByPurchase); + if (mesSaleOrderRelatesByPurchase != null && !mesSaleOrderRelatesByPurchase.isEmpty()) { + throw new ServiceException("序号: " + mesPurchaseOrder.getSerialNumber() + ",采购订单已经合并过,不能再绑定"); + } + this.checkSaveSalesBindPurchase(mesPurchaseOrder); this.updateOrderBind(mesSaleOrder, mesPurchaseOrder, userName, currentDate); @@ -477,7 +532,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { } } if (!autoStockPurchaseOrderList.isEmpty()) { - for(MesPurchaseOrder mpo : autoStockPurchaseOrderList){ + for (MesPurchaseOrder mpo : autoStockPurchaseOrderList) { MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(mpo.getMaterialId()); mpo.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE); diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml index b5476fc..96fab18 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml @@ -308,6 +308,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mpo.po_no, mpo.document_status, mpo.material_id, + mpo.order_status, mbmi.material_code, mbmi.material_name, mbmi.material_spec, diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml index b91c68a..5c7cf40 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml @@ -253,7 +253,8 @@ mso.end_date, mso.complete_date, mso.sale_order_classfication - from mes_sale_order mso left join mes_base_material_info mbmi on (mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2') + from mes_sale_order mso left join mes_base_material_info mbmi on + (mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2') and mso.saleorder_code like concat('%', #{saleorderCode}, '%') diff --git a/hw-ui/src/views/mes/purchaseOrder/index.vue b/hw-ui/src/views/mes/purchaseOrder/index.vue index c7f45da..7a04f75 100644 --- a/hw-ui/src/views/mes/purchaseOrder/index.vue +++ b/hw-ui/src/views/mes/purchaseOrder/index.vue @@ -88,6 +88,7 @@ + @@ -145,7 +146,7 @@ icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['mes:purchaseOrder:bind']" - v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO" + v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO && (scope.row.orderStatus === ORDER_STATUS.TO_PURCHASE || scope.row.orderStatus === ORDER_STATUS.PURCHASEING)" >绑定 @@ -294,7 +295,12 @@ export default { ALWAYS_FLAG: { YES: "1", NO: "0" + }, + ORDER_STATUS: { + TO_PURCHASE: "1",//代采购 + PURCHASEING: "2"//采购中 } + }; }, created() { diff --git a/hw-ui/src/views/mes/purchaseOrder/selectSaleOrder.vue b/hw-ui/src/views/mes/purchaseOrder/selectSaleOrder.vue index c37d03b..32e2301 100644 --- a/hw-ui/src/views/mes/purchaseOrder/selectSaleOrder.vue +++ b/hw-ui/src/views/mes/purchaseOrder/selectSaleOrder.vue @@ -103,6 +103,7 @@ export default { documentStatus: null, factoryId: null, prodlineId: null, + saleOrderClassfication:'1', materialId: null, materialCode: null, materialName: null, diff --git a/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue b/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue index 3df2354..bb5dc99 100644 --- a/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue +++ b/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue @@ -192,6 +192,7 @@ :row-style="getRowStyle"> + diff --git a/hw-ui/src/views/mes/saleOrder/index.vue b/hw-ui/src/views/mes/saleOrder/index.vue index be6436a..2ccbda2 100644 --- a/hw-ui/src/views/mes/saleOrder/index.vue +++ b/hw-ui/src/views/mes/saleOrder/index.vue @@ -191,6 +191,7 @@ icon="el-icon-edit" @click="handleBindingPurchase(scope.row)" v-hasPermi="['mes:saleOrder:bind']" + v-if="scope.row.saleOrderClassfication==='1'" >绑定 diff --git a/hw-ui/src/views/wms/base/wmslocation/index.vue b/hw-ui/src/views/wms/base/wmslocation/index.vue index dc4a231..9f9378a 100644 --- a/hw-ui/src/views/wms/base/wmslocation/index.vue +++ b/hw-ui/src/views/wms/base/wmslocation/index.vue @@ -43,10 +43,10 @@ /> - + - + @@ -388,22 +388,22 @@ - - - - - - + - + + + + + +