Commit b71ec74252f2144bd5bacb6699f17a7d854aa720
1 parent
04b1bd23
增加取消任务接口
Showing
4 changed files
with
45 additions
and
8 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ import java.util.stream.Collectors; |
7 | 7 | import javax.annotation.Resource; |
8 | 8 | |
9 | 9 | import org.jeecg.common.api.vo.Result; |
10 | +import org.jeecg.common.exception.JeecgBootException; | |
10 | 11 | import org.jeecg.modules.wms.api.wcs.entity.MaterialInfoEntity; |
11 | 12 | import org.jeecg.modules.wms.api.wcs.entity.TaskReentryEntity; |
12 | 13 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; |
... | ... | @@ -42,7 +43,6 @@ import org.springframework.stereotype.Service; |
42 | 43 | import org.springframework.transaction.annotation.Transactional; |
43 | 44 | |
44 | 45 | import com.alibaba.fastjson.JSON; |
45 | -import org.jeecg.common.exception.JeecgBootException; | |
46 | 46 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
47 | 47 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
48 | 48 | |
... | ... | @@ -408,7 +408,32 @@ public class WcsServiceImpl implements WcsService { |
408 | 408 | } |
409 | 409 | } |
410 | 410 | LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 |
411 | - return Result.ok("下发成功"); | |
411 | + return Result.ok("下发任务成功"); | |
412 | + } | |
413 | + | |
414 | + @Override | |
415 | + public Result cancelWcsTask(TaskHeader taskHeader) { | |
416 | + WcsTask wcsTask = new WcsTask(); | |
417 | + wcsTask.setTaskNo(String.valueOf(taskHeader.getId())); | |
418 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CONNECT_WCS); | |
419 | + if (StringUtils.isEmpty(value)) { | |
420 | + throw new JeecgBootException("下发任务时,没有找到连接WCS的数据配置"); | |
421 | + } | |
422 | + int connectWCS = Integer.parseInt(value); | |
423 | + if (connectWCS == QuantityConstant.RULE_WCS_CONNECT) { | |
424 | + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TASK_CANCEL); | |
425 | + String jsonParam = JSON.toJSONString(wcsTask); | |
426 | + System.out.println(jsonParam); | |
427 | + String body = OkHttpUtils.sendPostByJsonStr(url, jsonParam); | |
428 | + if (StringUtils.isEmpty(body)) { | |
429 | + throw new JeecgBootException("接口地址错误或返回为空"); | |
430 | + } | |
431 | + Result result = JSON.parseObject(body, Result.class); | |
432 | + if (result.getCode() != QuantityConstant.HTTP_OK) { | |
433 | + return Result.error(result.getMessage()); | |
434 | + } | |
435 | + } | |
436 | + return Result.ok("取消任务成功"); | |
412 | 437 | } |
413 | 438 | |
414 | 439 | // wcs任务类型 入库 = 100 , 出库 = 300,分拣出库 = 400 ,移库 = 800,换站=1000 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -882,6 +882,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
882 | 882 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
883 | 883 | return Result.ok("任务(" + taskId + ")任务已经是完成的!"); |
884 | 884 | } |
885 | + if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { | |
886 | + Result result = wcsService.cancelWcsTask(taskHeader); | |
887 | + if (!result.isSuccess()) { | |
888 | + return result; | |
889 | + } | |
890 | + } | |
885 | 891 | int taskType = taskHeader.getTaskType().intValue(); |
886 | 892 | int preTaskNo = taskId; |
887 | 893 | String warehouseCode = taskHeader.getWarehouseCode(); |
... | ... | @@ -1119,6 +1125,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1119 | 1125 | inventoryHeader.setContainerCode(containerCode); |
1120 | 1126 | inventoryHeader.setLocationCode(toLocationCode); |
1121 | 1127 | inventoryHeader.setTotalWeight(taskHeader.getWeight()); |
1128 | + inventoryHeader.setCreateBy(taskHeader.getCreateBy()); | |
1122 | 1129 | inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_SOME); |
1123 | 1130 | inventoryHeader.setEnable(QuantityConstant.STATUS_ENABLE); |
1124 | 1131 | if (!inventoryHeaderService.save(inventoryHeader)) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/interceptor/HuahengBatisInterceptor.java
... | ... | @@ -109,12 +109,12 @@ public class HuahengBatisInterceptor implements Interceptor { |
109 | 109 | try { |
110 | 110 | if ("updateBy".equals(field.getName())) { |
111 | 111 | // 获取登录用户信息 |
112 | - if (sysUser != null) { | |
113 | - // 登录账号 | |
114 | - field.setAccessible(true); | |
115 | - field.set(parameter, HuahengJwtUtil.getCurrentOperator()); | |
116 | - field.setAccessible(false); | |
117 | - } | |
112 | +// if (sysUser != null) { | |
113 | + // 登录账号 | |
114 | + field.setAccessible(true); | |
115 | + field.set(parameter, HuahengJwtUtil.getCurrentOperator()); | |
116 | + field.setAccessible(false); | |
117 | +// } | |
118 | 118 | } |
119 | 119 | if ("updateTime".equals(field.getName())) { |
120 | 120 | field.setAccessible(true); |
... | ... |