This commit is contained in:
2023-08-18 18:20:04 +08:00
11 changed files with 149 additions and 36 deletions

View File

@@ -448,6 +448,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -468,11 +471,26 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//三色灯状态
status = ikey;
if (status != last_status) {
if (status != last_status && status != 6 && status != 7) {
boolean flag = true;
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
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", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
}
last_status = status;

View File

@@ -691,6 +691,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4");
param.put("product_area", ParamService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -711,11 +714,26 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//三色灯状态
status = ikey;
if (status != last_status) {
if (status != last_status && status != 6 && status != 7) {
boolean flag = true;
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
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", ParamService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
}
last_status = status;
@@ -729,7 +747,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (!ObjectUtil.isEmpty(data)) {
phase =0;
//phase =0;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
TwoNDCSocketConnectionAutoRun.write(data);

View File

@@ -123,6 +123,9 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
param.put("device_code", this.device_id);
param.put("error", alarm);
param.put("error_msg", ErrorUtil.getDictDetail("ssx_error_type", alarm));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "3");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
this.last_iserror = iserror;

View File

@@ -37,6 +37,8 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -67,6 +69,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
//工作模式
int mode = 0;
int last_mode = 0;
@@ -179,7 +182,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
if (mode == 2) {
@@ -221,6 +227,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
@@ -238,7 +247,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
update_instruction_status();
} catch (Exception var17) {
var17.printStackTrace();
feedMessage = var17.getMessage();
@@ -287,7 +295,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
if (task != 0) {
remark = remark + "当前上报任务号(task)应该为0,";
if(ObjectUtil.isNotEmpty(this.inst)){
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
@@ -337,11 +345,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else {
this.instruction_require_time = date;
//抓取工位
if(ObjectUtil.isEmpty(getDeviceCodeList)){
if (ObjectUtil.isEmpty(getDeviceCodeList)) {
getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
}
//放货工位
if(ObjectUtil.isEmpty(putDeviceCodeList)){
if (ObjectUtil.isEmpty(putDeviceCodeList)) {
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
}
@@ -1085,10 +1093,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
public Instruction checkInst(){
if(ObjectUtil.isNotEmpty(this.inst)){
if(this.task>0){
if(this.inst.getInstruction_code().equals(String.valueOf(this.task))){
public Instruction checkInst() {
if (ObjectUtil.isNotEmpty(this.inst)) {
if (this.task > 0) {
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
return this.inst;
} else {
inst = instructionService.findByCodeFromCache(String.valueOf(task));

View File

@@ -232,7 +232,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
@@ -275,6 +278,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
}

View File

@@ -190,7 +190,10 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
@@ -230,6 +233,9 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));

View File

@@ -173,7 +173,10 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
@@ -208,6 +211,9 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));

View File

@@ -164,7 +164,10 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
if (last_mode != mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
if (to_command != last_to_command) {
@@ -189,6 +192,9 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
}

View File

@@ -34,6 +34,8 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,6 +66,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
//分切行架机械手是否禁用 0否 1是
private int is_disable = 0;
private String error_type = "fqhj_error_type";
@@ -232,7 +235,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
inst_type = null;
@@ -265,6 +271,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));

View File

@@ -550,10 +550,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
// log.info("sendDeviceStatus - 请求参数 {}", param);
// HttpRequest
// .post(url)
// .body(param.toString())
// .execute();
HttpRequest
.post(url)
.body(param.toString())
.execute();
// log.info("sendDeviceStatus - 返回参数 {}", response.body());
}
} catch (Throwable ignored) {

View File

@@ -883,18 +883,51 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String task_code = jsonObject.getString("task_code");
//1-允许取放; 2-允许离开
String option = jsonObject.getString("option");
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device device_k = deviceAppService.findDeviceByCode(device_code + "_K");
Device device_m = deviceAppService.findDeviceByCode(device_code + "_M");
if (device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if (device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
Instruction inst = instructionService.findByTaskcode(task_code);
if(ObjectUtil.isEmpty(inst)){
JSONObject jo = new JSONObject();
jo.put("task_code",task_code);
jo.put("message","未找到对应任务");
errArr.add(jo);
continue;
} else {
String carNo = inst.getCarno();
if(ObjectUtil.isEmpty(carNo)) {
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("message", "未找到任务对应车号");
errArr.add(jo);
continue;
} else {
Device device = deviceAppService.findDeviceByCode(carNo);
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
if(device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver ){
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver)device.getDeviceDriver();
int phase = agvNdcTwoDeviceDriver.getPhase();
if(phase == 0x03 || phase == 0x05 || phase == 0x08)
{
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device device_k = deviceAppService.findDeviceByCode(device_code + "_K");
Device device_m = deviceAppService.findDeviceByCode(device_code + "_M");
if (device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if (device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
} else {
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("message", "AGV未就绪无法设置");
errArr.add(jo);
continue;
}
}
}
}
}
}
JSONObject resultJson = new JSONObject();