Browse Source

rev:新需求

v1.1_20240705
耿宝印 1 year ago
parent
commit
0383bc15d3
  1. 14
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java
  2. 199
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java
  3. 8
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java
  4. 268
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java
  5. 7
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  6. 151
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 19
      acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java
  8. 43
      acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java
  9. 4
      acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql
  10. 17
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java
  11. 105
      acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue

14
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java

@ -212,7 +212,7 @@ public class AgvWaitUtil {
// 诺力4期对接位驱动 // 诺力4期对接位驱动
NL4StationDeviceDriver driver = (NL4StationDeviceDriver) device.getDeviceDriver(); NL4StationDeviceDriver driver = (NL4StationDeviceDriver) device.getDeviceDriver();
if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(task.getDirection())) { if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(task.getDirection())) {
// 门架上料完成任务 // 其余物料上料完成任务
if (deviceCode.equals(task.getNext_device_code2())) { if (deviceCode.equals(task.getNext_device_code2())) {
// 如果是放满点,需要把取满点的信息写入再请求离开。 // 如果是放满点,需要把取满点的信息写入再请求离开。
Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code2()); Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code2());
@ -244,11 +244,12 @@ public class AgvWaitUtil {
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
} }
} }
} else if (RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL.getCode().equals(task.getDirection())) { }
// 槽钢呼叫满料任务 else if (RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED.getCode().equals(task.getDirection())) {
if (deviceCode.equals(task.getNext_device_code())) { // 槽钢上料完成任务
if (deviceCode.equals(task.getNext_device_code2())) {
// 如果是放满点,需要把取满点的信息写入再请求离开。 // 如果是放满点,需要把取满点的信息写入再请求离开。
Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code()); Device device2 = this.deviceAppService.findDeviceByCode(task.getStart_device_code2());
driver.writing("to_material", device2.getMaterial_type()); driver.writing("to_material", device2.getMaterial_type());
driver.writing("to_qty", device2.getBatch()); driver.writing("to_qty", device2.getBatch());
driver.writing("to_command", 4); driver.writing("to_command", 4);
@ -277,7 +278,8 @@ public class AgvWaitUtil {
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
} }
} }
} else { }
else {
driver.writing("to_command", 4); driver.writing("to_command", 4);
if (driver.getMode() != 0) { if (driver.getMode() != 0) {
String message = "允许AGV放货后离开。"; String message = "允许AGV放货后离开。";

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

@ -210,12 +210,17 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
param.put("disableVehicle", false); param.put("disableVehicle", false);
agvurl = agvurl + ":" + agvport + "/terminate"; agvurl = agvurl + ":" + agvport + "/terminate";
log.info("删除agv指令请求agvurl:{}", agvurl); log.info("删除agv指令请求agvurl:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl) try {
.body(param.toJSONString()) HttpResponse result = HttpRequest.post(agvurl)
.timeout(20000)//超时,毫秒 .body(param.toJSONString())
.execute(); .timeout(20000)//超时,毫秒
log.info("删除agv指令请求反馈:{}", result); .execute();
return result; log.info("删除agv指令请求反馈:{}", result);
return result;
} catch (Exception e) {
log.error("取消AGV指令信息错误:{}", e.getMessage());
throw new BadRequestException(e.getMessage());
}
} else { } else {
return null; return null;
} }
@ -570,106 +575,110 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} }
// 起点2 // 起点2
Device device3 = deviceAppService.findDeviceByCode(inst.getStart_device_code2()); if (StrUtil.isNotEmpty(inst.getStart_device_code2())) {
if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) { Device device3 = deviceAppService.findDeviceByCode(inst.getStart_device_code2());
//取货前等待 if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) {
block = new JSONObject(); //取货前等待
block.put("blockId", IdUtil.simpleUUID()); block = new JSONObject();
block.put("location", inst.getStart_point_code2() + "INGET"); block.put("blockId", IdUtil.simpleUUID());
block.put("operation", "script"); block.put("location", inst.getStart_point_code2() + "INGET");
block.put("id", inst.getStart_point_code2() + "INGET"); block.put("operation", "script");
block.put("script_name", "userpy/interact.py"); block.put("id", inst.getStart_point_code2() + "INGET");
JSONObject scriptArgs = new JSONObject(); block.put("script_name", "userpy/interact.py");
scriptArgs.put("addr", addr); JSONObject scriptArgs = new JSONObject();
JSONObject data = new JSONObject(); scriptArgs.put("addr", addr);
JSONObject reach = new JSONObject(); JSONObject data = new JSONObject();
reach.put("task_code", inst.getInstruction_code()); JSONObject reach = new JSONObject();
reach.put("address", inst.getStart_point_code2() + "INGET"); reach.put("task_code", inst.getInstruction_code());
data.put("reach", reach); reach.put("address", inst.getStart_point_code2() + "INGET");
scriptArgs.put("data", data); data.put("reach", reach);
scriptArgs.put("protocol", "HTTP"); scriptArgs.put("data", data);
block.put("script_args", scriptArgs); scriptArgs.put("protocol", "HTTP");
blocks.add(block); block.put("script_args", scriptArgs);
} blocks.add(block);
}
block = new JSONObject();
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"))) {
//取货完成等待
block = new JSONObject(); block = new JSONObject();
block.put("blockId", IdUtil.simpleUUID()); block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getStart_point_code2() + "OUTGET"); block.put("location", inst.getStart_point_code2());
block.put("operation", "script"); block.put("operation", "JackLoad");
block.put("id", inst.getStart_point_code2() + "OUTGET"); block.put("operationArgs", new JSONObject() {{
block.put("script_name", "userpy/interact.py"); put("recognize", true);
JSONObject scriptArgs = new JSONObject(); }});
scriptArgs.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getStart_point_code2() + "OUTGET");
data.put("reach", reach);
scriptArgs.put("data", data);
scriptArgs.put("protocol", "HTTP");
block.put("script_args", scriptArgs);
blocks.add(block); blocks.add(block);
}
// 终点2 if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) {
Device device4 = deviceAppService.findDeviceByCode(inst.getNext_device_code2()); //取货完成等待
if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) { block = new JSONObject();
//放货前等待 block.put("blockId", IdUtil.simpleUUID());
block = new JSONObject(); block.put("location", inst.getStart_point_code2() + "OUTGET");
block.put("blockId", IdUtil.simpleUUID()); block.put("operation", "script");
block.put("location", inst.getNext_point_code2() + "INPUT"); block.put("id", inst.getStart_point_code2() + "OUTGET");
block.put("operation", "script"); block.put("script_name", "userpy/interact.py");
block.put("id", inst.getNext_point_code2() + "INPUT"); JSONObject scriptArgs = new JSONObject();
block.put("script_name", "userpy/interact.py"); scriptArgs.put("addr", addr);
JSONObject scriptArgs = new JSONObject(); JSONObject data = new JSONObject();
scriptArgs.put("addr", addr); JSONObject reach = new JSONObject();
JSONObject data = new JSONObject(); reach.put("task_code", inst.getInstruction_code());
JSONObject reach = new JSONObject(); reach.put("address", inst.getStart_point_code2() + "OUTGET");
reach.put("task_code", inst.getInstruction_code()); data.put("reach", reach);
reach.put("address", inst.getNext_point_code2() + "INPUT"); scriptArgs.put("data", data);
data.put("reach", reach); scriptArgs.put("protocol", "HTTP");
scriptArgs.put("data", data); block.put("script_args", scriptArgs);
scriptArgs.put("protocol", "HTTP"); blocks.add(block);
block.put("script_args", scriptArgs); }
blocks.add(block);
} }
block = new JSONObject(); if (StrUtil.isNotEmpty(inst.getNext_device_code2())) {
block.put("blockId", IdUtil.simpleUUID()); // 终点2
block.put("location", inst.getNext_point_code2()); Device device4 = deviceAppService.findDeviceByCode(inst.getNext_device_code2());
block.put("operation", "JackUnload"); if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) {
blocks.add(block); //放货前等待
block = new JSONObject();
block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getNext_point_code2() + "INPUT");
block.put("operation", "script");
block.put("id", inst.getNext_point_code2() + "INPUT");
block.put("script_name", "userpy/interact.py");
JSONObject scriptArgs = new JSONObject();
scriptArgs.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getNext_point_code2() + "INPUT");
data.put("reach", reach);
scriptArgs.put("data", data);
scriptArgs.put("protocol", "HTTP");
block.put("script_args", scriptArgs);
blocks.add(block);
}
if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) {
//放货完成等待
block = new JSONObject(); block = new JSONObject();
block.put("blockId", IdUtil.simpleUUID()); block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getNext_point_code2() + "OUTPUT"); block.put("location", inst.getNext_point_code2());
block.put("operation", "script"); block.put("operation", "JackUnload");
block.put("id", inst.getNext_point_code2() + "OUTPUT");
block.put("script_name", "userpy/interact.py");
JSONObject scriptArgs = new JSONObject();
scriptArgs.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getNext_point_code2() + "OUTPUT");
data.put("reach", reach);
scriptArgs.put("data", data);
scriptArgs.put("protocol", "HTTP");
block.put("script_args", scriptArgs);
blocks.add(block); blocks.add(block);
if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) {
//放货完成等待
block = new JSONObject();
block.put("blockId", IdUtil.simpleUUID());
block.put("location", inst.getNext_point_code2() + "OUTPUT");
block.put("operation", "script");
block.put("id", inst.getNext_point_code2() + "OUTPUT");
block.put("script_name", "userpy/interact.py");
JSONObject scriptArgs = new JSONObject();
scriptArgs.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getNext_point_code2() + "OUTPUT");
data.put("reach", reach);
scriptArgs.put("data", data);
scriptArgs.put("protocol", "HTTP");
block.put("script_args", scriptArgs);
blocks.add(block);
}
} }
return blocks; return blocks;

