Browse Source

update

v1.1_20240705
张江玮 1 year ago
parent
commit
1504737964
  1. 3
      acs/nladmin-system/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java
  2. 18
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java
  3. 83
      acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  4. 131
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
  5. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java
  6. 492
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java
  7. 12
      acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java
  8. 14
      acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java
  9. 8
      acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java
  10. 122
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  11. 52
      acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java
  12. 2
      acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java
  13. 2
      acs/nladmin-system/src/main/resources/config/application-dev.yml
  14. 5
      acs/nladmin-system/src/main/resources/config/application-prod.yml
  15. 2
      acs/nladmin-system/src/main/resources/config/application.yml
  16. 4
      acs/nladmin-ui/.env.production
  17. 11
      acs/nladmin-ui/src/views/acs/instruction/index.vue

3
acs/nladmin-system/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java

@ -1,5 +1,6 @@
package org.nl.acs.agv.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -11,6 +12,7 @@ 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;
/**
@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
@Api(tags = "仙工AGV")
@Slf4j
@SaIgnore
public class XianGongAgvController {
private final XianGongAgvService agvService;

18
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java

@ -41,7 +41,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final AcsToWmsService acsToWmsService;
private final InstructionService instructionService;
private final InstructionService instructionService;
private final AgvWaitUtil agvWaitUtil;
private final TaskService taskService;
Map<String, AgvDto> AGVDeviceStatus = new HashMap<>();
@ -229,6 +229,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo.put("complete", true);
jo.put("blocks", createBlocksData(inst));
jo.put("priority", inst.getPriority());
Device device1 = deviceAppService.findDeviceByCode(inst.getStart_device_code());
if (Arrays.asList("1", "2", "3").contains(device1.getRegion())) {
jo.put("group", "NT");
} else if (Arrays.asList("4", "8").contains(device1.getRegion())) {
jo.put("group", "JF");
} else if (Arrays.asList("5", "6", "7").contains(device1.getRegion())) {
jo.put("group", "ZZ");
}
log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo.toString());
if (StrUtil.equals(paramService.findByCode(org.nl.acs.config.AcsConfig.FORKAGV).getValue(), "1")) {
@ -462,7 +470,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
public JSONArray createBlocksData(Instruction inst) {
String ip = paramService.findByCode("local_host").getValue();
String addr = ip + port;
String addr = "http://" + ip + ":" + port;
JSONArray blocks = new JSONArray();
@ -493,6 +501,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getStart_point_code());
block.put("operation", "JackLoad");
block.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
blocks.add(block);
if ("true".equals(device1.getExtraValue().get("ignore_pickup_check"))) {
@ -593,6 +604,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getStart_point_code2());
block.put("operation", "JackLoad");
block.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
blocks.add(block);
if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) {

83
acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -933,89 +933,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
@Override
public void changeDeviceStatus(JSONObject form) {
String device_code = form.getString("device_code");
if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) {
String[] point = device_code.split("-");
device_code = point[0];
}
//需要数量
String hasGoodStatus = form.getString("hasGoodStatus");
if (StrUtil.isEmpty(hasGoodStatus)) {
hasGoodStatus = "0";
}
String batch = form.getString("batch");
String material_type = form.getString("material_type");
String quantity = form.getString("quantity");
String remark = form.getString("remark");
String islock = form.getString("islock");
if (device_code.indexOf(".") != -1) {
device_code = device_code.substring(0, device_code.indexOf("."));
}
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new BadRequestException("未找到对应设备:" + device_code);
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (!StrUtil.isEmpty(hasGoodStatus)) {
standardOrdinarySiteDeviceDriver.setHasGoods(Integer.parseInt(hasGoodStatus));
device.setHas_goods(Integer.parseInt(hasGoodStatus));
}
if (StrUtil.isNotEmpty(material_type)) {
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
device.setMaterial_type(material_type);
} else {
standardOrdinarySiteDeviceDriver.setMaterial("");
device.setMaterial_type("");
}
if (StrUtil.isNotEmpty(quantity)) {
standardOrdinarySiteDeviceDriver.setQty(quantity);
device.setQuantity(quantity);
} else {
standardOrdinarySiteDeviceDriver.setQty("");
device.setQuantity("");
}
if (StrUtil.isNotEmpty(remark)) {
standardOrdinarySiteDeviceDriver.setRemark(remark);
device.setRemark(remark);
} else {
standardOrdinarySiteDeviceDriver.setRemark("");
device.setRemark("");
}
if (StrUtil.isNotEmpty(batch)) {
standardOrdinarySiteDeviceDriver.setBatch(batch);
device.setBatch(batch);
} else {
standardOrdinarySiteDeviceDriver.setBatch("");
device.setBatch("");
}
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = runpointwo.query("device_code ='" + device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(json)) {
DeviceRunpointDto obj = json.toJavaObject(DeviceRunpointDto.class);
obj.setHasgoods(hasGoodStatus);
obj.setMaterial_type(material_type);
obj.setBatch(batch);
device.setHas_goods(Integer.parseInt(hasGoodStatus));
device.setMaterial_type(material_type);
device.setRemark(remark);
device.setQuantity(quantity);
device.setBatch(batch);
device.setIslock(islock);
JSONObject updatejson = (JSONObject) JSONObject.toJSON(obj);
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
}
else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial(material_type);
standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type);
device.setBatch(batch);
}
}
@Override

131
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java

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

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java

@ -58,7 +58,7 @@ public interface OpcDeviceDriver extends DeviceDriver {
}
default Integer getIntegeregerValue(String protocol) {
Object value = this.getValue(protocol)==null?"0":this.getValue(protocol);
Object value = this.getValue(protocol) == null ? "0" : this.getValue(protocol);
return Integer.parseInt(value.toString());
}

492
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java

@ -64,7 +64,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private int toQty = 0;
private int lastToQty = this.toQty;
private String deviceCode = null;
private String currentDeviceCode = null;
private boolean isOnline = false;
private boolean isError = false;
private String message = "";
@ -85,7 +85,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
this.message = "";
try {
this.deviceCode = this.device.getDevice_code();
this.currentDeviceCode = this.getDeviceCode();
this.mode = this.itemProtocol.getMode();
this.move = this.itemProtocol.getMove();
@ -99,40 +99,43 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if (this.mode != this.lastMode) {
this.requireSuccess = false;
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode);
if (mode == 2) {
this.writing("to_command", "0");
}
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode);
}
if (this.move != this.lastMove) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_MOVE, String.valueOf(this.move));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_MOVE + " " + this.lastMove + " -> " + this.move);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MOVE, String.valueOf(this.move));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MOVE + " " + this.lastMove + " -> " + this.move);
}
if (this.action != this.lastAction) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_ACTION, String.valueOf(this.action));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_ACTION + " " + this.lastAction + " -> " + this.action);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_ACTION, String.valueOf(this.action));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_ACTION + " " + this.lastAction + " -> " + this.action);
}
if (this.error != this.lastError) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_ERROR, String.valueOf(this.error));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_ERROR + " " + this.lastError + " -> " + this.error);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_ERROR, String.valueOf(this.error));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_ERROR + " " + this.lastError + " -> " + this.error);
}
if (this.task != this.lastTask) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TASK, String.valueOf(this.task));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TASK + " " + this.lastTask + " -> " + this.task);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TASK, String.valueOf(this.task));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TASK + " " + this.lastTask + " -> " + this.task);
}
if (this.toCommand != this.lastToCommand) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_COMMAND, String.valueOf(this.toCommand));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_COMMAND + " " + this.lastToCommand + " -> " + this.toCommand);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_COMMAND, String.valueOf(this.toCommand));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_COMMAND + " " + this.lastToCommand + " -> " + this.toCommand);
}
if (this.toMaterial != this.lastToMaterial) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_MATERIAL, String.valueOf(this.toMaterial));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_MATERIAL + " " + this.lastToMaterial + " -> " + this.toMaterial);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_MATERIAL, String.valueOf(this.toMaterial));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_MATERIAL + " " + this.lastToMaterial + " -> " + this.toMaterial);
}
if (this.toQty != this.lastToQty) {
this.deviceExecuteLogService.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_QTY, String.valueOf(this.toQty));
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_QTY + " " + this.lastToQty + " -> " + this.toQty);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_QTY, String.valueOf(this.toQty));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_QTY + " " + this.lastToQty + " -> " + this.toQty);
}
} catch (Exception e) {
log.error("{} device driver execute error!", deviceCode);
log.error("{} device driver execute error!", currentDeviceCode);
log.error(e.getMessage(), e);
return;
}
@ -158,23 +161,32 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if (ObjectUtil.isNotEmpty(methodName)) {
try {
this.executionMethodByMode(methodName.toString());
this.requireSuccess = true;
} catch (Exception e) {
log.error("{} device driver execute error!", deviceCode);
log.error("{} device driver execute error!", currentDeviceCode);
log.error(e.getMessage(), e);
String message = "执行工作模式对应方法 " + methodName + " 错误!错误信息:" + e.getMessage();
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
this.isError = true;
}
} else {
String message = "未知工作模式,驱动未配置对应方法。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
}
}
}
this.lastMode = this.mode;
this.lastMove = this.move;
this.lastAction = this.action;
this.lastError = this.error;
this.lastTask = this.task;
this.lastToCommand = this.toCommand;
this.lastToMaterial = this.toMaterial;
this.lastToQty = this.toQty;
}
@Override
@ -198,7 +210,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
itemMap.put(to_param, value);
this.control(itemMap);
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", param + " 写入 " + value);
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", param + " 写入 " + value);
}
private synchronized void executionMethodByMode(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
@ -244,7 +256,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
if (device != null && "0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
return device;
}
}
@ -254,7 +266,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findNotHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
if (device != null && "0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
return device;
}
}
@ -265,49 +277,53 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 门架上料完成
*/
@SuppressWarnings("unused")
public synchronized void gantryMaterialFinished() throws Exception {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.deviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 门架上料完成放空设备
Object gantryDeviceCode1 = this.getDevice().getExtraValue().get("gantry_device_code1");
if (ObjectUtil.isEmpty(gantryDeviceCode1)) {
String message = "门架上料完成放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray emptyDeviceCodes = JSONArray.parseArray(gantryDeviceCode1.toString());
// 门架上料完成取满设备
Object gantryDeviceCode2 = this.getDevice().getExtraValue().get("gantry_device_code2");
if (ObjectUtil.isEmpty(gantryDeviceCode2)) {
String message = "门架上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString());
// 查找合适的放空设备
Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes);
if (ObjectUtil.isEmpty(emptyDevice)) {
String message = "未找到合适的门架上料完成放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert emptyDevice != null;
// 查找合适的取满设备
Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes);
if (ObjectUtil.isEmpty(materialDevice)) {
String message = "未找到合适的门架上料完成取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert materialDevice != null;
public void gantryMaterialFinished() throws Exception {
synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 门架上料完成放空设备
Object gantryDeviceCode1 = this.getDevice().getExtraValue().get("gantry_device_code1");
if (ObjectUtil.isEmpty(gantryDeviceCode1)) {
String message = "门架上料完成放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray emptyDeviceCodes = JSONArray.parseArray(gantryDeviceCode1.toString());
// 门架上料完成取满设备
Object gantryDeviceCode2 = this.getDevice().getExtraValue().get("gantry_device_code2");
if (ObjectUtil.isEmpty(gantryDeviceCode2)) {
String message = "门架上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString());
// 查找合适的放空设备
Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes);
if (ObjectUtil.isEmpty(emptyDevice)) {
String message = "未找到合适的门架上料完成放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert emptyDevice != null;
// 查找合适的取满设备
Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes);
if (ObjectUtil.isEmpty(materialDevice)) {
String message = "未找到合适的门架上料完成取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert materialDevice != null;
this.taskService.create(this.creatTask(currentDevice, emptyDevice, materialDevice, currentDevice, RequestMethodEnum.GANTRY_MATERIAL_FINISHED));
this.taskService.create(this.creatTask(currentDevice, emptyDevice, materialDevice, currentDevice, RequestMethodEnum.GANTRY_MATERIAL_FINISHED));
this.requireSuccess = true;
this.writing("to_command", this.mode);
}
}
}
@ -315,68 +331,72 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 槽钢上料完成
*/
@SuppressWarnings("unused")
public synchronized void channelSteelMaterialFinished() throws Exception {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.deviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 槽钢上料完成取满设备
Object channelSteelDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_device_code1");
if (ObjectUtil.isEmpty(channelSteelDeviceCode1)) {
String message = "槽钢上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelDeviceCode1.toString());
// 槽钢上料完成放满设备
Object channelSteelDeviceCode2 = this.getDevice().getExtraValue().get("channel_steel_device_code2");
if (ObjectUtil.isEmpty(channelSteelDeviceCode2)) {
String message = "槽钢上料完成放满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes2 = JSONArray.parseArray(channelSteelDeviceCode2.toString());
// 槽钢上料完成放空设备
Object channelSteelDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_device_code4");
if (ObjectUtil.isEmpty(channelSteelDeviceCode4)) {
String message = "槽钢上料完成放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString());
// 查找合适的取满设备
Device device1 = this.findHasGoodsDevice(deviceCodes1);
if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢上料完成取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device1 != null;
// 查找合适的放满设备
Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的槽钢上料完成放满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device2 != null;
// 查找合适的放空设备
Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢上料完成放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device4 != null;
public void channelSteelMaterialFinished() throws Exception {
synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 槽钢上料完成取满设备
Object channelSteelDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_device_code1");
if (ObjectUtil.isEmpty(channelSteelDeviceCode1)) {
String message = "槽钢上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelDeviceCode1.toString());
// 槽钢上料完成放满设备
Object channelSteelDeviceCode2 = this.getDevice().getExtraValue().get("channel_steel_device_code2");
if (ObjectUtil.isEmpty(channelSteelDeviceCode2)) {
String message = "槽钢上料完成放满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes2 = JSONArray.parseArray(channelSteelDeviceCode2.toString());
// 槽钢上料完成放空设备
Object channelSteelDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_device_code4");
if (ObjectUtil.isEmpty(channelSteelDeviceCode4)) {
String message = "槽钢上料完成放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString());
// 查找合适的取满设备
Device device1 = this.findHasGoodsDevice(deviceCodes1);
if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢上料完成取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device1 != null;
// 查找合适的放满设备
Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的槽钢上料完成放满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device2 != null;
// 查找合适的放空设备
Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢上料完成放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device4 != null;
this.taskService.create(this.creatTask(device1, device2, currentDevice, device4, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED));
this.taskService.create(this.creatTask(device1, device2, currentDevice, device4, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED));
this.requireSuccess = true;
this.writing("to_command", this.mode);
}
}
}
@ -384,68 +404,72 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 槽钢呼叫满料
*/
@SuppressWarnings("unused")
public synchronized void channelSteelCallMaterial() throws Exception {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.deviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 槽钢呼叫满料取满设备
Object channelSteelCallMaterialDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code1");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode1)) {
String message = "槽钢呼叫满料取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode1.toString());
// 槽钢呼叫满料取空设备
Object channelSteelCallMaterialDeviceCode3 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code3");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode3)) {
String message = "槽钢呼叫满料取空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes3 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode3.toString());
// 槽钢呼叫满料放空设备
Object channelSteelCallMaterialDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code4");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode4)) {
String message = "槽钢呼叫满料放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode4.toString());
// 查找合适的取满设备
Device device1 = this.findHasGoodsDevice(deviceCodes1);
if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢呼叫满料取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device1 != null;
// 查找合适的取空设备
Device device3 = this.findHasGoodsDevice(deviceCodes3);
if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的槽钢呼叫满料取空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device3 != null;
// 查找合适的放空设备
Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢呼叫满料放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device4 != null;
public void channelSteelCallMaterial() throws Exception {
synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 槽钢呼叫满料取满设备
Object channelSteelCallMaterialDeviceCode1 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code1");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode1)) {
String message = "槽钢呼叫满料取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes1 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode1.toString());
// 槽钢呼叫满料取空设备
Object channelSteelCallMaterialDeviceCode3 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code3");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode3)) {
String message = "槽钢呼叫满料取空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes3 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode3.toString());
// 槽钢呼叫满料放空设备
Object channelSteelCallMaterialDeviceCode4 = this.getDevice().getExtraValue().get("channel_steel_call_material_device_code4");
if (ObjectUtil.isEmpty(channelSteelCallMaterialDeviceCode4)) {
String message = "槽钢呼叫满料放空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode4.toString());
// 查找合适的取满设备
Device device1 = this.findHasGoodsDevice(deviceCodes1);
if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢呼叫满料取满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device1 != null;
// 查找合适的取空设备
Device device3 = this.findHasGoodsDevice(deviceCodes3);
if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的槽钢呼叫满料取空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device3 != null;
this.taskService.create(this.creatTask(device1, currentDevice, device3, device4, RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL));
// 查找合适的放空设备
Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢呼叫满料放空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device4 != null;
this.taskService.create(this.creatTask(device1, currentDevice, device3, device4, RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL));
this.requireSuccess = true;
this.writing("to_command", this.mode);
}
}
}
@ -453,49 +477,53 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 下料完成
*/
@SuppressWarnings("unused")
public synchronized void productionCompleted() throws Exception {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.deviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 下料完成放满设备
Object productionCompletedDeviceCode2 = this.getDevice().getExtraValue().get("production_completed_device_code2");
if (ObjectUtil.isEmpty(productionCompletedDeviceCode2)) {
String message = "下料完成放满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes2 = JSONArray.parseArray(productionCompletedDeviceCode2.toString());
// 下料完成取空设备
Object productionCompletedDeviceCode3 = this.getDevice().getExtraValue().get("production_completed_device_code3");
if (ObjectUtil.isEmpty(productionCompletedDeviceCode3)) {
String message = "下料完成取空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
JSONArray deviceCodes3 = JSONArray.parseArray(productionCompletedDeviceCode3.toString());
// 查找合适的放满设备
Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的下料完成放满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device2 != null;
// 查找合适的取空设备
Device device3 = this.findHasGoodsDevice(deviceCodes3);
if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的下料完成取空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.deviceCode, "", "", message);
return;
}
assert device3 != null;
public void productionCompleted() throws Exception {
synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) {
// 下料完成放满设备
Object productionCompletedDeviceCode2 = this.getDevice().getExtraValue().get("production_completed_device_code2");
if (ObjectUtil.isEmpty(productionCompletedDeviceCode2)) {
String message = "下料完成放满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes2 = JSONArray.parseArray(productionCompletedDeviceCode2.toString());
// 下料完成取空设备
Object productionCompletedDeviceCode3 = this.getDevice().getExtraValue().get("production_completed_device_code3");
if (ObjectUtil.isEmpty(productionCompletedDeviceCode3)) {
String message = "下料完成取空设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
JSONArray deviceCodes3 = JSONArray.parseArray(productionCompletedDeviceCode3.toString());
// 查找合适的放满设备
Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的下料完成放满设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device2 != null;
this.taskService.create(this.creatTask(currentDevice, device2, device3, currentDevice, RequestMethodEnum.PRODUCTION_COMPLETED));
// 查找合适的取空设备
Device device3 = this.findHasGoodsDevice(deviceCodes3);
if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的下料完成取空设备。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
assert device3 != null;
this.taskService.create(this.creatTask(currentDevice, device2, device3, currentDevice, RequestMethodEnum.PRODUCTION_COMPLETED));
this.requireSuccess = true;
this.writing("to_command", this.mode);
}
}
}
}

12
acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceAppServiceImpl.java

@ -18,8 +18,8 @@ import java.util.*;
@Slf4j
@Service
public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoInitial {
private List<Device> devices = new ArrayList();
private List<String> code_indexs = new ArrayList();
private List<Device> devices = new ArrayList<>();
private List<String> code_indexs = new ArrayList<>();
@Autowired
private DeviceManageService deviceManageService;
@Autowired
@ -36,7 +36,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
return null;
}
Iterator var2 = this.findAllDevice().iterator();
Iterator<Device> var2 = this.findAllDevice().iterator();
Device device;
do {
@ -44,7 +44,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
return null;
}
device = (Device) var2.next();
device = var2.next();
} while (!StrUtil.equals(device.getDevice_code(), device_code));
return device;
@ -236,8 +236,8 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
@Override
public <T extends DeviceDriver> List<T> findDeviceDriver(Class<T> clazz) {
List<T> list = new ArrayList();
Iterator var3 = this.findAllDevice().iterator();
List<T> list = new ArrayList<>();
Iterator<Device> var3 = this.findAllDevice().iterator();
while (var3.hasNext()) {
Device device = (Device) var3.next();

14
acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java

@ -38,8 +38,8 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
new TheadFactoryName()
);*/
this.executorService = new ThreadPoolExecutor(
10,
20,
32,
64,
1L,
TimeUnit.SECONDS,
new ArrayBlockingQueue<>(queueLength),
@ -87,14 +87,12 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
log.info("设备执行线程开始...");
while (true) {
Thread.sleep((long) this.loop_time_millions);
Thread.sleep(this.loop_time_millions);
List<ExecutableDeviceDriver> deviceDrivers = this.deviceAppService.findDeviceDriver(ExecutableDeviceDriver.class);
Iterator it = deviceDrivers.iterator();
while (it.hasNext()) {
final ExecutableDeviceDriver deviceDriver = (ExecutableDeviceDriver) it.next();
for (ExecutableDeviceDriver deviceDriver : deviceDrivers) {
//不包含正在执行的线程,则进行执行
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
if (!this.runs.containsKey(deviceDriver.getDeviceCode())) {
BlockedRunable runnable = new BlockedRunable() {
@Override
public void subRun() {
@ -106,7 +104,7 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
return deviceDriver.getDeviceCode();
}
};
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
if (!this.runs.containsKey(deviceDriver.getDeviceCode())) {
this.runs.put(deviceDriver.getDeviceCode(), runnable);
}

8
acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java

@ -197,12 +197,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
if (!UnifiedDataAppService.isEquals(value, his)) {
OpcItemDto itemDto = this.getItem(itemId);
if (true) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
}
if(!ObjectUtil.isEmpty(value)){
accessor_value.setValue(itemId, value);
}
this.logItemChanged(itemId, accessor_value, value, itemDto);
accessor_value.setValue(itemId, value);
}
}

122
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -788,6 +788,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String priority = acsTask.getPriority();
String start_point_code = acsTask.getStart_point_code();
String start_device_code = acsTask.getStart_device_code();
String start_point_code2 = acsTask.getStart_point_code2();
String start_device_code2 = acsTask.getStart_device_code2();
String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type();
//是否复合任务 =0非复合任务
@ -795,11 +797,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String compound_task_data = null;
String next_point_code = acsTask.getNext_point_code();
String next_device_code = acsTask.getNext_device_code();
String next_point_code2 = acsTask.getNext_point_code2();
String next_device_code2 = acsTask.getNext_device_code2();
if (StrUtil.isEmpty(start_device_code)) {
throw new BadRequestException("起点设备为空,无法生成指令!");
throw new BadRequestException("起点设备为空,无法生成指令");
}
if (StrUtil.isEmpty(next_device_code)) {
throw new BadRequestException("终点设备为空,无法生成指令!");
throw new BadRequestException("终点设备为空,无法生成指令。");
}
if (StrUtil.isEmpty(start_device_code2)) {
throw new BadRequestException("起点设备2为空,无法生成指令。");
}
if (StrUtil.isEmpty(next_device_code2)) {
throw new BadRequestException("终点设备为2空,无法生成指令。");
}
List<Instruction> instructions = instructionService.queryAll("instruction_status < 2");
String maxInstnumber = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
@ -853,113 +863,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppService.class);
Device startdevice = appService.findDeviceByCode(start_device_code);
Device nextdevice = appService.findDeviceByCode(next_device_code);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
Device startdevice2 = appService.findDeviceByCode(start_device_code2);
Device nextdevice2 = appService.findDeviceByCode(next_device_code2);
if (ObjectUtils.isEmpty(startdevice)) {
throw new BadRequestException("起点设备编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。");
}
if (ObjectUtils.isEmpty(nextdevice)) {
throw new BadRequestException("终点设备编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。");
}
//普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardEmptyPalletSiteDeviceDriver standardEmptsyPalletSiteDeviceDriver;
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
if (StrUtil.equals(createTaskCheck, "1")) {
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2) {
throw new BadRequestException("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
}
}
if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardEmptsyPalletSiteDeviceDriver.getMode() != 2) {
throw new BadRequestException("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
}
}
if (startdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) startdevice.getDeviceDriver();
if (lnshFoldDiscSiteDeviceDriver.getMode() != 2) {
throw new BadRequestException("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
}
}
//校验 是否同任务是否存在相同终点、未完成的指令
int sameqty = instructionService.querySameDestinationInst(next_point_code);
if (sameqty > 0) {
throw new BadRequestException("存在相同终点的指令,任务号:" + taskcode);
}
if (ObjectUtils.isEmpty(startdevice2)) {
throw new BadRequestException("起点设备2编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。");
}
//空盘位生成指令需要另外逻辑
if (nextdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) nextdevice.getDeviceDriver();
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
} else if (lnshFoldDiscSiteDeviceDriver.getError() != 0
|| lnshFoldDiscSiteDeviceDriver.getStatus() == 3) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
}
int max_emptypalletnum = Integer.parseInt(nextdevice.getExtraValue().get("max_emptypalletnum").toString());
int nowNumber = lnshFoldDiscSiteDeviceDriver.getContainer_qty();
if (nowNumber >= max_emptypalletnum) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 已满,无法生成指令。");
}
// 查看是否有相同终点的指令
int count = instructionService.queryDeviceInstCount(next_device_code);
if (count > 0) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 已被占用,无法生成指令。");
}
next_point_code = next_device_code + "." + (nowNumber + 1);
} else if (nextdevice.getDeviceDriver() instanceof LnshStationDeviceDriver
&& "true".equals(nextdevice.getExtraValue().get("inspect_in_stocck"))) {
LnshStationDeviceDriver deviceDriver = (LnshStationDeviceDriver) nextdevice.getDeviceDriver();
if (deviceDriver.getMode() == 0) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
} else if (deviceDriver.getMove() != 0) {
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 有货,无法生成指令。");
}
if (ObjectUtils.isEmpty(nextdevice2)) {
throw new BadRequestException("终点设备2编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。");
}
if (startdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) startdevice.getDeviceDriver();
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
} else if (lnshFoldDiscSiteDeviceDriver.getError() != 0
|| lnshFoldDiscSiteDeviceDriver.getStatus() == 3) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
}
int container_qty = lnshFoldDiscSiteDeviceDriver.getContainer_qty();
int max_emptypalletnum = Integer.parseInt(startdevice.getExtraValue().get("max_emptypalletnum").toString());
if (container_qty < (max_emptypalletnum / 2)) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 可用托盘数量少于最大托盘数量 [" + max_emptypalletnum + "] / 2,无法生成指令。");
}
int count = instructionService.queryDeviceInstCount(start_device_code);
if (count > 0) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 已被占用,无法生成指令。");
}
start_point_code = start_device_code + ".1";
} else if (startdevice.getDeviceDriver() instanceof LnshStationDeviceDriver
&& "true".equals(startdevice.getExtraValue().get("inspect_in_stocck"))) {
LnshStationDeviceDriver deviceDriver = (LnshStationDeviceDriver) startdevice.getDeviceDriver();
if (deviceDriver.getMode() == 0) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
} else if (deviceDriver.getMove() == 0) {
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 无货,无法生成指令。");
}
}
Instruction instdto = new Instruction();
instdto.setInstruction_type(acsTask.getTask_type());
@ -978,6 +896,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setStart_device_code2(start_device_code2);
instdto.setStart_point_code2(start_point_code2);
instdto.setNext_device_code2(next_device_code2);
instdto.setNext_point_code2(next_point_code2);
instdto.setCompound_inst_data(compound_task_data);
instdto.setPriority(priority);
instdto.setInstruction_status("0");

