#
zwl
2025-06-08 91eca979b480dff62809368a5c6563c9e0fcc851
src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -69,7 +69,9 @@
        EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        }
        return R.ok(taskWrkService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -214,36 +216,8 @@
            locMast.setBarcode(taskWrk.getBarcode());
        }
        String response="";
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("TaskNo",taskWrk.getTaskNo());
            headParam.put("Result",1);
//            headParam.put("reportTime",new Date());
            log.info("wcs手动完成任务上报wms={}", 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);
        }
        locMastService.updateById(locMast);
        taskWrk.setStatus(7);//手动完成任务
        taskWrk.setStatus(6);//手动完成任务
        taskWrk.setModiTime(new Date());
        taskWrkService.updateById(taskWrk);
        return R.ok();
@@ -290,34 +264,7 @@
        }catch (Exception e){
            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);
        }
        taskWrk.setStatus(4);//手动取消
        taskWrk.setCompleteTime(now);//完结时间
        taskWrkService.updateById(taskWrk);
        return R.ok();
@@ -354,32 +301,40 @@
    @PostMapping(value = "/taskWrk/state")
//    @ManagerAuth(memo = "接收RCS任务状态")
    public R taskWrkState(@RequestBody NotifyDto notifyDto) {
        R r = R.ok();
        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")){
        /**
         * 任务完成
         */
        switch (notifyDto.getMsgType()) {
            case "task_complete":
                r = taskWrkService.taskComplete(taskWrk);
                break;
        }
        if(notifyDto.getMsgType().equals("task_complete")&&taskWrk.getIoType()==3){
            taskWrk.setWrkSts(7);//更新数据完成,直接转历史档
            //更新源库位状态为空库位
            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();
//        if (notifyDto.getMsgType().equals("task_complete") && taskWrk.getIoType() == 3) {//移库
//            taskWrk.setWrkSts(7);//更新数据完成,直接转历史档
//
//            //更新源库位状态为空库位
//            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;
    }
}