8
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java

@ -15,12 +15,12 @@ public enum RequestMethodEnum {
feedback_task_status(2, "feedback_task_status", "反馈任务状态","1"), feedback_task_status(2, "feedback_task_status", "反馈任务状态","1"),
GANTRY_MATERIAL_FINISHED(3, "gantryMaterialFinished", "门架上料完成","0"), GANTRY_MATERIAL_FINISHED(3, "gantryMaterialFinished", "其余物料上料完成","0"),
CHANNEL_STEEL_MATERIAL_FINISHED(4, "channelSteelMaterialFinished", "槽钢上料完成", "0"), CHANNEL_STEEL_MATERIAL_FINISHED(4, "channelSteelMaterialFinished", "槽钢上料完成", "0");
CHANNEL_STEEL_CALL_MATERIAL(5, "channelSteelCallMaterial", "槽钢呼叫满料", "0"), // CHANNEL_STEEL_CALL_MATERIAL(5, "channelSteelCallMaterial", "槽钢呼叫满料", "0"),
PRODUCTION_COMPLETED(6, "productionCompleted", "下料完成", "0"); // PRODUCTION_COMPLETED(6, "productionCompleted", "下料完成", "0");

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

@ -19,6 +19,7 @@ import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
@ -102,6 +103,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if (mode == 2) { if (mode == 2) {
this.writing("to_command", "0"); this.writing("to_command", "0");
} }
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", "mode信号发生变化,进行复位标记,此时标记值:" + requireSuccess);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode)); this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode);
} }
@ -223,6 +225,19 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
} }
} }
private void unLock(Device device1, Device device2, Device device3, Device device4) {
JSONObject rpUpdate = new JSONObject();
rpUpdate.put("islock", "0");
rpUpdate.put("update_by", "auto");
rpUpdate.put("update_time", DateUtil.now());
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device3.getDevice_code() + "', '" + device4.getDevice_code() + "')");
device1.setIslock("0");
device2.setIslock("0");
device3.setIslock("0");
device4.setIslock("0");
}
@NotNull @NotNull
private TaskDto creatTask(Device device1, Device device2, Device device3, Device device4, RequestMethodEnum method) { private TaskDto creatTask(Device device1, Device device2, Device device3, Device device4, RequestMethodEnum method) {
JSONObject rpUpdate = new JSONObject(); JSONObject rpUpdate = new JSONObject();
@ -273,37 +288,79 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
return null; return null;
} }
private boolean findHasGoodsIsFull(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if (device != null && device.getHas_goods() == 0) {
return false;
}
}
return true;
}
/** /**
* 门架上料完成 * 其余物料上料完成
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void gantryMaterialFinished() throws Exception { public void gantryMaterialFinished() throws Exception {
synchronized (NL4StationDeviceDriver.class) { synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) { if ("0".equals(currentDevice.getIslock())) {
// 门架上料完成放空设备
Object gantryDeviceCode1 = this.getDevice().getExtraValue().get("gantry_device_code1"); // 其余物料上料完成放空设备
if (ObjectUtil.isEmpty(gantryDeviceCode1)) { Object gantryDeviceCode2 = this.getDevice().getExtraValue().get("gantry_device_code1");
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)) { if (ObjectUtil.isEmpty(gantryDeviceCode2)) {
String message = "门架上料完成取满设备未配置。"; String message = "其余物料上料完成放空设备未配置。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString()); JSONArray emptyDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString());
Object gantryDeviceCode3 = null;
JSONArray materialDeviceCodes = null;
//查询其余物料上料对接位关联的所有上料对接位
Object link_device_code = this.getDevice().getExtraValue().get("link_device_code");
if (ObjectUtil.isNotEmpty(link_device_code)) {
JSONArray linkDeviceCodes = JSONArray.parseArray(link_device_code.toString());
boolean flag = this.findHasGoodsIsFull(linkDeviceCodes);
if (!flag) {
//否则查询特殊的取满设备
gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code3");
if (ObjectUtil.isEmpty(gantryDeviceCode3)) {
String message = "其余物料上料完成特殊取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString());
} else {
// 其余物料上料完成取满设备
gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code2");
if (ObjectUtil.isEmpty(gantryDeviceCode3)) {
String message = "其余物料上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString());
}
} else {
// 其余物料上料完成取满设备
gantryDeviceCode3 = this.getDevice().getExtraValue().get("gantry_device_code2");
if (ObjectUtil.isEmpty(gantryDeviceCode3)) {
String message = "其余物料上料完成取满设备未配置。";
this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return;
}
materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode3.toString());
}
// 查找合适的放空设备 // 查找合适的放空设备
Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes); Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes);
if (ObjectUtil.isEmpty(emptyDevice)) { if (ObjectUtil.isEmpty(emptyDevice)) {
String message = "未找到合适的门架上料完成放空设备。"; String message = "未找到合适的其余物料上料完成放空设备。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
@ -313,14 +370,18 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
// 查找合适的取满设备 // 查找合适的取满设备
Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes); Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes);
if (ObjectUtil.isEmpty(materialDevice)) { if (ObjectUtil.isEmpty(materialDevice)) {
String message = "未找到合适的门架上料完成取满设备。"; String message = "未找到合适的其余物料上料完成取满设备。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
assert materialDevice != null; assert materialDevice != null;
try {
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));
} catch (Exception e) {
this.unLock(currentDevice, emptyDevice, materialDevice, currentDevice);
throw new BadRequestException(e.getMessage());
}
this.requireSuccess = true; this.requireSuccess = true;
this.writing("to_command", this.mode); this.writing("to_command", this.mode);
} }
@ -335,195 +396,58 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
synchronized (NL4StationDeviceDriver.class) { synchronized (NL4StationDeviceDriver.class) {
Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode); Device currentDevice = this.deviceAppService.findDeviceByCode(this.currentDeviceCode);
if ("0".equals(currentDevice.getIslock())) { 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"); Object channelSteelDeviceCode2 = this.getDevice().getExtraValue().get("channel_steel_device_code1");
if (ObjectUtil.isEmpty(channelSteelDeviceCode4)) { if (ObjectUtil.isEmpty(channelSteelDeviceCode2)) {
String message = "槽钢上料完成放空设备未配置。"; String message = "槽钢上料完成放空设备未配置。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString()); JSONArray deviceCodes2 = JSONArray.parseArray(channelSteelDeviceCode2.toString());
// 查找合适的取满设备 // 槽钢上料完成取满设备
Device device1 = this.findHasGoodsDevice(deviceCodes1); Object channelSteelDeviceCode3 = this.getDevice().getExtraValue().get("channel_steel_device_code2");
if (ObjectUtil.isEmpty(device1)) { if (ObjectUtil.isEmpty(channelSteelDeviceCode3)) {
String message = "未找到合适的槽钢上料完成取满设备。"; String message = "槽钢上料完成取满设备未配置。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
assert device1 != null; JSONArray deviceCodes3 = JSONArray.parseArray(channelSteelDeviceCode3.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;
// 查找合适的放空设备 // 查找合适的放空设备
Device device4 = this.findNotHasGoodsDevice(deviceCodes4); Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
if (ObjectUtil.isEmpty(device4)) { if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的槽钢上料完成放空设备。"; String message = "未找到合适的槽钢上料完成放空设备。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
assert device4 != null; assert device2 != null;
this.taskService.create(this.creatTask(device1, device2, currentDevice, device4, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED));
this.requireSuccess = true;
this.writing("to_command", this.mode);
}
}
}
/**
* 槽钢呼叫满料
*/
@SuppressWarnings("unused")
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); Device device3 = this.findHasGoodsDevice(deviceCodes3);
if (ObjectUtil.isEmpty(device3)) { if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的槽钢呼叫满料取空设备。"; String message = "未找到合适的槽钢上料完成取满设备。";
this.message = message; this.message = message;
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message); this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", message);
return; return;
} }
assert device3 != null; assert device3 != null;
// 查找合适的放空设备 try {
Device device4 = this.findNotHasGoodsDevice(deviceCodes4); this.taskService.create(this.creatTask(currentDevice, device2, device3, currentDevice, RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED));
if (ObjectUtil.isEmpty(device4)) { } catch (Exception e) {
String message = "未找到合适的槽钢呼叫满料放空设备。"; this.unLock(currentDevice, device2, device3, currentDevice);
this.message = message; throw new BadRequestException(e.getMessage());
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.requireSuccess = true;
this.writing("to_command", this.mode); this.writing("to_command", this.mode);
} }
} }
} }
/**
* 下料完成
*/
@SuppressWarnings("unused")
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;
// 查找合适的取空设备
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);
}
}
}
} }

