From 25cb4da81defa1592dbb902d35a0f502db24ba67 Mon Sep 17 00:00:00 2001 From: xins Date: Thu, 23 May 2024 16:54:32 +0800 Subject: [PATCH] =?UTF-8?q?2.3.4=20MES:=20=E5=9B=9B=E6=A5=BC=E6=BF=80?= =?UTF-8?q?=E5=85=89=E5=88=87=E5=89=B2=E5=B7=A5=E4=BD=8D=E6=9D=BF=E6=9D=90?= =?UTF-8?q?=E9=A2=86=E6=96=99=E5=92=8C=E6=9D=BF=E6=9D=90=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hw/common/log/enums/BusinessType.java | 5 + .../java/com/hw/wms/config/WmsConfig.java | 13 + .../hw/wms/controller/WmsApiController.java | 11 + .../java/com/hw/wms/domain/WmsRawStock.java | 246 ++++++++++-------- .../wms/service/IWmsRawOutstockService.java | 8 + .../impl/WmsRawOutstockServiceImpl.java | 116 ++++++++- .../mapper/wms/WmsRawStockMapper.xml | 6 + hw-ui/src/api/board/index.js | 11 + .../views/board/fourthFloor/laserLight.vue | 103 +++++--- 9 files changed, 370 insertions(+), 149 deletions(-) diff --git a/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java b/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java index 5b264b6..571c1a2 100644 --- a/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java +++ b/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java @@ -124,4 +124,9 @@ public enum BusinessType */ BIND, + /** + * 校验 + */ + CHECK, + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java index 8e3e4d5..c24fe43 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java @@ -34,6 +34,11 @@ public class WmsConfig */ private Long fourthFloorProductWarehouseId; + /** + * 四楼板材库ID + */ + private Long fourthFloorPalteWarehouseId; + public String getFifthAssembleStationCode() { return fifthAssembleStationCode; @@ -66,4 +71,12 @@ public class WmsConfig public void setFourthFloorProductWarehouseId(Long fourthFloorProductWarehouseId) { this.fourthFloorProductWarehouseId = fourthFloorProductWarehouseId; } + + public Long getFourthFloorPalteWarehouseId() { + return fourthFloorPalteWarehouseId; + } + + public void setFourthFloorPalteWarehouseId(Long fourthFloorPalteWarehouseId) { + this.fourthFloorPalteWarehouseId = fourthFloorPalteWarehouseId; + } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index 7211397..c4ad903 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -1,5 +1,6 @@ package com.hw.wms.controller; +import com.alibaba.fastjson2.JSONObject; import com.hw.common.core.constant.WmsConstants; import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.domain.AjaxResult; @@ -12,6 +13,7 @@ import com.hw.wms.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import reactor.core.publisher.Flux; import java.util.List; @@ -101,6 +103,15 @@ public class WmsApiController extends BaseController { return toAjax(wmsRawInstockService.insertWmsRawInstock(wmsRawInstockVo)); } + /** + * 原材料直接出库前校验(适合于四楼激光切割工位的板材出库) + */ + @Log(title = "原材料出库记录", businessType = BusinessType.CHECK) + @PostMapping(("/checkSuitableSaleOrderMaterial")) + public AjaxResult checkSuitableSaleOrderMaterial(@RequestBody WmsRawOutstock wmsRawOutstock) { + JSONObject returnJson = wmsRawOutstockService.checkSuitableSaleOrderMaterial(wmsRawOutstock); + return AjaxResult.success(returnJson); + } /** * 原材料直接出库(适合于四楼激光切割工位的板材出库) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawStock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawStock.java index c16df8b..0e2a6c1 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawStock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawStock.java @@ -2,7 +2,9 @@ package com.hw.wms.domain; import java.math.BigDecimal; import java.util.Date; + import com.fasterxml.jackson.annotation.JsonFormat; +import com.hw.common.core.constant.MesConstants; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.hw.common.core.annotation.Excel; @@ -14,101 +16,144 @@ import com.hw.common.core.web.domain.BaseEntity; * @author xs * @date 2023-12-21 */ -public class WmsRawStock extends BaseEntity -{ +public class WmsRawStock extends BaseEntity { private static final long serialVersionUID = 1L; - /** 原材料库存ID */ + /** + * 原材料库存ID + */ private Long rawStockId; - /** 仓库ID */ + /** + * 仓库ID + */ @Excel(name = "仓库ID") private Long warehouseId; - /** 仓库名称 */ + /** + * 仓库名称 + */ @Excel(name = "仓库名称") private String warehouseName; - /** 仓库楼层 */ + /** + * 仓库楼层 + */ @Excel(name = "仓库楼层") private Long warehouseFloor; - /** 库位编码 */ + /** + * 库位编码 + */ @Excel(name = "库位编码") private String locationCode; - /** 库存类型:1原材料 2半成品 */ + /** + * 库存类型:1原材料 2半成品 + */ @Excel(name = "库存类型") private String stockType; - /** 物料ID */ + /** + * 物料ID + */ @Excel(name = "物料ID") private Long materialId; - /** 物料编号 */ + /** + * 物料编号 + */ @Excel(name = "物料编号") private String materialCode; - /** 物料名称 */ + /** + * 物料名称 + */ @Excel(name = "物料名称") private String materialName; - /** 入库批次号 */ + /** + * 入库批次号 + */ @Excel(name = "入库批次号") private String instockBatch; - /**托盘码*/ + /** + * 托盘码 + */ private String palletInfoCode; private Long saleOrderId; private String safeFlag; - /** 入库时间 */ + /** + * 入库时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date instockDate; - /** 最晚出库时间;入库时,根据物料信“存放周期“计算出来的时间 */ + /** + * 最晚出库时间;入库时,根据物料信“存放周期“计算出来的时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "最晚出库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date lastOutstockTime; - /** 质检状态(1检验中,2质检通过,3质检不通过) */ + /** + * 质检状态(1检验中,2质检通过,3质检不通过) + */ @Excel(name = "质检状态") private String qualityStatus; - /** 完整标识 */ + /** + * 完整标识 + */ @Excel(name = "完整标识") private String completeFlag; - /** 总数量 */ + /** + * 总数量 + */ @Excel(name = "总数量") private BigDecimal totalAmount; - /** 冻结数量 */ + /** + * 冻结数量 + */ @Excel(name = "冻结数量") private BigDecimal frozenAmount; - /** 占用数量 */ + /** + * 占用数量 + */ @Excel(name = "占用数量") private BigDecimal occupyAmount; - /** 供应商ID */ + /** + * 供应商ID + */ @Excel(name = "供应商ID") private Long supplierId; - /** 创建时间 */ + /** + * 创建时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date createDate; - /** 最后更新时间 */ + /** + * 最后更新时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date updateDate; - /** 有效标记 */ + /** + * 有效标记 + */ @Excel(name = "有效标记") private String activeFlag; @@ -136,22 +181,19 @@ public class WmsRawStock extends BaseEntity this.materialName = materialName; } - public void setRawStockId(Long rawStockId) - { + public void setRawStockId(Long rawStockId) { this.rawStockId = rawStockId; } - public Long getRawStockId() - { + public Long getRawStockId() { return rawStockId; } - public void setWarehouseId(Long warehouseId) - { + + public void setWarehouseId(Long warehouseId) { this.warehouseId = warehouseId; } - public Long getWarehouseId() - { + public Long getWarehouseId() { return warehouseId; } @@ -163,40 +205,35 @@ public class WmsRawStock extends BaseEntity this.warehouseFloor = warehouseFloor; } - public void setLocationCode(String locationCode) - { + public void setLocationCode(String locationCode) { this.locationCode = locationCode; } - public String getLocationCode() - { + public String getLocationCode() { return locationCode; } - public void setStockType(String stockType) - { + + public void setStockType(String stockType) { this.stockType = stockType; } - public String getStockType() - { + public String getStockType() { return stockType; } - public void setMaterialId(Long materialId) - { + + public void setMaterialId(Long materialId) { this.materialId = materialId; } - public Long getMaterialId() - { + public Long getMaterialId() { return materialId; } - public void setInstockBatch(String instockBatch) - { + + public void setInstockBatch(String instockBatch) { this.instockBatch = instockBatch; } - public String getInstockBatch() - { + public String getInstockBatch() { return instockBatch; } @@ -224,31 +261,27 @@ public class WmsRawStock extends BaseEntity this.safeFlag = safeFlag; } - public void setInstockDate(Date instockDate) - { + public void setInstockDate(Date instockDate) { this.instockDate = instockDate; } - public Date getInstockDate() - { + public Date getInstockDate() { return instockDate; } - public void setLastOutstockTime(Date lastOutstockTime) - { + + public void setLastOutstockTime(Date lastOutstockTime) { this.lastOutstockTime = lastOutstockTime; } - public Date getLastOutstockTime() - { + public Date getLastOutstockTime() { return lastOutstockTime; } - public void setQualityStatus(String qualityStatus) - { + + public void setQualityStatus(String qualityStatus) { this.qualityStatus = qualityStatus; } - public String getQualityStatus() - { + public String getQualityStatus() { return qualityStatus; } @@ -260,91 +293,88 @@ public class WmsRawStock extends BaseEntity this.completeFlag = completeFlag; } - public void setTotalAmount(BigDecimal totalAmount) - { + public void setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; } - public BigDecimal getTotalAmount() - { + public BigDecimal getTotalAmount() { return totalAmount; } - public void setFrozenAmount(BigDecimal frozenAmount) - { + + public void setFrozenAmount(BigDecimal frozenAmount) { this.frozenAmount = frozenAmount; } - public BigDecimal getFrozenAmount() - { + public BigDecimal getFrozenAmount() { return frozenAmount; } - public void setOccupyAmount(BigDecimal occupyAmount) - { + + public void setOccupyAmount(BigDecimal occupyAmount) { this.occupyAmount = occupyAmount; } - public BigDecimal getOccupyAmount() - { + public BigDecimal getOccupyAmount() { return occupyAmount; } - public void setSupplierId(Long supplierId) - { + + public void setSupplierId(Long supplierId) { this.supplierId = supplierId; } - public Long getSupplierId() - { + public Long getSupplierId() { return supplierId; } - public void setCreateDate(Date createDate) - { + + public void setCreateDate(Date createDate) { this.createDate = createDate; } - public Date getCreateDate() - { + public Date getCreateDate() { return createDate; } - public void setUpdateDate(Date updateDate) - { + + public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } - public Date getUpdateDate() - { + public Date getUpdateDate() { return updateDate; } - public void setActiveFlag(String activeFlag) - { + + public void setActiveFlag(String activeFlag) { this.activeFlag = activeFlag; } - public String getActiveFlag() - { + public String getActiveFlag() { return activeFlag; } + public String getLocationAndMaterial() { + return "库位:" + locationCode + ",物料条码:" + instockBatch + + ",安全库存:"+(safeFlag.equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)?"是":"否")+";"; + } + @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("rawStockId", getRawStockId()) - .append("warehouseId", getWarehouseId()) - .append("locationCode", getLocationCode()) - .append("stockType", getStockType()) - .append("materialId", getMaterialId()) - .append("instockBatch", getInstockBatch()) - .append("instockDate", getInstockDate()) - .append("lastOutstockTime", getLastOutstockTime()) - .append("qualityStatus", getQualityStatus()) - .append("totalAmount", getTotalAmount()) - .append("frozenAmount", getFrozenAmount()) - .append("occupyAmount", getOccupyAmount()) - .append("supplierId", getSupplierId()) - .append("createBy", getCreateBy()) - .append("createDate", getCreateDate()) - .append("updateBy", getUpdateBy()) - .append("updateDate", getUpdateDate()) - .append("activeFlag", getActiveFlag()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("rawStockId", getRawStockId()) + .append("warehouseId", getWarehouseId()) + .append("locationCode", getLocationCode()) + .append("stockType", getStockType()) + .append("materialId", getMaterialId()) + .append("instockBatch", getInstockBatch()) + .append("instockDate", getInstockDate()) + .append("lastOutstockTime", getLastOutstockTime()) + .append("qualityStatus", getQualityStatus()) + .append("totalAmount", getTotalAmount()) + .append("frozenAmount", getFrozenAmount()) + .append("occupyAmount", getOccupyAmount()) + .append("supplierId", getSupplierId()) + .append("createBy", getCreateBy()) + .append("createDate", getCreateDate()) + .append("updateBy", getUpdateBy()) + .append("updateDate", getUpdateDate()) + .append("activeFlag", getActiveFlag()) + .toString(); } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawOutstockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawOutstockService.java index 107d6da..cb7a79b 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawOutstockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawOutstockService.java @@ -126,6 +126,14 @@ public interface IWmsRawOutstockService */ public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo); + /** + * 在板材出库时先校验是否能出库 + * @param wmsRawOutstock + * @return + */ + public JSONObject checkSuitableSaleOrderMaterial(WmsRawOutstock wmsRawOutstock); + + /** * 直接出库(适合四楼激光切割工位板材出库) * @param wmsRawOutstock diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java index d393ced..653a01c 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java @@ -558,7 +558,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { * @return */ private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse, - String planCode, String planDetailCode, Long materialId, String taskCode, String taskType,String applyReason, + String planCode, String planDetailCode, Long materialId, String taskCode, String taskType, String applyReason, BigDecimal planAmount, Date currentDate, String userName) { //出库要求 (0申请出库,1申请审核出库,2直接出库) String outRequirement = baseWarehouse.getOutRequirement(); @@ -966,15 +966,18 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { /** - * 直接出库(适合四楼激光切割工位板材出库) + * 在板材出库时先校验是否能出库 * * @param wmsRawOutstock * @return */ - @Transactional @Override - public int directRawOutstock(WmsRawOutstock wmsRawOutstock) { - //出库要求 (0申请出库,1申请审核出库,2直接出库) + public JSONObject checkSuitableSaleOrderMaterial(WmsRawOutstock wmsRawOutstock) { + String directOutstockCode = "1"; + String confirmOutstockCode = "2"; + String cannotOutstockCode = "3"; + + JSONObject returnJson = new JSONObject(); String materialBarcode = wmsRawOutstock.getMaterialBarcode(); R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); if (baseBarcodeInfoR == null) { @@ -985,11 +988,107 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { throw new ServiceException("物料编码有误"); } + //验证销售订单绑定关系,或者是否安全库存 + Long saleOrderId = wmsRawOutstock.getSaleOrderId(); + if (saleOrderId != null) { + //如果出库的物料是安全库存,则判断是否有绑定的销售订单信息 + if ((baseBarcodeInfo.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES))) { + String returnMsg = getSuitableSaleOrderMaterials(saleOrderId); + if (StringUtils.isEmpty(returnMsg)) {//如果没有,可以直接出库 + returnJson.put("code", directOutstockCode); + } else {//如果有,可以二次提示是否需要出库 + returnJson.put("code", confirmOutstockCode); + returnJson.put("msg", returnMsg); + } + return returnJson; + } else {//如果非安全库存,需要判断销售订单ID是否相同 + if (baseBarcodeInfo.getSaleOrderId() == null || !saleOrderId.equals(baseBarcodeInfo.getSaleOrderId())) { + String returnMsg = getSuitableSaleOrderMaterials(saleOrderId); + if (StringUtils.isEmpty(returnMsg)) {//如果没有 + returnMsg = getSuitableSafeMaterials(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES); + } + + if (StringUtils.isEmpty(returnMsg)) { + throw new ServiceException("请出库对应销售订单的板材【已经没有此销售订单的库存和安全库存】"); + } else {//如果有,不能出库 + returnJson.put("code", cannotOutstockCode); + returnJson.put("msg", returnMsg); + } + return returnJson; + } else { + returnJson.put("code", directOutstockCode); + return returnJson; + } + } + } else {//如果没有销售订单,则需要出安全库存 + if (!baseBarcodeInfo.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)) { + String returnMsg = getSuitableSafeMaterials(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES); + if (StringUtils.isEmpty(returnMsg)) { + throw new ServiceException("请出库安全库存的板材【已经没有安全库存】"); + } else { + returnJson.put("code", cannotOutstockCode); + returnJson.put("msg", returnMsg); + } + return returnJson; + } + } + + return returnJson; + } + + public String getSuitableSaleOrderMaterials(Long saleOrderId) { + WmsRawStock queryRawStock = new WmsRawStock(); + queryRawStock.setSaleOrderId(saleOrderId); + queryRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); + List wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(queryRawStock); + List availableRawStocks = wmsRawStocks.stream().filter(wmsRawStock -> + (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) + .subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + if (availableRawStocks != null && !availableRawStocks.isEmpty()) { + List returnMsg = availableRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); + return returnMsg.toString(); + } + return ""; + } + + + public String getSuitableSafeMaterials(String safeFlag) { + WmsRawStock querySafeRawStock = new WmsRawStock(); + querySafeRawStock.setSafeFlag(safeFlag); + querySafeRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); + List safeRawStocks = wmsRawStockMapper.selectWmsRawStockList(querySafeRawStock); + List availableSafeRawStocks = safeRawStocks.stream().filter(wmsRawStock -> + (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) + .subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + if (availableSafeRawStocks != null && !availableSafeRawStocks.isEmpty()) { + List returnMsg = availableSafeRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); + return returnMsg.toString(); + } + + return ""; + } + + /** + * 直接出库(适合四楼激光切割工位板材出库) + * + * @param wmsRawOutstock + * @return + */ + @Transactional + @Override + public int directRawOutstock(WmsRawOutstock wmsRawOutstock) { + //出库要求 (0申请出库,1申请审核出库,2直接出库) + String materialBarcode = wmsRawOutstock.getMaterialBarcode(); String locationCode = wmsRawOutstock.getLocationCode(); WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); if (baseLocation == null) { throw new ServiceException("库位编码错误"); } + R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } + MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); BigDecimal outstockAmount = wmsRawOutstock.getOutstockAmount(); String batchCode = baseBarcodeInfo.getBatchCode(); @@ -1012,16 +1111,15 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { this.insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode, userName, currentDate); - directOutstockUpdateRawStock(locationCode, batchCode, outstockAmount, userName, currentDate); + directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate); return 1; } - public void directOutstockUpdateRawStock(String locationCode, String batchCode, BigDecimal outstockAmount, + public void directOutstockUpdateRawStock(String locationCode, String materialBarcode, BigDecimal outstockAmount, String userName, Date currentDate) { - //TODO:批次码 - WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode); + WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode); if (wmsRawStock == null) { throw new ServiceException("没找到库存信息"); } else { diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml index f995870..9d188ee 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml @@ -13,6 +13,8 @@ + + @@ -43,6 +45,8 @@ mbmi.material_name, wrs.instock_batch, wrs.pallet_info_code, + wrs.sale_order_id, + wrs.safe_flag, wrs.instock_date, wrs.last_outstock_time, wrs.quality_status, @@ -68,6 +72,8 @@ and wrs.location_code = #{locationCode} and wrs.stock_type = #{stockType} and wrs.material_id = #{materialId} + and wrs.sale_order_id = #{saleOrderId} + and wrs.safe_flag = #{safeFlag} and wrs.instock_batch = #{instockBatch} and wrs.instock_date = #{instockDate} and wrs.last_outstock_time = #{lastOutstockTime} diff --git a/hw-ui/src/api/board/index.js b/hw-ui/src/api/board/index.js index 8755f95..e77b990 100644 --- a/hw-ui/src/api/board/index.js +++ b/hw-ui/src/api/board/index.js @@ -183,6 +183,17 @@ export function addRawInstock(data) { }) } + +//激光切割工位板材出库 +export function checkSuitableSaleOrderMaterial(data) { + return request({ + url: '/wms/api/checkSuitableSaleOrderMaterial', + method: 'post', + data: data + }) +} + + //激光切割工位板材出库 export function directRawOutstock(data) { return request({ diff --git a/hw-ui/src/views/board/fourthFloor/laserLight.vue b/hw-ui/src/views/board/fourthFloor/laserLight.vue index 7af9db6..d12d55c 100644 --- a/hw-ui/src/views/board/fourthFloor/laserLight.vue +++ b/hw-ui/src/views/board/fourthFloor/laserLight.vue @@ -194,10 +194,10 @@ - + - + @@ -219,6 +219,7 @@ import { startNextProductPlanDetailAttach, getPlanDrawings, addRawInstock, + checkSuitableSaleOrderMaterial, directRawOutstock, } from "@/api/board"; @@ -251,19 +252,26 @@ export default { title: '', open: false, stockType: '', - wmsForm:{ + wmsForm: { locationCode: null, - materialBarcode : null, + materialBarcode: null, },//板材领料入库使用 // 表单校验 wmsRules: { locationCode: [ - { required: true, message: "库位编码不能为空", trigger: "blur" } + {required: true, message: "库位编码不能为空", trigger: "blur"} ], materialBarcode: [ - { required: true, message: "物料条码不能为空", trigger: "blur" } + {required: true, message: "物料条码不能为空", trigger: "blur"} ], - } + }, + + OUTSTOCKCODE: { + directOutstockCode: "1", + confirmOutstockCode: "2", + cannotOutstockCode: "3" + }, + } }, async mounted() { @@ -285,6 +293,7 @@ export default { this.form.materialId = e.rows[0]?.materialId this.form.materialCode = e.rows[0]?.materialCode this.form.materialName = e.rows[0]?.materialName + this.form.saleOrderId = e.rows[0]?.saleOrderId this.form.planDetailStatus = setState(val.data.planDetailStatus) }) }) @@ -462,7 +471,8 @@ export default { this.$store.dispatch('LogOut').then(() => { location.href = '/login?isStationId=true'; }) - }).catch(() => {}); + }).catch(() => { + }); }, next1() { this.nowNum1 += 1 @@ -485,6 +495,7 @@ export default { this.form.materialId = e.materialId this.form.materialCode = e.materialCode this.form.materialName = e.materialName + this.form.saleOrderId = e.saleOrderId this.form.planDetailStatus = setState(val.data.planDetailStatus) }) }, @@ -834,6 +845,7 @@ export default { this.form.materialId = val.materialId this.form.materialCode = val.materialCode this.form.materialName = val.materialName + this.form.saleOrderId = val.saleOrderId this.form.planDetailStatus = setState(val1.data.planDetailStatus) }) const data = await getPlanDrawings({planId: val.planId, attachId: val.attachId}) @@ -887,47 +899,73 @@ export default { this.resetForm("wmsForm"); }, - handleRawInstock(){ + handleRawInstock() { this.resetWmsForm(); this.open = true; this.stockType = "1";//入库 this.title = "板材入库"; }, - handleRawOutstock(){ + handleRawOutstock() { this.resetWmsForm(); this.open = true; this.stockType = "2";//出库 this.title = "板材领料"; }, - cancel(){ + cancel() { this.stockType = ""; this.open = false; this.resetWmsForm(); }, - submitRawStock(){ - if(this.stockType == "1"){//入库 - this.wmsForm.instockAmount = 1; - addRawInstock(this.wmsForm).then(response => { - this.$modal.msgSuccess("板材入库成功"); - this.cancel(); - }); - } else if(this.stockType == "2"){//出库 - this.wmsForm.outstockAmount = 1; - this.wmsForm.planCode = this.form.planCode; - this.wmsForm.planDetailCode = this.form.planDetailCode; - this.wmsForm.operationType = '1';//人工 - this.wmsForm.taskType = '1';//生产领料 + submitRawStock() { + if (this.stockType == "1") {//入库 + this.wmsForm.instockAmount = 1; + addRawInstock(this.wmsForm).then(response => { + this.$modal.msgSuccess("板材入库成功"); + this.cancel(); + }); + } else if (this.stockType == "2") {//出库 + this.wmsForm.outstockAmount = 1; + this.wmsForm.planCode = this.form.planCode; + this.wmsForm.planDetailCode = this.form.planDetailCode; + this.wmsForm.operationType = '1';//人工 + this.wmsForm.taskType = '1';//生产领料 + this.wmsForm.saleOrderId = this.form.saleOrderId; - directRawOutstock(this.wmsForm).then(response => { - this.$modal.msgSuccess("板材领取成功"); - this.cancel(); - }); - } + checkSuitableSaleOrderMaterial(this.wmsForm).then(response => { + let returnCode = response.data.code; + let returnMsg = response.data.msg; + if (returnCode == this.OUTSTOCKCODE.directOutstockCode) { + this.directRawOutstock(); + } else if (returnCode == this.OUTSTOCKCODE.confirmOutstockCode) { + this.$confirm('此库存为安全库存,确认要出安全库存么?有以下销售订单库存可以优先出:'+returnMsg, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.directRawOutstock(); + }).catch(() => { + }); + + } else { + this.$modal.msgWarning("请出库:"+returnMsg); + } + + }); + + } }, + directRawOutstock() { + + + directRawOutstock(this.wmsForm).then(response => { + this.$modal.msgSuccess("板材领取成功"); + this.cancel(); + }); + } }, @@ -981,8 +1019,9 @@ export default { /deep/ .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell { background-color: #fff0; } - /deep/ .el-table__expand-icon{ - color:#fff + + /deep/ .el-table__expand-icon { + color: #fff } /deep/ .current-row .el-table__expand-icon { @@ -990,7 +1029,7 @@ export default { } /deep/ .current-row:hover .el-table__expand-icon { - color:#fff + color: #fff } /deep/ .current-row:hover .cell {