Browse Source

更新

master
gengby 2 years ago
parent
commit
61e4759703
  1. 211
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  2. 28
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  3. 172
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  4. 7
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java
  5. 8
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
  6. 24
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  7. 133
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  8. 205
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  9. 2897
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  10. 25
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

211
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

@ -83,170 +83,53 @@ public class NDCAgvServiceImpl implements NDCAgvService {
@Override
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
if (!StrUtil.equals(agv_system_type, "1")) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
int startAddress2 = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2());
int nextAddress2 = deviceService.queryAddressBydeviceCode(inst.getNext_point_code2());
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte qhdhigh2 = (byte) IntToHexHigh(startAddress2);
byte qhdlow2 = (byte) IntToHexLow(startAddress2);
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte fhdlow = (byte) IntToHexLow(nextAddress);
byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2);
byte fhdlow2 = (byte) IntToHexLow(nextAddress2);
byte prioritylow = (byte) IntToHexLow(priority);
String str = "十进制下发:";
String str1 = "十六进制下发:";
str += "ikey:" + (Integer.parseInt(instcode));
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
str += "/type:" + (type);
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
str += "/qhd:" + (startAddress);
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
str += "/fhd:" + (nextAddress);
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
str += "/qhd2:" + (startAddress2);
str1 += "/qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF);
str += "/fhd2:" + (nextAddress2);
str1 += "/fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF);
str += "/priority:" + (priority);
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
System.out.println(str1);
byte[] b = new byte[]{};
if (type == 1) {
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X16,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X12,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) qhdhigh2, (byte) qhdlow2,
(byte) fhdhigh, (byte) fhdlow,
(byte) fhdhigh2, (byte) fhdlow2
};
} else if (type == 2) {
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X16,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X12,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) 0X00, (byte) 0X00,
(byte) fhdhigh, (byte) fhdlow,
(byte) 0X00, (byte) 0X00
};
} else if (type == 3) {
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X16,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X12,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) qhdhigh2, (byte) qhdlow2,
(byte) fhdhigh, (byte) fhdlow,
(byte) fhdhigh2, (byte) fhdlow2
};
}
log.info("下发AGV作业指令--{}", str1);
if (StrUtil.equals(agv_system_type,"2")){
TwoNDCSocketConnectionAutoRun.write(b);
} else if (StrUtil.equals(agv_system_type,"3")){
TwoNDC2SocketConnectionAutoRun.write(b);
}
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
} else {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getInstruction_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte fhdlow = (byte) IntToHexLow(nextAddress);
byte prioritylow = (byte) IntToHexLow(priority);
String str = "十进制下发:";
String str1 = "十六进制下发:";
str += "ikey:" + (Integer.parseInt(instcode));
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
str += "/type:" + (type);
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
str += "/qhd:" + (startAddress);
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
str += "/fhd:" + (nextAddress);
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
str += "/priority:" + (priority);
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
System.out.println(str1);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X0E,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
};
log.info("下发AGV作业指令--{}", str1);
OneNDCSocketConnectionAutoRun.write(b);
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
}
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte fhdlow = (byte) IntToHexLow(nextAddress);
byte prioritylow = (byte) IntToHexLow(priority);
String str = "十进制下发:";
String str1 = "十六进制下发:";
str += "ikey:" + (Integer.parseInt(instcode));
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
str += "/type:" + (type);
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
str += "/qhd:" + (startAddress);
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
str += "/fhd:" + (nextAddress);
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
str += "/priority:" + (priority);
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
System.out.println(str1);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X0E,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
};
log.info("下发AGV作业指令--{}", str1);
OneNDCSocketConnectionAutoRun.write(b);
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
}
}