7
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -575,11 +575,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
JSONObject jo1 = new JSONObject(); JSONObject jo1 = new JSONObject();
jo1.put("device_code", instnextdevice); jo1.put("device_code", instnextdevice);
if (StrUtil.equals(entity.getMaterial(), "1")) { jo1.put("hasGoodStatus", "1");
jo1.put("hasGoodStatus", "1");
} else {
jo1.put("hasGoodStatus", "2");
}
jo1.put("material_type", startdevice.getMaterial_type()); jo1.put("material_type", startdevice.getMaterial_type());
jo1.put("quantity", startdevice.getQuantity()); jo1.put("quantity", startdevice.getQuantity());
jo1.put("remark", startdevice.getRemark()); jo1.put("remark", startdevice.getRemark());
@ -835,7 +831,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
log.debug("地址对应设备未找到"); log.debug("地址对应设备未找到");
return; return;
} }
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
removeByCodeFromCache(entity.getInstruction_code()); removeByCodeFromCache(entity.getInstruction_code());
} }

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

@ -12,21 +12,13 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.config.AcsConfig; import org.nl.acs.config.AcsConfig;
import org.nl.acs.device.service.DeviceAssignedService; import org.nl.acs.device.service.DeviceAssignedService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.StorageCellService; import org.nl.acs.device.service.StorageCellService;
import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.dto.DeviceAssignedDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.ext.wms.data.AcsToWmsData.feedBackTaskStatus.FeedBackTaskStatusRequest; import org.nl.acs.ext.wms.data.AcsToWmsData.feedBackTaskStatus.FeedBackTaskStatusRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
@ -323,7 +315,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String plan_code = dto.getRoute_plan_code(); String plan_code = dto.getRoute_plan_code();
//判断起点终点设备类型 //判断起点终点设备类型
if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).isEmpty() if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).isEmpty()
&& routelineserver.getShortPathLines(dto.getStart_device_code2(), dto.getNext_device_code2(), plan_code).isEmpty()) { && routelineserver.getShortPathLines(dto.getStart_device_code2(), dto.getNext_device_code2(), plan_code).isEmpty()) {
throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
} }
@ -485,7 +477,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode()); request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName()); request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
boolean flag = false; boolean flag = false;
String resp = null; String resp = null;
try { try {
resp = acstowmsService.applyTask(request); resp = acstowmsService.applyTask(request);
} catch (Exception e) { } catch (Exception e) {
@ -541,22 +533,38 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
// 诺力四期 完成任务后更新点位状态 // 诺力四期 完成任务后更新点位状态
if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) { if (RequestMethodEnum.GANTRY_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) {
// 门架上料完成任务 // 其余物料上料完成任务
WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint");
//起点1
Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code());
//终点1
Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code()); Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code());
device2.setIslock("0"); device2.setIslock("0");
device2.setHas_goods(0); device2.setHas_goods(1);
device2.setMaterial_type("0"); device2.setMaterial_type("0");
device2.setBatch("0"); device2.setBatch("0");
JSONObject update23 = new JSONObject(); JSONObject update24 = new JSONObject();
update23.put("islock", "0"); update24.put("islock", "0");
update23.put("hasgoods", "0"); update24.put("hasgoods", "1");
update23.put("material_type", "0"); update24.put("material_type", "0");
update23.put("batch", "0"); update24.put("batch", "0");
update23.put("update_by", "auto"); update24.put("update_by", "auto");
update23.put("update_time", DateUtil.now()); update24.put("update_time", DateUtil.now());
rpTable.update(update23, "device_code = '" + device2.getDevice_code() + "'"); rpTable.update(update24, "device_code = '" + device2.getDevice_code() + "'");
device1.setIslock("0");
device1.setHas_goods(0);
device1.setMaterial_type("0");
device1.setBatch("0");
JSONObject update13 = new JSONObject();
update13.put("islock", "0");
update13.put("hasgoods", "0");
update13.put("material_type", "0");
update13.put("batch", "0");
update13.put("update_by", "auto");
update13.put("update_time", DateUtil.now());
rpTable.update(update13, "device_code = '" + device1.getDevice_code() + "'");
Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2());
Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2()); Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2());
@ -577,7 +585,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
device3.setHas_goods(0); device3.setHas_goods(0);
device3.setMaterial_type("0"); device3.setMaterial_type("0");
device3.setBatch("0"); device3.setBatch("0");
rpTable.update(update23, "device_code = '" + device3.getDevice_code() + "'"); rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'");
} else if (RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) { } else if (RequestMethodEnum.CHANNEL_STEEL_MATERIAL_FINISHED.getCode().equals(entity.getDirection())) {
// 槽钢上料完成任务 // 槽钢上料完成任务
WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint");
@ -586,13 +594,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code()); Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code());
device2.setIslock("0"); device2.setIslock("0");
device2.setHas_goods(1); device2.setHas_goods(1);
device2.setMaterial_type(device1.getMaterial_type()); device2.setMaterial_type("0");
device2.setBatch(device1.getBatch()); device2.setBatch("0");
JSONObject update2 = new JSONObject(); JSONObject update2 = new JSONObject();
update2.put("islock", "0"); update2.put("islock", "0");
update2.put("hasgoods", "1"); update2.put("hasgoods", "1");
update2.put("material_type", device1.getMaterial_type()); update2.put("material_type", "0");
update2.put("batch", device1.getBatch()); update2.put("batch", "0");
update2.put("update_by", "auto"); update2.put("update_by", "auto");
update2.put("update_time", DateUtil.now()); update2.put("update_time", DateUtil.now());
rpTable.update(update2, "device_code = '" + device2.getDevice_code() + "'"); rpTable.update(update2, "device_code = '" + device2.getDevice_code() + "'");
@ -611,27 +619,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
rpTable.update(update13, "device_code = '" + device1.getDevice_code() + "'"); rpTable.update(update13, "device_code = '" + device1.getDevice_code() + "'");
Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2()); Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2());
device3.setIslock("0");
device3.setHas_goods(0);
device3.setMaterial_type("0");
device3.setBatch("0");
rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'");
Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2()); Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2());
device4.setIslock("0"); device4.setIslock("0");
device4.setHas_goods(1); device4.setHas_goods(1);
device4.setMaterial_type("0"); device4.setMaterial_type(device3.getMaterial_type());
device4.setBatch("0"); device4.setBatch(device3.getBatch());
JSONObject update4 = new JSONObject(); JSONObject update4 = new JSONObject();
update4.put("islock", "0"); update4.put("islock", "0");
update4.put("hasgoods", "1"); update4.put("hasgoods", "1");
update4.put("material_type", "0"); update4.put("material_type", device3.getMaterial_type());
update4.put("batch", "0"); update4.put("batch", device3.getBatch());
update4.put("update_by", "auto"); update4.put("update_by", "auto");
update4.put("update_time", DateUtil.now()); update4.put("update_time", DateUtil.now());
rpTable.update(update4, "device_code = '" + device4.getDevice_code() + "'"); rpTable.update(update4, "device_code = '" + device4.getDevice_code() + "'");
} else if (RequestMethodEnum.CHANNEL_STEEL_CALL_MATERIAL.getCode().equals(entity.getDirection())) {
// 槽钢呼叫满料任务 device3.setIslock("0");
device3.setHas_goods(0);
device3.setMaterial_type("0");
device3.setBatch("0");
rpTable.update(update13, "device_code = '" + device3.getDevice_code() + "'");
} else {
//手持任务完成更新点位状态
WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint"); WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint");
Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code()); Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code());
@ -661,58 +670,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
update134.put("update_by", "auto"); update134.put("update_by", "auto");
update134.put("update_time", DateUtil.now()); update134.put("update_time", DateUtil.now());
rpTable.update(update134, "device_code = '" + device1.getDevice_code() + "'"); rpTable.update(update134, "device_code = '" + device1.getDevice_code() + "'");
Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2());
device3.setIslock("0");
device3.setHas_goods(0);
device3.setMaterial_type("0");
device3.setBatch("0");
rpTable.update(update134, "device_code = '" + device3.getDevice_code() + "'");
Device device4 = deviceAppService.findDeviceByCode(entity.getNext_device_code2());
device4.setIslock("0");
device4.setHas_goods(0);
device4.setMaterial_type("0");
device4.setBatch("0");
rpTable.update(update134, "device_code = '" + device4.getDevice_code() + "'");
} else if (RequestMethodEnum.PRODUCTION_COMPLETED.getCode().equals(entity.getDirection())) {
// 下料完成任务
WQLObject rpTable = WQLObject.getWQLObject("acs_device_runpoint");
Device device1 = deviceAppService.findDeviceByCode(entity.getStart_device_code());
device1.setIslock("0");
device1.setHas_goods(1);
device1.setMaterial_type("0");
device1.setBatch("0");
JSONObject update12 = new JSONObject();
update12.put("islock", "0");
update12.put("hasgoods", "1");
update12.put("material_type", "0");
update12.put("batch", "0");
update12.put("update_by", "auto");
update12.put("update_time", DateUtil.now());
rpTable.update(update12, "device_code = '" + device1.getDevice_code() + "'");
Device device2 = deviceAppService.findDeviceByCode(entity.getNext_device_code());
device2.setIslock("0");
device2.setHas_goods(1);
device2.setMaterial_type("0");
device2.setBatch("0");
rpTable.update(update12, "device_code = '" + device2.getDevice_code() + "'");
Device device3 = deviceAppService.findDeviceByCode(entity.getStart_device_code2());
device3.setIslock("0");
device3.setHas_goods(0);
device3.setMaterial_type("0");
device3.setBatch("0");
JSONObject update3 = new JSONObject();
update3.put("islock", "0");
update3.put("hasgoods", "0");
update3.put("material_type", "0");
update3.put("batch", "0");
update3.put("update_by", "auto");
update3.put("update_time", DateUtil.now());
rpTable.update(update3, "device_code = '" + device3.getDevice_code() + "'");
} }
} }
@ -769,12 +726,24 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
rpUpdate.put("islock", "0"); rpUpdate.put("islock", "0");
rpUpdate.put("update_by", "auto"); rpUpdate.put("update_by", "auto");
rpUpdate.put("update_time", DateUtil.now()); rpUpdate.put("update_time", DateUtil.now());
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device3.getDevice_code() + "', '" + device4.getDevice_code() + "')"); String device_code3 = "";
String device_code4 = "";
if (device3 != null){
device_code3 = device3.getDevice_code();
}
if (device4 != null){
device_code4 = device4.getDevice_code();
}
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device_code3 + "', '" + device_code4 + "')");
device1.setIslock("0"); device1.setIslock("0");
device2.setIslock("0"); device2.setIslock("0");
device3.setIslock("0"); if (device3 != null) {
device4.setIslock("0"); device3.setIslock("0");
}
if (device4 != null) {
device4.setIslock("0");
}
} }
@Override @Override

