diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java index a2c7fd54..69fe2e56 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java @@ -261,6 +261,10 @@ public class WmsTransferServiceImpl implements IWmsTransferService { wmsTransferDetail.setExecuteTime(currentDate); wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail); + oriLocation.setContainerCode(""); + oriLocation.setUpdateBy(userName); + oriLocation.setUpdateTime(currentDate); + wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation); wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); @@ -290,30 +294,50 @@ public class WmsTransferServiceImpl implements IWmsTransferService { throw new ServiceException("物料条码错误"); } + if (StringUtils.isEmpty(mesBaseBarcodeInfo.getPalletInfoCode())) { + throw new ServiceException("此物料条码没有绑定托盘"); + } + WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode); if (targetLocation == null) { throw new ServiceException("库位不存在"); } + WmsProductStock queryProductStock = new WmsProductStock(); + queryProductStock.setLocationCode(targetLocationCode); + List productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock); + if (productStocks != null && !productStocks.isEmpty()) { + throw new ServiceException("此库位已经有库存,不能入库"); + } + + WmsTransfer queryTransfer = new WmsTransfer(); + queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); + String barcodeType = mesBaseBarcodeInfo.getBarcodeType(); + //如果是非成品条码,就还可以入原来的半成品库 + Long targetWarehouseId = targetLocation.getWarehouseId(); + WmsBaseWarehouse targetWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetWarehouseId); + if (!barcodeType.equals(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT)) { +// queryTransfer.setProductBatch(materialBarcode); + throw new ServiceException("请打印成品条码入成品库"); + + } + //如果是成品条码,则只能入成品库 + if (StringUtils.isEmpty(mesBaseBarcodeInfo.getBindBarcode())) { + throw new ServiceException("物料条码有误,没有绑定"); + } + if (!targetWarehouse.getWarehouseFloor().equals(5L) || + !targetWarehouse.getWarehouseInstockType().equals(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT)) { + throw new ServiceException("请入5楼成品库"); + } + + queryTransfer.setProductBatch(mesBaseBarcodeInfo.getBindBarcode()); /**判断有没有已出库的转库记录*/ - WmsTransfer queryTransfer = new WmsTransfer(); - queryTransfer.setProductBatch(materialBarcode); - queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); List wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer); if (wmsTransfers == null || wmsTransfers.isEmpty()) { throw new ServiceException("没有此成品的转库出库记录,不能转库入库"); } - WmsProductStock queryProductStock = new WmsProductStock(); - queryProductStock.setLocationCode(targetLocationCode); - List productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock); - if(productStocks!=null && !productStocks.isEmpty()){ - throw new ServiceException("此库位已经有库存,不能入库"); - } - - Long targetWarehouseId = targetLocation.getWarehouseId(); - WmsBaseWarehouse targetWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetWarehouseId); WmsTransfer wmsTransfer = wmsTransfers.get(0); wmsTransfer.setTargetWarehouseId(targetWarehouseId); @@ -325,6 +349,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService { wmsTransfer.setEndTime(currentDate); wmsTransferMapper.updateWmsTransfer(wmsTransfer); + //更新库位表的containercode,代表此库位有库存,供调度判断使用 + targetLocation.setContainerCode(mesBaseBarcodeInfo.getPalletInfoCode()); + targetLocation.setUpdateTime(currentDate); + targetLocation.setUpdateBy(userName); + wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation); //插入转库任务明细 wmsTransferDetail.setTransferId(wmsTransfer.getTransferId()); diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseLocationMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseLocationMapper.xml index 42d13723..548f31d4 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseLocationMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseLocationMapper.xml @@ -39,6 +39,8 @@ + + @@ -155,6 +157,7 @@ warehouse_id = #{warehouseId}, agv_position_code = #{agvPositionCode}, location_code = #{locationCode}, + container_code = #{containerCode}, loc_row = #{locRow}, layer_num = #{layerNum}, loc_column = #{locColumn},