28
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -126,12 +126,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
List<Instruction> insts = null;
boolean link_flag = false;
Device agv_device = null;
if(carno != 0){
if (carno != 0) {
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
}
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
if (ObjectUtil.isEmpty(inst)){
if (ObjectUtil.isEmpty(inst)) {
inst = instructionService.findByCode(String.valueOf(ikey));
}
}
@ -160,24 +160,22 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//任务完毕
//(无车id及状态)
else if (phase == 0x0A) {
if (!ObjectUtil.isEmpty(inst)) {
if (!ObjectUtil.isEmpty(inst)) {
instructionService.finish(inst.getInstruction_id());
}
instructionService.finish(inst.getInstruction_id());
} else {
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},已反馈agv任务完成!");
}
//请求删除任务
//(需要WCS反馈)
else if(phase == 0x30){
else if (phase == 0x30) {
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0);
}
//任务删除确认
//(需要WCS反馈)
else if(phase == 0xFF) {
else if (phase == 0xFF) {
if (!ObjectUtil.isEmpty(inst)) {
if (!ObjectUtil.isEmpty(inst)) {
@ -189,12 +187,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} else {
//上报异常信息
//(不需要WCS反馈)
if(phase == 0x67){
if (phase == 0x67) {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
} else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
}
if(ObjectUtil.isNotEmpty(device)){
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
agvNdcOneDeviceDriver.processSocket(arr);
@ -215,9 +213,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
System.out.println("OneAgv链接异常");
log.info("OneAgv链接异常");
log.error("agv连接出现异常:{}", e);
logServer.deviceExecuteLog("1","","","agv异常"+e.getMessage());
logServer.deviceExecuteLog("1","","","agv异常" + e);
if(ObjectUtil.isNotEmpty(s)){
logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage());
logServer.deviceExecuteLog("1", "", "", "agv异常" + e);
if (ObjectUtil.isNotEmpty(s)) {
s.close();
}
System.out.println(e.getMessage());

172
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -2,6 +2,9 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -23,6 +26,8 @@ import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
@ -43,6 +48,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
@ -90,7 +96,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
if (ObjectUtil.isEmpty(inst)){
if (ObjectUtil.isEmpty(inst)) {
inst = instructionService.findByCode(String.valueOf(ikey));
}
}
@ -163,27 +169,43 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
// standardOrdinarySiteDeviceDriver.setIndex(index);
// standardOrdinarySiteDeviceDriver.setInst(inst);
// }
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
String instruction_type = inst.getInstruction_type();
if (StrUtil.equals(instruction_type, "3")
|| StrUtil.equals(instruction_type, "5")
|| StrUtil.equals(instruction_type, "9")
|| StrUtil.equals(instruction_type, "11")
|| StrUtil.equals(instruction_type, "13")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "1");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
}
} else {
log.info("请求取货条件不满足待机有货");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs不需要请求wms取货申请,已反馈agv允许取货", inst.getInstruction_code());
}
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
//取货完毕
//(需要WCS反馈)
} else if (phase == 0x05) {
@ -223,38 +245,41 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
if(siemensConveyorDeviceDriver.getTo_command() == 2){
log.info("取货完成请求离开,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command());
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
String instruction_type = inst.getInstruction_type();
if (StrUtil.equals(instruction_type, "2")
|| StrUtil.equals(instruction_type, "3")
|| StrUtil.equals(instruction_type, "4")
|| StrUtil.equals(instruction_type, "5")
|| StrUtil.equals(instruction_type, "6")
|| StrUtil.equals(instruction_type, "8")
|| StrUtil.equals(instruction_type, "9")
|| StrUtil.equals(instruction_type, "10")
|| StrUtil.equals(instruction_type, "11")
|| StrUtil.equals(instruction_type, "13")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "2");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
}
} else {
log.info("取货完成请求离开下发输送信号,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command());
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "2");
list.add(map);
siemensConveyorDeviceDriver.writing(list);
siemensConveyorDeviceDriver.writing(list);
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
}
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs不需要反馈wms取货完成,已反馈agv取货完成", inst.getInstruction_code());
}
}
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
//到达放货点
//(需要WCS反馈)
} else if (phase == 0x07) {
@ -289,22 +314,34 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
// standardOrdinarySiteDeviceDriver.setIndex(index);
// standardOrdinarySiteDeviceDriver.setInst(inst);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
String instruction_type = inst.getInstruction_type();
if (StrUtil.equals(instruction_type, "2")
|| StrUtil.equals(instruction_type, "4")
|| StrUtil.equals(instruction_type, "8")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "3");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs不需要请求wms放货申请,已反馈agv允许放货", inst.getInstruction_code());
}
}
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
//放货完毕
//(需要WCS反馈)
@ -341,23 +378,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
// standardOrdinarySiteDeviceDriver.setIndex(index);
// standardOrdinarySiteDeviceDriver.setInst(inst);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
//到达位置点
//(需要WCS反馈)