19
acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
@ -37,9 +38,23 @@ public class HFHandController {
@SaIgnore @SaIgnore
//@PreAuthorize("@el.check('sect:list')") //@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> query() { public ResponseEntity<Object> query() {
return new ResponseEntity<>(handService.queryArea(null), HttpStatus.OK); return new ResponseEntity<>(handService.queryArea(new HashMap()), HttpStatus.OK);
} }
@PostMapping("/designatedRegion")
@Log("查询特定区域区域")
@ApiOperation("查询特定区域")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryDesignatedRegion() {
Map whereJson = new HashMap();
String region_code = "region_code";
whereJson.put("region_code", region_code);
return new ResponseEntity<>(handService.queryArea(whereJson), HttpStatus.OK);
}
@PostMapping("/point") @PostMapping("/point")
@Log("查询设备编号及状态") @Log("查询设备编号及状态")
@ApiOperation("查询设备编号及状态") @ApiOperation("查询设备编号及状态")
@ -100,7 +115,7 @@ public class HFHandController {
return new ResponseEntity<>(handService.queryRouteplanType(), HttpStatus.OK); return new ResponseEntity<>(handService.queryRouteplanType(), HttpStatus.OK);
} }
@PostMapping("/task") @PostMapping("/callTask")
@Log("创建任务") @Log("创建任务")
@ApiOperation("创建任务") @ApiOperation("创建任务")
@SaIgnore @SaIgnore

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

