rev 项目提交
This commit is contained in:
@@ -9,7 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
* https://blog.csdn.net/moneyshi/article/details/82978073
|
||||
*/
|
||||
public enum DriverTypeEnum {
|
||||
ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "conveyor"),
|
||||
ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "station"),
|
||||
|
||||
INSPECT_SITE(2, "standard_inspect_site", "检测站点", "conveyor"),
|
||||
|
||||
|
||||
@@ -2,19 +2,23 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.lubei_conveyor.LubeiConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
@@ -27,6 +31,10 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceManageDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -68,6 +76,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
String error_message = "";
|
||||
boolean flag = false;
|
||||
|
||||
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
|
||||
this.error = error;
|
||||
@@ -92,6 +101,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno);
|
||||
Instruction link_inst = null;
|
||||
List<Instruction> insts = null;
|
||||
@@ -133,8 +143,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
StandardStorageDeviceDriver standardStorageDeviceDriver;
|
||||
//
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
//将车号写入DeviceManageDto
|
||||
DeviceManageDto deviceManageDto = new DeviceManageDto();
|
||||
deviceManageDto.setCarno(carno);
|
||||
|
||||
|
||||
LubeiConveyorDeviceDriver lubeiConveyorDeviceDriver;
|
||||
boolean is_feedback = false;
|
||||
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
||||
AcsToWmsZDService acsToWmsZDService = SpringContextHolder.getBean("acsToWmsZDServiceImpl");
|
||||
TaskDto task = taskService.findByCode(inst.getTask_code());
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
@@ -145,11 +163,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//到达取货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x03) {
|
||||
log.info("==================AGV请求取货==================");
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令:" + ikey);
|
||||
log.info("{},{}", device_code, "未找到指令 [" + ikey + "]");
|
||||
return;
|
||||
}
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
log.info("{},{}", device_code, "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
@@ -170,43 +194,70 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
log.info("{},{}", device_code, "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "applyTake");
|
||||
log.info("请求参数:{}", jo);
|
||||
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 (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
log.info("请求参数:{}", jo);
|
||||
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);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// } else {
|
||||
// log.info("请求取货条件不满足待机有货");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// } else {
|
||||
// log.info("请求取货条件不满足待机有货");
|
||||
// }
|
||||
// }
|
||||
// if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
@@ -243,40 +294,58 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "takeFinish");
|
||||
log.info("请求参数:{}", jo);
|
||||
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 (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getTo_command() == 2) {
|
||||
log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "takeFinish");
|
||||
log.info("请求参数:{}", jo);
|
||||
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 (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// if (siemensConveyorDeviceDriver.getTo_command() == 2) {
|
||||
// log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// } else {
|
||||
// log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
// List list = new ArrayList();
|
||||
// Map map = new HashMap();
|
||||
// map.put("code", "to_command");
|
||||
// map.put("value", "2");
|
||||
// list.add(map);
|
||||
// siemensConveyorDeviceDriver.writing(list);
|
||||
// siemensConveyorDeviceDriver.writing(list);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (ObjectUtil.isNotEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
}
|
||||
@@ -308,24 +377,53 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "applyPut");
|
||||
log.info("请求参数:{}", jo);
|
||||
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);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "applyPut");
|
||||
log.info("请求参数:{}", jo);
|
||||
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);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
if (flag) {
|
||||
log.info("==================允许AGV放货==================");
|
||||
log.info("{},{}", device_code,"允许AGV放货。");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x09) {
|
||||
@@ -360,18 +458,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "putFinish");
|
||||
log.info("请求参数:{}", jo);
|
||||
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);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode", task.getTask_code());
|
||||
jo.put("carId", carno);
|
||||
jo.put("taskType ", task.getTask_type());
|
||||
jo.put("feedbackStatus", "putFinish");
|
||||
log.info("请求参数:{}", jo);
|
||||
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);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//到达位置点
|
||||
@@ -418,6 +537,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
//将小车状态写入DeviceManageDto
|
||||
deviceManageDto.setStatus(status);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "wms接口")
|
||||
@RequestMapping("/restful/api/v3/system_car")
|
||||
@RequestMapping("/wcs/restful/api/v3/system_car")
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@SaIgnore
|
||||
|
||||
@@ -47,15 +47,16 @@ public class DeviceManageDto {
|
||||
private Boolean is_entrance;
|
||||
/* 粉桶号 */
|
||||
private String barrels_code;
|
||||
|
||||
/* 配合批号 */
|
||||
private String cooperate_code;
|
||||
|
||||
/* 粉种名称 */
|
||||
private String powder_name;
|
||||
|
||||
/* 粉桶状态 */
|
||||
private String barrels_status;
|
||||
/* 小车车号 */
|
||||
private Integer carno;
|
||||
/* 小车状态 */
|
||||
private Integer status;
|
||||
|
||||
private List<DeviceExtraManageDto> extra = new LinkedList();
|
||||
private String perfix;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||
import org.nl.modules.mnt.websocket.MsgType;
|
||||
import org.nl.modules.mnt.websocket.SocketMsg;
|
||||
import org.nl.modules.mnt.websocket.WebSocketServer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
/**
|
||||
* 设备上传 zjj
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DeviceStatusUpdate {
|
||||
@Autowired
|
||||
AcsToWmsZDService acsToWmsZDService;
|
||||
@Autowired
|
||||
ZheDaAgvService zheDaAgvService;
|
||||
|
||||
public void run() throws Exception {
|
||||
JSONObject row = new JSONObject();
|
||||
HttpResponse response = zheDaAgvService.queryZDAgvDeviceStatus();
|
||||
JSONArray inst_rows = JSONArray.parseArray(response.body());
|
||||
|
||||
for (int i = 0; i < inst_rows.size(); i++) {
|
||||
JSONObject inst_jo = inst_rows.getJSONObject(i);
|
||||
String deviceCode = inst_jo.getString("vehicle");
|
||||
String statusDescription = inst_jo.getString("status");
|
||||
row.put("deviceCode",deviceCode);
|
||||
row.put("status","1");
|
||||
row.put("statusDescription",statusDescription);
|
||||
JSONObject jo=JSONObject.parseObject(String.valueOf(row));
|
||||
HttpResponse result=acsToWmsZDService.deviceStatusUpdate(jo);
|
||||
JSONObject response1=JSONObject.parseObject(result.body());
|
||||
int responseCode= response1.getInteger("responseCode");
|
||||
if(responseCode == 0) {
|
||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
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.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class QueryZDAgvTaskStatus {
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
ZheDaAgvService agvService;
|
||||
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
|
||||
@Autowired
|
||||
AcsToWmsZDService acsToWmsZDService;
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
|
||||
HttpResponse response = agvService.queryAgvInstStatus();
|
||||
//查询AGV指令列表
|
||||
JSONArray inst_rows = JSONArray.parseArray(response.body());
|
||||
for (int i = 0; i < inst_rows.size(); i++) {
|
||||
JSONObject inst_jo = inst_rows.getJSONObject(i);
|
||||
String inst_code = inst_jo.getString("task_code");
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
log.info("查询到的任务号{}",inst);
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
continue;
|
||||
}
|
||||
//反馈结果状态
|
||||
log.info("instcode:" + inst_code + "," + inst_jo.toString());
|
||||
String state = inst_jo.getString("state");
|
||||
String vehicle = "";
|
||||
//正在执行指令agv车号
|
||||
if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) {
|
||||
vehicle = inst_jo.getString("vehicle");
|
||||
inst.setCarno(vehicle);
|
||||
}
|
||||
// RAW:初始状态
|
||||
// ACTIVE:业务订单已激活
|
||||
// DISPATCHABLE:业务订单已通过系统验证,等待被调度执行
|
||||
// BEING_PROCESSED:业务订单正在被执行
|
||||
// WITHDRAWN:业务订单已被撤销
|
||||
// FINISHED:业务订单已完成
|
||||
// FAILED:业务订单已失败
|
||||
// UNROUTABLE:无法规划该业务订单的执行路线
|
||||
|
||||
//执行中
|
||||
if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) {
|
||||
if (inst != null && StrUtil.equals("0",inst.getInstruction_status())) {
|
||||
log.info("更新指令状态执行中---");
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
log.info("更新指令状态执行中成功---");
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
TaskDto entity = taskService.findByCode(inst.getTask_code());
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
String Type1=entity.getTask_type();
|
||||
|
||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode",entity.getTask_code());
|
||||
jo.put("carId","111");
|
||||
jo.put("taskType ",entity.getTask_type());
|
||||
jo.put("feedbackStatus","taking");
|
||||
log.info("请求参数:{}",jo);
|
||||
try{
|
||||
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
|
||||
log.info("请求ZDwcs成功,反馈取货中 请求结果{}",result.body());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// JSONObject response=JSONObject.parseObject(result.body());
|
||||
// int responseCode= response.getInteger("responseCode");
|
||||
// if(responseCode == 0) {
|
||||
// log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode);
|
||||
// }
|
||||
} else {
|
||||
if(StrUtil.equals(Type1,"定点任务")){
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode",entity.getTask_code());
|
||||
jo.put("carId",vehicle);
|
||||
jo.put("taskType ",entity.getTask_type());
|
||||
jo.put("feedbackStatus","taking");
|
||||
log.info("请求参数:{}",jo);
|
||||
try{
|
||||
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
|
||||
log.info("请求ZDwcs成功,反馈取货中 请求结果{}",result.body());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// JSONObject response=JSONObject.parseObject(result.body());
|
||||
// int responseCode= response.getInteger("responseCode");
|
||||
// if(responseCode == 0) {
|
||||
// log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode);
|
||||
// }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(ObjectUtil.isEmpty(inst)){
|
||||
log.info("未更新指令状态执行中,inst为空,指令号:"+ inst_code);
|
||||
}
|
||||
if(!StrUtil.equals("0",inst.getInstruction_status())){
|
||||
log.info("未更新指令状态执行中,inst状态:"+ inst.getInstruction_status());
|
||||
}
|
||||
}
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
}
|
||||
} else if ("WITHDRAWN".equals(state) || "FAILED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("3");
|
||||
instructionService.update(inst);
|
||||
instructionService.removeByCodeFromCache(inst_jo.getString("task_code"));
|
||||
}
|
||||
}
|
||||
JSONArray ja = inst_jo.getJSONArray("destinations");
|
||||
for (int j = 0; j < ja.size(); j++) {
|
||||
JSONObject jo = ja.getJSONObject(j);
|
||||
JSONArray pro_rows = jo.getJSONArray("properties");
|
||||
//Load 取货动作 Unload放货动作 Wait等待
|
||||
String operation = jo.getString("operation");
|
||||
String device = jo.getString("locationName");
|
||||
for (int k = 0; k < pro_rows.size(); k++) {
|
||||
JSONObject item = pro_rows.getJSONObject(k);
|
||||
if ("true".equals(item.get("value"))) {
|
||||
String param = item.get("key").toString();
|
||||
//EntryRequired是否进入前等待 PauseOnStation是否离开等待 Wait在该点进行等待
|
||||
agvService.process(inst_code, param, device, operation, vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<appender name="FILE11" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/AgvNdcOneDeviceDriver/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<FileNamePattern>${LOG_HOME}/NDC与ACS交互/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?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="QueryZDAgvTaskStatus" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/任务反馈/%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.modules.quartz.task.QueryZDAgvTaskStatus" level="info" additivity="false">
|
||||
<appender-ref ref="QueryZDAgvTaskStatus"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -30,7 +30,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<include resource="log/ZheDaAgv.xml"/>
|
||||
<include resource="log/AcsToZDWms.xml"/>
|
||||
<include resource="log/ZDToAcsWms.xml"/>
|
||||
<include resource="log/QueryZDAgvTaskStatus.xml"/>
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
|
||||
14
nladmin-system/src/main/resources/log/AcsToZDWms.xml
Normal file
14
nladmin-system/src/main/resources/log/AcsToZDWms.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="$CONTROLLER_NAME$"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
||||
Reference in New Issue
Block a user