#
taisheng
2025-05-24 53ae8e478f6034579303c51bdf881ffa526c942c
src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -11,6 +11,8 @@
import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.entity.TaskWrkLog;
import com.zy.asrs.entity.param.NotifyDto;
import com.zy.asrs.entity.param.TaskOverToWms;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.CommandInfoService;
@@ -289,33 +291,34 @@
            taskWrk.setModiUser(9999L);//操作员
        }
        String response="";
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("TaskNo",taskWrk.getTaskNo());
            headParam.put("Result",0);
//            headParam.put("reportTime",new Date());
//        try{
//            HashMap<String, Object> headParam = new HashMap<>();
//            headParam.put("TaskNo",taskWrk.getTaskNo());
//            headParam.put("Result",0);
////            headParam.put("reportTime",new Date());
//
//            log.info("wcs手动取消任务上报wm={}", taskWrk);
//            response = new HttpHandler.Builder()
//                    // .setHeaders(headParam)
//                    .setUri(wmsUrl)
//                    .setPath(TaskExecCallback)
//                    .setJson(JSON.toJSONString(headParam))
//                    .build()
//                    .doPost();
//            JSONObject jsonObject = JSON.parseObject(response);
//            apiLogService.save("wcs手动取消任务上报wms"
//                    ,wmsUrl+TaskExecCallback
//                    ,null
//                    ,"127.0.0.1"
//                    ,JSON.toJSONString(headParam)
//                    ,response
//                    ,true
//            );
//        }catch (Exception e){
//            log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response);
////            throw new CoolException(e);
//        }
            log.info("wcs手动取消任务上报wm={}", taskWrk);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(TaskExecCallback)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            apiLogService.save("wcs手动取消任务上报wms"
                    ,wmsUrl+TaskExecCallback
                    ,null
                    ,"127.0.0.1"
                    ,JSON.toJSONString(headParam)
                    ,response
                    ,true
            );
        }catch (Exception e){
            log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response);
//            throw new CoolException(e);
        }
        taskWrk.setCompleteTime(now);//完结时间
        taskWrkService.updateById(taskWrk);
        return R.ok();
@@ -349,4 +352,29 @@
        }
    }
    @PostMapping(value = "/taskWrk/state")
//    @ManagerAuth(memo = "接收RCS任务状态")
    public R taskWrkState(@RequestBody NotifyDto notifyDto) {
        log.info("接收RCS任务状态={}", notifyDto);
        TaskWrk taskWrk = taskWrkService.selectByTaskNo(notifyDto.getSuperTaskNo());//wms任务号
        if (taskWrk == null) {
            return R.error("没有找到该任务={"+notifyDto+"}");
        }
        Date now = new Date();
        if (notifyDto.getMsgType().equals("task_complete")) {
            if (taskWrk.getIoType() == 1 || taskWrk.getIoType() == 3) {
                taskWrk.setWrkSts(8);//更新数据
                taskWrk.setModiTime(now);//操作时间
                taskWrk.setModiUser(9998L);//操作员
                taskWrkService.updateById(taskWrk);
            } else if (taskWrk.getIoType() == 2) {
                taskWrk.setWrkSts(18);//更新数据
                taskWrk.setModiTime(now);//操作时间
                taskWrk.setModiUser(9998L);//操作员
                taskWrkService.updateById(taskWrk);
            }
        }
        return R.ok();
    }
}