diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java index e09c480..bc36dca 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java @@ -293,6 +293,10 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { throw new ServiceException("审核未通过,不能出库"); } + if (wmsRawReturn.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + throw new ServiceException("已经退库完成,无需再退库"); + } + String batchFlag = mesBaseBarcodeInfo.getBatchFlag(); if (!batchFlag.equals(MesConstants.IS_BATCH)) { @@ -301,16 +305,16 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { } } - if(!wmsRawReturn.getMaterialId().equals(mesBaseBarcodeInfo.getMaterialId())){ + if (!wmsRawReturn.getMaterialId().equals(mesBaseBarcodeInfo.getMaterialId())) { throw new ServiceException("物料编码错误"); } WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); - if(baseLocation == null){ + if (baseLocation == null) { throw new ServiceException("库位编码有误"); } - if(!baseLocation.getWarehouseId().equals(wmsRawReturn.getWarehouseId())){ + if (!baseLocation.getWarehouseId().equals(wmsRawReturn.getWarehouseId())) { throw new ServiceException("退库仓库有误"); } @@ -323,6 +327,15 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { throw new ServiceException("退库数量不能大于" + planAmount); } + WmsRawReturnDetail queryRawReturnDetail = new WmsRawReturnDetail(); + queryRawReturnDetail.setRawReturnId(rawReturnId); + queryRawReturnDetail.setMaterialBarcode(materialBarcode); + List wmsRawReturnDetails = wmsRawReturnDetailMapper.selectWmsRawReturnDetailList(queryRawReturnDetail); + if (wmsRawReturnDetails != null && !wmsRawReturnDetails.isEmpty()) { + throw new ServiceException("已经退库,无需重复退库"); + } + + String executeStatus = ""; if (updatedReturnAmount.compareTo(planAmount) == 0) { executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH; @@ -344,7 +357,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { mesBaseBarcodeInfo, userName, currentDate); //更新原材料库存 - this.updateRawStock(wmsRawReturnConfirmVo, mesBaseBarcodeInfo, baseLocation,userName, currentDate); + this.updateRawStock(wmsRawReturnConfirmVo, mesBaseBarcodeInfo, baseLocation, userName, currentDate); return 1; } diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml index 7570b9f..4a20e41 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml @@ -162,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" product_id = #{productId}, material_id = #{materialId}, plan_amount = #{planAmount}, + return_amount = #{returnAmount}, operation_type = #{operationType}, task_type = #{taskType}, apply_reason = #{applyReason},