diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index e575119..34cb7c8 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -2,9 +2,15 @@ package org.nl.modules.quartz.task; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.DeviceAppService; @@ -14,6 +20,7 @@ import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.modules.wql.util.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -35,13 +42,11 @@ public class AutoCreateInst { InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); List list = taskserver.queryAll("task_status = '0'"); for (int i = 0; i < list.size(); i++) { TaskDto acsTask = list.get(i); - if(StrUtil.equals(acsTask.getTask_type(),"7") && !StrUtil.startWith(acsTask.getTask_code(), "-") ){ - continue; - } String taskid = acsTask.getTask_id(); String taskcode = acsTask.getTask_code(); String task_type = acsTask.getTask_type(); @@ -49,32 +54,50 @@ public class AutoCreateInst { String storage_task_type = acsTask.getStorage_task_type(); String priority = acsTask.getPriority(); String is_send = acsTask.getIs_send(); - String start_device_code = acsTask.getStart_device_code(); String start_point_code = acsTask.getStart_point_code(); - String put_device_code = acsTask.getPut_device_code(); String put_point_code = acsTask.getPut_point_code(); - String next_device_code = acsTask.getNext_device_code(); String next_point_code = acsTask.getNext_point_code(); - String start_point_code2 = acsTask.getStart_point_code2(); String start_device_code2 = acsTask.getStart_device_code2(); - String next_point_code2 = acsTask.getNext_point_code2(); String next_device_code2 = acsTask.getNext_device_code2(); - - String route_plan_code = acsTask.getRoute_plan_code(); String vehicleType = acsTask.getVehicle_type(); String agv_system_type = acsTask.getAgv_system_type(); - - if (StrUtil.equals(is_send, "0")) { continue; } - + String start_device = appService + .findDeviceByCode(start_device_code) + .getDeviceDriverDefination() + .getFitDeviceTypes() + .get(0) + .name(); + if (StrUtil.equals("storage", start_device)) { + JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("vehicle_code", acsTask.getVehicle_code()); + map.put("status", "5"); + map.put("device_code", acsTask.getStart_point_code()); + map.put("task_code", acsTask.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + JSONObject resp = JSONObject.parseObject(httpResponse.body()); + if (resp.getInteger("status") == 200) { + log.info("任务号:{},acs反馈wms请求货架取货成功,wms允许agv取货", acsTask.getTask_code()); + } else { + log.info("任务号:{},acs反馈wms请求货架取货成功,wms不允许agv取货", acsTask.getTask_code()); + continue; + } + } else { + log.warn("任务号:{},acs反馈wms请求货架取货成功,连接被拒绝", acsTask.getTask_code()); + continue; + } + } //校验路由关系 List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); if (ObjectUtils.isEmpty(shortPathsList)) {