52
acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java

@ -285,7 +285,7 @@ public class HFHandServiceImpl implements HFHandService {
startDevice.setIslock("true");
nextDevice.setIslock("true");
} catch (Exception e) {
resultJson.put("code", "2");
resultJson.put("code", "0");
resultJson.put("desc", e.getMessage());
resultJson.put("result", "");
return resultJson;
@ -433,7 +433,7 @@ public class HFHandServiceImpl implements HFHandService {
resultJson.put("code", "1");
resultJson.put("desc", "登陆成功");
} else {
resultJson.put("code", "2");
resultJson.put("code", "0");
resultJson.put("desc", "登陆失败!");
}
JSONObject jo = new JSONObject();
@ -520,10 +520,6 @@ public class HFHandServiceImpl implements HFHandService {
String task_uuid = jsonObject.get("inst_uuid");
String type = jsonObject.get("type");
JSONObject taskjo = WQLObject.getWQLObject("acs_task").query("task_id='" + task_uuid + "'").uniqueResult(0);
String task_code = taskjo.getString("task_code");
String start_point_code = taskjo.getString("start_point_code");
String next_point_code = taskjo.getString("next_point_code");
String task_id = taskjo.getString("task_id");
if (StrUtil.isEmpty(task_uuid)) {
throw new BadRequestException("id不能为空!");
@ -533,7 +529,7 @@ public class HFHandServiceImpl implements HFHandService {
}
if (StrUtil.equals(taskjo.getString("task_status"), "2") ||
StrUtil.equals(taskjo.getString("task_status"), "3")) {
jo.put("code", "2");
jo.put("code", "0");
jo.put("desc", "任务已完成或已取消,无法操作");
jo.put("result", "");
return jo;
@ -541,51 +537,15 @@ public class HFHandServiceImpl implements HFHandService {
//重新生成
if (type.equals("1")) {
//重新生产指令
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.getString("remark"));
instdto.setMaterial(taskjo.getString("material"));
instdto.setTask_id(taskjo.getString("task_id"));
instdto.setTask_code(taskjo.getString("task_code"));
instdto.setVehicle_code(taskjo.getString("vehicle_code"));
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_point_code(taskjo.getString("start_point_code"));
instdto.setNext_point_code(taskjo.getString("next_point_code"));
instdto.setStart_device_code(taskjo.getString("start_device_code"));
instdto.setNext_device_code(taskjo.getString("next_device_code"));
instdto.setInstruction_status("0");
instdto.setIs_delete("0");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
JSONObject instcheckjson = instwo.query(" instruction_status <2 and next_point_code= '" + next_point_code + "'" + " and start_point_code = '" + start_point_code + "'" + " and task_id = '" + task_id + "'").uniqueResult(0);
if (instcheckjson != null) {
jo.put("code", "2");
jo.put("desc", "操作失败");
jo.put("result", task_code + ":该任务已存在待完成指令!");
return jo;
}
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
try {
instructionService.create(instdto);
taskService.createInst(task_uuid);
} catch (Exception e) {
jo.put("code", "2");
jo.put("code", "0");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
instdto.setExecute_device_code(taskjo.getString("start_point_code"));
//下发指令给agv
// AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
// try {
// agvserver.sendAgvInstToMagic(instdto);
// } catch (Exception e) {
// jo.put("code", "2");
// jo.put("desc", e.getMessage());
// jo.put("result", "");
// return jo;
// }
}
//强制完成

2
acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java

@ -230,7 +230,7 @@ public class ResultBean implements Serializable, Cloneable {
rows = new ArrayList();
}
JSONArray jrows = this.rows2jsonarray(rows);
JSONObject jrow = new JSONObject();
JSONObject jrow = null;
if (jrows.size() > 0) {
jrow = jrows.getJSONObject(0);
}

2
acs/nladmin-system/src/main/resources/config/application-dev.yml

@ -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:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl4_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:nl4_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数

5
acs/nladmin-system/src/main/resources/config/application-prod.yml

@ -6,8 +6,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_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:rl_mg_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:188.188.69.101}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数
@ -131,7 +130,7 @@ logging:
config: classpath:logback-spring.xml
lucene:
index:
path: D:\lucene\index
path: C:\lucene\index
# Sa-Token配置
sa-token:

2
acs/nladmin-system/src/main/resources/config/application.yml

@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:

4
acs/nladmin-ui/.env.production

@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
VUE_APP_BASE_API = 'http://10.93.41.198:8010'
VUE_APP_BASE_API = 'http://127.0.0.1:8010'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://10.93.41.198:8010'
VUE_APP_WS_API = 'ws://127.0.0.1:8010'

11
acs/nladmin-ui/src/views/acs/instruction/index.vue

@ -164,7 +164,7 @@
v-permission="['admin','instruction:edit','instruction:del']"
fixed="left"
label="操作"
width="150px"
width="80px"
align="center"
>
<template slot-scope="scope">
@ -172,7 +172,7 @@
<span class="el-dropdown-link">
<i class="el-icon-menu" />
</span>
<el-dropdown-menu slot="dropdonwn">
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">下发</el-dropdown-item>
@ -347,11 +347,8 @@ export default {
case 'b'://
this.cancel(command.index, command.row)
break
case 'c'://
this.forceCancel(command.index, command.row)
break
case 'd'://
this.init(command.index, command.row)
case 'c':
this.sendToAGV(command.index, command.row)
break
}
}

Loading…
Cancel
Save