7
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java

@ -105,4 +105,11 @@ public class AcsToWmsController {
public ResponseEntity<Object> liKuApplyTaskRequest(@RequestBody LiKuApplyTaskRequest param) {
return new ResponseEntity<>(acstowmsService.liKuApplyTaskRequest(param), HttpStatus.OK);
}
@PostMapping("/feedAgvTaskStatus")
@Log(value = "反馈AGV取放货状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
@ApiOperation("反馈AGV取放货状态")
public ResponseEntity<Object> feedAgvTaskStatus(@RequestBody JSONArray from) {
return new ResponseEntity<>(acstowmsService.feedAgvTaskStatus(from), HttpStatus.OK);
}
}

8
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java

@ -104,4 +104,12 @@ public interface AcsToWmsService {
// 输送线有货变成无货时向lms请求
HttpResponse shipDeviceUpdate(JSONObject param);
/**
* 反馈AGV取放货状态
*
* @param from
* @return
*/
HttpResponse feedAgvTaskStatus(JSONArray from);
}

24
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -529,4 +529,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
return null;
}
@Override
public HttpResponse feedAgvTaskStatus(JSONArray from) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
HttpResponse result = null;
log.info("feedAgvTaskStatus----请求参数{}", from);
try {
result = HttpRequest.post(url)
.body(String.valueOf(from))
.execute();
System.out.println(result);
log.info("feedAgvTaskStatus----返回参数{}", result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
//System.out.println(msg);
}
return result;
}
}

