Commit ef72e4cffa64267ea19c72b08cce1d4e6c03bc88
1 parent
691a5226
叠盘完成任务,清空库存数据
Showing
4 changed files
with
47 additions
and
18 deletions
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
... | ... | @@ -173,7 +173,7 @@ |
173 | 173 | <a-divider type="vertical"/> |
174 | 174 | </a-popconfirm> |
175 | 175 | |
176 | - <a-popconfirm v-if="record.status < 100 && record.taskType != 600 " v-has="'taskHeader:switchTask'" title="确定切换任务吗?" @confirm="() => switchTask(record)"> | |
176 | + <a-popconfirm v-if="record.status <= 10 && record.taskType != 600 " v-has="'taskHeader:switchTask'" title="确定切换任务吗?" @confirm="() => switchTask(record)"> | |
177 | 177 | <a-button type="danger">切换任务</a-button> |
178 | 178 | </a-popconfirm> |
179 | 179 | </span> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java
... | ... | @@ -53,4 +53,6 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { |
53 | 53 | boolean updateInventory(String containerCode, String locationCode, String warehouseCode); |
54 | 54 | |
55 | 55 | Result qualityInventoryDetail(List<InventoryDetail> inventoryDetailList, String warehouseCode); |
56 | + | |
57 | + Result clearInentory(String containerCode, String warehouseCode); | |
56 | 58 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
... | ... | @@ -541,4 +541,28 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
541 | 541 | return Result.ok("生成质检任务成功"); |
542 | 542 | } |
543 | 543 | |
544 | + @Override | |
545 | + @Transactional(rollbackFor = Exception.class) | |
546 | + public Result clearInentory(String containerCode, String warehouseCode) { | |
547 | + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
548 | + if (inventoryHeader == null) { | |
549 | + return Result.error("清空库存失败,没有找到库存头"); | |
550 | + } | |
551 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
552 | + if (inventoryDetailList.size() == 0) { | |
553 | + return Result.error("清空库存失败,没有找到库存详情"); | |
554 | + } | |
555 | + List<Integer> inventoryDetailIds = inventoryDetailList.stream().map(InventoryDetail::getId).collect(Collectors.toList()); | |
556 | + if (!inventoryDetailService.removeByIds(inventoryDetailIds)) { | |
557 | + throw new JeecgBootException("清空库存失败,删除库存详情失败"); | |
558 | + } | |
559 | + if (!inventoryHeaderService.removeById(inventoryHeader.getId())) { | |
560 | + throw new JeecgBootException("清空库存失败,删除库存头失败"); | |
561 | + } | |
562 | + if (!containerService.updateFillStatus(containerCode, QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode)) { | |
563 | + throw new JeecgBootException("清空库存失败,更新托盘状态失败"); | |
564 | + } | |
565 | + return Result.ok("清空库存成功"); | |
566 | + } | |
567 | + | |
544 | 568 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1061,23 +1061,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1061 | 1061 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
1062 | 1062 | case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: |
1063 | 1063 | result = taskHeaderService.completeShipmentTask(taskHeader); |
1064 | - if (foldFlag) { | |
1065 | - String fromLocationCode = taskHeader.getFromLocationCode(); | |
1066 | - String toLocationCode = taskHeader.getToLocationCode(); | |
1067 | - String containerCode = taskHeader.getContainerCode(); | |
1068 | - String warehouseCode = taskHeader.getWarehouseCode(); | |
1069 | - if (!containerService.updateLocationCode(containerCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1070 | - throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空容器数据失败"); | |
1071 | - } | |
1072 | - if (!locationService.updateContainerCode(fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1073 | - throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空起始库位失败"); | |
1074 | - } | |
1075 | - if (StringUtils.isNotEmpty(toLocationCode)) { | |
1076 | - if (!locationService.updateContainerCode(toLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1077 | - throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空目标库位失败"); | |
1078 | - } | |
1079 | - } | |
1080 | - } | |
1081 | 1064 | break; |
1082 | 1065 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
1083 | 1066 | result = taskHeaderService.completeCycleCountTask(taskHeader); |
... | ... | @@ -1109,6 +1092,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1109 | 1092 | default: |
1110 | 1093 | throw new JeecgBootException("完成任务," + "不支持的任务类型" + taskType); |
1111 | 1094 | } |
1095 | + if (foldFlag) { | |
1096 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
1097 | + String toLocationCode = taskHeader.getToLocationCode(); | |
1098 | + String containerCode = taskHeader.getContainerCode(); | |
1099 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
1100 | + if (!containerService.updateLocationCode(containerCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1101 | + throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空容器数据失败"); | |
1102 | + } | |
1103 | + if (StringUtils.isNotEmpty(fromLocationCode)) { | |
1104 | + if (!locationService.updateContainerCode(fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1105 | + throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空起始库位失败"); | |
1106 | + } | |
1107 | + } | |
1108 | + if (StringUtils.isNotEmpty(toLocationCode)) { | |
1109 | + if (!locationService.updateContainerCode(toLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode)) { | |
1110 | + throw new JeecgBootException("完成任务," + containerCode + " 叠盘清空目标库位失败"); | |
1111 | + } | |
1112 | + } | |
1113 | + inventoryHeaderService.clearInentory(containerCode, warehouseCode); | |
1114 | + } | |
1112 | 1115 | return result; |
1113 | 1116 | } |
1114 | 1117 | |
... | ... |