自动化立体仓库 - WCS系统
#
lsh
2024-03-21 b9927bd58cdc940069c7640f3cc04a60dd37ef87
src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -6,11 +6,13 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.entity.param.TaskOverToWms;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.CommandInfoService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.TaskWrkService;
@@ -42,6 +44,12 @@
    @Autowired
    private LocMastService locMastService;
    @Value("${wms.taskStatusFeedbackPath}")
    private String taskStatusFeedbackPath;
    @Autowired
    private ApiLogService apiLogService;
    @RequestMapping(value = "/taskWrk/{wrkNo}/auth")
    @ManagerAuth
@@ -204,11 +212,39 @@
                locMast.setBarcode(taskWrk.getBarcode());
            }
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("taskNo",taskWrk.getTaskNo());
            headParam.put("status",taskWrk.getStatus());
            headParam.put("ioType",taskWrk.getIoType());
            headParam.put("barcode",taskWrk.getBarcode());
            headParam.put("reportTime",new Date());
            String response;
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            apiLogService.save("wcs派发入库任务上报wms"
                    ,wmsUrl+taskStatusFeedbackPath
                    ,null
                    ,"127.0.0.1"
                    ,JSON.toJSONString(headParam)
                    ,response
                    ,true
            );
        }catch (Exception e){
            log.error("wcs手动取消任务上报wms失败", taskWrk);
            throw new CoolException("wcs派发入库任务上报wms失败");
        }
            locMastService.updateById(locMast);
            taskWrk.setStatus(7);//手动完成任务
            taskWrk.setModiTime(new Date());
            taskWrkService.updateById(taskWrk);
        return R.ok();
    }
@@ -230,6 +266,35 @@
        }catch (Exception e){
            taskWrk.setModiUser(9999L);//操作员
        }
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("taskNo",taskWrk.getTaskNo());
            headParam.put("status",taskWrk.getStatus());
            headParam.put("ioType",taskWrk.getIoType());
            headParam.put("barcode",taskWrk.getBarcode());
            headParam.put("reportTime",new Date());
            String response;
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            apiLogService.save("wcs派发入库任务上报wms"
                    ,wmsUrl+taskStatusFeedbackPath
                    ,null
                    ,"127.0.0.1"
                    ,JSON.toJSONString(headParam)
                    ,response
                    ,true
            );
        }catch (Exception e){
            log.error("wcs手动完结任务上报wms失败", taskWrk);
            throw new CoolException("wcs派发入库任务上报wms失败");
        }
        taskWrk.setCompleteTime(now);//完结时间
        taskWrkService.updateById(taskWrk);
        return R.ok();