Commit 6ff609eb26cdea6447efb276d072629c5dd682bf
1 parent
a5e8ff07
取消任务
Showing
18 changed files
with
299 additions
and
78 deletions
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
... | ... | @@ -143,8 +143,9 @@ |
143 | 143 | <a-divider type="vertical"/></a> |
144 | 144 | <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 |
145 | 145 | <a-divider type="vertical"/></a> |
146 | - <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消 | |
147 | - <a-divider type="vertical"/></a> | |
146 | + <a-popconfirm v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" title="确定取消任务吗?" @confirm="() => cancelTask(record)"> | |
147 | + <a>取消</a> | |
148 | + </a-popconfirm> | |
148 | 149 | </span> |
149 | 150 | |
150 | 151 | </a-table> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java
... | ... | @@ -2,6 +2,8 @@ package org.jeecg.modules.wms.framework.service; |
2 | 2 | |
3 | 3 | import org.jeecg.common.api.vo.Result; |
4 | 4 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
5 | +import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | |
6 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; | |
5 | 7 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
6 | 8 | |
7 | 9 | /** |
... | ... | @@ -12,4 +14,10 @@ public interface IHuahengMultiHandlerService { |
12 | 14 | Result sendTaskToWcs(TaskHeader taskHeader); |
13 | 15 | |
14 | 16 | Result<TaskHeader> createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode); |
17 | + | |
18 | + Result combination(CombinationModel combinationModel); | |
19 | + | |
20 | + Result combination(CombinationParam combinationParam); | |
21 | + | |
22 | + Result cancelCombine(Integer id); | |
15 | 23 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.framework.service.impl; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
4 | + | |
3 | 5 | import javax.annotation.Resource; |
4 | 6 | |
5 | 7 | import org.jeecg.common.api.vo.Result; |
6 | 8 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
7 | 9 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; |
10 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
11 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
8 | 12 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
9 | 13 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; |
14 | +import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | |
15 | +import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; | |
16 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; | |
17 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; | |
18 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | |
19 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; | |
10 | 20 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
11 | 21 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
12 | 22 | import org.springframework.stereotype.Service; |
23 | +import org.springframework.transaction.annotation.Transactional; | |
13 | 24 | |
14 | 25 | /** |
15 | 26 | * @author 游杰 |
... | ... | @@ -21,8 +32,17 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem |
21 | 32 | private ITaskHeaderService taskHeaderService; |
22 | 33 | @Resource |
23 | 34 | private IReceiptContainerHeaderService receiptContainerHeaderService; |
35 | + @Resource | |
36 | + private IShipmentCombinationService shipmentCombinationService; | |
37 | + @Resource | |
38 | + private IShipmentDetailService shipmentDetailService; | |
39 | + @Resource | |
40 | + private IInventoryDetailService inventoryDetailService; | |
41 | + @Resource | |
42 | + private IShipmentContainerHeaderService shipmentContainerHeaderService; | |
24 | 43 | |
25 | 44 | @Override |
45 | + @Transactional(rollbackFor = Exception.class) | |
26 | 46 | public Result sendTaskToWcs(TaskHeader taskHeader) { |
27 | 47 | if (taskHeader == null) { |
28 | 48 | return Result.error("任务信息为空"); |
... | ... | @@ -39,6 +59,7 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem |
39 | 59 | } |
40 | 60 | |
41 | 61 | @Override |
62 | + @Transactional(rollbackFor = Exception.class) | |
42 | 63 | public Result<TaskHeader> createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode) { |
43 | 64 | String lockKey = warehouseCode; |
44 | 65 | Result result = handleMultiProcess("createReceiptTask", lockKey, new MultiProcessListener() { |
... | ... | @@ -50,4 +71,50 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem |
50 | 71 | }); |
51 | 72 | return result; |
52 | 73 | } |
74 | + | |
75 | + @Override | |
76 | + @Transactional(rollbackFor = Exception.class) | |
77 | + public Result combination(CombinationModel combinationModel) { | |
78 | + Result result = handleMultiProcess("combination", new MultiProcessListener() { | |
79 | + @Override | |
80 | + public Result<?> doProcess() { | |
81 | + Result result = shipmentCombinationService.combination(combinationModel); | |
82 | + return result; | |
83 | + } | |
84 | + }); | |
85 | + return result; | |
86 | + } | |
87 | + | |
88 | + @Override | |
89 | + @Transactional(rollbackFor = Exception.class) | |
90 | + public Result combination(CombinationParam combinationParam) { | |
91 | + Result result = handleMultiProcess("combination", new MultiProcessListener() { | |
92 | + @Override | |
93 | + public Result<?> doProcess() { | |
94 | + ShipmentDetail shipmentDetail = shipmentDetailService.getById(combinationParam.getShipmentDetailID()); | |
95 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(combinationParam.getInventoryDetailID()); | |
96 | + CombinationModel combinationModel = new CombinationModel(); | |
97 | + combinationModel.setShipmentDetail(shipmentDetail); | |
98 | + combinationModel.setInventoryDetail(inventoryDetail); | |
99 | + combinationModel.setShipQty(new BigDecimal(combinationParam.getShipQty())); | |
100 | + Result result = shipmentCombinationService.combination(combinationModel); | |
101 | + return result; | |
102 | + } | |
103 | + }); | |
104 | + return result; | |
105 | + } | |
106 | + | |
107 | + @Override | |
108 | + @Transactional(rollbackFor = Exception.class) | |
109 | + public Result cancelCombine(Integer id) { | |
110 | + Result result = handleMultiProcess("cancelCombine", new MultiProcessListener() { | |
111 | + @Override | |
112 | + public Result<?> doProcess() { | |
113 | + Result result = shipmentContainerHeaderService.cancelCombine(id); | |
114 | + return result; | |
115 | + } | |
116 | + }); | |
117 | + return result; | |
118 | + } | |
119 | + | |
53 | 120 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
... | ... | @@ -40,4 +40,12 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { |
40 | 40 | */ |
41 | 41 | IPage<InventoryDetail> queryPage(Page<InventoryDetail> page, QueryWrapper<InventoryDetail> queryWrapper); |
42 | 42 | |
43 | + /** | |
44 | + * 更新库存详情的任务数量 | |
45 | + * @param taskQty | |
46 | + * @param id | |
47 | + * @return | |
48 | + */ | |
49 | + boolean updateTaskQtyById(BigDecimal taskQty, int id); | |
50 | + | |
43 | 51 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
... | ... | @@ -111,6 +111,15 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
111 | 111 | return pageResult; |
112 | 112 | } |
113 | 113 | |
114 | + @Override | |
115 | + public boolean updateTaskQtyById(BigDecimal taskQty, int id) { | |
116 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
117 | + inventoryDetail.setTaskQty(taskQty); | |
118 | + inventoryDetail.setId(id); | |
119 | + boolean success = updateById(inventoryDetail); | |
120 | + return success; | |
121 | + } | |
122 | + | |
114 | 123 | /** |
115 | 124 | * 计算库存明细托盘填充度 |
116 | 125 | * @author TanYibin |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java
... | ... | @@ -10,14 +10,12 @@ import org.jeecg.common.api.vo.Result; |
10 | 10 | import org.jeecg.common.aspect.annotation.AutoLog; |
11 | 11 | import org.jeecg.modules.wms.config.location.entity.Location; |
12 | 12 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
13 | -import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; | |
14 | 13 | import org.jeecg.modules.wms.config.port.entity.Port; |
15 | 14 | import org.jeecg.modules.wms.config.port.service.IPortService; |
16 | 15 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
17 | 16 | import org.jeecg.modules.wms.config.zone.service.IZoneService; |
18 | -import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
17 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
19 | 18 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
20 | -import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | |
21 | 19 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.Shipment; |
22 | 20 | import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; |
23 | 21 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
... | ... | @@ -58,6 +56,8 @@ public class ShipmentCombinationController { |
58 | 56 | private IZoneService zoneService; |
59 | 57 | @Resource |
60 | 58 | private IPortService portService; |
59 | + @Resource | |
60 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * 获取单据列表 |
... | ... | @@ -100,13 +100,7 @@ public class ShipmentCombinationController { |
100 | 100 | @PostMapping("/combination") |
101 | 101 | @ResponseBody |
102 | 102 | public Result combination(@RequestBody CombinationParam combinationParam) { |
103 | - ShipmentDetail shipmentDetail = shipmentDetailService.getById(combinationParam.getShipmentDetailID()); | |
104 | - InventoryDetail inventoryDetail = inventoryDetailService.getById(combinationParam.getInventoryDetailID()); | |
105 | - CombinationModel combinationModel = new CombinationModel(); | |
106 | - combinationModel.setShipmentDetail(shipmentDetail); | |
107 | - combinationModel.setInventoryDetail(inventoryDetail); | |
108 | - combinationModel.setShipQty(new BigDecimal(combinationParam.getShipQty())); | |
109 | - return shipmentCombinationService.combination(combinationModel); | |
103 | + return huahengMultiHandlerService.combination(combinationParam); | |
110 | 104 | } |
111 | 105 | |
112 | 106 | /** |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentCombination.service; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | import org.jeecg.common.api.vo.Result; |
4 | 7 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
5 | -import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | |
6 | 8 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; |
9 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; | |
7 | 10 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
8 | 11 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
9 | 12 | |
10 | -import java.math.BigDecimal; | |
11 | -import java.util.List; | |
12 | - | |
13 | 13 | /** |
14 | 14 | * @author 游杰 |
15 | 15 | */ |
... | ... | @@ -26,4 +26,8 @@ public interface IShipmentCombinationService { |
26 | 26 | public Result combination(CombinationModel combinationModel); |
27 | 27 | |
28 | 28 | public Result autoCombinationDetail(ShipmentDetail shipmentDetail, BigDecimal shipQty); |
29 | + | |
30 | + ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail); | |
31 | + | |
32 | + ShipmentContainerDetail addShipmentContainerDetail(ShipmentContainerHeader shipmentContainerHeader, CombinationModel combinationModel); | |
29 | 33 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... | ... | @@ -5,6 +5,8 @@ import java.util.ArrayList; |
5 | 5 | import java.util.Collections; |
6 | 6 | import java.util.List; |
7 | 7 | |
8 | +import javax.annotation.Resource; | |
9 | + | |
8 | 10 | import org.jeecg.common.api.vo.Result; |
9 | 11 | import org.jeecg.common.exception.JeecgBootException; |
10 | 12 | import org.jeecg.modules.wms.config.container.entity.Container; |
... | ... | @@ -14,6 +16,7 @@ import org.jeecg.modules.wms.config.location.service.ILocationService; |
14 | 16 | import org.jeecg.modules.wms.config.material.entity.Material; |
15 | 17 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
16 | 18 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
19 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
17 | 20 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
18 | 21 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
19 | 22 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
... | ... | @@ -46,10 +49,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
46 | 49 | |
47 | 50 | import cn.monitor4all.logRecord.annotation.OperationLog; |
48 | 51 | import cn.monitor4all.logRecord.context.LogRecordContext; |
52 | +import lombok.extern.slf4j.Slf4j; | |
49 | 53 | |
50 | 54 | /** |
51 | 55 | * @author 游杰 |
52 | 56 | */ |
57 | +@Slf4j | |
53 | 58 | @Service |
54 | 59 | public class ShipmentCombinationServiceImpl implements IShipmentCombinationService { |
55 | 60 | |
... | ... | @@ -81,6 +86,8 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
81 | 86 | private ITaskDetailService taskDetailService; |
82 | 87 | @Autowired |
83 | 88 | private IInventoryHeaderService inventoryHeaderService; |
89 | + @Resource | |
90 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | |
84 | 91 | |
85 | 92 | /** |
86 | 93 | * 根据出库单详情,匹配到可用出库的库存详情 |
... | ... | @@ -212,7 +219,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
212 | 219 | combinationModel.setShipQty(inventoryQty); |
213 | 220 | shipmentQty = shipmentQty.subtract(inventoryQty); |
214 | 221 | } |
215 | - Result result = shipmentCombinationService.combination(combinationModel); | |
222 | + Result result = huahengMultiHandlerService.combination(combinationModel); | |
216 | 223 | if (!result.isSuccess()) { |
217 | 224 | throw new JeecgBootException(result.getMessage()); |
218 | 225 | } |
... | ... | @@ -227,6 +234,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
227 | 234 | BigDecimal shipmentQty = combinationModel.getShipQty(); |
228 | 235 | ShipmentDetail shipmentDetail = combinationModel.getShipmentDetail(); |
229 | 236 | InventoryDetail inventoryDetail = combinationModel.getInventoryDetail(); |
237 | + log.info("开始出库配盘" + shipmentDetail); | |
230 | 238 | if (shipmentQty.compareTo(BigDecimal.ZERO) <= 0) { |
231 | 239 | return Result.error("配盘时,出库数量必须大于0"); |
232 | 240 | } |
... | ... | @@ -281,7 +289,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
281 | 289 | return Result.error("配盘时, 库存详情的任务数量不能超过库存数量"); |
282 | 290 | } |
283 | 291 | inventoryDetail.setTaskQty(inventoryDetailTaskQty); |
284 | - success = inventoryDetailService.updateById(inventoryDetail); | |
292 | + success = inventoryDetailService.updateTaskQtyById(inventoryDetailTaskQty, inventoryDetail.getId()); | |
285 | 293 | if (!success) { |
286 | 294 | throw new JeecgBootException("配盘时, 更新库存详情失败"); |
287 | 295 | } |
... | ... | @@ -291,21 +299,18 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
291 | 299 | } |
292 | 300 | if (shipmentDetailTaskQty.compareTo(shipmentDetailQty) > 0) { |
293 | 301 | return Result.error("配盘时, 出库详情的任务数量不能超过单据数量"); |
294 | - } else if (inventoryDetailTaskQty.compareTo(inventoryDetailQty) == 0) { | |
295 | - shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAITING_OFF_SHELF); | |
296 | - } else if (inventoryDetailTaskQty.compareTo(inventoryDetailQty) < 0) { | |
297 | - shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAITING_OFF_SHELF); | |
298 | 302 | } |
303 | + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); | |
299 | 304 | shipmentDetail.setTaskQty(shipmentDetailTaskQty); |
300 | - success = shipmentDetailService.updateById(shipmentDetail); | |
305 | + success = shipmentDetailService.updateTaskQtyAndStatusById(shipmentDetailTaskQty, QuantityConstant.SHIPMENT_HEADER_GROUPDISK, shipmentDetail.getId()); | |
301 | 306 | if (!success) { |
302 | 307 | throw new JeecgBootException("配盘时, 更新出库详情失败"); |
303 | 308 | } |
304 | - ShipmentContainerHeader shipmentContainerHeader = addShipmentContainerHeader(inventoryDetail, shipmentDetail); | |
309 | + ShipmentContainerHeader shipmentContainerHeader = shipmentCombinationService.addShipmentContainerHeader(inventoryDetail, shipmentDetail); | |
305 | 310 | if (shipmentContainerHeader == null) { |
306 | 311 | throw new JeecgBootException("配盘时, 新增出库组盘头失败"); |
307 | 312 | } |
308 | - ShipmentContainerDetail shipmentContainerDetail = addShipmentContainerDetail(shipmentContainerHeader, combinationModel); | |
313 | + ShipmentContainerDetail shipmentContainerDetail = shipmentCombinationService.addShipmentContainerDetail(shipmentContainerHeader, combinationModel); | |
309 | 314 | if (shipmentContainerDetail == null) { |
310 | 315 | throw new JeecgBootException("配盘时, 新增出库组盘详情失败"); |
311 | 316 | } |
... | ... | @@ -314,9 +319,11 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
314 | 319 | throw new JeecgBootException("配盘时, 更新出库单失败"); |
315 | 320 | } |
316 | 321 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(shipmentContainerDetail))); |
322 | + log.info("完成出库配盘" + shipmentDetail); | |
317 | 323 | return Result.ok("配盘成功"); |
318 | 324 | } |
319 | 325 | |
326 | + @Override | |
320 | 327 | @Transactional(rollbackFor = JeecgBootException.class) |
321 | 328 | public ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail) { |
322 | 329 | String containerCode = inventoryDetail.getContainerCode(); |
... | ... | @@ -342,14 +349,22 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
342 | 349 | if (shipmentContainerHeader != null) { |
343 | 350 | if (taskType != shipmentContainerHeader.getTaskType()) { |
344 | 351 | shipmentContainerHeader.setTaskType(taskType); |
345 | - if (!shipmentContainerHeaderService.updateById(shipmentContainerHeader)) { | |
352 | + if (!shipmentContainerHeaderService.updateTaskTypeById(taskType, shipmentContainerHeader.getId())) { | |
346 | 353 | throw new ServiceException("更新出库组盘头任务类型失败"); |
347 | 354 | } |
348 | 355 | } |
349 | 356 | } else { |
357 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | |
358 | + if (StringUtils.isEmpty(value)) { | |
359 | + throw new JeecgBootException("取消入库任务时, 没有获取到配置属性"); | |
360 | + } | |
361 | + int taskLocationRule = Integer.parseInt(value); | |
350 | 362 | shipmentContainerHeader = new ShipmentContainerHeader(); |
351 | 363 | shipmentContainerHeader.setContainerCode(containerCode); |
352 | 364 | shipmentContainerHeader.setFromLocationCode(locationCode); |
365 | + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { | |
366 | + shipmentContainerHeader.setToLocationCode(locationCode); | |
367 | + } | |
353 | 368 | shipmentContainerHeader.setWarehouseCode(warehouseCode); |
354 | 369 | shipmentContainerHeader.setCompanyCode(shipmentDetail.getCompanyCode()); |
355 | 370 | shipmentContainerHeader.setContainerTypeCode(container.getContainerTypeCode()); |
... | ... | @@ -365,6 +380,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
365 | 380 | return shipmentContainerHeader; |
366 | 381 | } |
367 | 382 | |
383 | + @Override | |
368 | 384 | @Transactional(rollbackFor = JeecgBootException.class) |
369 | 385 | public ShipmentContainerDetail addShipmentContainerDetail(ShipmentContainerHeader shipmentContainerHeader, CombinationModel combinationModel) { |
370 | 386 | boolean success = false; |
... | ... | @@ -381,8 +397,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
381 | 397 | .eq(ShipmentContainerDetail::getWarehouseCode, warehouseCode); |
382 | 398 | ShipmentContainerDetail shipmentContainerDetail = shipmentContainerDetailService.getOne(shipmentContainerDetailLambdaQueryWrapper); |
383 | 399 | if (shipmentContainerDetail != null) { |
384 | - shipmentContainerDetail.setQty(shipmentContainerDetail.getQty().add(combinationModel.getShipQty())); | |
385 | - success = shipmentContainerDetailService.updateById(shipmentContainerDetail); | |
400 | + BigDecimal qty = shipmentContainerDetail.getQty().add(combinationModel.getShipQty()); | |
401 | + shipmentContainerDetail.setQty(qty); | |
402 | + success = shipmentContainerDetailService.updateQtyById(qty, shipmentContainerDetail.getId()); | |
386 | 403 | if (!success) { |
387 | 404 | throw new JeecgBootException("更新出库组盘详情失败"); |
388 | 405 | } |
... | ... | @@ -435,6 +452,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
435 | 452 | if (shipmentContainerHeader.getStatus() >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { |
436 | 453 | return Result.error("生成出库任务时, 出库组盘头" + shipmentContainerHeader.getId() + "已经生成任务,请不要重复生成,操作中止"); |
437 | 454 | } |
455 | + log.info("开始创建出库任务,出库配盘头" + shipmentContainerHeader.getId()); | |
438 | 456 | List<ShipmentContainerDetail> shipmentContainerDetailList = |
439 | 457 | shipmentContainerDetailService.getShipmentContainerDetailListByHeaderId(shipmentContainerHeader.getId()); |
440 | 458 | if (shipmentContainerDetailList.size() == 0) { |
... | ... | @@ -446,6 +464,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
446 | 464 | String fromLocationCode = shipmentContainerHeader.getFromLocationCode(); |
447 | 465 | String toLocationCode = shipmentContainerHeader.getToLocationCode(); |
448 | 466 | String containerCode = shipmentContainerHeader.getContainerCode(); |
467 | + String toPort = shipmentContainerHeader.getToPort(); | |
449 | 468 | if (StringUtils.isEmpty(fromLocationCode)) { |
450 | 469 | return Result.error("生成出库任务时, 出库组盘头没有起始库位号"); |
451 | 470 | } |
... | ... | @@ -500,13 +519,6 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
500 | 519 | if (shipmentTaskRule == QuantityConstant.RULE_TASK_PICK_SHIPMENT) { |
501 | 520 | taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT; |
502 | 521 | } |
503 | - value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | |
504 | - int taskLocationRule = Integer.parseInt(value); | |
505 | - if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { | |
506 | - toLocationCode = fromLocationCode; | |
507 | - shipmentContainerHeader.setToLocationCode(toLocationCode); | |
508 | - } | |
509 | - shipmentContainerHeader.setTaskType(taskType); | |
510 | 522 | String zoneCode = location.getZoneCode(); |
511 | 523 | TaskHeader taskHeader = new TaskHeader(); |
512 | 524 | taskHeader.setPreTaskNo(preTaskNo); |
... | ... | @@ -556,6 +568,17 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
556 | 568 | if (!success) { |
557 | 569 | throw new JeecgBootException("生成出库任务时, 创建任务详情失败"); |
558 | 570 | } |
571 | + value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | |
572 | + int taskLocationRule = Integer.parseInt(value); | |
573 | + int shipmentContainerHeaderId = shipmentContainerHeader.getId(); | |
574 | + shipmentContainerHeader = new ShipmentContainerHeader(); | |
575 | + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { | |
576 | + toLocationCode = fromLocationCode; | |
577 | + shipmentContainerHeader.setToLocationCode(toLocationCode); | |
578 | + } | |
579 | + shipmentContainerHeader.setToPort(toPort); | |
580 | + shipmentContainerHeader.setId(shipmentContainerHeaderId); | |
581 | + shipmentContainerHeader.setTaskType(taskType); | |
559 | 582 | shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); |
560 | 583 | success = shipmentContainerHeaderService.updateById(shipmentContainerHeader); |
561 | 584 | if (!success) { |
... | ... | @@ -570,6 +593,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
570 | 593 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(shipmentContainerDetailList));// 操作日志收集 |
571 | 594 | LogRecordContext.putVariable("taskDetailList", taskDetailList);// 操作日志收集 |
572 | 595 | LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(taskDetailList));// 操作日志收集 |
596 | + log.info("完成创建出库任务,出库配盘头" + shipmentContainerHeader.getId()); | |
573 | 597 | return Result.OK("生成出库任务成功"); |
574 | 598 | } |
575 | 599 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/controller/ShipmentContainerHeaderController.java
... | ... | @@ -6,6 +6,7 @@ import java.util.List; |
6 | 6 | import java.util.Map; |
7 | 7 | import java.util.stream.Collectors; |
8 | 8 | |
9 | +import javax.annotation.Resource; | |
9 | 10 | import javax.servlet.http.HttpServletRequest; |
10 | 11 | import javax.servlet.http.HttpServletResponse; |
11 | 12 | |
... | ... | @@ -17,12 +18,12 @@ import org.jeecg.common.system.base.controller.JeecgController; |
17 | 18 | import org.jeecg.common.system.query.QueryGenerator; |
18 | 19 | import org.jeecg.common.system.vo.LoginUser; |
19 | 20 | import org.jeecg.common.util.oConvertUtils; |
21 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
20 | 22 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
21 | 23 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
22 | 24 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; |
23 | 25 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; |
24 | 26 | import org.jeecg.utils.HuahengJwtUtil; |
25 | -import org.jeecg.utils.StringUtils; | |
26 | 27 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
27 | 28 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
28 | 29 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | ... | @@ -60,6 +61,9 @@ public class ShipmentContainerHeaderController extends JeecgController<ShipmentC |
60 | 61 | @Autowired |
61 | 62 | private IShipmentContainerDetailService shipmentContainerDetailService; |
62 | 63 | |
64 | + @Resource | |
65 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | |
66 | + | |
63 | 67 | /*---------------------------------主表处理-begin-------------------------------------*/ |
64 | 68 | |
65 | 69 | /** |
... | ... | @@ -122,7 +126,7 @@ public class ShipmentContainerHeaderController extends JeecgController<ShipmentC |
122 | 126 | @RequiresPermissions("shipmentContainerHeader:delete") |
123 | 127 | @DeleteMapping(value = "/delete") |
124 | 128 | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
125 | - return shipmentContainerHeaderService.cancelCombine(Integer.parseInt(id)); | |
129 | + return huahengMultiHandlerService.cancelCombine(Integer.parseInt(id)); | |
126 | 130 | } |
127 | 131 | |
128 | 132 | /** |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerDetailService.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.service; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
7 | + | |
4 | 8 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | -import java.util.List; | |
6 | 9 | |
7 | 10 | /** |
8 | 11 | * @Description: 出库组盘详情 |
... | ... | @@ -17,4 +20,6 @@ public interface IShipmentContainerDetailService extends IService<ShipmentContai |
17 | 20 | public List<ShipmentContainerDetail> getShipmentContainerDetailListByHeaderId(int shipmentContainerHeaderId); |
18 | 21 | |
19 | 22 | public List<ShipmentContainerDetail> getShipmentContainerDetailListByShipmentCode(String shipmentCode); |
23 | + | |
24 | + boolean updateQtyById(BigDecimal qty, int id); | |
20 | 25 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java
... | ... | @@ -55,4 +55,21 @@ public interface IShipmentContainerHeaderService extends IService<ShipmentContai |
55 | 55 | * @return |
56 | 56 | */ |
57 | 57 | Result cancelCombine(List<Integer> ids); |
58 | + | |
59 | + /** | |
60 | + * 更新任务类型 | |
61 | + * @param taskType | |
62 | + * @param id | |
63 | + * @return | |
64 | + */ | |
65 | + boolean updateTaskTypeById(int taskType, int id); | |
66 | + | |
67 | + /** | |
68 | + * 更新出库配盘状态 | |
69 | + * @param status | |
70 | + * @param id | |
71 | + * @return | |
72 | + */ | |
73 | + boolean updateStatusById(int status, int id); | |
74 | + | |
58 | 75 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerDetailServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.impl; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.List; | |
5 | + | |
5 | 6 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
6 | 7 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.mapper.ShipmentContainerDetailMapper; |
7 | 8 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | 10 | import org.springframework.stereotype.Service; |
9 | -import java.util.List; | |
11 | + | |
12 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
13 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
10 | 14 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
11 | -import org.springframework.beans.factory.annotation.Autowired; | |
12 | 15 | |
13 | 16 | /** |
14 | 17 | * @Description: 出库组盘详情 |
... | ... | @@ -43,4 +46,13 @@ public class ShipmentContainerDetailServiceImpl extends ServiceImpl<ShipmentCont |
43 | 46 | List<ShipmentContainerDetail> shipmentContainerDetailList = list(shipmentContainerDetailLambdaQueryWrapper); |
44 | 47 | return shipmentContainerDetailList; |
45 | 48 | } |
49 | + | |
50 | + @Override | |
51 | + public boolean updateQtyById(BigDecimal qty, int id) { | |
52 | + ShipmentContainerDetail shipmentContainerDetail = new ShipmentContainerDetail(); | |
53 | + shipmentContainerDetail.setQty(qty); | |
54 | + shipmentContainerDetail.setId(id); | |
55 | + boolean success = updateById(shipmentContainerDetail); | |
56 | + return success; | |
57 | + } | |
46 | 58 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.impl; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | +import java.math.BigDecimal; | |
4 | 5 | import java.util.ArrayList; |
5 | 6 | import java.util.Collection; |
6 | 7 | import java.util.List; |
... | ... | @@ -9,9 +10,10 @@ import java.util.stream.Collectors; |
9 | 10 | import javax.annotation.Resource; |
10 | 11 | |
11 | 12 | import org.jeecg.common.api.vo.Result; |
13 | +import org.jeecg.common.exception.JeecgBootException; | |
14 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
12 | 15 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
13 | 16 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
14 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | |
15 | 17 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
16 | 18 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
17 | 19 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.mapper.ShipmentContainerDetailMapper; |
... | ... | @@ -28,13 +30,13 @@ import org.springframework.stereotype.Service; |
28 | 30 | import org.springframework.transaction.annotation.Transactional; |
29 | 31 | |
30 | 32 | import com.alibaba.fastjson.JSON; |
31 | -import org.jeecg.common.exception.JeecgBootException; | |
32 | 33 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
33 | 34 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
34 | 35 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
35 | 36 | |
36 | 37 | import cn.monitor4all.logRecord.annotation.OperationLog; |
37 | 38 | import cn.monitor4all.logRecord.context.LogRecordContext; |
39 | +import lombok.extern.slf4j.Slf4j; | |
38 | 40 | |
39 | 41 | /** |
40 | 42 | * @Description: 出库组盘 |
... | ... | @@ -42,6 +44,7 @@ import cn.monitor4all.logRecord.context.LogRecordContext; |
42 | 44 | * @Date: 2022-11-22 |
43 | 45 | * @Version: V1.0 |
44 | 46 | */ |
47 | +@Slf4j | |
45 | 48 | @Service |
46 | 49 | public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentContainerHeaderMapper, ShipmentContainerHeader> |
47 | 50 | implements IShipmentContainerHeaderService { |
... | ... | @@ -58,6 +61,8 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
58 | 61 | private IShipmentContainerDetailService shipmentContainerDetailService; |
59 | 62 | @Resource |
60 | 63 | private IInventoryDetailService inventoryDetailService; |
64 | + @Resource | |
65 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | |
61 | 66 | |
62 | 67 | @Override |
63 | 68 | @Transactional |
... | ... | @@ -138,12 +143,13 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
138 | 143 | if (shipmentContainerHeader == null) { |
139 | 144 | return false; |
140 | 145 | } |
146 | + log.info("开始取消出库任务,任务id" + taskHeader.getId()); | |
141 | 147 | int shipmentContainerStatus = shipmentContainerHeader.getStatus(); |
142 | 148 | if (shipmentContainerStatus != QuantityConstant.SHIPMENT_CONTAINER_TASK) { |
143 | 149 | throw new JeecgBootException("取消出库任务时, 任务状态不为生成任务状态"); |
144 | 150 | } |
145 | 151 | shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); |
146 | - boolean success = updateById(shipmentContainerHeader); | |
152 | + boolean success = this.updateStatusById(QuantityConstant.SHIPMENT_CONTAINER_BUILD, shipmentContainerHeader.getId()); | |
147 | 153 | if (!success) { |
148 | 154 | throw new JeecgBootException("取消入库任务时, 更新入库组盘头失败"); |
149 | 155 | } |
... | ... | @@ -156,6 +162,10 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
156 | 162 | if (shipmentDetail == null) { |
157 | 163 | throw new JeecgBootException("取消出库任务时, 没有找到出库单详情" + shipmentContainerDetail.getShipmentDetailId()); |
158 | 164 | } |
165 | + int shipmentId = shipmentDetail.getShipmentId(); | |
166 | + shipmentDetail = new ShipmentDetail(); | |
167 | + shipmentDetail.setId(shipmentContainerDetail.getShipmentDetailId()); | |
168 | + shipmentDetail.setShipmentId(shipmentId); | |
159 | 169 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); |
160 | 170 | shipmentDetailList.add(shipmentDetail); |
161 | 171 | } |
... | ... | @@ -172,6 +182,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
172 | 182 | } |
173 | 183 | } |
174 | 184 | } |
185 | + log.info("完成取消出库任务,任务id" + taskHeader.getId()); | |
175 | 186 | LogRecordContext.putVariable("shipmentContainerHeader", shipmentContainerHeader);// 操作日志收集 |
176 | 187 | LogRecordContext.putVariable("shipmentContainerDetailList", shipmentContainerDetailList);// 操作日志收集 |
177 | 188 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(shipmentContainerDetailList));// 操作日志收集 |
... | ... | @@ -182,6 +193,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
182 | 193 | @Transactional(rollbackFor = JeecgBootException.class) |
183 | 194 | @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情取消配盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) |
184 | 195 | public Result cancelCombine(Integer id) { |
196 | + log.info("开始取消配盘,id:" + id); | |
185 | 197 | ShipmentContainerHeader shipmentContainerHeader = this.getById(id); |
186 | 198 | if (shipmentContainerHeader == null) { |
187 | 199 | return Result.error("取消出库配盘失败, 没有找到出库组盘头ID:" + id); |
... | ... | @@ -191,15 +203,15 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
191 | 203 | return Result.error("取消出库配盘失败,已经生成出库任务"); |
192 | 204 | } |
193 | 205 | List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByHeaderId(id); |
194 | - List<ShipmentDetail> shipmentDetailList = new ArrayList<ShipmentDetail>(); | |
195 | 206 | for (ShipmentContainerDetail shipmentContainerDetail : shipmentContainerDetailList) { |
196 | 207 | ShipmentDetail shipmentDetail = shipmentDetailService.getById(shipmentContainerDetail.getShipmentDetailId()); |
197 | 208 | if (shipmentDetail == null) { |
198 | 209 | throw new JeecgBootException("取消出库配盘失败, 没有找到出库单,出库详情ID:" + shipmentContainerDetail.getShipmentDetailId()); |
199 | 210 | } |
200 | 211 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); |
201 | - shipmentDetail.setTaskQty(shipmentDetail.getTaskQty().subtract(shipmentContainerDetail.getQty())); | |
202 | - if (!shipmentDetailService.updateById(shipmentDetail)) { | |
212 | + BigDecimal taskQty = shipmentDetail.getTaskQty().subtract(shipmentContainerDetail.getQty()); | |
213 | + shipmentDetail.setTaskQty(taskQty); | |
214 | + if (!shipmentDetailService.updateTaskQtyAndStatusById(taskQty, QuantityConstant.SHIPMENT_HEADER_BUILD, shipmentDetail.getId())) { | |
203 | 215 | throw new JeecgBootException("取消出库配盘失败, 更新出库明细失败,出库详情ID:" + shipmentContainerDetail.getShipmentDetailId()); |
204 | 216 | } |
205 | 217 | if (!shipmentContainerDetailService.removeById(shipmentContainerDetail.getId())) { |
... | ... | @@ -209,26 +221,48 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
209 | 221 | throw new JeecgBootException("取消出库配盘失败, 更新出库单头失败,出库单ID:" + shipmentDetail.getShipmentId()); |
210 | 222 | } |
211 | 223 | InventoryDetail inventoryDetail = inventoryDetailService.getById(shipmentContainerDetail.getInventoryDetailId()); |
212 | - inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(shipmentContainerDetail.getQty())); | |
213 | - if (!inventoryDetailService.updateById(inventoryDetail)) { | |
224 | + if (inventoryDetail == null) { | |
225 | + throw new JeecgBootException("取消出库配盘失败, 没有找到库存详情失败,库存详情ID:" + shipmentContainerDetail.getInventoryDetailId()); | |
226 | + } | |
227 | + BigDecimal inventoryDetailTaskQty = inventoryDetail.getTaskQty().subtract(shipmentContainerDetail.getQty()); | |
228 | + if (!inventoryDetailService.updateTaskQtyById(inventoryDetailTaskQty, shipmentContainerDetail.getInventoryDetailId())) { | |
214 | 229 | throw new JeecgBootException("取消出库配盘失败, 解锁库存详情失败,库存详情ID:" + inventoryDetail.getId()); |
215 | 230 | } |
216 | - shipmentDetailList.add(shipmentDetail); | |
217 | 231 | } |
218 | 232 | if (!this.removeById(id)) { |
219 | 233 | throw new JeecgBootException("取消出库配盘失败, 删除出库组盘头表失败,配盘ID:" + id); |
220 | 234 | } |
221 | 235 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(shipmentContainerDetailList)); |
236 | + log.info("完成取消配盘,id:" + id); | |
222 | 237 | return Result.ok("取消配盘成功"); |
223 | 238 | } |
224 | 239 | |
225 | 240 | @Override |
241 | + @Transactional(rollbackFor = Exception.class) | |
226 | 242 | public Result cancelCombine(List<Integer> ids) { |
227 | 243 | Result result = null; |
228 | 244 | for (Integer id : ids) { |
229 | - result = cancelCombine(id); | |
245 | + result = huahengMultiHandlerService.cancelCombine(id); | |
230 | 246 | } |
231 | 247 | return result; |
232 | 248 | } |
233 | 249 | |
250 | + @Override | |
251 | + public boolean updateTaskTypeById(int taskType, int id) { | |
252 | + ShipmentContainerHeader shipmentContainerHeader = new ShipmentContainerHeader(); | |
253 | + shipmentContainerHeader.setTaskType(taskType); | |
254 | + shipmentContainerHeader.setId(id); | |
255 | + boolean success = this.updateById(shipmentContainerHeader); | |
256 | + return success; | |
257 | + } | |
258 | + | |
259 | + @Override | |
260 | + public boolean updateStatusById(int status, int id) { | |
261 | + ShipmentContainerHeader shipmentContainerHeader = new ShipmentContainerHeader(); | |
262 | + shipmentContainerHeader.setStatus(status); | |
263 | + shipmentContainerHeader.setId(id); | |
264 | + boolean success = this.updateById(shipmentContainerHeader); | |
265 | + return success; | |
266 | + } | |
267 | + | |
234 | 268 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentHeader.service; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | import org.jeecg.common.api.vo.Result; |
4 | 7 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
5 | -import com.baomidou.mybatisplus.extension.service.IService; | |
6 | -import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | |
7 | 8 | |
8 | -import java.util.List; | |
9 | +import com.baomidou.mybatisplus.extension.service.IService; | |
9 | 10 | |
10 | 11 | /** |
11 | 12 | * @Description: 出库单详情 |
... | ... | @@ -22,4 +23,6 @@ public interface IShipmentDetailService extends IService<ShipmentDetail> { |
22 | 23 | public List<ShipmentDetail> getShipmentDetailListByShipmentId(Integer id); |
23 | 24 | |
24 | 25 | boolean batchSave(List<ShipmentDetail> shipmentDetailList); |
26 | + | |
27 | + boolean updateTaskQtyAndStatusById(BigDecimal taskQty, int status, int id); | |
25 | 28 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentHeader.service; |
2 | 2 | |
3 | +import java.io.Serializable; | |
4 | +import java.util.Collection; | |
5 | + | |
3 | 6 | import org.jeecg.common.api.vo.Result; |
4 | -import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | |
5 | -import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | |
6 | -import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | |
7 | 7 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
8 | + | |
8 | 9 | import com.baomidou.mybatisplus.extension.service.IService; |
9 | -import org.springframework.beans.factory.annotation.Autowired; | |
10 | -import java.io.Serializable; | |
11 | -import java.util.Collection; | |
12 | -import java.util.List; | |
13 | 10 | |
14 | 11 | /** |
15 | 12 | * @Description: 出库单 |
... | ... | @@ -40,4 +37,6 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { |
40 | 37 | public ShipmentHeader getShipmentHeaderByCode(String code, String warehouseCode); |
41 | 38 | |
42 | 39 | public ShipmentHeader getShipmentHeaderByReferCode(String referCode, String warehouseCode); |
40 | + | |
41 | + boolean updateFirstStatusAndLastStatusById(Integer firstStatus, Integer lastStatus, int id); | |
43 | 42 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentHeader.service.impl; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | -import org.jeecg.common.exception.JeecgBootException; | |
5 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.Collections; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import javax.annotation.Resource; | |
8 | + | |
7 | 9 | import org.jeecg.common.api.vo.Result; |
10 | +import org.jeecg.common.exception.JeecgBootException; | |
8 | 11 | import org.jeecg.modules.wms.config.material.entity.Material; |
9 | 12 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
10 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | |
11 | -import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | |
12 | 13 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
13 | 14 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
14 | 15 | import org.jeecg.modules.wms.shipment.shipmentHeader.mapper.ShipmentDetailMapper; |
... | ... | @@ -16,19 +17,17 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailServ |
16 | 17 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; |
17 | 18 | import org.jeecg.utils.StringUtils; |
18 | 19 | import org.jeecg.utils.constant.QuantityConstant; |
20 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | 21 | import org.springframework.stereotype.Service; |
20 | 22 | |
21 | -import java.util.Collections; | |
22 | -import java.util.List; | |
23 | +import com.alibaba.fastjson.JSON; | |
24 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
25 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
23 | 26 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
24 | 27 | |
25 | 28 | import cn.monitor4all.logRecord.annotation.OperationLog; |
26 | 29 | import cn.monitor4all.logRecord.context.LogRecordContext; |
27 | 30 | |
28 | -import org.springframework.beans.factory.annotation.Autowired; | |
29 | - | |
30 | -import javax.annotation.Resource; | |
31 | - | |
32 | 31 | /** |
33 | 32 | * @Description: 出库单详情 |
34 | 33 | * @Author: jeecg-boot |
... | ... | @@ -108,4 +107,15 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
108 | 107 | public boolean batchSave(List<ShipmentDetail> shipmentDetailList) { |
109 | 108 | return this.saveBatch(shipmentDetailList); |
110 | 109 | } |
110 | + | |
111 | + @Override | |
112 | + public boolean updateTaskQtyAndStatusById(BigDecimal taskQty, int status, int id) { | |
113 | + ShipmentDetail shipmentDetail = new ShipmentDetail(); | |
114 | + shipmentDetail.setTaskQty(taskQty); | |
115 | + shipmentDetail.setStatus(status); | |
116 | + shipmentDetail.setId(id); | |
117 | + boolean success = updateById(shipmentDetail); | |
118 | + return success; | |
119 | + } | |
120 | + | |
111 | 121 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
... | ... | @@ -193,7 +193,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
193 | 193 | // 尾状态是单据详情中最小的状态 |
194 | 194 | shipmentHeader.setFirstStatus(maxStatus); |
195 | 195 | shipmentHeader.setLastStatus(minStatus); |
196 | - if (!shipmentHeaderService.updateById(shipmentHeader)) { | |
196 | + if (!shipmentHeaderService.updateFirstStatusAndLastStatusById(maxStatus, minStatus, shipmentId)) { | |
197 | 197 | throw new JeecgBootException("更新出库单:" + shipmentHeader.getCode() + " 头状态失败"); |
198 | 198 | } |
199 | 199 | LogRecordContext.putVariable("minStatus", minStatus); |
... | ... | @@ -238,4 +238,14 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
238 | 238 | return shipmentHeader; |
239 | 239 | } |
240 | 240 | |
241 | + @Override | |
242 | + public boolean updateFirstStatusAndLastStatusById(Integer firstStatus, Integer lastStatus, int id) { | |
243 | + ShipmentHeader shipmentHeader = new ShipmentHeader(); | |
244 | + shipmentHeader.setFirstStatus(firstStatus); | |
245 | + shipmentHeader.setLastStatus(lastStatus); | |
246 | + shipmentHeader.setId(id); | |
247 | + boolean success = updateById(shipmentHeader); | |
248 | + return success; | |
249 | + } | |
250 | + | |
241 | 251 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -909,6 +909,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
909 | 909 | if (!success) { |
910 | 910 | return Result.error("取消任务失败, 删除任务失败"); |
911 | 911 | } |
912 | + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskId); | |
913 | + if (taskDetailList.size() > 0) { | |
914 | + List<Integer> taskDetailIdList = taskDetailList.stream().map(TaskDetail::getId).collect(Collectors.toList()); | |
915 | + success = taskDetailService.removeByIds(taskDetailIdList); | |
916 | + if (!success) { | |
917 | + return Result.error("取消任务失败, 删除任务详情失败"); | |
918 | + } | |
919 | + } | |
912 | 920 | Result result = Result.ok("取消任务成功"); |
913 | 921 | switch (taskType) { |
914 | 922 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: |
... | ... | @@ -959,6 +967,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
959 | 967 | @Override |
960 | 968 | @Transactional(rollbackFor = Exception.class) |
961 | 969 | public Result<TaskHeader> createEmptyIn(String containerCode, String toLocationCode, String warehouseCode) { |
970 | + log.info("开始创建空托入库任务"); | |
962 | 971 | if (StringUtils.isEmpty(containerCode)) { |
963 | 972 | return Result.error("创建空托盘入库时, 托盘号为空"); |
964 | 973 | } |
... | ... | @@ -1004,6 +1013,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1004 | 1013 | taskHeader.setToLocationCode(toLocationCode); |
1005 | 1014 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
1006 | 1015 | success = taskHeaderService.save(taskHeader); |
1016 | + log.info("完成创建空托入库任务"); | |
1007 | 1017 | if (!success) { |
1008 | 1018 | throw new JeecgBootException("创建空托盘入库时,保存任务失败"); |
1009 | 1019 | } |
... | ... | @@ -1503,6 +1513,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1503 | 1513 | && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { |
1504 | 1514 | // 属性一样的库存,相加合并。 |
1505 | 1515 | BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); |
1516 | + inventoryDetail1.setQty(totalQty); | |
1506 | 1517 | InventoryDetail inventoryDetail = new InventoryDetail(); |
1507 | 1518 | inventoryDetail.setId(inventoryDetail1.getId()); |
1508 | 1519 | inventoryDetail.setQty(totalQty); |
... | ... | @@ -1546,6 +1557,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1546 | 1557 | @Override |
1547 | 1558 | @Transactional(rollbackFor = Exception.class) |
1548 | 1559 | public Result completeEmptyInTask(TaskHeader taskHeader) { |
1560 | + log.info("开始完成空托入库任务"); | |
1549 | 1561 | String warehouseCode = taskHeader.getWarehouseCode(); |
1550 | 1562 | String toLocationCode = taskHeader.getToLocationCode(); |
1551 | 1563 | String containerCode = taskHeader.getContainerCode(); |
... | ... | @@ -1574,8 +1586,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1574 | 1586 | if (!success) { |
1575 | 1587 | throw new JeecgBootException("完成空托盘入库任务时, 更新库位的容器编码和状态失败"); |
1576 | 1588 | } |
1577 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1578 | - success = taskHeaderService.updateById(taskHeader); | |
1589 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1590 | + log.info("完成空托入库任务"); | |
1579 | 1591 | if (!success) { |
1580 | 1592 | throw new JeecgBootException("完成空托盘入库任务时, 更新任务失败"); |
1581 | 1593 | } |
... | ... | @@ -2244,7 +2256,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2244 | 2256 | public Result cancelShipmentTask(TaskHeader taskHeader) { |
2245 | 2257 | boolean success = shipmentContainerHeaderService.cancelShipmentTask(taskHeader); |
2246 | 2258 | if (!success) { |
2247 | - throw new JeecgBootException("取消入库任务时, 更新组盘头状态失败"); | |
2259 | + throw new JeecgBootException("取消出库任务时, 更新组盘头状态失败"); | |
2248 | 2260 | } |
2249 | 2261 | return Result.ok("取消出库任务成功"); |
2250 | 2262 | } |
... | ... |