From b5509540c8d6280bf4b382771ac3ca47c9e387a5 Mon Sep 17 00:00:00 2001 From: xs Date: Sat, 27 Jul 2024 18:41:18 +0800 Subject: [PATCH] =?UTF-8?q?2.7.1=20WMS=EF=BC=9A=E5=8D=8A=E6=88=90=E5=93=81?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=BA=93=E4=BD=8D=E8=A1=A8=E6=B8=85=E7=A9=BA?= =?UTF-8?q?containercode=E3=80=82=E5=8D=8A=E6=88=90=E5=93=81=E5=85=A5?= =?UTF-8?q?=E6=88=90=E5=93=81=E5=BA=93=E4=BF=9D=E5=AD=98containercode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WmsTransferServiceImpl.java | 51 +++++++++++++++---- .../mapper/wms/WmsBaseLocationMapper.xml | 3 ++ 2 files changed, 43 insertions(+), 11 deletions(-) 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 a2c7fd5..69fe2e5 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("库位不存在"); } - - /**判断有没有已出库的转库记录*/ - 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()){ + 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()); + + /**判断有没有已出库的转库记录*/ + List wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer); + if (wmsTransfers == null || wmsTransfers.isEmpty()) { + throw new ServiceException("没有此成品的转库出库记录,不能转库入库"); + } + 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 42d1372..548f31d 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},