diff --git a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue index f01ea8b..e9c80de 100644 --- a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue @@ -220,7 +220,7 @@ <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus <= 200)) || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button><a-divider type="vertical"/></a> <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus <= 200)) - || (flowOff == '0' && record.lastStatus <= 200)" @click="openAutoShipmentCombine(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">自动出库</a-button></a> + || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipment(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">自动出库</a-button></a> <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1') || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null)"> <a class="ant-dropdown-link"><a-divider type="vertical"/>更多 <a-icon type="down"/></a> <a-menu slot="overlay"> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java index a1350aa..e55df3a 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java @@ -16,6 +16,7 @@ import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; @@ -56,6 +57,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe @Resource private IInventoryHeaderService inventoryHeaderService; + @Resource + private IParameterConfigurationService parameterConfigurationService; + @Override public List<InventoryDetail> selectByMainId(String mainId) { return inventoryDetailMapper.selectByMainId(mainId); @@ -139,6 +143,14 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe .eq(StringUtils.isNotEmpty(inventoryDetail.getLot()), InventoryDetail::getLot, inventoryDetail.getLot()) .eq(StringUtils.isNotEmpty(inventoryDetail.getProject()), InventoryDetail::getProject, inventoryDetail.getLot()) .eq(InventoryDetail::getCompanyCode, inventoryDetail.getCompanyCode()); + + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, inventoryDetail.getZoneCode()); + } + } List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); if (inventoryDetailList.size() == 0) { return BigDecimal.ZERO; @@ -156,6 +168,13 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe .eq(StringUtils.isNotEmpty(inventoryDetail.getLot()), InventoryDetail::getLot, inventoryDetail.getLot()) .eq(StringUtils.isNotEmpty(inventoryDetail.getProject()), InventoryDetail::getProject, inventoryDetail.getLot()) .eq(InventoryDetail::getCompanyCode, inventoryDetail.getCompanyCode()); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, inventoryDetail.getZoneCode()); + } + } List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); if (inventoryDetailList.size() == 0) { return BigDecimal.ZERO; @@ -176,6 +195,13 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe .eq(StringUtils.isNotEmpty(inventoryDetail.getProject()), InventoryDetail::getProject, inventoryDetail.getLot()) .eq(InventoryDetail::getEnable, QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) .eq(InventoryDetail::getContainerStatus, QuantityConstant.STATUS_CONTAINER_EMPTY).eq(InventoryDetail::getCompanyCode, inventoryDetail.getCompanyCode()); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, inventoryDetail.getZoneCode()); + } + } List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); if (inventoryDetailList.size() == 0) { return BigDecimal.ZERO; diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java index 5f410f5..bf5862b 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java @@ -130,6 +130,13 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi .eq(InventoryDetail::getEnable, QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) .eq(StringUtils.isNotEmpty(zoneCode), InventoryDetail::getZoneCode, zoneCode) .eq(InventoryDetail::getContainerStatus, QuantityConstant.STATUS_CONTAINER_EMPTY); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, zoneCode); + } + } List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); return inventoryDetailList; } @@ -159,6 +166,13 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi .eq(InventoryDetail::getEnable, QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) .eq(StringUtils.isNotEmpty(zoneCode), InventoryDetail::getZoneCode, zoneCode).eq(InventoryDetail::getContainerCode, containerCode) .eq(InventoryDetail::getContainerStatus, QuantityConstant.STATUS_CONTAINER_EMPTY); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, zoneCode); + } + } List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); return inventoryDetailList; } @@ -170,6 +184,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi String companyCode = shipmentDetail.getCompanyCode(); String materialCode = shipmentDetail.getMaterialCode(); String inventoryStatus = shipmentDetail.getInventoryStatus(); + String zoneCode = shipmentDetail.getZoneCode(); if (StringUtils.isEmpty(warehouseCode)) { throw new JeecgBootException("寻找库存详情时,出库详情没有仓库编码"); } @@ -186,6 +201,13 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode).eq(InventoryDetail::getCompanyCode, companyCode) .eq(InventoryDetail::getMaterialCode, materialCode).eq(InventoryDetail::getInventoryStatus, inventoryStatus) .eq(InventoryDetail::getEnable, QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getZoneCode, zoneCode); + } + } List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); return inventoryDetailList; } @@ -316,6 +338,18 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if (inventoryDetail == null) { return Result.error("配盘时,库存未找到"); } + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_ZONE); + if (StringUtils.isNotEmpty(value)) { + int shipmentZoneRule = Integer.parseInt(value); + if (shipmentZoneRule == QuantityConstant.SHIPMENT_BY_ZONE) { + if (StringUtils.isEmpty(inventoryDetail.getZoneCode())) { + return Result.error("配盘时,库存没有库区"); + } + if (!inventoryDetail.getZoneCode().equals(shipmentDetail.getZoneCode())) { + return Result.error("配盘时,库存和库区不匹配"); + } + } + } String locationCode = inventoryDetail.getLocationCode(); String containerCode = inventoryDetail.getContainerCode(); String warehouseCode = inventoryDetail.getWarehouseCode(); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java index cf24871..0845942 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -214,6 +214,7 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS inventoryDetail.setWarehouseCode(shipmentDetail1.getWarehouseCode()); inventoryDetail.setInventoryStatus(shipmentDetail1.getInventoryStatus()); inventoryDetail.setCompanyCode(shipmentDetail1.getCompanyCode()); + inventoryDetail.setZoneCode(shipmentDetail1.getZoneCode()); inventoryDetail.setBatch(shipmentDetail1.getBatch()); inventoryDetail.setProject(shipmentDetail1.getProject()); inventoryDetail.setLot(shipmentDetail1.getLot()); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java index fa8d65f..f846870 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java @@ -123,6 +123,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, this.delMain(id.toString()); } } + @Override @Transactional(rollbackFor = JeecgBootException.class) @OperationLog(bizId = "#shipmentHeader == null ? '' : #shipmentHeader.getCode()", bizType = "'出库单追踪'", tag = "'出库单新增'", @@ -351,24 +352,28 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, if (StringUtils.isEmpty(shipmentCode)) { return Result.error("自动出库, 出库单编码为空"); } - if (StringUtils.isEmpty(toPort)) { - return Result.error("自动出库, 出库口为空"); - } +// if (StringUtils.isEmpty(toPort)) { +// return Result.error("自动出库, 出库口为空"); +// } if (StringUtils.isEmpty(warehouseCode)) { return Result.error("自动出库, 仓库编码为空"); } - Port port = portService.getPortByCode(toPort, warehouseCode); - if (port == null) { - return Result.error("自动出库, 没有找到出库口"); - } - int type = Integer.parseInt(port.getType()); - if (type == QuantityConstant.PORT_TYPE_IN) { - return Result.error("自动出库, 不能选择入库口来出库"); - } +// Port port = portService.getPortByCode(toPort, warehouseCode); +// if (port == null) { +// return Result.error("自动出库, 没有找到出库口"); +// } +// int type = Integer.parseInt(port.getType()); +// if (type == QuantityConstant.PORT_TYPE_IN) { +// return Result.error("自动出库, 不能选择入库口来出库"); +// } Result result = shipmentCombinationService.autoCombination(shipmentCode, warehouseCode); if (!result.isSuccess()) { throw new JeecgBootException("自动出库," + result.getMessage()); } + ShipmentHeader shipmentHeader = shipmentHeaderService.getShipmentHeaderByCode(shipmentCode, warehouseCode); + if (shipmentHeader == null) { + throw new JeecgBootException("自动出库, 没有找到出库单"); + } List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByShipmentCode(shipmentCode); if (shipmentContainerDetailList == null) { throw new JeecgBootException("自动出库, 没有找到出库配盘详情"); @@ -384,7 +389,18 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, if (shipmentContainerHeader == null) { throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); } - shipmentContainerHeader.setToPort(toPort); + String zoneCode = shipmentHeader.getZoneCode(); + int taskType = shipmentContainerHeader.getTaskType(); + int type = QuantityConstant.PORT_TYPE_PICK; + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { + type = QuantityConstant.PORT_TYPE_OUT; + } + List<Port> portList = portService.getPortListByType(type, zoneCode, warehouseCode); + if (portList == null) { + throw new JeecgBootException("自动出库, 没有合适的出库口"); + } + Port port = portList.get(0); + shipmentContainerHeader.setToPort(port.getCode()); boolean success = shipmentContainerHeaderService.updateById(shipmentContainerHeader); if (!success) { throw new JeecgBootException("自动出库, 更新出库组盘头失败"); @@ -401,16 +417,6 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, if (taskHeader == null) { throw new JeecgBootException("自动出库, 没有找到容器号对应任务" + containerCode); } - if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { - if (type != QuantityConstant.PORT_TYPE_OUT) { - throw new JeecgBootException("自动出库, 出库口和整出任务不匹配" + toPort); - } - } - if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { - if (type != QuantityConstant.PORT_TYPE_PICK) { - throw new JeecgBootException("自动出库, 出库口和分拣任务不匹配" + toPort); - } - } } return Result.OK("自动出库成功"); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java index 51801d2..694dc35 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java @@ -318,6 +318,14 @@ public interface ITaskHeaderService extends IService<TaskHeader> { boolean updateStatusById(int status, int id); /** + * 更新出库口 + * @param toPortCode + * @param id + * @return + */ + boolean updateToPortCodeById(String toPortCode, int id); + + /** * 更新 * @param status * @param id diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index a3c402c..6af078a 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -2786,6 +2786,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } @Override + public boolean updateToPortCodeById(String toPortCode, int id) { + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setToPortCode(toPortCode); + taskHeader.setId(id); + boolean success = taskHeaderService.updateById(taskHeader); + return success; + } + + @Override public boolean updateExceptionStateById(int exceptionState, int id) { TaskHeader taskHeader = new TaskHeader(); taskHeader.setExceptionState(exceptionState); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index 96891ee..9089847 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -495,10 +495,20 @@ public class QuantityConstant { public static final String RULE_CANCEL_TASK = "cancelTask"; public static final String RULE_DOWN_ADDRESS = "downAdress"; public static final String TV_VERSION = "Tv-Ver"; + public static final String RULE_SHIPMENT_ZONE = "shipmentZoneRule"; public static final int DOUBLE_FORK = 1; public static final int SINGLE_FORK = 0; + /** + * 出库不依赖库区 + */ + public static final int NOT_SHIPMENT_BY_ZONE = 0; + /** + * 出库依赖库区 + */ + public static final int SHIPMENT_BY_ZONE = 1; + // 取消任务,不取消配盘 public static final int RULE_TASK_CANCEL_NORMAL = 0; // 取消任务,顺便取消配盘 @@ -605,7 +615,7 @@ public class QuantityConstant { /* 受控 */ public static final int INVENTORY_DETAIL_STATUS_CONTAINER = 1; - //库存锁定 + // 库存锁定 public static final String STATUS_INVENTORY_LOCK = "lock"; public static final int HTTP_OK = 200;