@ -67,7 +67,7 @@ public class HFHandServiceImpl implements HFHandService {
@Override @Override
public Map<String, Object> queryArea(Map whereJson) { public Map<String, Object> queryArea(Map whereJson) {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
JSONArray resultJSONArray = WQL.getWO("QJN_QUERY001").addParam("flag", "1").process().getResultJSONArray(0); JSONArray resultJSONArray = WQL.getWO("QJN_QUERY001").addParam("flag", "1").addParamMap(whereJson).process().getResultJSONArray(0);
jo.put("code", "1"); jo.put("code", "1");
jo.put("desc", "查询成功"); jo.put("desc", "查询成功");
jo.put("result", resultJSONArray); jo.put("result", resultJSONArray);
@ -208,8 +208,8 @@ public class HFHandServiceImpl implements HFHandService {
@Override @Override
public Map<String, Object> createTask(Map<String, String> jsonObject) { public Map<String, Object> createTask(Map<String, String> jsonObject) {
String start_devicecode = jsonObject.get("start_devicecode"); String start_devicecode = jsonObject.get("start_device_code");
String next_devicecode = jsonObject.get("next_devicecode"); String next_devicecode = jsonObject.get("next_device_code");
String material_type = jsonObject.get("material_type"); String material_type = jsonObject.get("material_type");
String task_type = jsonObject.get("task_type"); String task_type = jsonObject.get("task_type");
String priority = jsonObject.get("priority"); String priority = jsonObject.get("priority");
@ -232,35 +232,29 @@ public class HFHandServiceImpl implements HFHandService {
resultJson.put("result", ""); resultJson.put("result", "");
return resultJson; return resultJson;
} }
// if (ObjectUtil.isNotEmpty(taskService.findByStartCode(start_devicecode)) ||
// ObjectUtil.isNotEmpty(taskService.findByStartCode(next_devicecode))) {
// resultJson.put("code", "2");
// resultJson.put("desc", "已存在该起点或终点的任务!");
// resultJson.put("result", "");
// return resultJson;
// }
//判断起点有货,终点为空 //判断起点有货,终点为空
if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) { if (0 == startDevice.getHas_goods() || "1".equals(startDevice.getIslock())) {
resultJson.put("code", "0"); resultJson.put("code", "0");
resultJson.put("desc", "起点必须有货"); resultJson.put("desc", "起点无货或者起点已锁定");
resultJson.put("result", ""); resultJson.put("result", "");
return resultJson; return resultJson;
} }
if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) {
resultJson.put("code", "0"); if (1 == nextDevice.getHas_goods() || "1".equals(nextDevice.getIslock())) {
resultJson.put("desc", "终点必须为空");
resultJson.put("result", "");
return resultJson;
}
if (Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())) {
resultJson.put("code", "0"); resultJson.put("code", "0");
resultJson.put("desc", "起点或终点设备已被锁定"); resultJson.put("desc", "终点有货或者终点已锁定");
resultJson.put("result", ""); resultJson.put("result", "");
return resultJson; return resultJson;
} }
if (StrUtil.isEmpty(priority)) { if (StrUtil.isEmpty(priority)) {
priority = "1"; priority = "1";
} }
if (StrUtil.isEmpty(task_type)) {
//3代表手持任务
task_type = "3";
}
if (start_devicecode.equals(next_devicecode)) { if (start_devicecode.equals(next_devicecode)) {
resultJson.put("code", "0"); resultJson.put("code", "0");
@ -282,8 +276,13 @@ public class HFHandServiceImpl implements HFHandService {
dto.setVehicle_code(carrier); dto.setVehicle_code(carrier);
try { try {
taskService.create(dto); taskService.create(dto);
startDevice.setIslock("true"); startDevice.setIslock("1");
nextDevice.setIslock("true"); nextDevice.setIslock("1");
JSONObject rpUpdate = new JSONObject();
rpUpdate.put("islock", "1");
rpUpdate.put("update_by", "sc");
rpUpdate.put("update_time", DateUtil.now());
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + start_devicecode + "', '" + next_devicecode + "')");
} catch (Exception e) { } catch (Exception e) {
resultJson.put("code", "0"); resultJson.put("code", "0");
resultJson.put("desc", e.getMessage()); resultJson.put("desc", e.getMessage());

4
acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql

@ -19,6 +19,7 @@
输入.start_point TYPEAS s_string 输入.start_point TYPEAS s_string
输入.next_point TYPEAS s_string 输入.next_point TYPEAS s_string
输入.detail_id TYPEAS s_string 输入.detail_id TYPEAS s_string
输入.region_code TYPEAS s_string
@ -52,6 +53,9 @@
sys_dict_detail sys_dict_detail
WHERE WHERE
`name` = 'region' `name` = 'region'
OPTION 输入.region_code <> ""
value in ('2','3')
ENDOPTION
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF

17
acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -6,12 +6,6 @@ import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.config.AcsConfig; import org.nl.acs.config.AcsConfig;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
@ -37,6 +31,7 @@ public class AutoCreateInst {
/** /**
* 根据任务状态创建指令生成下一条指令 * 根据任务状态创建指令生成下一条指令
* 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货 * 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货
* task_type == 3代表手持任务类型
*/ */
public void run() throws Exception { public void run() throws Exception {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class); TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@ -76,13 +71,13 @@ public class AutoCreateInst {
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);
continue; continue;
} }
if (StrUtil.isEmpty(start_device_code2)) { if (StrUtil.isEmpty(start_device_code2) && !"3".equals(acsTask.getTask_type())) {
log.info("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。"); log.info("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 起点设备2为空,无法生成指令。");
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);
continue; continue;
} }
if (StrUtil.isEmpty(next_device_code2)) { if (StrUtil.isEmpty(next_device_code2) && !"3".equals(acsTask.getTask_type())) {
log.info("任务 [" + taskcode + "] 终点设备为2空,无法生成指令。"); log.info("任务 [" + taskcode + "] 终点设备为2空,无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 终点设备2为空,无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 终点设备2为空,无法生成指令。");
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);
@ -137,7 +132,7 @@ public class AutoCreateInst {
//校验路由关系 //校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
List<RouteLineDto> shortPathsList2 = routeLineService.getShortPathLines(start_device_code2, next_device_code2, route_plan_code); List<RouteLineDto> shortPathsList2 = routeLineService.getShortPathLines(start_device_code2, next_device_code2, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList) || ObjectUtils.isEmpty(shortPathsList2)) { if (ObjectUtils.isEmpty(shortPathsList) || (ObjectUtils.isEmpty(shortPathsList2) && !"3".equals(acsTask.getTask_type()))) {
log.info("任务 [" + taskcode + "] 路由不通无法生成指令。"); log.info("任务 [" + taskcode + "] 路由不通无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 路由不通无法生成指令。"); acsTask.setRemark("任务 [" + taskcode + "] 路由不通无法生成指令。");
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);
@ -159,11 +154,11 @@ public class AutoCreateInst {
log.info("任务 [" + taskcode + "] 终点设备编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。"); log.info("任务 [" + taskcode + "] 终点设备编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。");
continue; continue;
} }
if (ObjectUtils.isEmpty(startdevice2)) { if (ObjectUtils.isEmpty(startdevice2) && !"3".equals(acsTask.getTask_type())) {
log.info("任务 [" + taskcode + "] 起点设备2编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。"); log.info("任务 [" + taskcode + "] 起点设备2编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。");
continue; continue;
} }
if (ObjectUtils.isEmpty(nextdevice2)) { if (ObjectUtils.isEmpty(nextdevice2) && !"3".equals(acsTask.getTask_type())) {
log.info("任务 [" + taskcode + "] 终点设备2编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。"); log.info("任务 [" + taskcode + "] 终点设备2编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。");
continue; continue;
} }

105
acs/nladmin-ui/src/views/acs/device/driver/nl4/nl4_station.vue

@ -101,7 +101,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="门架上料完成放空设备" prop="gantry_device_code1" label-width="200"> <el-form-item label="其余物料放空设备" prop="gantry_device_code1" label-width="200">
<el-select <el-select
v-model="form.gantry_device_code1" v-model="form.gantry_device_code1"
multiple multiple
@ -119,7 +119,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="门架上料完成取满设备" prop="gantry_device_code2" label-width="200"> <el-form-item label="其余物料取满设备" prop="gantry_device_code2" label-width="200">
<el-select <el-select
v-model="form.gantry_device_code2" v-model="form.gantry_device_code2"
multiple multiple
@ -136,48 +136,10 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="槽钢上料完成取满设备" prop="channel_steel_device_code1" label-width="200">
<el-select
v-model="form.channel_steel_device_code1"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="槽钢上料完成放满设备" prop="channel_steel_device_code2" label-width="200">
<el-select
v-model="form.channel_steel_device_code2"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="槽钢上料完成放空设备" prop="channel_steel_device_code4" label-width="200"> <el-form-item label="其余物料特殊取满设备" prop="gantry_device_code3" label-width="200">
<el-select <el-select
v-model="form.channel_steel_device_code4" v-model="form.gantry_device_code3"
multiple multiple
filterable filterable
reserve-keyword reserve-keyword
@ -195,45 +157,9 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="槽钢呼叫满料取满设备" prop="channel_steel_call_material_device_code1" label-width="200"> <el-form-item label="槽钢上料放空设备" prop="channel_steel_device_code1" label-width="200">
<el-select <el-select
v-model="form.channel_steel_call_material_device_code1" v-model="form.channel_steel_device_code1"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="槽钢呼叫满料取空设备" prop="channel_steel_call_material_device_code3" label-width="200">
<el-select
v-model="form.channel_steel_call_material_device_code3"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="槽钢呼叫满料放空设备" prop="channel_steel_call_material_device_code4" label-width="200">
<el-select
v-model="form.channel_steel_call_material_device_code4"
multiple multiple
filterable filterable
reserve-keyword reserve-keyword
@ -248,12 +174,10 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="下料完成放满设备" prop="production_completed_device_code2" label-width="200"> <el-form-item label="槽钢上料取满设备" prop="channel_steel_device_code2" label-width="200">
<el-select <el-select
v-model="form.production_completed_device_code2" v-model="form.channel_steel_device_code2"
multiple multiple
filterable filterable
reserve-keyword reserve-keyword
@ -269,9 +193,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="下料完成取空设备" prop="production_completed_device_code3" label-width="200"> <el-form-item label="其余物料上料对接设备" prop="link_device_code" label-width="200">
<el-select <el-select
v-model="form.production_completed_device_code3" v-model="form.link_device_code"
multiple multiple
filterable filterable
reserve-keyword reserve-keyword
@ -525,14 +449,9 @@ export default {
link_device_code: [], link_device_code: [],
gantry_device_code1: [], gantry_device_code1: [],
gantry_device_code2: [], gantry_device_code2: [],
gantry_device_code3: [],
channel_steel_device_code1: [], channel_steel_device_code1: [],
channel_steel_device_code2: [], channel_steel_device_code2: []
channel_steel_device_code4: [],
channel_steel_call_material_device_code1: [],
channel_steel_call_material_device_code3: [],
channel_steel_call_material_device_code4: [],
production_completed_device_code2: [],
production_completed_device_code3: []
}, },
rules: {} rules: {}
} }

Loading…
Cancel
Save