|
|
@ -261,6 +261,10 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
|
|
|
|
wmsTransferDetail.setExecuteTime(currentDate);
|
|
|
|
wmsTransferDetail.setExecuteTime(currentDate);
|
|
|
|
wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail);
|
|
|
|
wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
oriLocation.setContainerCode("");
|
|
|
|
|
|
|
|
oriLocation.setUpdateBy(userName);
|
|
|
|
|
|
|
|
oriLocation.setUpdateTime(currentDate);
|
|
|
|
|
|
|
|
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
|
|
|
|
|
|
|
|
|
|
|
|
wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId());
|
|
|
|
wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId());
|
|
|
|
|
|
|
|
|
|
|
@ -290,30 +294,50 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
|
|
|
|
throw new ServiceException("物料条码错误");
|
|
|
|
throw new ServiceException("物料条码错误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(mesBaseBarcodeInfo.getPalletInfoCode())) {
|
|
|
|
|
|
|
|
throw new ServiceException("此物料条码没有绑定托盘");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode);
|
|
|
|
WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode);
|
|
|
|
if (targetLocation == null) {
|
|
|
|
if (targetLocation == null) {
|
|
|
|
throw new ServiceException("库位不存在");
|
|
|
|
throw new ServiceException("库位不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**判断有没有已出库的转库记录*/
|
|
|
|
|
|
|
|
WmsTransfer queryTransfer = new WmsTransfer();
|
|
|
|
|
|
|
|
queryTransfer.setProductBatch(materialBarcode);
|
|
|
|
|
|
|
|
queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
|
|
|
|
|
|
|
|
List<WmsTransfer> wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer);
|
|
|
|
|
|
|
|
if (wmsTransfers == null || wmsTransfers.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("没有此成品的转库出库记录,不能转库入库");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsProductStock queryProductStock = new WmsProductStock();
|
|
|
|
WmsProductStock queryProductStock = new WmsProductStock();
|
|
|
|
queryProductStock.setLocationCode(targetLocationCode);
|
|
|
|
queryProductStock.setLocationCode(targetLocationCode);
|
|
|
|
List<WmsProductStock> productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock);
|
|
|
|
List<WmsProductStock> productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock);
|
|
|
|
if(productStocks!=null && !productStocks.isEmpty()){
|
|
|
|
if (productStocks != null && !productStocks.isEmpty()) {
|
|
|
|
throw new ServiceException("此库位已经有库存,不能入库");
|
|
|
|
throw new ServiceException("此库位已经有库存,不能入库");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsTransfer queryTransfer = new WmsTransfer();
|
|
|
|
|
|
|
|
queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
|
|
|
|
|
|
|
|
String barcodeType = mesBaseBarcodeInfo.getBarcodeType();
|
|
|
|
|
|
|
|
//如果是非成品条码,就还可以入原来的半成品库
|
|
|
|
Long targetWarehouseId = targetLocation.getWarehouseId();
|
|
|
|
Long targetWarehouseId = targetLocation.getWarehouseId();
|
|
|
|
WmsBaseWarehouse targetWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetWarehouseId);
|
|
|
|
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<WmsTransfer> wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer);
|
|
|
|
|
|
|
|
if (wmsTransfers == null || wmsTransfers.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("没有此成品的转库出库记录,不能转库入库");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsTransfer wmsTransfer = wmsTransfers.get(0);
|
|
|
|
WmsTransfer wmsTransfer = wmsTransfers.get(0);
|
|
|
|
wmsTransfer.setTargetWarehouseId(targetWarehouseId);
|
|
|
|
wmsTransfer.setTargetWarehouseId(targetWarehouseId);
|
|
|
@ -325,6 +349,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
|
|
|
|
wmsTransfer.setEndTime(currentDate);
|
|
|
|
wmsTransfer.setEndTime(currentDate);
|
|
|
|
wmsTransferMapper.updateWmsTransfer(wmsTransfer);
|
|
|
|
wmsTransferMapper.updateWmsTransfer(wmsTransfer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新库位表的containercode,代表此库位有库存,供调度判断使用
|
|
|
|
|
|
|
|
targetLocation.setContainerCode(mesBaseBarcodeInfo.getPalletInfoCode());
|
|
|
|
|
|
|
|
targetLocation.setUpdateTime(currentDate);
|
|
|
|
|
|
|
|
targetLocation.setUpdateBy(userName);
|
|
|
|
|
|
|
|
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
|
|
|
|
|
|
|
|
|
|
|
|
//插入转库任务明细
|
|
|
|
//插入转库任务明细
|
|
|
|
wmsTransferDetail.setTransferId(wmsTransfer.getTransferId());
|
|
|
|
wmsTransferDetail.setTransferId(wmsTransfer.getTransferId());
|
|
|
|