133
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -58,8 +58,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final AcsToLiKuService acsToLiKuService;
private String log_file_type="log_file_type";
private String log_type="LMS请求ACS";
private String log_file_type = "log_file_type";
private String log_type = "LMS请求ACS";
@Override
public CancelTaskResponse cancelFromWms(String param) throws Exception {
@ -172,7 +172,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}
response.setStatus(200);
response.setMessage("success");
@ -232,7 +231,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min());
jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec());
//温度需要除以10
jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature()/10);
jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature() / 10);
jo.put("door", hongXiangConveyorDeviceDriver.getDoor());
jo.put("finish", hongXiangConveyorDeviceDriver.getFinish());
jo.put("task", hongXiangConveyorDeviceDriver.getTask());
@ -305,7 +304,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public Map<String, Object> putPlusPullAction(String param) {
try {
@ -319,61 +317,61 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (ObjectUtil.isEmpty(device)) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "未找到对应的设备:"+device_code);
resultJson.put("message", "未找到对应的设备:" + device_code);
return resultJson;
}
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
// 0 穿轴 1拔轴
if(StrUtil.equals(type,"1")){
if (StrUtil.equals(type, "1")) {
if(plugPullDeviceSiteDeviceDriver.getMode() == 1){
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求拔轴,当前设备工作模式未自动");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getAction() == 0){
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求拔轴,当前设备未全自动");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求拔轴,当前设备未待机");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getControl() != 0){
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求拔轴,当前设备未远程控制");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getMove() != 0){
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求拔轴,当前设备有轴");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1
&& plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==0
&& plugPullDeviceSiteDeviceDriver.getControl() ==0 ){
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
List list = new ArrayList();
Map map = new HashMap();
map.put("code","to_size");
map.put("value",size);
map.put("code", "to_size");
map.put("value", size);
list.add(map);
Map map2 = new HashMap();
map2.put("code","to_type");
map2.put("value",type);
map2.put("code", "to_type");
map2.put("value", type);
list.add(map2);
Map map3 = new HashMap();
map3.put("code","to_command");
map3.put("value","1");
map3.put("code", "to_command");
map3.put("value", "1");
list.add(map3);
plugPullDeviceSiteDeviceDriver.writing(list);
@ -384,55 +382,55 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return resultJson;
}
} else if (StrUtil.equals(type,"0")){
} else if (StrUtil.equals(type, "0")) {
if(plugPullDeviceSiteDeviceDriver.getMode() == 1){
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求插轴,当前设备工作模式未自动");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getAction() == 0){
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求插轴,当前设备未全自动");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求插轴,当前设备未待机");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getControl() != 0){
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求插轴,当前设备未远程控制");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getMove() != 1){
if (plugPullDeviceSiteDeviceDriver.getMove() != 1) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "请求插轴,当前设备没有轴");
return resultJson;
}
if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1
&& plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==1
&& plugPullDeviceSiteDeviceDriver.getControl() ==0 ){
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
List list = new ArrayList();
Map map = new HashMap();
map.put("code","to_size");
map.put("value",size);
map.put("code", "to_size");
map.put("value", size);
list.add(map);
Map map2 = new HashMap();
map2.put("code","to_type");
map2.put("value",type);
map2.put("code", "to_type");
map2.put("value", type);
list.add(map2);
Map map3 = new HashMap();
map3.put("code","to_command");
map3.put("value","1");
map3.put("code", "to_command");
map3.put("value", "1");
list.add(map3);
plugPullDeviceSiteDeviceDriver.writing(list);
@ -457,7 +455,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public CreateTaskResponse crateTask(String param) {
try {
@ -581,14 +578,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
route_plan_code = "normal";
}
if( StrUtil.equals(task_type,"5") && taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "已存在相同的起点终点未执行的输送任务");
errArr.add(json);
continue;
}
// if( StrUtil.equals(task_type,"5") && taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "已存在相同的起点终点未执行的输送任务");
// errArr.add(json);
// continue;
// }
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
if (taskDto != null) {
JSONObject json = new JSONObject();
@ -646,6 +643,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type);
jo.put("storage_task_type", storage_task_type);
if (StrUtil.isEmpty(agv_system_type)) {
agv_system_type = "1";
}
jo.put("agv_system_type", agv_system_type);
jo.put("oven_time", (int) Math.ceil(oven_time));
jo.put("remark", remark);
@ -658,45 +658,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
// task_type=7 则是立库任务需要下刻下发
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
// taskService.create(task_dto);
// try{
// taskService.createInst(task_dto.getTask_id());
// } catch (Exception e) {
// e.printStackTrace();
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "创建指令失败:"+e.getMessage());
// errArr.add(json);
// }
//创建临时指令 不创建、不生成
//等立库反馈成功才能创建任务和指令
Instruction inst = taskService.createTemporaryInst(task_dto);
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst);
if(StrUtil.equals(resp.result,"true")){
//创建任务和指令
taskService.create(task_dto);
inst.setSend_status("1");
taskService.createInst(inst);
} else {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", resp.getComment());
json.put("code", resp.code);
json.put("data", data);
errArr.add(json);
continue;
}
} else {
taskService.create(task_dto);
}
taskService.create(task_dto);
} catch (Exception e) {
// e.printStackTrace();
JSONObject json = new JSONObject();
@ -712,7 +674,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
response.setMessage("success");
} else {
response.setStatus(400);
if(ObjectUtil.isNotEmpty(errArr)){
if (ObjectUtil.isNotEmpty(errArr)) {
response.setMessage(errArr.getJSONObject(0).getString("message"));
} else {
response.setMessage("false");
@ -727,7 +689,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}

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

@ -250,15 +250,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override
public Instruction findByTaskcodeAndStatus(String code) {
Iterator var3 = instructions.iterator();
while (var3.hasNext()) {
Instruction instruction = (Instruction) var3.next();
if (StrUtil.equals(instruction.getTask_code(), code)
&& StrUtil.equals(instruction.getInstruction_status(), "0")) {
return instruction;
}
Iterator var3 = instructions.iterator();
while (var3.hasNext()) {
Instruction instruction = (Instruction) var3.next();
if (StrUtil.equals(instruction.getTask_code(), code)
&& StrUtil.equals(instruction.getInstruction_status(), "0")) {
return instruction;
}
return null;
}
return null;
}
@Override
@ -342,11 +342,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
}
try {
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
@ -1097,77 +1092,77 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override
public Instruction findByLinkNumSend(String code) {
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "1")) {
return inst;
}
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "1")) {
return inst;
}
}
return null;
}
@Override
public List<Instruction> findByLinkNum(String code) {
List<Instruction> list = new ArrayList<>();
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) {
list.add(inst);
}
List<Instruction> list = new ArrayList<>();
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) {
list.add(inst);
}
return list;
}
return list;
}
@Override
public Instruction findByLinkNumNoSend(String code) {
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) {
return inst;
}
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getLink_num()) && StrUtil.equals(inst.getIs_send(), "0")) {
return inst;
}
}
return null;
return null;
}
@Override
public Instruction findByCodeFromCache(String code) {
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getInstruction_code())) {
return inst;
}
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(code, inst.getInstruction_code())) {
return inst;
}
return null;
}
return null;
}
@Override
public Instruction findByBarcodeFromCache(String barcode) {
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(barcode, inst.getVehicle_code())) {
return inst;
}
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(barcode, inst.getVehicle_code())) {
return inst;
}
return null;
}
return null;
}
@Override
public Instruction findByIdFromCache(String id) {
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(id, inst.getInstruction_id())) {
return inst;
}
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(id, inst.getInstruction_id())) {
return inst;
}
return null;
}
return null;
}
@Override
@ -1243,23 +1238,23 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override
public Instruction findByDeviceCodeFromCache(String devicecode) {
List<Instruction> instructionList = instructions;
ListUtil.sort(
instructionList,
new Comparator<Instruction>() {
@Override
public int compare(Instruction o1, Instruction o2) {
return o1.getCreate_time().compareTo(o2.getCreate_time());
}
});
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(devicecode, inst.getStart_device_code())
&& inst.getInstruction_status().equals("0")) {
return inst;
}
List<Instruction> instructionList = instructions;
ListUtil.sort(
instructionList,
new Comparator<Instruction>() {
@Override
public int compare(Instruction o1, Instruction o2) {
return o1.getCreate_time().compareTo(o2.getCreate_time());
}
});
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(devicecode, inst.getStart_device_code())
&& inst.getInstruction_status().equals("0")) {
return inst;
}
}
return null;
}
@ -1271,52 +1266,52 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override
public Integer querySameDestinationInst(String devicecode) {
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
// 处理空盘位站点
String next_code = inst.getNext_point_code();
if (next_code.indexOf(".") != -1) {
next_code = next_code.substring(0, next_code.indexOf("."));
}
if (StrUtil.equals(devicecode, next_code)) {
num = num + 1;
}
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
// 处理空盘位站点
String next_code = inst.getNext_point_code();
if (next_code.indexOf(".") != -1) {
next_code = next_code.substring(0, next_code.indexOf("."));
}
if (StrUtil.equals(devicecode, next_code)) {
num = num + 1;
}
}
return num;
return num;
}
@Override
public Integer querySameInstType(String inst_type) {
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(inst.getInstruction_type(), inst_type)) {
num = num + 1;
}
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(inst.getInstruction_type(), inst_type)) {
num = num + 1;
}
return num;
}
return num;
}
@Override
public Integer querySameOriginInst(String devicecode) {
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
// 处理空盘位站点
String start_code = inst.getStart_point_code();
if (start_code.indexOf(".") != -1) {
start_code = start_code.substring(0, start_code.indexOf("."));
}
if (StrUtil.equals(devicecode, start_code)) {
num = num + 1;
}
int num = 0;
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
// 处理空盘位站点
String start_code = inst.getStart_point_code();
if (start_code.indexOf(".") != -1) {
start_code = start_code.substring(0, start_code.indexOf("."));
}
return num;
if (StrUtil.equals(devicecode, start_code)) {
num = num + 1;
}
}
return num;
}
@Override

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

File diff suppressed because it is too large

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

@ -139,29 +139,8 @@ public class AutoCreateInst {
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
//判断agv系统
//1、1楼叉车系统
//2、2楼1区域AGV系统
//3、2楼2区域AGV系统
if (!StrUtil.equals(agv_system_type, "1")) {
// task_type
//1、生箔; Itype=1:取空,取满,放空,放满;
//2、分切 Itype=3取满、取空、放满、放空;
//3、普通任务 Itype=2:取货、放货;
//4、叉车任务
//5、输送任务
//6、行架
//7、立库
if (StrUtil.equals(task_type, "1")) {
instdto.setAgv_inst_type("1");
} else if (StrUtil.equals(task_type, "3")) {
instdto.setAgv_inst_type("2");
} else if (StrUtil.equals(task_type, "2")) {
instdto.setAgv_inst_type("3");
}
} else {
instdto.setAgv_inst_type("4");
}
instdto.setAgv_inst_type("1");
try {
instructionService.create(instdto);

Loading…
Cancel
Save