fix: 开发
This commit is contained in:
@@ -133,19 +133,19 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
if (type == 1) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X14,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X00, (byte) 0X10,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) qhdhigh2, (byte) qhdlow2,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
(byte) 0X00, (byte) 0X00
|
||||
|
||||
};
|
||||
} else if (type == 2) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.device_driver.agv.ndctwo;
|
||||
|
||||
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;
|
||||
@@ -16,9 +17,13 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
||||
import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.AcsToWcsData.DeviceStatusGetRequest;
|
||||
import org.nl.acs.ext.wms.data.AcsToWcsData.DeviceStatusGetResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
@@ -27,11 +32,13 @@ import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.enums.FeedbackStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.JsonUtl;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
@@ -71,6 +78,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
|
||||
ISysDictService dictService = SpringContextHolder.getBean(ISysDictService.class);
|
||||
AcsToWcsService acsToWcsService = SpringContextHolder.getBean(AcsToWcsService.class);
|
||||
|
||||
String error_code = "0";
|
||||
int agvaddr = 0;
|
||||
@@ -169,6 +177,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//标准-光电检测
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
//自动门
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
|
||||
|
||||
if (phase == 0x02) {
|
||||
@@ -225,16 +235,82 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
instructionService.update(inst);
|
||||
}
|
||||
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//更新agv状态
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("containerCode", inst.getVehicle_code());
|
||||
param3.put("taskCode", inst.getTask_code());
|
||||
param3.put("carId", inst.getCarno());
|
||||
param3.put("taskType", inst.getInstruction_type());
|
||||
param3.put("feedbackStatus", FeedbackStatusEnum.APPLY_TAKE.getCode());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请取货,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请取货返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("inspect_in_stocck"))
|
||||
&& StrUtil.equals("true", device.getExtraValue().get("inspect_in_stocck").toString())
|
||||
) {
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("deviceCode", device_code);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("获取设备信息,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
//点位需要判断光电,判断站点
|
||||
HttpResponse httpResponse = acsToWcsService.deviceStatusGet(param);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
DeviceStatusGetResponse format = JsonUtl.format(body, DeviceStatusGetResponse.class);
|
||||
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("获取设备信息返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
if (format.getStatus() == 0 && format.getHasGoods()) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
} else {
|
||||
LuceneLogDto logDto4 = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("条件不满足:" + format.toString())
|
||||
.build();
|
||||
logDto4.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -298,6 +374,31 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
//更新agv状态
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("containerCode", inst.getVehicle_code());
|
||||
param3.put("taskCode", inst.getTask_code());
|
||||
param3.put("carId", inst.getCarno());
|
||||
param3.put("taskType", inst.getInstruction_type());
|
||||
param3.put("feedbackStatus", FeedbackStatusEnum.TAKE_FINISH.getCode());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("取货完成,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("取货完成返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
@@ -305,9 +406,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -360,6 +459,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
//更新agv状态
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("containerCode", inst.getVehicle_code());
|
||||
param3.put("taskCode", inst.getTask_code());
|
||||
param3.put("carId", inst.getCarno());
|
||||
param3.put("taskType", inst.getInstruction_type());
|
||||
param3.put("feedbackStatus", FeedbackStatusEnum.APPLY_PUT.getCode());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请放货,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请放货返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
|
||||
}
|
||||
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
@@ -421,30 +547,75 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//更新agv状态
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("containerCode", inst.getVehicle_code());
|
||||
param3.put("taskCode", inst.getTask_code());
|
||||
param3.put("carId", inst.getCarno());
|
||||
param3.put("taskType", inst.getInstruction_type());
|
||||
param3.put("feedbackStatus", FeedbackStatusEnum.PUT_FINISH.getCode());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("放货完成,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("放货完成返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("inspect_in_stocck"))
|
||||
&& StrUtil.equals("true", device.getExtraValue().get("inspect_in_stocck").toString())
|
||||
) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("获取设备信息,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
//点位需要判断光电,判断站点
|
||||
HttpResponse httpResponse = acsToWcsService.deviceStatusGet(param);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
DeviceStatusGetResponse format = JsonUtl.format(body, DeviceStatusGetResponse.class);
|
||||
|
||||
JSONObject param2 = new JSONObject();
|
||||
param2.put("device_code", device_code);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("获取设备信息返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
if (format.getStatus() == 0 && format.getHasGoods()) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
} else {
|
||||
LuceneLogDto logDto4 = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("条件不满足:" + format.toString())
|
||||
.build();
|
||||
logDto4.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto4);
|
||||
}
|
||||
}
|
||||
}
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
standardInspectSiteDeviceDriver.writing(1);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
@@ -497,11 +668,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//当前上报的车号
|
||||
String now_car = String.valueOf(this.agvaddr);
|
||||
//如果配置的车号是诺宝车号
|
||||
if(now_car.equals(is_atuo_car)){
|
||||
if (now_car.equals(is_atuo_car)) {
|
||||
//是否开启自动充电
|
||||
String is_atuo_electric = ISysParamService.findByCode(AcsConfig.IS_ATUO_ELECTRIC).getValue();
|
||||
log.info("接收agv上报信息,is_atuo_electric:" + is_atuo_electric);
|
||||
if("1".equals(is_atuo_electric)){
|
||||
if ("1".equals(is_atuo_electric)) {
|
||||
String electric_begin = ISysParamService.findByCode(AcsConfig.ELECTRIC_BEGIN).getValue();
|
||||
String[] begins = electric_begin.split(":");
|
||||
String electric_end = ISysParamService.findByCode(AcsConfig.ELECTRIC_END).getValue();
|
||||
@@ -513,76 +684,57 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
LocalTime now = LocalTime.now();
|
||||
// 判断当前时间是否在时间段内
|
||||
boolean isInRange = !now.isBefore(startTime) && !now.isAfter(endTime);
|
||||
int electric = 0 ;
|
||||
int electric = 0;
|
||||
//早上8-22点
|
||||
if(isInRange){
|
||||
if (isInRange) {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC).getValue());
|
||||
}else{
|
||||
} else {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC2).getValue());
|
||||
}
|
||||
if (electric_qty>0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty,electric);
|
||||
if (electric_qty > 0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty, electric);
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station",String.valueOf(this.agvaddr),null);
|
||||
if(ObjectUtil.isNotEmpty(dict1)){
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断",this.agvaddr,dict1.getPara1());
|
||||
}else{
|
||||
Dict dict1 = dictService.getDictByName3("station", String.valueOf(this.agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断", this.agvaddr, dict1.getPara1());
|
||||
} else {
|
||||
//未下发,判断是否有空闲充电桩
|
||||
Dict dict = dictService.getDictByName2("station");
|
||||
if(ObjectUtil.isNotEmpty(dict)){
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
ndcAgvService.charge(String.valueOf(this.agvaddr));
|
||||
isCharge =true;
|
||||
}else{
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty,electric);
|
||||
isCharge = true;
|
||||
} else {
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty, electric);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "三色灯状态:" + status)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
|
||||
if (status != last_status && status != 6 && status != 7) {
|
||||
boolean flag = true;
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", this.device_code);
|
||||
if (status == 1) {
|
||||
param.put("mode", 0);
|
||||
} else if (status == 2) {
|
||||
param.put("mode", 3);
|
||||
} else if ("345".contains(String.valueOf(status))) {
|
||||
param.put("mode", 2);
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
param.put("device_name", this.getDevice().getDevice_name());
|
||||
param.put("device_type", "4");
|
||||
param.put("product_area", ISysParamService.findByCode("productArea").getValue());
|
||||
acsToWmsService.sendDeviceStatus(param);
|
||||
}
|
||||
}
|
||||
|
||||
last_status = status;
|
||||
} //进入区域(phase值)
|
||||
//进入区域(phase值)
|
||||
else if (phase == 0x50) {
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (Objects.equals(inst.getInstruction_type(), "1") &&standardInspectSiteDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
String address = standardAutodoorDeviceDriver.getExtraValue().get("address").toString();
|
||||
|
||||
try {
|
||||
if (standardAutodoorDeviceDriver.getError() == 0){
|
||||
standardAutodoorDeviceDriver.writing("to_open", "1");
|
||||
standardAutodoorDeviceDriver.writing("toTarget", address);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (Objects.equals(inst.getInstruction_type(), "2") &&standardInspectSiteDeviceDriver.getMove() == 1) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getError() == 0) {
|
||||
log.info("下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen());
|
||||
}
|
||||
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
@@ -595,6 +747,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//离开区域(phase值)
|
||||
else if (phase == 0x51) {
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
if (standardAutodoorDeviceDriver.getError() == 0){
|
||||
standardAutodoorDeviceDriver.writing("to_finish", "1");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content("agvphase:" + phase + "反馈:" + data)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
@@ -613,24 +786,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String code = error.get("code");
|
||||
String info = error.get("info");
|
||||
this.setErrorInfo(ikey, code, info);
|
||||
}
|
||||
if (error != last_error) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
dto.setError_code(String.valueOf(error_code));
|
||||
dto.setError_info(error_message);
|
||||
deviceErrorLogService.create(dto);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", this.device_code);
|
||||
param.put("error", error);
|
||||
param.put("error_msg", error == 0 ? "" : this.getError_message());
|
||||
param.put("device_name", this.getDevice().getDevice_name());
|
||||
param.put("device_type", "4");
|
||||
param.put("product_area", ISysParamService.findByCode("productArea").getValue());
|
||||
acsToWmsService.sendDeviceStatus(param);
|
||||
}
|
||||
last_error = error;
|
||||
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
|
||||
@@ -9,10 +9,18 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class ItemProtocol {
|
||||
/**
|
||||
* 心跳
|
||||
*/
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_open = "open";
|
||||
public static String item_close = "close";
|
||||
public static String item_error = "error";
|
||||
|
||||
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_open = "to_open";
|
||||
public static String item_to_close = "to_close";
|
||||
public static String item_to_finish = "to_finish";
|
||||
public static String item_to_safety = "to_safety";
|
||||
|
||||
|
||||
private StandardAutodoorDeviceDriver driver;
|
||||
@@ -21,12 +29,18 @@ public class ItemProtocol {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getOpen() {
|
||||
return this.getOpcIntegerValue(item_open);
|
||||
|
||||
/**
|
||||
* 获取心跳值
|
||||
*
|
||||
* @return 心跳状态值
|
||||
*/
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getClose() {
|
||||
return this.getOpcIntegerValue(item_close);
|
||||
public int getOpen() {
|
||||
return this.getOpcIntegerValue(item_open);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +48,43 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_open);
|
||||
}
|
||||
|
||||
public int getToClose() {
|
||||
return this.getOpcIntegerValue(item_to_close);
|
||||
/**
|
||||
* 获取故障值
|
||||
*
|
||||
* @return 故障状态值
|
||||
*/
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取到目标位指令值
|
||||
*
|
||||
* @return 到目标位指令值
|
||||
*/
|
||||
public int getToTarget() {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取到完成位指令值
|
||||
*
|
||||
* @return 到完成位指令值
|
||||
*/
|
||||
public int getToFinish() {
|
||||
return this.getOpcIntegerValue(item_to_finish);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取到安全位指令值
|
||||
*
|
||||
* @return 到安全位指令值
|
||||
*/
|
||||
public int getToSafety() {
|
||||
return this.getOpcIntegerValue(item_to_safety);
|
||||
}
|
||||
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
@@ -61,15 +108,18 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "10000"));
|
||||
list.add(new ItemDto(item_open, "开到位", "10001"));
|
||||
list.add(new ItemDto(item_close, "关到位", "10002"));
|
||||
list.add(new ItemDto(item_error, "故障", "10003"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_open, "下发开门", "00001" ));
|
||||
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
|
||||
list.add(new ItemDto(item_to_open, "下发开门", "00001"));
|
||||
list.add(new ItemDto(item_to_target, "下发到目标位", "00003"));
|
||||
list.add(new ItemDto(item_to_finish, "下发到完成位", "00004"));
|
||||
list.add(new ItemDto(item_to_safety, "下发到安全位", "00005"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,15 +36,19 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
|
||||
int open = 0;
|
||||
int close = 0;
|
||||
|
||||
int last_open = 0;
|
||||
int last_close = 0;
|
||||
|
||||
int toOpen = 0;
|
||||
int last_toOpen = 0;
|
||||
int toClose = 0;
|
||||
int last_toClose = 0;
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
int toTarget = 0;
|
||||
int last_toTarget = 0;
|
||||
int toFinish = 0;
|
||||
int last_toFinish = 0;
|
||||
int toSafety = 0;
|
||||
int last_toSafety = 0;
|
||||
String device_code = null;
|
||||
|
||||
@Override
|
||||
@@ -59,22 +63,23 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
device_code = this.getDevice().getDevice_code();
|
||||
open = this.itemProtocol.getOpen();
|
||||
close = this.itemProtocol.getClose();
|
||||
toOpen = this.itemProtocol.getToOpen();
|
||||
toClose = this.itemProtocol.getToClose();
|
||||
|
||||
error = this.itemProtocol.getError();
|
||||
toTarget = this.itemProtocol.getToTarget();
|
||||
toFinish = this.itemProtocol.getToFinish();
|
||||
toSafety = this.itemProtocol.getToSafety();
|
||||
if (open != last_open) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open);
|
||||
}
|
||||
if (close != last_close) {
|
||||
if(close ==1 ){
|
||||
this.writing("to_close","0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
last_open = open;
|
||||
last_close = close;
|
||||
last_toClose = toClose;
|
||||
last_toOpen = toOpen;
|
||||
last_error = error;
|
||||
last_toTarget = toTarget;
|
||||
last_toFinish = toFinish;
|
||||
last_toSafety = toSafety;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,11 +123,6 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
} else if (this.getOpen() == 1) {
|
||||
open = "开到位";
|
||||
}
|
||||
if (this.getClose() == 0) {
|
||||
open = "未知";
|
||||
} else if (this.getClose() == 1) {
|
||||
open = "关到位";
|
||||
}
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("open", open);
|
||||
jo.put("close", close);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.acs.ext.wms.data.AcsToWcsData;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备状态查询接口 - 输入参数实体类
|
||||
*/
|
||||
@Data
|
||||
public class DeviceStatusGetRequest {
|
||||
/**
|
||||
* 库编号(非必选)
|
||||
*/
|
||||
private String houseCode;
|
||||
|
||||
/**
|
||||
* 系统编码(非必选)
|
||||
*/
|
||||
private String systemCode;
|
||||
|
||||
/**
|
||||
* 扩展项(非必选,字段不足时拓展补充)
|
||||
*/
|
||||
private Object parameters;
|
||||
|
||||
/**
|
||||
* 请求设备号/库位号(必选)
|
||||
*/
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 容器编号(文档高亮标注,建议按必选处理)
|
||||
*/
|
||||
private String containerCode;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.acs.ext.wms.data.AcsToWcsData;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备状态查询接口 - 输出参数实体类
|
||||
*/
|
||||
@Data
|
||||
public class DeviceStatusGetResponse {
|
||||
/**
|
||||
* 请求结果代码(必选):0-正常;非0-异常
|
||||
*/
|
||||
private Integer responseCode;
|
||||
|
||||
/**
|
||||
* 请求结果描述(非必选):responseCode≠0时填异常信息
|
||||
*/
|
||||
private String responseMessage;
|
||||
|
||||
/**
|
||||
* 扩展项(非必选,字段不足时拓展补充)
|
||||
*/
|
||||
private Object parameters;
|
||||
|
||||
/**
|
||||
* 设备状态(必选):0-正常;非0-异常
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 状态描述(非必选)
|
||||
*/
|
||||
private String statusDescription;
|
||||
|
||||
/**
|
||||
* 是否有货(必选):true-有货;false-无货
|
||||
*/
|
||||
private Boolean hasGoods;
|
||||
|
||||
/**
|
||||
* 设备当前模式(必选):0-复位;1-手动;2-联机待机;3-联机执行任务;5-申请空托;14-申请入库;其它-未知
|
||||
*/
|
||||
private Integer deviceMode;
|
||||
|
||||
/**
|
||||
* 有货状态(必选):0-无货;1-前端有货;8-后端有货;17-低位前端有货;33-高位前端有货;其它-未知
|
||||
*/
|
||||
private Integer deviceMove;
|
||||
}
|
||||
@@ -47,10 +47,7 @@ public class BaseRequest {
|
||||
*/
|
||||
private String systemCode;
|
||||
|
||||
/**
|
||||
* 扩展参数:砖型等
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class CreateTaskWcsRequest extends BaseRequest {
|
||||
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
private String taskCode;
|
||||
|
||||
|
||||
/**
|
||||
* 取货点1
|
||||
*/
|
||||
String locationFrom;
|
||||
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
String parameters;
|
||||
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
String locationTo;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
String priority ;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
String containerCode;
|
||||
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
String containerType;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
Map<String, String> params = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 路由方案
|
||||
*/
|
||||
String route_plan_code;
|
||||
|
||||
/**
|
||||
* 1、生箔;
|
||||
* 2、分切
|
||||
* 3、普通任务
|
||||
* 4、叉车任务
|
||||
* 5、输送任务
|
||||
* 6、行架
|
||||
* 7、立库
|
||||
* 任务类型
|
||||
*/
|
||||
String taskType;
|
||||
|
||||
|
||||
/**
|
||||
* 任务创建时间
|
||||
*/
|
||||
String taskCreateDateTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/wcs")
|
||||
@Slf4j
|
||||
public class AcsToWcsController {
|
||||
|
||||
|
||||
private final AcsToWcsService acstowcsService;
|
||||
|
||||
|
||||
@PostMapping("/taskStatusFeedback")
|
||||
@Log("向WCS反馈任务状态")
|
||||
public ResponseEntity<Object> feedbackTaskStatusToWms(@RequestBody JSONObject json) {
|
||||
|
||||
return new ResponseEntity<>(acstowcsService.feedbackTaskStatusToWcs(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deprecateTask")
|
||||
@Log("WCS取消任务")
|
||||
public ResponseEntity<Object> feedbackDeprecateTask(@RequestBody JSONObject json) {
|
||||
|
||||
return new ResponseEntity<>(acstowcsService.feedbackDeprecateTask(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/deviceStatusGet")
|
||||
@Log("设备状态获取")
|
||||
public ResponseEntity<Object> deviceStatusGet(@RequestBody JSONObject json) {
|
||||
|
||||
return new ResponseEntity<>(acstowcsService.deviceStatusGet(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/acs")
|
||||
@Slf4j
|
||||
public class WcsToAcsController {
|
||||
|
||||
|
||||
private final WmsToAcsService wcstoacsService;
|
||||
@PostMapping("/task")
|
||||
@Log(value = "ACS接收WMS任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> createFromWms(@RequestBody String whereJson, HttpServletRequest request) {
|
||||
log.info("wcs下发任务的ip:{},端口号:{},地址:{}", request.getRemoteAddr(),request.getRemotePort(),request.getRemoteHost());
|
||||
return new ResponseEntity<>(wcstoacsService.crateTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface AcsToWcsService {
|
||||
/**
|
||||
* 向WMS反馈任务状态
|
||||
* @param arr
|
||||
* @return
|
||||
*/
|
||||
public HttpResponse feedbackTaskStatusToWcs(JSONObject arr);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务取消
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public HttpResponse feedbackDeprecateTask(JSONObject json);
|
||||
|
||||
|
||||
/**
|
||||
* 设备状态查询
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public HttpResponse deviceStatusGet(JSONObject json);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.one.CancelTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.one.CancelTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.one.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.one.CreateTaskResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface WcsToAcsService {
|
||||
/**
|
||||
* crateTask
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
org.nl.acs.ext.wms.data.CreateTaskResponse crateTask(String param);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.Header;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.yomahub.tlog.hutoolhttp.TLogHutoolhttpInterceptor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.address.service.AddressService;
|
||||
import org.nl.acs.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.RetryableUtil;
|
||||
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsToWcsServiceImpl implements AcsToWcsService {
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "ACS请求WCS";
|
||||
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
AddressService addressService;
|
||||
|
||||
TLogHutoolhttpInterceptor tLogHutoolhttpInterceptor = new TLogHutoolhttpInterceptor();
|
||||
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer;
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneLogService;
|
||||
|
||||
@Autowired
|
||||
private RetryableUtil retryableUtil;
|
||||
|
||||
public String token;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResponse feedbackTaskStatusToWcs(JSONObject jo) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("feedbackTaskStatusToWcs-----agv状态更新输入参数{}", jo);
|
||||
String wcsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWcs");
|
||||
String url = wcsurl + addressDto.getMethods_url();
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jo))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("feedbackTaskStatusToWcs-----agv状态更新输出参数{}", msg);
|
||||
//网络不通
|
||||
}
|
||||
if (ObjectUtil.isEmpty(result2)) {
|
||||
log.info("feedbackTaskStatusToWcs-----agv状态更新输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("feedbackTaskStatusToWcs-----agv状态更新输出参数{}", result2.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedbackTaskStatusToWcs", String.valueOf(result2.getStatus()),
|
||||
JSON.toJSONString(jo), String.valueOf(result2.body()), "ACS向WCS申请agv状态更新");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedbackDeprecateTask(JSONObject jo) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("feedbackDeprecateTask-----agv状态更新输入参数{}", jo);
|
||||
String wcsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWcs");
|
||||
String url = wcsurl + addressDto.getMethods_url();
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jo))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("feedbackDeprecateTask-----任务取消输出参数{}", msg);
|
||||
//网络不通
|
||||
}
|
||||
if (ObjectUtil.isEmpty(result2)) {
|
||||
log.info("feedbackDeprecateTask-----任务取消输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("feedbackDeprecateTask-----任务取消输出参数{}", result2.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedbackDeprecateTask", String.valueOf(result2.getStatus()),
|
||||
JSON.toJSONString(jo), String.valueOf(result2.body()), "ACS向WCS申请任务取消");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse deviceStatusGet(JSONObject jo) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("deviceStatusGet-----agv状态更新输入参数{}", jo);
|
||||
String wcsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("deviceStatusGet");
|
||||
String url = wcsurl + addressDto.getMethods_url();
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jo))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("deviceStatusGet-----设备状态查询输出参数{}", msg);
|
||||
//网络不通
|
||||
}
|
||||
if (ObjectUtil.isEmpty(result2)) {
|
||||
log.info("deviceStatusGet-----设备状态查询输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("deviceStatusGet-----设备状态查询输出参数{}", result2.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "deviceStatusGet", String.valueOf(result2.getStatus()),
|
||||
JSON.toJSONString(jo), String.valueOf(result2.body()), "ACS向WCS申请设备状态查询");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.*;
|
||||
import org.nl.acs.ext.wms.service.WcsToAcsService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WcsToAcsServiceImpl implements WcsToAcsService {
|
||||
|
||||
@Autowired
|
||||
private StorageCellMapper storageCellMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskserver;
|
||||
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "LMS请求ACS";
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("ACS接收WCS任务-----输入参数{}", param);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("ACS接收WCS任务")
|
||||
.content("ACS接收WCS任务-----输入参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
CreateTaskResponse response = new CreateTaskResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
CreateTaskWcsRequest request = JsonUtl.format(data, CreateTaskWcsRequest.class);
|
||||
|
||||
String task_code = request.getTaskCode();
|
||||
String start_device_code = request.getLocationFrom();
|
||||
String next_device_code = request.getLocationTo();
|
||||
String priority = request.getPriority();
|
||||
String vehicle_code = request.getContainerCode();
|
||||
String vehicle_type = request.getContainerType();
|
||||
String route_plan_code = request.getRoute_plan_code();
|
||||
String task_type = request.getTaskType();
|
||||
String parameters = request.getParameters();
|
||||
|
||||
|
||||
|
||||
String start_point_code = "";
|
||||
String start_point_code2 = "";
|
||||
String next_point_code = "";
|
||||
String next_point_code2 = "";
|
||||
String put_point_code = "";
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
|
||||
json.put("message", "任务号不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
StorageCell start_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
|
||||
.eq(StorageCell::getStorage_code, start_device_code)
|
||||
.one();
|
||||
StorageCell next_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
|
||||
.eq(StorageCell::getStorage_code, next_device_code)
|
||||
.one();
|
||||
|
||||
JSONObject start_device_json = (JSONObject) JSONObject.toJSON(start_storageCell);
|
||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json = (JSONObject) JSONObject.toJSON(next_storageCell);
|
||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isEmpty(route_plan_code)) {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
if (StrUtil.equals(task_type, "5")) {
|
||||
if (taskserver.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "存在相同的任务号:" + task_code);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", request.getLocationFrom() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", request.getLocationTo() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", IdUtil.simpleUUID());
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("start_point_code2", start_point_code2);
|
||||
jo.put("next_point_code2", next_point_code2);
|
||||
jo.put("put_point_code", put_point_code);
|
||||
jo.put("start_parent_code", start_point_code);
|
||||
jo.put("next_parent_code", next_point_code);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
jo.put("route_plan_code", route_plan_code);
|
||||
jo.put("request_param", parameters);
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
|
||||
taskserver.create(task_dto);
|
||||
|
||||
} catch (Exception e) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
||||
response.setMessage(errArr.getJSONObject(0).getString("message"));
|
||||
} else {
|
||||
response.setMessage("false");
|
||||
}
|
||||
response.setErrArr(errArr);
|
||||
}
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("ACS接收WCS任务")
|
||||
.content("ACS接收WCS任务-----返回参数:" + JSON.toJSONString(response))
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
log.info("ACS接收WCS任务--------------:输出参数:" + JSON.toJSONString(response));
|
||||
|
||||
return response;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.acs.instruction.enums;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 任务反馈状态枚举类
|
||||
* @author 自动生成(基于feedbackStatus状态定义)
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FeedbackStatusEnum {
|
||||
/**
|
||||
* 任务反馈状态枚举常量(index按顺序分配)
|
||||
*/
|
||||
APPLY_TAKE("0", "applyTake", "申请取货"),
|
||||
TAKING("1", "taking", "取货中"),
|
||||
TAKE_FINISH("2", "takeFinish", "取货完成"),
|
||||
APPLY_PUT("3", "applyPut", "申请放货"),
|
||||
PUTTING("4", "puting", "放货中"),
|
||||
PUT_FINISH("5", "putFinish", "放货完成"),
|
||||
NO_TARGET_PUT_FINISH("6", "NoTargetPutFinish", "非终点位放货完成"),
|
||||
ERROR_FINISH("7", "errorFinish", "任务异常完成"),
|
||||
EXCEPTION("8", "exception", "异常"),
|
||||
DEPRECATE("9", "deprecate", "作废");
|
||||
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String index;
|
||||
/**
|
||||
* 编码(与反馈状态code对应)
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 状态名称(中文描述)
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 描述(预留字段,保持与原枚举结构一致)
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 构造方法(保持与原InstructionStatusEnum结构一致)
|
||||
* @param index 索引
|
||||
* @param code 编码
|
||||
* @param name 状态名称
|
||||
*/
|
||||
FeedbackStatusEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有状态列表(JSONArray格式,包含code和name)
|
||||
* @return 状态列表JSONArray
|
||||
*/
|
||||
public static JSONArray getList() {
|
||||
JSONArray arr = new JSONArray();
|
||||
for (FeedbackStatusEnum em : FeedbackStatusEnum.values()) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", em.getCode());
|
||||
json.put("name", em.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编码获取状态名称
|
||||
* @param code 状态编码
|
||||
* @return 状态名称(未找到返回null)
|
||||
*/
|
||||
public static String getName(String code) {
|
||||
for (FeedbackStatusEnum c : FeedbackStatusEnum.values()) {
|
||||
if (c.code.equals(code)) { // 修正原枚举的==比较(改为equals更严谨)
|
||||
return c.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package org.nl.acs.instruction.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.dto.InstructionWcsStatusRequestDTO;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -211,6 +213,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
void update(Instruction dto);
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param /
|
||||
*/
|
||||
void updateAGV(String code, String agvStatus);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.acs.instruction.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description /
|
||||
* @date 2021-04-01
|
||||
**/
|
||||
@Data
|
||||
public class InstructionWcsStatusRequestDTO implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 指令编码
|
||||
*/
|
||||
private String instruction_code;
|
||||
|
||||
private String taskType;
|
||||
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String containerCode;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String carId;
|
||||
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String feedbackStatus;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -30,12 +30,16 @@ import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.enums.FeedbackStatusEnum;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.instruction.service.dto.InstructionWcsStatusRequestDTO;
|
||||
import org.nl.acs.instruction.service.dto.InteractionJsonDTO;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
@@ -122,6 +126,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
|
||||
@Autowired
|
||||
private AcsToWcsService acsToWcsService;
|
||||
|
||||
private List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
|
||||
@@ -782,6 +789,18 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
instructions.add(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAGV(String code, String agvStatus) {
|
||||
Instruction instruction = this.findByCode(code);
|
||||
InstructionWcsStatusRequestDTO instructionWcsStatusRequestDTO = new InstructionWcsStatusRequestDTO();
|
||||
instructionWcsStatusRequestDTO.setCarId(instruction.getCarno());
|
||||
instructionWcsStatusRequestDTO.setFeedbackStatus(agvStatus);
|
||||
instructionWcsStatusRequestDTO.setContainerCode(instruction.getVehicle_code());
|
||||
instructionWcsStatusRequestDTO.setInstruction_code(instruction.getTask_code());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) throws Exception {
|
||||
@@ -872,6 +891,28 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
log.debug("地址对应设备未找到");
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull", start_device_code));
|
||||
|
||||
}
|
||||
//更新agv状态
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("containerCode", entity.getVehicle_code());
|
||||
param3.put("taskCode", entity.getTask_code());
|
||||
param3.put("carId", entity.getCarno());
|
||||
param3.put("taskType", entity.getInstruction_type());
|
||||
param3.put("feedbackStatus", FeedbackStatusEnum.NO_TARGET_PUT_FINISH.getCode());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.content("任务完成,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.content("任务完成返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
|
||||
}
|
||||
|
||||
jo1.put("hasGoodStatus", CommonFinalParam.ONE);
|
||||
@@ -1201,6 +1242,22 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
JSONObject param3 = new JSONObject();
|
||||
param3.put("taskCode", entity.getTask_code());
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.content("任务取消,参数:" + param3)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
HttpResponse httpResponse2 = acsToWcsService.feedbackTaskStatusToWcs(param3);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse2)) {
|
||||
JSONObject param2 = new JSONObject();
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.content("任务取消返回参数:" + param2)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
} else if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.ONE)
|
||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
||||
|
||||
@@ -10,7 +10,7 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nanyang}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:ndxy3_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:nanyang}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:P@ssw0rd}
|
||||
# 初始连接数
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="LMSToACS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="ACSToWCS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/LMS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<FileNamePattern>${LOG_HOME}/ACS下发WCS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
@@ -23,7 +23,7 @@
|
||||
</appender>
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="LMSToACS"/>
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWcsServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="WCSToACS"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -3,10 +3,10 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="ACSToLMS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="WCSToACS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ACS请求LMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<FileNamePattern>${LOG_HOME}/WCS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
@@ -14,8 +14,8 @@
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<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>
|
||||
@@ -23,7 +23,7 @@
|
||||
</appender>
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="ACSToLMS"/>
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.WcsToAcsServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="WCSToACS"/>
|
||||
</logger>
|
||||
</included>
|
||||
Reference in New Issue
Block a user