add:新增wcs接口
This commit is contained in:
@@ -2,17 +2,27 @@ package org.nl.acs.device_driver.basedriver.standard_inspect_site;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dreamlu.mica.core.utils.StringUtil;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToHJXService;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToMesService;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToZDWmsService;
|
||||||
|
import org.nl.acs.instruction.enums.InstTypeEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
@@ -24,12 +34,15 @@ import org.nl.acs.route.service.RouteLineService;
|
|||||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,7 +51,7 @@ import java.util.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
|
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
@Autowired
|
@Autowired
|
||||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
@@ -48,6 +61,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||||
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
|
//外部系统交互
|
||||||
|
AcsToZDWmsService acsToZDWmsService = SpringContextHolder.getBean(AcsToZDWmsService.class);
|
||||||
|
AcsToHJXService acsToHJXService = SpringContextHolder.getBean(AcsToHJXService.class);
|
||||||
|
AcsToMesService acsToMesService = SpringContextHolder.getBean(AcsToMesService.class);
|
||||||
|
AcsToNDCService acsToNDCService = SpringContextHolder.getBean(AcsToNDCService.class);
|
||||||
|
|
||||||
String container;
|
String container;
|
||||||
String container_type_desc;
|
String container_type_desc;
|
||||||
String last_container_type_desc;
|
String last_container_type_desc;
|
||||||
@@ -132,172 +154,438 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
String message = null;
|
|
||||||
// try {
|
|
||||||
// String device_code = this.getDeviceCode();
|
|
||||||
// mode = this.itemProtocol.getMode();
|
|
||||||
// error = this.itemProtocol.getError();
|
|
||||||
// move = this.itemProtocol.getMove();
|
|
||||||
// task = this.itemProtocol.getTask();
|
|
||||||
// hasGoods = this.itemProtocol.getMove();
|
|
||||||
//
|
|
||||||
// if (mode != last_mode) {
|
|
||||||
// this.setRequireSucess(false);
|
|
||||||
// }
|
|
||||||
// if (move != last_move) {
|
|
||||||
// }
|
|
||||||
// if (error != last_error) {
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.getApply_handling()) {
|
try {
|
||||||
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
|
this.devicecode = this.getDevice().getDevice_code();
|
||||||
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
||||||
// Device link_device = appService.findDeviceByCode(link_device_code);
|
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
||||||
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
//取货申请
|
||||||
// if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getStart_point_code(), this.devicecode)) {
|
||||||
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
|
if (agvphase == 1) {
|
||||||
//// if(standardInspectSiteDevicedriver.getMode() != 2){
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
//// log.debug("设备未待机");
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
//// return;
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
//// }
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
//// if(standardInspectSiteDevicedriver.getMove() != 0){
|
log.info("定点任务下发agv允许取货信号");
|
||||||
//// log.debug("设备不满足放货条件");
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
//// return;
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
//// }
|
return;
|
||||||
//
|
} else {
|
||||||
// //如果目标设备申请叫料 则允许生成任务
|
this.reqTakeRequireSuccess = false;
|
||||||
// if (standardInspectSiteDevicedriver.getApply_material()) {
|
this.reqTakeInstCode = null;
|
||||||
// TaskDto dto = new TaskDto();
|
this.agvphase = 0;
|
||||||
// String now = DateUtil.now();
|
}
|
||||||
// dto.setTask_id(IdUtil.simpleUUID());
|
} else {
|
||||||
// dto.setCreate_by(this.getDevice().getDevice_code());
|
Object ext_system = device.getExtraValue().get("ext_system");
|
||||||
// dto.setUpdate_by(this.getDevice().getDevice_code());
|
//检测站点,安全交互类型为中鼎的
|
||||||
// dto.setStart_point_code(this.getDevice().getDevice_code());
|
if (!StringUtil.isEmpty(ext_system)) {
|
||||||
//
|
if (ext_system.equals("1")) {
|
||||||
// String taskcode = CodeUtil.getNewCode("TASK_NO");
|
JSONObject jo = new JSONObject();
|
||||||
// dto.setTask_code("-" + taskcode);
|
jo.put("taskCode", task.getTask_code());
|
||||||
// dto.setTask_status("0");
|
jo.put("carId", instruction.getCarno());
|
||||||
// dto.setPriority("101");
|
jo.put("taskType ", task.getTask_type());
|
||||||
//// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
jo.put("feedbackStatus", "applyTake");
|
||||||
//// String next_device_codecode = jo.getNext_device_code();
|
log.info("请求wms取货参数:{}", jo);
|
||||||
//// if(StrUtil.isEmpty(next_device_codecode)){
|
HttpResponse result = acsToZDWmsService.taskFeedback(jo);
|
||||||
//// throw new RuntimeException("该设备未找到对应路由");
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
//// }
|
int responseCode = response.getInteger("responseCode");
|
||||||
// dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
|
if (responseCode == 0) {
|
||||||
// dto.setUpdate_time(now);
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
// dto.setCreate_time(now);
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
//
|
return;
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
} else {
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
this.reqTakeRequireSuccess = false;
|
||||||
//
|
this.reqTakeInstCode = null;
|
||||||
// wo.insert(json);
|
this.agvphase = 0;
|
||||||
// standardInspectSiteDevicedriver.setApply_material(false);
|
}
|
||||||
// }
|
} else {
|
||||||
// }
|
log.error("请求wms取货失败参数:{}", response);
|
||||||
// this.setApply_handling(false);
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
// }
|
.device_code(this.getDeviceCode())
|
||||||
|
.content("请求wms取货失败参数::" + response)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
}
|
||||||
|
//焊接线
|
||||||
|
} else if (ext_system.equals("3")) {
|
||||||
|
JSONObject jo1 = new JSONObject();
|
||||||
|
jo1.put("point", this.devicecode);
|
||||||
|
jo1.put("type", "1");
|
||||||
|
jo1.put("containerCode", task.getVehicle_code());
|
||||||
|
Object url = device.getExtraValue().get("address");
|
||||||
|
if (StringUtil.isEmpty(ext_system)) {
|
||||||
|
log.error("请求安全交互失败,未配置焊接线IP" + this.devicecode);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(this.getDeviceCode())
|
||||||
|
.content("请求安全交互失败,未配置焊接线IP" + this.devicecode)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
jo1.put("url", url);
|
||||||
|
HttpResponse result = acsToHJXService.actionRequest(jo1);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int code = response.getInteger("code");
|
||||||
|
if (code == 200) {
|
||||||
|
log.info("请求焊接线成功,申请取货 请求结果{}", code);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(this.getDeviceCode())
|
||||||
|
.content("请求焊接线成功,申请取货 请求结果:" + code)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("请求焊接线失败,申请区货 错误信息{}", response);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(this.getDeviceCode())
|
||||||
|
.content("请求焊接线失败,申请区货 错误信息:" + response)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
}
|
||||||
|
} else if (ext_system.equals("2")) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("检测站点未配置检测系统");
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(this.getDeviceCode())
|
||||||
|
.content("检测站点未配置检测系统")
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (agvphase == 2) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
|
|
||||||
// } catch (Exception var17) {
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
// return;
|
log.info("定点任务下发agv允许取货信号");
|
||||||
// }
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
//
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
// if (!this.itemProtocol.getIsonline()) {
|
return;
|
||||||
// this.setIsonline(false);
|
} else {
|
||||||
// this.setIserror(true);
|
this.reqTakeRequireSuccess = false;
|
||||||
// message = "信号量同步异常";
|
this.reqTakeInstCode = null;
|
||||||
// //未联机
|
this.agvphase = 0;
|
||||||
// } else if (mode == 0) {
|
}
|
||||||
// this.setIsonline(false);
|
} else {
|
||||||
// this.setIserror(true);
|
Object ext_system = device.getExtraValue().get("ext_system");
|
||||||
// message = "未联机";
|
//检测站点,安全交互类型为中鼎的
|
||||||
// //有报警
|
if (!StringUtil.isEmpty(ext_system)) {
|
||||||
// } else if (error != 0) {
|
if (ext_system.equals("1")) {
|
||||||
// this.setIsonline(false);
|
JSONObject jo = new JSONObject();
|
||||||
// this.setIserror(true);
|
jo.put("taskCode", task.getTask_code());
|
||||||
// message = "有报警";
|
jo.put("carId", instruction.getCarno());
|
||||||
// //无报警
|
jo.put("taskType ", task.getTask_type());
|
||||||
// } else {
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
// this.setIsonline(true);
|
log.info("请求wms取货完毕参数:{}", jo);
|
||||||
// this.setIserror(false);
|
HttpResponse result = acsToZDWmsService.taskFeedback(jo);
|
||||||
// message = "";
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
// Instruction instruction = null;
|
int responseCode = response.getInteger("responseCode");
|
||||||
// List toInstructions;
|
if (responseCode == 0) {
|
||||||
// switch (mode) {
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
// case 1:
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
// log.debug("设备运转模式:等待工作");
|
return;
|
||||||
// return;
|
} else {
|
||||||
// case 2:
|
this.reqTakeRequireSuccess = false;
|
||||||
//申请任务
|
this.reqTakeInstCode = null;
|
||||||
// if (this.getApply_handling()) {
|
this.agvphase = 0;
|
||||||
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
|
}
|
||||||
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
} else {
|
||||||
// Device link_device = appService.findDeviceByCode(link_device_code);
|
log.error("请求wms取货失败参数:{}", response);
|
||||||
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
}
|
||||||
// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
//焊接线
|
||||||
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
|
} else if (ext_system.equals("3")) {
|
||||||
// if(standardInspectSiteDevicedriver.getMode() != 2){
|
JSONObject jo = new JSONObject();
|
||||||
// log.debug("设备未待机");
|
jo.put("taskCode", task.getTask_code());
|
||||||
// return;
|
jo.put("carId", instruction.getCarno());
|
||||||
// }
|
jo.put("taskType ", task.getTask_type());
|
||||||
// if(standardInspectSiteDevicedriver.getMove() != 0){
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
// log.debug("设备不满足放货条件");
|
log.info("请求MES取货完成参数:{}", jo);
|
||||||
// return;
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
// }
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
//
|
int responseCode = response.getInteger("responseCode");
|
||||||
// //如果目标设备申请叫料 则允许生成任务
|
if (responseCode == 0) {
|
||||||
// if(standardInspectSiteDevicedriver.getApply_material()){
|
log.info("请求MES成功,取货完成 请求结果{}", responseCode);
|
||||||
// TaskDto dto = new TaskDto();
|
JSONObject jo1 = new JSONObject();
|
||||||
// String now = DateUtil.now();
|
jo1.put("point", this.devicecode);
|
||||||
// dto.setTask_id(IdUtil.simpleUUID());
|
jo1.put("type", "3");
|
||||||
// dto.setCreate_by(this.getDevice().getDevice_code());
|
jo1.put("containerCode", task.getVehicle_code());
|
||||||
// dto.setUpdate_by(this.getDevice().getDevice_code());
|
Object url = device.getExtraValue().get("address");
|
||||||
// dto.setStart_point_code(this.getDevice().getDevice_code());
|
if (StringUtil.isEmpty(ext_system)) {
|
||||||
//
|
log.error("请求焊接线失败,未配置焊接线IP" + this.devicecode);
|
||||||
// String taskcode = CodeGenerateUtil.getNewCode("TASK_NO");
|
return;
|
||||||
// dto.setTask_code("-"+taskcode);
|
}
|
||||||
// dto.setTask_status("0");
|
jo1.put("url", url);
|
||||||
// dto.setPriority("101");
|
HttpResponse result2 = acsToHJXService.actionFinish(jo1);
|
||||||
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
JSONObject response2 = JSONObject.parseObject(result2.body());
|
||||||
// String next_device_codecode = jo.getNext_device_code();
|
int code = response2.getInteger("code");
|
||||||
// if(StrUtil.isEmpty(next_device_codecode)){
|
if (code == 200) {
|
||||||
// throw new RuntimeException("该设备未找到对应路由");
|
log.info("请求焊接线成功,申请取货完成 请求结果{}", code);
|
||||||
// }
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
// dto.setNext_point_code(next_device_codecode);
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
// dto.setUpdate_time(now);
|
return;
|
||||||
// dto.setCreate_time(now);
|
} else {
|
||||||
//
|
this.reqTakeRequireSuccess = false;
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
this.reqTakeInstCode = null;
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("请求焊接线失败,申请取货完成 错误信息{}", response2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("请求MES取货完成失败,取货完成 错误码{}", responseCode);
|
||||||
|
}
|
||||||
|
} else if (ext_system.equals("2")) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
|
log.info("请求MES取货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode == 0) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//放货申请
|
||||||
|
else if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getNext_point_code(), this.devicecode)) {
|
||||||
|
if (agvphase == 3) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
|
log.info("定点任务下发agv允许取货信号");
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object ext_system = device.getExtraValue().get("ext_system");
|
||||||
|
//检测站点,安全交互类型为中鼎的
|
||||||
|
if (!StringUtil.isEmpty(ext_system)) {
|
||||||
|
if (ext_system.equals("1")) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "applyPut");
|
||||||
|
log.info("请求wms请求放货参数:{}", jo);
|
||||||
|
HttpResponse result = acsToZDWmsService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode == 0) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("请求wms请求放货失败参数:{}", response);
|
||||||
|
}
|
||||||
|
//焊接线
|
||||||
|
} else if (ext_system.equals("3")) {
|
||||||
|
JSONObject jo1 = new JSONObject();
|
||||||
|
jo1.put("point", this.devicecode);
|
||||||
|
jo1.put("type", "2");
|
||||||
|
jo1.put("containerCode", task.getVehicle_code());
|
||||||
|
Object url = device.getExtraValue().get("address");
|
||||||
|
if (StringUtil.isEmpty(ext_system)) {
|
||||||
|
log.error("请求焊接线请求放货,未配置焊接线IP" + this.devicecode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
jo1.put("url", url);
|
||||||
|
HttpResponse result = acsToHJXService.actionRequest(jo1);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int code = response.getInteger("code");
|
||||||
|
if (code == 200) {
|
||||||
|
log.info("请求焊接线放货成功,申请取货 请求结果{}", code);
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("请求焊接线放货失败,申请区货 错误信息{}", response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (ext_system.equals("2")) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("检测站点未配置检测系统");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (agvphase == 4) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
|
log.info("定点任务下发agv允许取货信号");
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object ext_system = device.getExtraValue().get("ext_system");
|
||||||
|
//检测站点,安全交互类型为中鼎的
|
||||||
|
if (!StringUtil.isEmpty(ext_system)) {
|
||||||
|
if (ext_system.equals("1")) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "putFinish");
|
||||||
|
log.info("请求wms放货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToZDWmsService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode == 0) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("请求wms放货失败参数:{}", response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//焊接线
|
||||||
|
} else if (ext_system.equals("3")) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "putFinish");
|
||||||
|
log.info("请求MES放货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode == 0) {
|
||||||
|
JSONObject jo1 = new JSONObject();
|
||||||
|
jo1.put("point", this.devicecode);
|
||||||
|
jo1.put("type", "4");
|
||||||
|
jo1.put("containerCode", task.getVehicle_code());
|
||||||
|
Object url = device.getExtraValue().get("address");
|
||||||
|
if (StringUtil.isEmpty(ext_system)) {
|
||||||
|
log.error("请求MES放货完成失败,未配置焊接线IP" + this.devicecode);
|
||||||
|
}
|
||||||
|
jo1.put("url", url);
|
||||||
|
HttpResponse result2 = acsToHJXService.actionFinish(jo1);
|
||||||
|
JSONObject response2 = JSONObject.parseObject(result2.body());
|
||||||
|
int code = response2.getInteger("code");
|
||||||
|
if (code == 200) {
|
||||||
|
log.info("请求焊接线放货货完成成功,请求结果{}", code);
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("请求焊接线放货货完成失败 错误信息{}", response2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("请求MES放货完成失败,错误码{}", responseCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (ext_system.equals("2")) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "putFinish");
|
||||||
|
log.info("请求MES放货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode == 0) {
|
||||||
|
HttpResponse result1 = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("请求MES放货货完成失败 错误信息{}", responseCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// wo.insert(json);
|
}
|
||||||
// standardInspectSiteDevicedriver.setApply_material(false);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
} catch (IOException e) {
|
||||||
// this.setApply_handling(false);
|
e.printStackTrace();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
|
||||||
// this.instruction_require(container);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// switch (flag) {
|
|
||||||
// //取货完成
|
|
||||||
// case 1:
|
|
||||||
// writing(2);
|
|
||||||
// return;
|
|
||||||
// //放货完成
|
|
||||||
// case 2:
|
|
||||||
// writing(3);
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// last_mode = mode;
|
|
||||||
// last_error = error;
|
|
||||||
// last_move = move;
|
|
||||||
// last_task = task;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
|
package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.nl.acs.agv.server.AgvService;
|
import org.nl.acs.agv.server.AgvService;
|
||||||
import org.nl.acs.agv.server.NDCAgvService;
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
@@ -12,7 +15,7 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.*;
|
||||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
@@ -21,9 +24,12 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
|||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +39,7 @@ import java.util.Date;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
|
public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -52,6 +58,14 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
|||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||||
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||||
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
|
//外部系统交互
|
||||||
|
AcsToZDWmsService acsToZDWmsService = SpringContextHolder.getBean(AcsToZDWmsService.class);
|
||||||
|
AcsToHJXService acsToHJXService = SpringContextHolder.getBean(AcsToHJXService.class);
|
||||||
|
AcsToMesService acsToMesService = SpringContextHolder.getBean(AcsToMesService.class);
|
||||||
|
AcsToNDCService acsToNDCService = SpringContextHolder.getBean(AcsToNDCService.class);
|
||||||
|
|
||||||
|
|
||||||
Integer hasGoods = 0;
|
Integer hasGoods = 0;
|
||||||
@@ -108,6 +122,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
|||||||
|
|
||||||
// 1 上位系统允许进入 2 上位系统允许离开
|
// 1 上位系统允许进入 2 上位系统允许离开
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
String devicecode;
|
||||||
|
|
||||||
//1取货请求 2取货完成完成 3放货请求 4放货完成 -1进入请求 -2请求离开
|
//1取货请求 2取货完成完成 3放货请求 4放货完成 -1进入请求 -2请求离开
|
||||||
private volatile int agvphase = 0;
|
private volatile int agvphase = 0;
|
||||||
@@ -124,72 +139,139 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
hasGoods = this.getDevice().getHas_goods();
|
try {
|
||||||
batch = this.getDevice().getBatch();
|
this.devicecode = this.getDevice().getDevice_code();
|
||||||
device_code = this.getDeviceCode();
|
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
||||||
|
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
||||||
if (agvphase == 0x03) {
|
//取货申请
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getStart_point_code(), this.devicecode)) {
|
||||||
inst.setExecute_status("1");
|
if (agvphase == 1) {
|
||||||
instructionService.update(inst);
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
agvphase = 0;
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
index = 0;
|
return;
|
||||||
inst = null;
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
|
||||||
} else {
|
} else {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (agvphase == 2) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
|
|
||||||
if (agvphase == 0x05) {
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
log.info("定点任务下发agv允许取货信号");
|
||||||
inst.setExecute_status("2");
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
instructionService.update(inst);
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
return;
|
||||||
// OneNDCSocketConnectionAutoRun.write(data);
|
|
||||||
agvphase = 0;
|
|
||||||
index = 0;
|
|
||||||
inst = null;
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
|
||||||
} else {
|
} else {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (agvphase == 0x07) {
|
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
|
||||||
inst.setExecute_status("5");
|
|
||||||
instructionService.update(inst);
|
|
||||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
|
||||||
// OneNDCSocketConnectionAutoRun.write(data);
|
|
||||||
agvphase = 0;
|
|
||||||
index = 0;
|
|
||||||
inst = null;
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
|
||||||
} else {
|
} else {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
//MES下发需要上报取货完成
|
||||||
|
if ("2".equals(task.getCreate_by())) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
|
log.info("请求MES取货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode != 0) {
|
||||||
|
log.error("请求MES取货完成失败参数:{}", response);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
if (agvphase == 0x09) {
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
return;
|
||||||
inst.setExecute_status("6");
|
|
||||||
instructionService.update(inst);
|
|
||||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
|
||||||
// OneNDCSocketConnectionAutoRun.write(data);
|
|
||||||
agvphase = 0;
|
|
||||||
index = 0;
|
|
||||||
inst = null;
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
|
||||||
} else {
|
} else {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//放货申请
|
||||||
|
else if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getNext_point_code(), this.devicecode)) {
|
||||||
|
if (agvphase == 3) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (agvphase == 4) {
|
||||||
|
device = deviceAppService.findDeviceByCode(this.devicecode);
|
||||||
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
TaskDto task = taskService.findByCode(instruction.getTask_code());
|
||||||
|
if ((StrUtil.startWith(task.getTask_code(), "-"))) {
|
||||||
|
log.info("定点任务下发agv允许取货信号");
|
||||||
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//mes下发需要上报放货完成
|
||||||
|
if ("2".equals(task.getCreate_by())) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "putFinish");
|
||||||
|
log.info("请求MES放货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToMesService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode != 0) {
|
||||||
|
log.error("请求MES放货失败参数:{}", response);
|
||||||
|
return;
|
||||||
|
} //wms下发需要上报放货完成
|
||||||
|
} else if ("1".equals(task.getCreate_by())) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("taskCode", task.getTask_code());
|
||||||
|
jo.put("carId", instruction.getCarno());
|
||||||
|
jo.put("taskType ", task.getTask_type());
|
||||||
|
jo.put("feedbackStatus", "putFinish");
|
||||||
|
log.info("请求WMS放货完成参数:{}", jo);
|
||||||
|
HttpResponse result = acsToZDWmsService.taskFeedback(jo);
|
||||||
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
|
int responseCode = response.getInteger("responseCode");
|
||||||
|
if (responseCode != 0) {
|
||||||
|
log.info("请求WMS放货货完成失败 错误信息{}", responseCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(instruction, 10);
|
||||||
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.reqTakeRequireSuccess = false;
|
||||||
|
this.reqTakeInstCode = null;
|
||||||
|
this.agvphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package org.nl.acs.ext.wms.service;
|
package org.nl.acs.ext.wms.service;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
|
|
||||||
public interface AcsToNDCService {
|
public interface AcsToNDCService {
|
||||||
|
|
||||||
|
HttpResponse genAgvSchedulingTask(Instruction instruction,int type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,94 @@
|
|||||||
package org.nl.acs.ext.wms.service.impl;
|
package org.nl.acs.ext.wms.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.AcsConfig;
|
||||||
|
import org.nl.acs.device.address.service.AddressService;
|
||||||
|
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
|
import org.nl.acs.ext.wms.NdcHttpUtil;
|
||||||
|
import org.nl.acs.ext.wms.UnifiedResponse;
|
||||||
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
|
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||||
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AcsToNDCServiceImpl implements AcsToNDCService {
|
public class AcsToNDCServiceImpl implements AcsToNDCService {
|
||||||
|
private final ParamService paramService;
|
||||||
|
@Autowired
|
||||||
|
private LuceneExecuteLogService luceneExecuteLogService;
|
||||||
|
@Autowired
|
||||||
|
AddressService addressService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务单
|
||||||
|
*
|
||||||
|
* @param instruction
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HttpResponse genAgvSchedulingTask(Instruction instruction,int type) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("receiver", "NDC");
|
||||||
|
jo.put("sender", "ACS");
|
||||||
|
jo.put("type", type);
|
||||||
|
JSONObject ja = new JSONObject();
|
||||||
|
//type 3:下发任务
|
||||||
|
if (type==3) {
|
||||||
|
ja.put("taskId", instruction.getInstruction_code());
|
||||||
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||||
|
int startAddress = deviceService.queryAddressBydeviceCode(instruction.getStart_point_code());
|
||||||
|
int nextAddress = deviceService.queryAddressBydeviceCode(instruction.getNext_point_code());
|
||||||
|
ja.put("pickId", startAddress);
|
||||||
|
ja.put("pickName", instruction.getStart_point_code());
|
||||||
|
ja.put("releaseId", nextAddress);
|
||||||
|
ja.put("releaseIdName", instruction.getNext_point_code());
|
||||||
|
ja.put("taskType", 5);
|
||||||
|
ja.put("vehicleId", 0);
|
||||||
|
ja.put("priority", 0);
|
||||||
|
jo.put("params", ja);
|
||||||
|
}
|
||||||
|
//type 9:取消任务
|
||||||
|
else if (type==9){
|
||||||
|
ja.put("taskId", instruction.getInstruction_code());
|
||||||
|
jo.put("params", ja);
|
||||||
|
}
|
||||||
|
//type 10:取放货请求应答
|
||||||
|
else if (type==10){
|
||||||
|
ja.put("taskId", instruction.getInstruction_code());
|
||||||
|
ja.put("taskPhase", instruction.getExecute_status());
|
||||||
|
jo.put("params", ja);
|
||||||
|
}
|
||||||
|
String wmsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();
|
||||||
|
AddressDto addressDto = addressService.findByCode("applyTaskToWcs");
|
||||||
|
String url = wmsurl + addressDto.getMethods_url();
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.post(url)
|
||||||
|
//表单内容
|
||||||
|
.body(String.valueOf(jo))
|
||||||
|
//超时,毫秒
|
||||||
|
.timeout(20000)
|
||||||
|
.execute();
|
||||||
|
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||||
|
.device_code("下发科聪任务")
|
||||||
|
.content("任务号:" + instruction.getTask_code() + ",指令号:" + instruction.getInstruction_code() + ",下发wcs任务序列反馈参数:" + jo)
|
||||||
|
.build();
|
||||||
|
logDto1.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||||
|
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", instruction.getTask_code(), instruction.getInstruction_code(), result.getStatus(), result.body());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,20 +45,16 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
String type = requestParam.getString("type");
|
String type = requestParam.getString("type");
|
||||||
JSONObject params = requestParam.getJSONObject("params");
|
JSONObject params = requestParam.getJSONObject("params");
|
||||||
|
|
||||||
|
//任务状态上报
|
||||||
if (MsgTypeEnum.TASK_STATE_RPT.getValue().equals(type)) {
|
if (MsgTypeEnum.TASK_STATE_RPT.getValue().equals(type)) {
|
||||||
String taskId = params.getString("taskId");
|
String taskId = params.getString("taskId");
|
||||||
String taskPhase = params.getString("taskPhase");
|
String taskPhase = params.getString("taskPhase");
|
||||||
String taskState = params.getString("taskState");
|
String taskState = params.getString("taskState");
|
||||||
String taskPoint = params.getString("taskPoint");
|
String taskPoint = params.getString("taskPoint");//请求进入/离开需要上报站点号
|
||||||
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||||
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
|
//请求进入/请求离开
|
||||||
if (StrUtil.isNotEmpty(taskPhase)&&(TaskPhaseEnum.ENTER_REQUEST_OR_ALLOWED.getValue().equals(taskPhase)||TaskPhaseEnum.LEAVE_NOTICE_OR_ALLOWED.getValue().equals(taskPhase))){
|
if (StrUtil.isNotEmpty(taskPhase)&&(TaskPhaseEnum.ENTER_REQUEST_OR_ALLOWED.getValue().equals(taskPhase)||TaskPhaseEnum.LEAVE_NOTICE_OR_ALLOWED.getValue().equals(taskPhase))){
|
||||||
|
|
||||||
}else if (StrUtil.isNotEmpty(taskPhase)&&(TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)||TaskStateEnum.NOT_STARTED.getValue().equals(taskPhase)||TaskStateEnum.EXECUTING.getValue().equals(taskPhase)||TaskStateEnum.COMPLETED.getValue().equals(taskPhase))){
|
|
||||||
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
|
||||||
if (ObjectUtil.isEmpty(instruction)) {
|
|
||||||
resp.put("code", "400");
|
|
||||||
resp.put("message", "请求失败,任务信息不存在,指令号:" + taskId);
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
StorageCellDto storageCellDto = storageCellService.findByAddress(taskPoint);
|
StorageCellDto storageCellDto = storageCellService.findByAddress(taskPoint);
|
||||||
if (ObjectUtil.isEmpty(storageCellDto)) {
|
if (ObjectUtil.isEmpty(storageCellDto)) {
|
||||||
resp.put("code", "400");
|
resp.put("code", "400");
|
||||||
@@ -71,95 +67,6 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
resp.put("message", "请求失败,请求位置编号不存在!");
|
resp.put("message", "请求失败,请求位置编号不存在!");
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
|
||||||
//taskPhase 任务完成
|
|
||||||
if (TaskStateEnum.COMPLETED.getValue().equals(taskPhase)){
|
|
||||||
//修改指令状态完成
|
|
||||||
instruction.setInstruction_status(InstStatusEnum.FINISHED.getCode());
|
|
||||||
|
|
||||||
instruction.setUpdate_time(DateUtil.now());
|
|
||||||
instructionService.finish(instruction);
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "完成任务成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskStateEnum.CANCELED.getValue().equals(taskPhase)){
|
|
||||||
instruction.setInstruction_status(InstStatusEnum.CANCELED.getCode());
|
|
||||||
instruction.setUpdate_time(DateUtil.now());
|
|
||||||
instructionService.cancel(instruction.getInstruction_id());
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "取消任务成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)){
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardOrdinarySiteDeviceDriver.setAgvphase(1);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardInspectSiteDeviceDriver.setAgvphase(1);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "反馈请求取货成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)){
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardOrdinarySiteDeviceDriver.setAgvphase(2);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardInspectSiteDeviceDriver.setAgvphase(2);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "反馈取货完成成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)){
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardOrdinarySiteDeviceDriver.setAgvphase(3);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardInspectSiteDeviceDriver.setAgvphase(3);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "反馈请求放货成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)){
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardOrdinarySiteDeviceDriver.setAgvphase(4);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
standardInspectSiteDeviceDriver.setAgvphase(4);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
|
||||||
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
|
||||||
}
|
|
||||||
resp.put("code", "200");
|
|
||||||
resp.put("message", "反馈放货完成成功");
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
if (TaskPhaseEnum.ENTER_REQUEST_OR_ALLOWED.getValue().equals(taskPhase)){
|
if (TaskPhaseEnum.ENTER_REQUEST_OR_ALLOWED.getValue().equals(taskPhase)){
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||||
@@ -194,10 +101,138 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
resp.put("message", "反馈请求离开成功");
|
resp.put("message", "反馈请求离开成功");
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
} else if (StrUtil.isNotEmpty(taskPhase)&&(TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)||TaskStateEnum.NOT_STARTED.getValue().equals(taskPhase)||TaskStateEnum.EXECUTING.getValue().equals(taskPhase)||TaskStateEnum.COMPLETED.getValue().equals(taskPhase))){
|
||||||
|
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
||||||
|
if (ObjectUtil.isEmpty(instruction)) {
|
||||||
|
resp.put("code", "400");
|
||||||
|
resp.put("message", "请求失败,任务信息不存在,指令号:" + taskId);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//taskPhase 任务完成
|
||||||
|
if (TaskStateEnum.COMPLETED.getValue().equals(taskState)){
|
||||||
|
instructionService.finish(instruction.getInstruction_id());
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "完成任务成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
//taskPhase 任务取消
|
||||||
|
if (TaskStateEnum.CANCELED.getValue().equals(taskState)){
|
||||||
|
instructionService.cancel(instruction.getInstruction_id());
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "取消任务成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
String start_point_code = instruction.getStart_point_code();
|
||||||
|
String next_point_code = instruction.getNext_point_code();
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(start_point_code);
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(next_point_code);
|
||||||
|
//taskPhase 请求取货上报
|
||||||
|
if (TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)){
|
||||||
|
if (ObjectUtil.isEmpty(startDevice)) {
|
||||||
|
resp.put("code", "400");
|
||||||
|
resp.put("message", "请求取货失败,请求位置编号不存在!");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setAgvphase(1);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
if (startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver.setAgvphase(1);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
instruction.setExecute_status("1");
|
||||||
|
instructionService.update(instruction);
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "反馈请求取货成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
//taskPhase 取货完成上报
|
||||||
|
if (TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)){
|
||||||
|
if (ObjectUtil.isEmpty(startDevice)) {
|
||||||
|
resp.put("code", "400");
|
||||||
|
resp.put("message", "请求取货完成失败,请求位置编号不存在!");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setAgvphase(2);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
if (startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver.setAgvphase(2);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
instruction.setExecute_status("2");
|
||||||
|
instructionService.update(instruction);
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "反馈取货完成成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
//taskPhase 请求放货上报
|
||||||
|
if (TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)){
|
||||||
|
if (ObjectUtil.isEmpty(nextDevice)) {
|
||||||
|
resp.put("code", "400");
|
||||||
|
resp.put("message", "请求放货失败,请求位置编号不存在!");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setAgvphase(3);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver.setAgvphase(3);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
instruction.setExecute_status("3");
|
||||||
|
instructionService.update(instruction);
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "反馈请求放货成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
//taskPhase 放货完成上报
|
||||||
|
if (TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)){
|
||||||
|
if (ObjectUtil.isEmpty(nextDevice)) {
|
||||||
|
resp.put("code", "400");
|
||||||
|
resp.put("message", "请求放货完成失败,请求位置编号不存在!");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setAgvphase(4);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver.setAgvphase(4);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeInstCode(taskId);
|
||||||
|
standardInspectSiteDeviceDriver.setReqTakeRequireSuccess(true);
|
||||||
|
}
|
||||||
|
instruction.setExecute_status("4");
|
||||||
|
instructionService.update(instruction);
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "反馈放货完成成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new BadRequestException("上报的阶段值有误!");
|
throw new BadRequestException("上报的阶段值有误!");
|
||||||
}
|
}
|
||||||
}else if (MsgTypeEnum.AGV_ID_RPT.getValue().equals(type)){
|
}
|
||||||
|
//任务分配车辆上报
|
||||||
|
else if (MsgTypeEnum.AGV_ID_RPT.getValue().equals(type)){
|
||||||
String taskId = params.getString("taskId");
|
String taskId = params.getString("taskId");
|
||||||
String agvId = params.getString("agvId");
|
String agvId = params.getString("agvId");
|
||||||
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
||||||
@@ -214,7 +249,9 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
resp.put("code", "200");
|
resp.put("code", "200");
|
||||||
resp.put("message", "更新车号成功");
|
resp.put("message", "更新车号成功");
|
||||||
return resp;
|
return resp;
|
||||||
}else if (MsgTypeEnum.TASK_INDEX_RPT.getValue().equals(type)){
|
}
|
||||||
|
//车辆任务生成上报
|
||||||
|
else if (MsgTypeEnum.TASK_INDEX_RPT.getValue().equals(type)){
|
||||||
String taskId = params.getString("taskId");
|
String taskId = params.getString("taskId");
|
||||||
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
Instruction instruction = instructionService.findByCodeFromCache(taskId);
|
||||||
if (ObjectUtil.isEmpty(instruction)) {
|
if (ObjectUtil.isEmpty(instruction)) {
|
||||||
@@ -230,7 +267,27 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
resp.put("message", "更新指令执行中成功");
|
resp.put("message", "更新指令执行中成功");
|
||||||
return resp;
|
return resp;
|
||||||
}else if (MsgTypeEnum.AGV_POWER_RPT.getValue().equals(type)){
|
}else if (MsgTypeEnum.AGV_POWER_RPT.getValue().equals(type)){
|
||||||
|
int agvId = params.getIntValue("agvId");
|
||||||
|
int stateValue = params.getIntValue("stateValue");
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "更新指令执行中成功");
|
||||||
|
return resp;
|
||||||
|
}else if (MsgTypeEnum.AGV_STATE_RPT.getValue().equals(type)){
|
||||||
|
int agvId = params.getIntValue("agvId");
|
||||||
|
int stateValue = params.getIntValue("stateValue");
|
||||||
|
int xLocation = params.getIntValue("xLocation");
|
||||||
|
int yLocation = params.getIntValue("yLocation");
|
||||||
|
int angle = params.getIntValue("angle");
|
||||||
|
int speed = params.getIntValue("speed");
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "更新指令执行中成功");
|
||||||
|
return resp;
|
||||||
|
}else if (MsgTypeEnum.AGV_ERROR_RPT.getValue().equals(type)){
|
||||||
|
int agvId = params.getIntValue("agvId");
|
||||||
|
int errorCode = params.getIntValue("errState");
|
||||||
|
resp.put("code", "200");
|
||||||
|
resp.put("message", "更新指令执行中成功");
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
|
|||||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.liKuData.*;
|
import org.nl.acs.ext.wms.liKuData.*;
|
||||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
@@ -94,6 +95,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
ZheDaAgvService zheDaAgvService;
|
ZheDaAgvService zheDaAgvService;
|
||||||
|
@Autowired
|
||||||
|
AcsToNDCService acsToNDCService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void autoInitial() {
|
public void autoInitial() {
|
||||||
@@ -245,7 +248,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
@Override
|
@Override
|
||||||
public Instruction findByCode(String code) {
|
public Instruction findByCode(String code) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
JSONObject json = wo.query("instruction_code ='" + code + "'","create_time desc").uniqueResult(0);
|
JSONObject json = wo.query("instruction_code ='" + code + "'", "create_time desc").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(json)) {
|
if (ObjectUtil.isEmpty(json)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -347,62 +350,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(),String.valueOf(AgvSystemEnum.Maigic.getIndex()))) {
|
HttpResponse result = acsToNDCService.genAgvSchedulingTask(dto,3);
|
||||||
HttpResponse result = magicAgvService.sendAgvInstToMagic(dto);
|
|
||||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
} else {
|
} else {
|
||||||
dto.setSend_status("1");
|
dto.setSend_status("1");
|
||||||
}
|
}
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(), String.valueOf(AgvSystemEnum.NDC.getIndex()))) {
|
|
||||||
if(StrUtil.isBlank(dto.getAgv_inst_type())){
|
|
||||||
// String agv_system_type = task.getAgv_system_type();
|
|
||||||
String task_type = task.getTask_type();
|
|
||||||
// task_type
|
|
||||||
//1、普通任务; Itype=1:
|
|
||||||
//2、四点任务 Itype=2;
|
|
||||||
//3、八点任务 Itype=3;
|
|
||||||
if (StrUtil.equals(task_type, "1")) {
|
|
||||||
dto.setAgv_inst_type("1");
|
|
||||||
} else if (StrUtil.equals(task_type, "2")||task_type.equals("4")) {
|
|
||||||
dto.setAgv_inst_type("2");
|
|
||||||
} else if (StrUtil.equals(task_type, "3")) {
|
|
||||||
dto.setAgv_inst_type("3");
|
|
||||||
} else {
|
|
||||||
log.info("未找到对应的AGV指令类型,任务号:" + task.getTask_code() + ",task_type:" + task.getTask_type()) ;
|
|
||||||
}
|
|
||||||
// dto.setAgv_system_type(task.getAgv_system_type());
|
|
||||||
}
|
|
||||||
ndcAgvService.sendAgvInstToNDC("1", dto);
|
|
||||||
dto.setSend_status("1");
|
|
||||||
|
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).toString(), String.valueOf(AgvSystemEnum.XianGong.getIndex()))) {
|
|
||||||
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
|
|
||||||
//追加订单
|
|
||||||
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
|
||||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
|
||||||
dto.setSend_status("2");
|
|
||||||
} else {
|
|
||||||
dto.setSend_status("1");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//创建订单序列
|
|
||||||
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
|
||||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
|
||||||
dto.setSend_status("2");
|
|
||||||
} else {
|
|
||||||
dto.setSend_status("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(), String.valueOf(AgvSystemEnum.ZheDa.getIndex()))) {
|
|
||||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
|
||||||
zheDaAgvService.sendAgvInstToAgv(dto);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
dto.setSend_status("2");
|
dto.setSend_status("2");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
@@ -679,11 +635,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status("2");
|
entity.setInstruction_status("2");
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||||
String instnextdevice = entity.getNext_device_code();
|
String instnextdevice = entity.getNext_point_code();
|
||||||
String insttaskid = entity.getTask_id();
|
String insttaskid = entity.getTask_id();
|
||||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
Device startdevice = appService.findDeviceByCode(entity.getStart_point_code());
|
||||||
if (ObjectUtils.isEmpty(startdevice)) {
|
if (ObjectUtils.isEmpty(startdevice)) {
|
||||||
log.debug("地址对应设备未找到");
|
log.debug("地址对应设备未找到");
|
||||||
throw new BadRequestException("地址对应设备未找到");
|
throw new BadRequestException("地址对应设备未找到");
|
||||||
@@ -910,7 +866,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||||
// NDC agv指令不当场取消指令,需要等agv上报
|
// NDC agv指令不当场取消指令,需要等agv上报
|
||||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||||
ndcAgvService.deleteAgvInstToNDC(entity);
|
acsToNDCService.genAgvSchedulingTask(entity, 9);
|
||||||
} else {
|
} else {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public abstract class BlockedRunable implements Runnable {
|
|||||||
|
|
||||||
public abstract String getCode();
|
public abstract String getCode();
|
||||||
|
|
||||||
public abstract void subRun();
|
public abstract void subRun() throws Exception;
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
|
|||||||
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
|
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
|
||||||
BlockedRunable runnable = new BlockedRunable() {
|
BlockedRunable runnable = new BlockedRunable() {
|
||||||
@Override
|
@Override
|
||||||
public void subRun() {
|
public void subRun() throws Exception {
|
||||||
deviceDriver.executeAuto();
|
deviceDriver.executeAuto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,8 +451,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
String start_point_code = dto.getStart_point_code();
|
String start_point_code = dto.getStart_point_code();
|
||||||
String next_point_code = dto.getNext_point_code();
|
String next_point_code = dto.getNext_point_code();
|
||||||
String start_device_code = dto.getStart_device_code();
|
String start_device_code = dto.getStart_point_code();
|
||||||
String next_device_code = dto.getNext_device_code();
|
String next_device_code = dto.getNext_point_code();
|
||||||
String route_plan_code = dto.getRoute_plan_code();
|
String route_plan_code = dto.getRoute_plan_code();
|
||||||
if (StrUtil.isEmpty(dto.getCreate_by())) {
|
if (StrUtil.isEmpty(dto.getCreate_by())) {
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_by(currentUsername);
|
||||||
@@ -463,82 +463,14 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
dto.setTask_code(task_code);
|
dto.setTask_code(task_code);
|
||||||
dto.setRoute_plan_code(route_plan_code);
|
dto.setRoute_plan_code(route_plan_code);
|
||||||
dto.setTask_status("0");
|
dto.setTask_status("0");
|
||||||
|
dto.setStart_device_code(start_device_code);
|
||||||
|
dto.setNext_device_code(next_device_code);
|
||||||
dto.setStart_device_code2(dto.getStart_point_code2());
|
dto.setStart_device_code2(dto.getStart_point_code2());
|
||||||
dto.setNext_device_code2(dto.getNext_point_code2());
|
dto.setNext_device_code2(dto.getNext_point_code2());
|
||||||
|
|
||||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||||
dto.setPriority("1");
|
dto.setPriority("1");
|
||||||
}
|
}
|
||||||
String plan_code = dto.getRoute_plan_code();
|
|
||||||
// 判断起点终点设备类型
|
|
||||||
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code());
|
|
||||||
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code());
|
|
||||||
// if (routelineserver
|
|
||||||
// .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
|
|
||||||
// .size()
|
|
||||||
// == 0) {
|
|
||||||
// throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
|
|
||||||
// }
|
|
||||||
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
|
|
||||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
|
||||||
Device nextdevice = appService.findDeviceByCode(next_device_code);
|
|
||||||
Device startdevice = appService.findDeviceByCode(start_device_code);
|
|
||||||
// dto.setMaterial(startdevice.getMaterial_type());
|
|
||||||
// if (StrUtil.equals(createTaskCheck, "1")) {
|
|
||||||
// // 判断起点为输送设备
|
|
||||||
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 判断起点为输送设备
|
|
||||||
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
|
||||||
// // if (nextdevice.getDeviceDriver() instanceof
|
|
||||||
// // StandardOrdinarySiteDeviceDriver) {
|
|
||||||
// // standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
|
|
||||||
// // nextdevice.getDeviceDriver();
|
|
||||||
// // if (nextdevice.getHas_goods() != 0) {
|
|
||||||
// // throw new Exception("任务终点需满足无货!");
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
// JSONObject jo = new JSONObject();
|
|
||||||
// JSONObject jo2 = new JSONObject();
|
|
||||||
// if (!StrUtil.isEmpty(dto.getMaterial())) {
|
|
||||||
// if (!StrUtil.equals(dto.getMaterial(), "1")) {
|
|
||||||
// jo.put("hasGoodStatus", "2");
|
|
||||||
// jo.put("material_type", dto.getMaterial());
|
|
||||||
// } else {
|
|
||||||
// jo.put("hasGoodStatus", "1");
|
|
||||||
// jo.put("material_type", "1");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// jo.put("hasGoodStatus", "1");
|
|
||||||
// jo.put("material_type", "1");
|
|
||||||
// }
|
|
||||||
// jo.put("device_code", dto.getStart_device_code());
|
|
||||||
// jo.put("quantity", dto.getQuantity());
|
|
||||||
// jo.put("remark", dto.getRemark());
|
|
||||||
// jo.put("batch", startdevice.getBatch());
|
|
||||||
// jo.put("islock", "true");
|
|
||||||
// deviceService.changeDeviceStatus(jo);
|
|
||||||
// Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
|
|
||||||
// jo2.put("device_code", dto.getNext_device_code());
|
|
||||||
// jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
|
|
||||||
// jo2.put("quantity", deviceByCode.getQuantity());
|
|
||||||
// jo2.put("remark", deviceByCode.getRemark());
|
|
||||||
// jo2.put("material_type", deviceByCode.getMaterial_type());
|
|
||||||
// jo2.put("batch", deviceByCode.getBatch());
|
|
||||||
// jo2.put("islock", "true");
|
|
||||||
// deviceService.changeDeviceStatus(jo2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
|
|
||||||
@@ -968,18 +900,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
log.info("请求ZDwcs成功,任务取消 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,任务取消 请求结果{}", responseCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// List<RouteLineDto> shortPathsList =
|
|
||||||
// routeLineService.getShortPathLines(
|
|
||||||
// entity.getStart_device_code(),
|
|
||||||
// entity.getNext_device_code(),
|
|
||||||
// entity.getRoute_plan_code());
|
|
||||||
// String type = shortPathsList.get(0).getType();
|
|
||||||
// // != 0 为agv任务
|
|
||||||
// if (!StrUtil.equals(type, "0")) {
|
|
||||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
|
||||||
// agvService.markComplete(entity.getTask_code());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="FILE22" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名-->
|
||||||
|
<FileNamePattern>${LOG_HOME}/ACS请求NDC/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||||
|
<maxFileSize>200MB</maxFileSize>
|
||||||
|
<!--所有日志最多占多大容量-->
|
||||||
|
<totalSizeCap>2GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||||
|
<charset>${log.charset}</charset>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||||
|
<appender-ref ref="FILE3"/>
|
||||||
|
</logger>-->
|
||||||
|
|
||||||
|
<!-- 打印sql -->
|
||||||
|
<logger name="org.nl.acs.ext.wms.service.impl.AcsToNDCServiceImpl" level="info" additivity="true">
|
||||||
|
<appender-ref ref="FILE22"/>
|
||||||
|
</logger>
|
||||||
|
</included>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="FILE22" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名-->
|
||||||
|
<FileNamePattern>${LOG_HOME}/NDC反馈ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||||
|
<maxFileSize>200MB</maxFileSize>
|
||||||
|
<!--所有日志最多占多大容量-->
|
||||||
|
<totalSizeCap>2GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||||
|
<charset>${log.charset}</charset>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||||
|
<appender-ref ref="FILE3"/>
|
||||||
|
</logger>-->
|
||||||
|
|
||||||
|
<!-- 打印sql -->
|
||||||
|
<logger name="org.nl.acs.ext.wms.service.impl.NDCToAcsServiceImpl" level="info" additivity="true">
|
||||||
|
<appender-ref ref="FILE22"/>
|
||||||
|
</logger>
|
||||||
|
</included>
|
||||||
Reference in New Issue
Block a user