Commit 0e71c0b9912a1e5c600d48ae6a3a1f52cec9cbe1

Authored by 谭毅彬
1 parent 4433fd16

接口异常错误返回信息优化

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java
1 package org.jeecg.modules.wms.api.wcs.controller; 1 package org.jeecg.modules.wms.api.wcs.controller;
2 2
  3 +import java.net.SocketException;
  4 +
3 import javax.annotation.Resource; 5 import javax.annotation.Resource;
4 import javax.servlet.http.HttpServletRequest; 6 import javax.servlet.http.HttpServletRequest;
5 7
@@ -59,8 +61,7 @@ public class WcsController extends HuahengBaseController { @@ -59,8 +61,7 @@ public class WcsController extends HuahengBaseController {
59 Result result = handleMultiProcess("warecellAllocation", lockKey, new MultiProcessListener() { 61 Result result = handleMultiProcess("warecellAllocation", lockKey, new MultiProcessListener() {
60 @Override 62 @Override
61 public Result<?> doProcess() { 63 public Result<?> doProcess() {
62 - Result result = wcsService.warecellAllocation(warecellDomain);  
63 - return result; 64 + return wcsService.warecellAllocation(warecellDomain);
64 } 65 }
65 }); 66 });
66 return result; 67 return result;
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
@@ -107,8 +107,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService @@ -107,8 +107,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
107 searchNumber = Integer.parseInt(value); 107 searchNumber = Integer.parseInt(value);
108 } 108 }
109 String lastString = "ORDER BY layer asc, id asc limit " + searchNumber; 109 String lastString = "ORDER BY layer asc, id asc limit " + searchNumber;
110 - StopWatch stopWatch = new StopWatch();  
111 - stopWatch.start("aaa");  
112 List<Integer> removeRoadWays = new ArrayList<>(); 110 List<Integer> removeRoadWays = new ArrayList<>();
113 // 寻找可用巷道,空闲的空库位低于设定值,那么这个巷道就不能用来分配库位 111 // 寻找可用巷道,空闲的空库位低于设定值,那么这个巷道就不能用来分配库位
114 for (Integer roadWay : roadWays) { 112 for (Integer roadWay : roadWays) {
@@ -122,9 +120,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService @@ -122,9 +120,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
122 removeRoadWays.add(roadWay); 120 removeRoadWays.add(roadWay);
123 } 121 }
124 } 122 }
125 - stopWatch.stop();  
126 - System.out.println("waste aa:" + stopWatch.getLastTaskTimeMillis());  
127 - stopWatch.start("bbb");  
128 roadWays.removeAll(removeRoadWays); 123 roadWays.removeAll(removeRoadWays);
129 if (roadWays == null || roadWays.size() == 0) { 124 if (roadWays == null || roadWays.size() == 0) {
130 throw new JeecgBootException("分配库位时, 巷道为空"); 125 throw new JeecgBootException("分配库位时, 巷道为空");
@@ -147,8 +142,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService @@ -147,8 +142,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
147 } 142 }
148 } 143 }
149 locationList.removeAll(removeLocaationList); 144 locationList.removeAll(removeLocaationList);
150 - stopWatch.stop();  
151 - System.out.println("waste bb:" + stopWatch.getLastTaskTimeMillis());  
152 if (locationList.size() == 0) { 145 if (locationList.size() == 0) {
153 locationLambda = Wrappers.lambdaQuery(); 146 locationLambda = Wrappers.lambdaQuery();
154 locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) 147 locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
@@ -170,8 +163,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService @@ -170,8 +163,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
170 return null; 163 return null;
171 } 164 }
172 Location location = locationList.stream().findFirst().orElse(null); 165 Location location = locationList.stream().findFirst().orElse(null);
173 - String locationCode = location.getCode();  
174 - return locationCode; 166 + return location.getCode();
175 } 167 }
176 168
177 /** 169 /**
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java
1 package org.jeecg.modules.wms.api.wcs.service; 1 package org.jeecg.modules.wms.api.wcs.service;
2 2
  3 +import java.net.SocketException;
  4 +
3 import org.jeecg.common.api.vo.Result; 5 import org.jeecg.common.api.vo.Result;
4 import org.jeecg.modules.wms.api.wcs.entity.MaterialInfoEntity; 6 import org.jeecg.modules.wms.api.wcs.entity.MaterialInfoEntity;
5 import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; 7 import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain;
@@ -11,7 +13,8 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; @@ -11,7 +13,8 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
11 */ 13 */
12 public interface WcsService { 14 public interface WcsService {
13 15
14 - /** 仓位分配 */ 16 + /** 仓位分配
  17 + * @throws SocketException */
15 Result warecellAllocation(WarecellDomain warecellDomain); 18 Result warecellAllocation(WarecellDomain warecellDomain);
16 19
17 /** 20 /**
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
1 package org.jeecg.modules.wms.api.wcs.service; 1 package org.jeecg.modules.wms.api.wcs.service;
2 2
  3 +import java.net.SocketException;
3 import java.util.ArrayList; 4 import java.util.ArrayList;
4 import java.util.List; 5 import java.util.List;
5 import java.util.stream.Collectors; 6 import java.util.stream.Collectors;
@@ -59,43 +60,57 @@ public class WcsServiceImpl implements WcsService { @@ -59,43 +60,57 @@ public class WcsServiceImpl implements WcsService {
59 60
60 @Resource 61 @Resource
61 private IZoneService zoneService; 62 private IZoneService zoneService;
  63 +
62 @Resource 64 @Resource
63 private ITaskHeaderService taskHeaderService; 65 private ITaskHeaderService taskHeaderService;
  66 +
64 @Resource 67 @Resource
65 private ITaskDetailService taskDetailService; 68 private ITaskDetailService taskDetailService;
  69 +
66 @Resource 70 @Resource
67 private IContainerService containerService; 71 private IContainerService containerService;
  72 +
68 @Resource 73 @Resource
69 private ILocationTypeService locationTypeService; 74 private ILocationTypeService locationTypeService;
  75 +
70 @Resource 76 @Resource
71 private ILocationHighService locationHighService; 77 private ILocationHighService locationHighService;
  78 +
72 @Resource 79 @Resource
73 private IParameterConfigurationService parameterConfigurationService; 80 private IParameterConfigurationService parameterConfigurationService;
  81 +
74 @Resource 82 @Resource
75 private IReceiptContainerDetailService receiptContainerDetailService; 83 private IReceiptContainerDetailService receiptContainerDetailService;
  84 +
76 @Resource 85 @Resource
77 private IMaterialService materialService; 86 private IMaterialService materialService;
  87 +
78 @Resource 88 @Resource
79 private IReceiptContainerHeaderService receiptContainerHeaderService; 89 private IReceiptContainerHeaderService receiptContainerHeaderService;
  90 +
80 @Resource 91 @Resource
81 private LocationAllocationService locationAllocationService; 92 private LocationAllocationService locationAllocationService;
  93 +
82 @Resource 94 @Resource
83 private ILocationService locationService; 95 private ILocationService locationService;
  96 +
84 @Resource 97 @Resource
85 private IAddressService addressService; 98 private IAddressService addressService;
  99 +
86 @Resource 100 @Resource
87 private IContainerTypeService containerTypeService; 101 private IContainerTypeService containerTypeService;
88 102
89 /** 103 /**
90 * 库位分配 104 * 库位分配
  105 + * @throws SocketException
91 */ 106 */
92 @Override 107 @Override
93 @Transactional(rollbackFor = Exception.class) 108 @Transactional(rollbackFor = Exception.class)
94 @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情分配库位'", extra = "#extraJsonString", 109 @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情分配库位'", extra = "#extraJsonString",
95 - msg = "'任务ID:' + #warecellDomain.getTaskNo() + ',库位编码:' + #locationCode", condition = "#receiptContainerDetailList.size() > 0", recordReturnValue = true)  
96 - @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'分配库位'", extra = "''", 110 + msg = "'任务ID:' + #warecellDomain.getTaskNo() + ',库位编码:' + #locationCode", condition = "null != #success && #success", recordReturnValue = true)
  111 + @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'分配库位'",
97 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", 112 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()",
98 - recordReturnValue = true) 113 + condition = "null != #success && #success", recordReturnValue = true)
99 public Result warecellAllocation(WarecellDomain warecellDomain) { 114 public Result warecellAllocation(WarecellDomain warecellDomain) {
100 log.info("开始分配库位"); 115 log.info("开始分配库位");
101 String warehouseCode = warecellDomain.getWarehouseCode(); 116 String warehouseCode = warecellDomain.getWarehouseCode();
@@ -247,14 +262,15 @@ public class WcsServiceImpl implements WcsService { @@ -247,14 +262,15 @@ public class WcsServiceImpl implements WcsService {
247 if (!taskHeaderService.updateById(taskHeader)) { 262 if (!taskHeaderService.updateById(taskHeader)) {
248 throw new JeecgBootException("更新任务头表目标库位失败"); 263 throw new JeecgBootException("更新任务头表目标库位失败");
249 } 264 }
250 - 265 +
251 WcsTask wcsTask = new WcsTask(); 266 WcsTask wcsTask = new WcsTask();
252 wcsTask.setToLocationCode(locationCode); 267 wcsTask.setToLocationCode(locationCode);
253 wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); 268 wcsTask.setPreTaskNo(String.valueOf(preTaskNo));
254 - LogRecordContext.putVariable("locationCode", locationCode);// 操作日志收集  
255 - LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集  
256 - LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集  
257 - LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 269 + // 操作日志收集
  270 + LogRecordContext.putVariable("locationCode", locationCode);
  271 + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));
  272 + LogRecordContext.putVariable("taskHeader", taskHeader);
  273 + LogRecordContext.putVariable("success", true);
258 log.info("完成分配库位,任务号:" + taskNo + ", 库位号:" + locationCode); 274 log.info("完成分配库位,任务号:" + taskNo + ", 库位号:" + locationCode);
259 return Result.OK(wcsTask); 275 return Result.OK(wcsTask);
260 } 276 }
@@ -263,7 +279,7 @@ public class WcsServiceImpl implements WcsService { @@ -263,7 +279,7 @@ public class WcsServiceImpl implements WcsService {
263 @Transactional(rollbackFor = Exception.class) 279 @Transactional(rollbackFor = Exception.class)
264 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'任务下发'", extra = "''", 280 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'任务下发'", extra = "''",
265 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", 281 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()",
266 - recordReturnValue = true) 282 + condition = "null != #success && #success", recordReturnValue = true)
267 public Result wcsTaskAssign(TaskHeader taskHeader) { 283 public Result wcsTaskAssign(TaskHeader taskHeader) {
268 if (taskHeader == null) { 284 if (taskHeader == null) {
269 return Result.error("wms任务为空"); 285 return Result.error("wms任务为空");
@@ -415,6 +431,7 @@ public class WcsServiceImpl implements WcsService { @@ -415,6 +431,7 @@ public class WcsServiceImpl implements WcsService {
415 } 431 }
416 } 432 }
417 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 433 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集
  434 + LogRecordContext.putVariable("success", true);
418 return Result.ok("下发任务成功"); 435 return Result.ok("下发任务成功");
419 } 436 }
420 437
@@ -500,7 +517,7 @@ public class WcsServiceImpl implements WcsService { @@ -500,7 +517,7 @@ public class WcsServiceImpl implements WcsService {
500 @Transactional(rollbackFor = Exception.class) 517 @Transactional(rollbackFor = Exception.class)
501 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'空出处理'", extra = "''", 518 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'空出处理'", extra = "''",
502 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", 519 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()",
503 - recordReturnValue = true) 520 + condition = "null != #success && #success", recordReturnValue = true)
504 public Result emptyOutHandle(String taskNo) { 521 public Result emptyOutHandle(String taskNo) {
505 if (StringUtils.isEmpty(taskNo)) { 522 if (StringUtils.isEmpty(taskNo)) {
506 return Result.error("任务号为空"); 523 return Result.error("任务号为空");
@@ -525,7 +542,9 @@ public class WcsServiceImpl implements WcsService { @@ -525,7 +542,9 @@ public class WcsServiceImpl implements WcsService {
525 if (!success) { 542 if (!success) {
526 return Result.error("修改任务失败,空出处理失败"); 543 return Result.error("修改任务失败,空出处理失败");
527 } 544 }
528 - LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 545 + // 操作日志收集
  546 + LogRecordContext.putVariable("taskHeader", taskHeader);
  547 + LogRecordContext.putVariable("success", true);
529 return Result.ok("空出处理成功"); 548 return Result.ok("空出处理成功");
530 } 549 }
531 550
@@ -533,7 +552,7 @@ public class WcsServiceImpl implements WcsService { @@ -533,7 +552,7 @@ public class WcsServiceImpl implements WcsService {
533 @Transactional(rollbackFor = Exception.class) 552 @Transactional(rollbackFor = Exception.class)
534 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'重入处理'", extra = "''", 553 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'重入处理'", extra = "''",
535 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", 554 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()",
536 - recordReturnValue = true) 555 + condition = "null != #success && #success", recordReturnValue = true)
537 public Result reentryHandle(String taskNo) { 556 public Result reentryHandle(String taskNo) {
538 // 1、判断非空字段 557 // 1、判断非空字段
539 if (StringUtils.isEmpty(taskNo)) { 558 if (StringUtils.isEmpty(taskNo)) {
@@ -630,7 +649,9 @@ public class WcsServiceImpl implements WcsService { @@ -630,7 +649,9 @@ public class WcsServiceImpl implements WcsService {
630 TaskReentryEntity taskReentryEntity = new TaskReentryEntity(); 649 TaskReentryEntity taskReentryEntity = new TaskReentryEntity();
631 taskReentryEntity.setTaskNo(Integer.parseInt(taskNo)); 650 taskReentryEntity.setTaskNo(Integer.parseInt(taskNo));
632 taskReentryEntity.setRedirectionLocationCode(locationCode); 651 taskReentryEntity.setRedirectionLocationCode(locationCode);
633 - LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 652 + // 操作日志收集
  653 + LogRecordContext.putVariable("taskHeader", taskHeader);
  654 + LogRecordContext.putVariable("success", true);
634 return Result.ok(taskReentryEntity); 655 return Result.ok(taskReentryEntity);
635 } 656 }
636 657
@@ -638,7 +659,7 @@ public class WcsServiceImpl implements WcsService { @@ -638,7 +659,7 @@ public class WcsServiceImpl implements WcsService {
638 @Transactional(rollbackFor = Exception.class) 659 @Transactional(rollbackFor = Exception.class)
639 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'取货错处理'", extra = "''", 660 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'取货错处理'", extra = "''",
640 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", 661 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()",
641 - recordReturnValue = true) 662 + condition = "null != #success && #success", recordReturnValue = true)
642 public Result pickupErrorHandle(String taskNo) { 663 public Result pickupErrorHandle(String taskNo) {
643 // 1、判断非空字段 664 // 1、判断非空字段
644 if (StringUtils.isEmpty(taskNo)) { 665 if (StringUtils.isEmpty(taskNo)) {
@@ -662,6 +683,7 @@ public class WcsServiceImpl implements WcsService { @@ -662,6 +683,7 @@ public class WcsServiceImpl implements WcsService {
662 return Result.error("取货错处理失败,更新任务失败"); 683 return Result.error("取货错处理失败,更新任务失败");
663 } 684 }
664 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 685 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集
  686 + LogRecordContext.putVariable("success", true);
665 return Result.ok("取货错处理成功"); 687 return Result.ok("取货错处理成功");
666 } 688 }
667 689
@@ -669,7 +691,7 @@ public class WcsServiceImpl implements WcsService { @@ -669,7 +691,7 @@ public class WcsServiceImpl implements WcsService {
669 @Transactional(rollbackFor = Exception.class) 691 @Transactional(rollbackFor = Exception.class)
670 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'到达站台'", extra = "''", 692 @OperationLog(bizId = "#taskHeader.getId()", bizType = "'任务追踪'", tag = "'到达站台'", extra = "''",
671 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", 693 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()",
672 - recordReturnValue = true) 694 + condition = "null != #success && #success", recordReturnValue = true)
673 public Result arrivedNotice(String taskNo, String port) { 695 public Result arrivedNotice(String taskNo, String port) {
674 TaskHeader taskHeader = taskHeaderService.getById(taskNo); 696 TaskHeader taskHeader = taskHeaderService.getById(taskNo);
675 if (taskHeader == null) { 697 if (taskHeader == null) {
@@ -685,7 +707,9 @@ public class WcsServiceImpl implements WcsService { @@ -685,7 +707,9 @@ public class WcsServiceImpl implements WcsService {
685 if (!result) { 707 if (!result) {
686 return Result.error("更新到达站台失败"); 708 return Result.error("更新到达站台失败");
687 } 709 }
688 - LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 710 + // 操作日志收集
  711 + LogRecordContext.putVariable("taskHeader", taskHeader);
  712 + LogRecordContext.putVariable("success", true);
689 return Result.ok("更新到达站台成功"); 713 return Result.ok("更新到达站台成功");
690 } 714 }
691 715
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/HuahengBaseController.java
@@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit; @@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit;
5 import javax.annotation.Nonnull; 5 import javax.annotation.Nonnull;
6 6
7 import org.jeecg.common.api.vo.Result; 7 import org.jeecg.common.api.vo.Result;
  8 +import org.jeecg.common.exception.JeecgBootException;
8 import org.jeecg.utils.support.RedissonDistributedLocker; 9 import org.jeecg.utils.support.RedissonDistributedLocker;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 11
@@ -73,7 +74,7 @@ public class HuahengBaseController { @@ -73,7 +74,7 @@ public class HuahengBaseController {
73 result = multiProcessListener.doProcess(); 74 result = multiProcessListener.doProcess();
74 } catch (Exception e) { 75 } catch (Exception e) {
75 log.error("[{}] 执行分布式事务失败 lockKey = {},errorMessage = {}", taskName, fullLockKey, ExceptionUtil.getMessage(e), e); 76 log.error("[{}] 执行分布式事务失败 lockKey = {},errorMessage = {}", taskName, fullLockKey, ExceptionUtil.getMessage(e), e);
76 - throw ExceptionUtil.convertFromOrSuppressedThrowable(e, RuntimeException.class); 77 + return Result.error(ExceptionUtil.getMessage(e));
77 } finally { 78 } finally {
78 redissonDistributedLocker.unlock(fullLockKey); 79 redissonDistributedLocker.unlock(fullLockKey);
79 final long finishTime = SystemClock.now(); 80 final long finishTime = SystemClock.now();
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -196,8 +196,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -196,8 +196,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
196 return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "未找到"); 196 return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "未找到");
197 } 197 }
198 Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); 198 Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
199 - if (fromLocation == null) {  
200 - return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "未找到"); 199 + if (toLocation == null) {
  200 + return Result.error("创建移库任务时,目标库位:" + toLocation + "未找到");
201 } 201 }
202 String containerCode = fromLocation.getContainerCode(); 202 String containerCode = fromLocation.getContainerCode();
203 // 这里增加组盘校验,如果此托盘存在未完成的组盘数据,则不能移库 203 // 这里增加组盘校验,如果此托盘存在未完成的组盘数据,则不能移库
@@ -979,11 +979,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -979,11 +979,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
979 @Transactional(rollbackFor = Exception.class) 979 @Transactional(rollbackFor = Exception.class)
980 @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'入库任务完成'", extra = "#extraJsonString1", 980 @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'入库任务完成'", extra = "#extraJsonString1",
981 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", 981 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()",
982 - condition = "#taskDetailList.size() > 0", recordReturnValue = true) 982 + condition = "null != #success && #success", recordReturnValue = true)
983 @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库任务完成'", extra = "#extraJsonString1", 983 @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库任务完成'", extra = "#extraJsonString1",
984 msg = "'任务ID:' + #taskHeader.getId() + ',库位编码:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", 984 msg = "'任务ID:' + #taskHeader.getId() + ',库位编码:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()",
985 - condition = "#taskDetailList.size() > 0", recordReturnValue = true)  
986 - @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情入库完成'", extra = "#extraJsonString2", msg = "''", condition = "#receiptDetaiList.size() > 0", 985 + condition = "null != #success && #success", recordReturnValue = true)
  986 + @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情入库完成'", extra = "#extraJsonString2", msg = "''", condition = "null != #success && #success",
987 recordReturnValue = true) 987 recordReturnValue = true)
988 public Result completeReceiptTask(TaskHeader taskHeader) { 988 public Result completeReceiptTask(TaskHeader taskHeader) {
989 if (taskHeader == null) { 989 if (taskHeader == null) {
@@ -1161,11 +1161,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -1161,11 +1161,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1161 } 1161 }
1162 receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); 1162 receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList());
1163 LogRecordContext.putVariable("taskHeader", taskHeader); 1163 LogRecordContext.putVariable("taskHeader", taskHeader);
1164 - LogRecordContext.putVariable("taskDetailList", taskDetailList);  
1165 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); 1164 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList));
1166 - LogRecordContext.putVariable("receiptDetaiList", receiptDetaiList);  
1167 LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(receiptDetaiList)); 1165 LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(receiptDetaiList));
1168 - log.info("完成入库任务, 任务号" + taskHeader.getId()); 1166 + LogRecordContext.putVariable("success", true);// 操作日志收集
  1167 + log.info("完成入库任务, 任务号:" + taskHeader.getId());
