#
taisheng
2025-05-09 aa538cf6967e63cf28b0aee43d3812b4cd468485
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());
            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);
        }
//        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);
//        }
        taskWrk.setWrkSts(9);
        taskWrk.setCompleteTime(now);//完结时间
        taskWrkService.updateById(taskWrk);
        return R.ok();
@@ -349,4 +352,32 @@
        }
    }
    @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")&&taskWrk.getIoType()==3){
            taskWrk.setWrkSts(9);//更新数据完成,直接转历史档
            //更新源库位状态为空库位
            LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint());
            locMast.setLocSts("O");
            locMastService.updateById(locMast);
            //更新目标库状态为在库
            LocMast locMast2 = locMastService.selectByLocNo(taskWrk.getTargetPoint());
            locMast2.setLocSts("F");
            locMastService.updateById(locMast2);
            taskWrk.setModiTime(now);//操作时间
            taskWrk.setModiUser(9998L);//操作员
            taskWrkService.updateById(taskWrk);
        }
        return R.ok();
    }
}