|
|
@ -10,12 +10,16 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.acs.AcsConfig; |
|
|
|
import org.nl.acs.agv.AgvUtil; |
|
|
|
import org.nl.acs.agv.server.ZheDaAgvService; |
|
|
|
import org.nl.acs.agv.server.dto.AgvDto; |
|
|
|
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.lubei_conveyor.LubeiConveyorDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsZDService; |
|
|
|
import org.nl.acs.instruction.service.InstructionService; |
|
|
|
import org.nl.acs.instruction.service.dto.Instruction; |
|
|
|
import org.nl.acs.log.LokiLog; |
|
|
@ -25,14 +29,23 @@ import org.nl.acs.opc.DeviceAppService; |
|
|
|
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
import org.nl.acs.task.service.dto.TaskDto; |
|
|
|
import org.nl.config.server.AcsConfigService; |
|
|
|
import org.nl.modules.system.service.ParamService; |
|
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
AcsConfigService acsConfigService; |
|
|
|
Map<String, AgvDto> AGVDeviceStatus = new HashMap(); |
|
|
|
private final ParamService paramService; |
|
|
|
@LokiLog(type = LokiLogType.AGV) |
|
|
|
@Override |
|
|
@ -73,13 +86,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); |
|
|
|
|
|
|
|
|
|
|
|
//不同楼层下发不同的agv系统
|
|
|
|
if (task_type.equals("1")) { |
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code(); |
|
|
|
} else { |
|
|
|
agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code(); |
|
|
|
} |
|
|
|
log.info("下发agv任务请求:{}", agvurl); |
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
@ -96,20 +103,28 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
@LokiLog(type = LokiLogType.AGV) |
|
|
|
@Override |
|
|
|
//ZDAGV
|
|
|
|
public HttpResponse queryAgvInstStatus(String type) { |
|
|
|
public HttpResponse queryAgvInstStatus() { |
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { |
|
|
|
String agvurl = ""; |
|
|
|
String agvport = ""; |
|
|
|
if (type.equals("1")) { |
|
|
|
agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/vehicles"; |
|
|
|
HttpResponse result = HttpRequest.get(agvurl) |
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
.execute(); |
|
|
|
System.out.println("查询agv指令数据:" + result.body()); |
|
|
|
|
|
|
|
return result; |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
} |
|
|
|
if (type.equals("2")) { |
|
|
|
agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); |
|
|
|
agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); |
|
|
|
} |
|
|
|
|
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders"; |
|
|
|
@Override |
|
|
|
public HttpResponse queryZDAgvDeviceStatus() { |
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { |
|
|
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/vehicles"; |
|
|
|
HttpResponse result = HttpRequest.get(agvurl) |
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
.execute(); |
|
|
@ -120,11 +135,13 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@LokiLog(type = LokiLogType.AGV) |
|
|
|
@Override |
|
|
|
//ZDAGV
|
|
|
|
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) { |
|
|
|
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action); |
|
|
|
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle,String feedbackStatus) |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action+",feedbackStatus:"+feedbackStatus); |
|
|
|
//释放AGV资源,继续后续动作
|
|
|
|
boolean is_feedback = false; |
|
|
|
String str = ""; |
|
|
@ -137,7 +154,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
} |
|
|
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); |
|
|
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); |
|
|
|
// AcsToWmsService acsToWmsService=SpringContextHolder.getBean("acsToWmsServiceImpl");
|
|
|
|
AcsToWmsZDService acsToWmsZDService = SpringContextHolder.getBean("acsToWmsZDServiceImpl"); |
|
|
|
|
|
|
|
Instruction inst = instructionService.findByCodeFromCache(jobno); |
|
|
|
TaskDto task = taskService.findByCode(inst.getTask_code()); |
|
|
@ -145,248 +163,158 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
|
Device addressdevice = appService.findDeviceByCode(address); |
|
|
|
|
|
|
|
CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver; |
|
|
|
EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver; |
|
|
|
HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver; |
|
|
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; |
|
|
|
PaintConveyorDeviceDriver paintConveyorDeviceDriver; |
|
|
|
|
|
|
|
LubeiConveyorDeviceDriver lubeiConveyorDeviceDriver; |
|
|
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; |
|
|
|
//取货的进入前等待和离开等待
|
|
|
|
if (action.equals("Load")) { |
|
|
|
if ("EntryRequired".equals(type)) { |
|
|
|
//共挤线三工位
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { |
|
|
|
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) { |
|
|
|
inst.setExecute_status("1"); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
} |
|
|
|
//叠盘位
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { |
|
|
|
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); |
|
|
|
if (number < Integer.valueOf(str)) { |
|
|
|
log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
inst.setExecute_status("1"); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
//货梯对接线
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { |
|
|
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) { |
|
|
|
inst.setExecute_status("1"); |
|
|
|
//
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) { |
|
|
|
lubeiConveyorDeviceDriver = (LubeiConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if(lubeiConveyorDeviceDriver.getMove()==1 && lubeiConveyorDeviceDriver.getAction()==1){ |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
} |
|
|
|
//豪凯自动线对接位
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { |
|
|
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((hongXiangConveyorDeviceDriver.getAction() == 1 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 1) { |
|
|
|
inst.setExecute_status("1"); |
|
|
|
is_feedback = true; |
|
|
|
} else { |
|
|
|
log.info("设备{} 请求取货,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove()); |
|
|
|
} |
|
|
|
} |
|
|
|
//油漆线
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { |
|
|
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) { |
|
|
|
inst.setExecute_status("1"); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("PauseOnStation".equals(type)) { |
|
|
|
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { |
|
|
|
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("2"); |
|
|
|
hailiangSmartplcTestDeviceDriver.writing(2); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { |
|
|
|
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("2"); |
|
|
|
emptyVehicleStackingPositionDeviceDriver.writing(2); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) { |
|
|
|
lubeiConveyorDeviceDriver = (LubeiConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if(lubeiConveyorDeviceDriver.getMove()==0){ |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,取货完成 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { |
|
|
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("2"); |
|
|
|
cargoLiftConveyorDeviceDriver.writing(2); |
|
|
|
is_feedback = true; |
|
|
|
} else { |
|
|
|
log.info("设备{} 请求离开,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove()); |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { |
|
|
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("2"); |
|
|
|
hongXiangConveyorDeviceDriver.writing(2); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { |
|
|
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("2"); |
|
|
|
paintConveyorDeviceDriver.writing(2); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,取货完成 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//等待点等待
|
|
|
|
if (action.equals("Wait")) { |
|
|
|
if ("Wait".equals(type)) { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("task_code", inst.getInstruction_code()); |
|
|
|
JSONArray destinations = new JSONArray(); |
|
|
|
String inst_type = inst.getInstruction_type(); |
|
|
|
//如果任务类型为1,在点位进行等待,则查询当前叠盘位的数量,取当前数量的层数进行追加任务
|
|
|
|
// if ("1".equals(inst_type)) {
|
|
|
|
// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
|
|
|
// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
|
|
|
// if (current_num > 12) {
|
|
|
|
// log.info("当前叠盘架:" + jobno + "已放满!");
|
|
|
|
// return null;
|
|
|
|
// }
|
|
|
|
// String start_point_code = inst.getStart_point_code();
|
|
|
|
// String next_point_code = inst.getNext_point_code();
|
|
|
|
// start_point_code = start_point_code + "." + (current_num + 1);
|
|
|
|
// destinations.add(destination(start_point_code, "Load", "1", "1"));
|
|
|
|
// destinations.add(destination(next_point_code, "Unload", "1", "1"));
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
|
|
|
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code()); |
|
|
|
JSONObject respjson = JSONObject.parseObject(resp); |
|
|
|
|
|
|
|
if(StrUtil.equals(inst.getInstruction_type(),"3")){ |
|
|
|
//2楼AGV起点追加任务
|
|
|
|
String start_device_code = respjson.getString("device_code"); |
|
|
|
String next_device_code = inst.getNext_device_code(); |
|
|
|
destinations.add(destination(start_device_code, "load", "1", "1")); |
|
|
|
destinations.add(destination(next_device_code, "Unload", "1", "1")); |
|
|
|
|
|
|
|
} else if(StrUtil.equals(inst.getInstruction_type(),"4")){ |
|
|
|
//2楼AGV终点追加任务
|
|
|
|
String next_device_code = respjson.getString("device_code"); |
|
|
|
destinations.add(destination(next_device_code, "Unload", "1", "1")); |
|
|
|
} |
|
|
|
|
|
|
|
jo.put("destinations", destinations); |
|
|
|
|
|
|
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
|
|
|
|
String url = agvurl + ":" + agvport + "/addDestinations"; |
|
|
|
log.info("下发agv任务请求:{}", url); |
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.post(url) |
|
|
|
.body(String.valueOf(jo))//表单内容
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
.execute(); |
|
|
|
log.info("下发agv任务请求反馈:{}", result); |
|
|
|
|
|
|
|
//对任务进行封口
|
|
|
|
JSONObject complete = new JSONObject(); |
|
|
|
complete.put("task_code", inst.getInstruction_code()); |
|
|
|
|
|
|
|
String url2 = agvurl + ":" + agvport + "markComplete"; |
|
|
|
log.info("下发agv任务请求:{}", url2); |
|
|
|
|
|
|
|
HttpResponse result2 = HttpRequest.post(url2) |
|
|
|
.body(String.valueOf(complete))//表单内容
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
.execute(); |
|
|
|
log.info("下发agv任务请求反馈:{}", result2); |
|
|
|
} |
|
|
|
} |
|
|
|
//放货的进入前等待和离开等待
|
|
|
|
if (action.equals("Unload")) { |
|
|
|
if ("EntryRequired".equals(type)) { |
|
|
|
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { |
|
|
|
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) { |
|
|
|
inst.setExecute_status("3"); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { |
|
|
|
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); |
|
|
|
if (number >= Integer.valueOf(str)) { |
|
|
|
log.info("叠盘位:" + jobno + "第" + str + "上有货!"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
inst.setExecute_status("3"); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { |
|
|
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) { |
|
|
|
inst.setExecute_status("3"); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) { |
|
|
|
lubeiConveyorDeviceDriver = (LubeiConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if(lubeiConveyorDeviceDriver.getMove()==0 && lubeiConveyorDeviceDriver.getAction()==1){ |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,开始放货 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { |
|
|
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((hongXiangConveyorDeviceDriver.getAction() == 2 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 0) { |
|
|
|
inst.setExecute_status("3"); |
|
|
|
is_feedback = true; |
|
|
|
} else { |
|
|
|
log.info("设备{} 请求放货,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { |
|
|
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) { |
|
|
|
inst.setExecute_status("3"); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,开始放货 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("PauseOnStation".equals(type)) { |
|
|
|
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { |
|
|
|
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("4"); |
|
|
|
hailiangSmartplcTestDeviceDriver.writing(3); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) { |
|
|
|
lubeiConveyorDeviceDriver = (LubeiConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
if(lubeiConveyorDeviceDriver.getMove()==1){ |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,放货完成 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { |
|
|
|
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("4"); |
|
|
|
emptyVehicleStackingPositionDeviceDriver.writing(3); |
|
|
|
is_feedback = true; |
|
|
|
} else { |
|
|
|
log.info("设备{} 请求离开,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove()); |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { |
|
|
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("4"); |
|
|
|
cargoLiftConveyorDeviceDriver.writing(3); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { |
|
|
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("4"); |
|
|
|
hongXiangConveyorDeviceDriver.writing(3); |
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("taskCode",task.getTask_code()); |
|
|
|
jo.put("carId",processingVehicle); |
|
|
|
jo.put("taskType ",type); |
|
|
|
jo.put("feedbackStatus",feedbackStatus); |
|
|
|
HttpResponse result= acsToWmsZDService.taskFeedback(jo); |
|
|
|
JSONObject response=JSONObject.parseObject(result.body()); |
|
|
|
int responseCode= response.getInteger("responseCode"); |
|
|
|
if(responseCode == 0) { |
|
|
|
is_feedback = true; |
|
|
|
log.info("请求ZDwcs成功,放货完成 请求结果{}",responseCode); |
|
|
|
} |
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { |
|
|
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
inst.setExecute_status("4"); |
|
|
|
paintConveyorDeviceDriver.writing(3); |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
JSONObject requestjo = new JSONObject(); |
|
|
|
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject(); |
|
|
|
if (is_feedback) { |
|
|
|
requestjo.put("task_code", jobno); |
|
|
|
requestjo.put("operation", action); |
|
|
@ -398,13 +326,12 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
log.info("反馈AGV请求数据:{}", requestjo); |
|
|
|
System.out.println("back agv:" + requestjo); |
|
|
|
|
|
|
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
|
|
|
|
if (inst.getInstruction_type().equals("4")) { |
|
|
|
agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); |
|
|
|
} |
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact"; |
|
|
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); |
|
|
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); |
|
|
|
|
|
|
|
agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + jobno + "/interact"; |
|
|
|
|
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
|
.body(String.valueOf(requestjo)) |
|
|
@ -414,6 +341,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { |
|
|
|
return requestjo.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
@LokiLog(type = LokiLogType.AGV) |
|
|
|
@Override |
|
|
|
public HttpResponse markComplete(String code) { |
|
|
|