This commit is contained in:
2023-06-05 17:39:09 +08:00
8 changed files with 371 additions and 149 deletions

View File

@@ -18,6 +18,7 @@ import org.nl.acs.device.service.dto.StorageCellDto;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil; import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.common.utils.StringUtils;
import org.nl.modules.wql.core.bean.ResultBean; import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil; import org.nl.modules.wql.util.WqlUtil;
@@ -110,15 +111,26 @@ public class StorageCellServiceImpl implements StorageCellService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void create(StorageCellDto dto) { public void create(StorageCellDto dto) {
JSONArray arr;
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
if(dto.getAddress()!=0) {
arr = wo.query("address ='" + dto.getAddress() + "'").getResultJSONArray(0);
if (arr.size() != 0) {
throw new BadRequestException("AGV编码非0时不能重复");
}
}
arr = wo.query("storage_code ='" + dto.getStorage_code() + "'").getResultJSONArray(0);
if(arr.size()!=0){
throw new BadRequestException("货位编码不能重复!");
}
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
dto.setStorage_id(IdUtil.simpleUUID()); dto.setStorage_id(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername); dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername); dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now); dto.setUpdate_time(now);
dto.setCreate_time(now); dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
JSONObject json = (JSONObject) JSONObject.toJSON(dto); JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json); wo.insert(json);
deviceService.addDeviceCodeByAddress(dto); deviceService.addDeviceCodeByAddress(dto);
@@ -131,12 +143,25 @@ public class StorageCellServiceImpl implements StorageCellService {
StorageCellDto entity = this.findById(dto.getStorage_id()); StorageCellDto entity = this.findById(dto.getStorage_id());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
JSONArray arr;
if(dto.getAddress()!=0) {
arr = wo.query("address ='" + dto.getAddress() + "'and storage_id <>'"+dto.getStorage_id() + "'").getResultJSONArray(0);
if (arr.size() != 0) {
throw new BadRequestException("AGV编码非0时不能重复");
}
}
arr = wo.query("storage_code ='" + dto.getStorage_code() + "'and storage_id <>'"+dto.getStorage_id()+ "'").getResultJSONArray(0);
if(arr.size()!=0){
throw new BadRequestException("货位编码不能重复!");
}
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
dto.setUpdate_time(now); dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername); dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
JSONObject json = (JSONObject) JSONObject.toJSON(dto); JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json); wo.update(json);
deviceService.updateDeviceCodeByAddress(dto); deviceService.updateDeviceCodeByAddress(dto);

View File

@@ -227,7 +227,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver(); photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
@@ -344,11 +343,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) { && StrUtil.equals(task.getTask_type(), "1")) {
// //
if (standardOrdinarySiteDeviceDriver.getOption() == 1) { if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
standardOrdinarySiteDeviceDriver.setAgvphase(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else { } else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey); log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
@@ -360,7 +361,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
this.setPhase(phase);
} else { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
@@ -533,21 +533,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) { // && StrUtil.equals(task.getTask_type(), "1")) {
// // //
if (standardOrdinarySiteDeviceDriver.getOption() == 2) { // if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setOption(0); // standardOrdinarySiteDeviceDriver.setOption(0);
} else { // } else {
log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey); // log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey);
message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; // message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
} // }
} else { // } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} // }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
this.setPhase(phase); this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
@@ -592,21 +592,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) { // && StrUtil.equals(task.getTask_type(), "1")) {
// // //
if (standardOrdinarySiteDeviceDriver.getOption() == 2) { // if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setOption(0); // standardOrdinarySiteDeviceDriver.setOption(0);
} else { // } else {
log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey); // log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey);
message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; // message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
} // }
} else { // } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} // }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
this.setPhase(phase); this.setPhase(phase);
} else { } else {
@@ -649,21 +649,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) { // && StrUtil.equals(task.getTask_type(), "1")) {
// // //
if (standardOrdinarySiteDeviceDriver.getOption() == 2) { // if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setOption(0); // standardOrdinarySiteDeviceDriver.setOption(0);
} else { // } else {
log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey); // log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey);
message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; // message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
} // }
} else { // } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} // }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
this.setPhase(phase); this.setPhase(phase);
} else { } else {

View File

@@ -648,6 +648,21 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))){
return false;
}
}
// if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); // this.writing(list);
// message = "重新下发电气信号"; // message = "重新下发电气信号";
@@ -760,11 +775,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
this.writing(list); this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
try { try {
Thread.sleep(500); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(ObjectUtil.isEmpty(taskserver.findByCode(taskdto.getTask_code()))){
return false;
}
} }
// if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); // this.writing(list);
// message = "重新下发电气信号"; // message = "重新下发电气信号";
@@ -806,6 +827,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(ObjectUtil.isEmpty(instructionService.findByDeviceCodeFromCache(this.device_code))){
return false;
}
} }
// if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list); // this.writing(list);
@@ -977,6 +1001,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
message = "申请补码AGV搬运任务成功"; message = "申请补码AGV搬运任务成功";
List list = new ArrayList();
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
, "8")) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", "再次下发mode信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo); logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo);
requireSucess = true; requireSucess = true;
} else { } else {
@@ -1013,6 +1048,22 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
message = "申请AGV搬运任务成功"; message = "申请AGV搬运任务成功";
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "8");
list.add(map);
this.writing(list);
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
, "8")) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发mode信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
requireSucess = true; requireSucess = true;
} else { } else {
@@ -1059,5 +1110,4 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
} }

View File