1169 return Result.ok("完成入库任务"); 1168 return Result.ok("完成入库任务");
1170 } 1169 }
1171 1170
@@ -1178,11 +1177,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -1178,11 +1177,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1178 @Transactional(rollbackFor = Exception.class) 1177 @Transactional(rollbackFor = Exception.class)
1179 @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1", 1178 @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1",
1180 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", 1179 msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()",
1181 - condition = "#taskDetailList.size() > 0", recordReturnValue = true) 1180 + condition = "null != #success && #success", recordReturnValue = true)
1182 @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1", 1181 @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1",
1183 msg = "'任务ID:' + #taskHeader.getId() + ',库位编码:' + #taskHeader.getFromLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", 1182 msg = "'任务ID:' + #taskHeader.getId() + ',库位编码:' + #taskHeader.getFromLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()",
1184 - recordReturnValue = true)  
1185 - @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情出库完成'", extra = "#extraJsonString2", msg = "''", condition = "#shipmentDetailList.size() > 0", 1183 + condition = "null != #success && #success", recordReturnValue = true)
  1184 + @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情出库完成'", extra = "#extraJsonString2", msg = "''", condition = "null != #success && #success",
1186 recordReturnValue = true) 1185 recordReturnValue = true)
1187 public Result completeShipmentTask(TaskHeader taskHeader) { 1186 public Result completeShipmentTask(TaskHeader taskHeader) {
1188 if (taskHeader == null) { 1187 if (taskHeader == null) {
@@ -1193,7 +1192,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -1193,7 +1192,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1193 String fromLocationCode = taskHeader.getFromLocationCode(); 1192 String fromLocationCode = taskHeader.getFromLocationCode();
1194 String toLocationCode = taskHeader.getToLocationCode(); 1193 String toLocationCode = taskHeader.getToLocationCode();
1195 String containerCode = taskHeader.getContainerCode(); 1194 String containerCode = taskHeader.getContainerCode();
1196 - String zoneCode = taskHeader.getZoneCode();  
1197 int taskType = taskHeader.getTaskType(); 1195 int taskType = taskHeader.getTaskType();
1198 List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); 1196 List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId());
1199 boolean success = false; 1197 boolean success = false;
@@ -1383,10 +1381,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -1383,10 +1381,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1383 // 操作记录添加 1381 // 操作记录添加
1384 shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); 1382 shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList());
1385 LogRecordContext.putVariable("taskHeader", taskHeader); 1383 LogRecordContext.putVariable("taskHeader", taskHeader);
1386 - LogRecordContext.putVariable("taskDetailList", taskDetailList); // 操作记录添加  
1387 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); 1384 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList));
1388 - LogRecordContext.putVariable("shipmentDetailList", shipmentDetailList);  
1389 LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(shipmentDetailList)); 1385 LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(shipmentDetailList));
  1386 + LogRecordContext.putVariable("success", true);
1390 log.info("完成出库任务,任务号:" + taskHeader.getId()); 1387 log.info("完成出库任务,任务号:" + taskHeader.getId());
1391 return Result.ok("完成出库任务"); 1388 return Result.ok("完成出库任务");
1392 } 1389 }