@@ -585,6 +585,16 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return true; return true;
} }
try { try {
@@ -659,11 +669,23 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
map2.put("value", inst.getInstruction_code()); map2.put("value", inst.getInstruction_code());
list.add(map4); list.add(map4);
this.writing(list); this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list);
// message = "重新下发电气信号";
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// }
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list); this.writing(list);
message = "重新下发电气信号"; logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
message = "下发电气任务号成功"; message = "下发电气任务号成功";
requireSucess = true; requireSucess = true;
return true; return true;
@@ -770,10 +792,20 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
map2.put("value", inst.getInstruction_code()); map2.put("value", inst.getInstruction_code());
list.add(map4); list.add(map4);
this.writing(list); this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list);
// message = "重新下发电气信号";
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// }
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list); this.writing(list);
message = "重新下发电气信号"; logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
} else { } else {
//如果不存在则直接找对应指令 //如果不存在则直接找对应指令
@@ -799,9 +831,19 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
map3.put("value", "1"); map3.put("value", "1");
list.add(map3); list.add(map3);
this.writing(list); this.writing(list);
if (task != Integer.parseInt(inst.getInstruction_code())) { // if (task != Integer.parseInt(inst.getInstruction_code())) {
// this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
// }
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
, inst.getInstruction_code())) {
this.writing(list); this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
requireSucess = true; requireSucess = true;
} }

View File

@@ -123,67 +123,67 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
batch = this.getDevice().getBatch(); batch = this.getDevice().getBatch();
device_code = this.getDeviceCode(); device_code = this.getDeviceCode();
if (agvphase == 0x03) { // if (agvphase == 0x03) {
if (ObjectUtil.isNotEmpty(inst)) { // if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("1"); // inst.setExecute_status("1");
instructionService.update(inst); // instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); // byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
agvphase = 0; // agvphase = 0;
index = 0; // index = 0;
inst = null; // inst = null;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else { // } else {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
//
} // }
} // }
//
if (agvphase == 0x05) { // if (agvphase == 0x05) {
if (ObjectUtil.isNotEmpty(inst)) { // if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("2"); // inst.setExecute_status("2");
instructionService.update(inst); // instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); // byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
// OneNDCSocketConnectionAutoRun.write(data); //// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0; // agvphase = 0;
index = 0; // index = 0;
inst = null; // inst = null;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else { // } else {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
//
} // }
} // }
//
if (agvphase == 0x07) { // if (agvphase == 0x07) {
if (ObjectUtil.isNotEmpty(inst)) { // if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("5"); // inst.setExecute_status("5");
instructionService.update(inst); // instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); // byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
// OneNDCSocketConnectionAutoRun.write(data); //// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0; // agvphase = 0;
index = 0; // index = 0;
inst = null; // inst = null;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else { // } else {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
} // }
} // }
//
if (agvphase == 0x09) { // if (agvphase == 0x09) {
if (ObjectUtil.isNotEmpty(inst)) { // if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("6"); // inst.setExecute_status("6");
instructionService.update(inst); // instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); // byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
// OneNDCSocketConnectionAutoRun.write(data); //// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0; // agvphase = 0;
index = 0; // index = 0;
inst = null; // inst = null;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
} else { // } else {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈"); // logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
//
} // }
} // }
} }

View File

@@ -70,24 +70,24 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
public Group getServer(String code) { public Group getServer(String code) {
synchronized(this.buildLock(code)) { synchronized(this.buildLock(code)) {
Group group = null; Group group = null;
group = (Group)this.groups.get(code); // group = (Group)this.groups.get(code);
if (group != null) { // if (group != null) {
label68: { // label68: {
Group var10000; // Group var10000;
try { // try {
if (!group.isActive()) { // if (!group.isActive()) {
break label68; // break label68;
} // }
//
var10000 = group; // var10000 = group;
} catch (JIException var14) { // } catch (JIException var14) {
log.error(code, var14); // log.error(code, var14);
break label68; // break label68;
} // }
//
return var10000; // return var10000;
} // }
} // }
Server server = (Server)this.servers.get(code); Server server = (Server)this.servers.get(code);
boolean needcreate = false; boolean needcreate = false;

View File

@@ -0,0 +1,103 @@
<template>
<!--agv单工位-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" size="small" label-width="95px">
<el-row>
<el-col :span="8">
<el-form-item label="ip地址" prop="ip_address">
<el-input
v-model="form.ip_address"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig
} from '@/api/acs/device/driverConfig'
import crud from '@/mixins/crud'
export default {
name: 'StandardConveyorControl',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
form: {
ip_address: ''
}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
this.sliceItem()
})
})
},
methods: {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -71,13 +71,14 @@
st_ivt_iostorinv mst st_ivt_iostorinv mst
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
box_no, a.box_no,
max(iostorinv_id) AS iostorinv_id max(a.iostorinv_id) AS iostorinv_id
FROM FROM
st_ivt_iostorinvdis st_ivt_iostorinvdis a
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
WHERE WHERE
1 = 1 b.io_type = '1'
group by box_no group by a.box_no
) dis ON dis.iostorinv_id = mst.iostorinv_id ) dis ON dis.iostorinv_id = mst.iostorinv_id
LEFT JOIN sch_base_point point ON point.vehicle_code = dis.box_no LEFT JOIN sch_base_point point ON point.vehicle_code = dis.box_no
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = mst.cust_code LEFT JOIN md_cs_customerbase cust ON cust.cust_code = mst.cust_code
@@ -112,13 +113,14 @@
sch_base_point point sch_base_point point
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
box_no, a.box_no,
max(iostorinv_id) AS iostorinv_id max(a.iostorinv_id) AS iostorinv_id
FROM FROM
st_ivt_iostorinvdis st_ivt_iostorinvdis a
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
WHERE WHERE
1 = 1 b.io_type = '1'
group by box_no group by a.box_no
) dis ON dis.box_no = point.vehicle_code ) dis ON dis.box_no = point.vehicle_code
LEFT JOIN ( LEFT JOIN (
SELECT SELECT