Browse Source

add 自动门对接逻辑

master
zhoujj 1 month ago
parent
commit
ed73cf7c3b
  1. 236
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  2. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  3. 78
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java
  4. 30
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java
  5. 55
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java
  6. 10
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 431
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java
  8. 4
      acs/nladmin-ui/.env.production
  9. 2
      acs/nladmin-ui/public/config.js
  10. 654
      acs/nladmin-ui/src/views/acs/task/index.vue
  11. 87
      acs/nladmin-ui/src/views/acs/task/taskFeedback/index.vue

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

@ -81,192 +81,60 @@ public class NDCAgvServiceImpl implements NDCAgvService {
",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() + ",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() +
",nextAddress:" + inst.getNext_point_code()); ",nextAddress:" + inst.getNext_point_code());
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
if (!StrUtil.equals(agv_system_type, "1")) { String instcode = inst.getInstruction_code();
String instcode = inst.getInstruction_code(); int type = Integer.parseInt(inst.getInstruction_type());
int type = Integer.parseInt(inst.getAgv_inst_type()); int priority = Integer.parseInt(inst.getPriority()) + 128;
int priority = Integer.parseInt(inst.getPriority()) + 128; DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
int startAddress2 = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2()); byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
int nextAddress2 = deviceService.queryAddressBydeviceCode(inst.getNext_point_code2()); byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); byte typehigh = (byte) IntToHexHigh(type);
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); byte typelow = (byte) IntToHexLow(type);
byte typehigh = (byte) IntToHexHigh(type); byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte typelow = (byte) IntToHexLow(type); byte qhdlow = (byte) IntToHexLow(startAddress);
byte qhdhigh = (byte) IntToHexHigh(startAddress); byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte qhdlow = (byte) IntToHexLow(startAddress); byte fhdlow = (byte) IntToHexLow(nextAddress);
byte qhdhigh2 = (byte) IntToHexHigh(startAddress2); byte prioritylow = (byte) IntToHexLow(priority);
byte qhdlow2 = (byte) IntToHexLow(startAddress2);
byte fhdhigh = (byte) IntToHexHigh(nextAddress); String str = "十进制下发:";
byte fhdlow = (byte) IntToHexLow(nextAddress); String str1 = "十六进制下发:";
byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2); str += "ikey:" + (Integer.parseInt(instcode));
byte fhdlow2 = (byte) IntToHexLow(nextAddress2); str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
byte prioritylow = (byte) IntToHexLow(priority);
str += "/type:" + (type);
String str = "十进制下发:"; str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
String str1 = "十六进制下发:";
str += "任务号 ikey:" + (Integer.parseInt(instcode)); str += "/qhd:" + (startAddress);
str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
str += "/fhd:" + (nextAddress);
str += "指令类型 /type:" + (type); str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
str += "/priority:" + (priority);
str += "取货点 /qhd:" + (startAddress); str1 += "/priority:" + hexToString(prioritylow & 0xFF);
str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
str += "放货点 /fhd:" + (nextAddress); byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); (byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
str += "取货点2 /qhd2:" + (startAddress2); (byte) 0X00, (byte) 0X01,
str1 += "取货点2 /qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF); (byte) 0X00, (byte) 0X71,
str += "放货点2 /fhd2:" + (nextAddress2); (byte) 0X00, (byte) 0X0E,
str1 += "放货点2 /fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF); (byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
str += "优先级 /priority:" + (priority); (byte) ikeyhigh, (byte) ikeylow,
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF); (byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
byte[] b = new byte[]{}; (byte) qhdhigh, (byte) qhdlow,
if (type == 1) { (byte) fhdhigh, (byte) fhdlow
b = new byte[]{(byte) 0X87, (byte) 0XCD, };
(byte) 0X00, (byte) 0X08, log.info("下发AGV作业指令--{}", str);
(byte) 0X00, (byte) 0X16, log.info("下发AGV作业指令--{}", str1);
(byte) 0X00, (byte) 0X01, TwoNDCSocketConnectionAutoRun.write(b);
(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);
log.info("下发AGV作业指令--{}", str);
log.info("下发agv指令数据--{}", Bytes2HexString(b));
if (StrUtil.equals(agv_system_type, "2")) {
TwoNDCSocketConnectionAutoRun.write(b);
}
} else {
String instcode = inst.getInstruction_code();
int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height());
int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height());
//默认取货放货高度都为0
//int type = Integer.parseInt(inst.getInstruction_type());
int type = 4;
if (startHeight != 0 && nextHeight != 0) {
//取货放货高度都不为0
type = 1;
} else if (startHeight != 0 && nextHeight == 0) {
//取货高度不为0 放货高度为0
type = 2;
} else if (startHeight == 0 && nextHeight != 0) {
//取货高度为0 放货高度不为0
type = 3;
}
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);
byte shhigh = (byte) IntToHexHigh(startHeight);
byte shlow = (byte) IntToHexLow(startHeight);
byte nhhigh = (byte) IntToHexHigh(nextHeight);
byte nhlow = (byte) IntToHexLow(nextHeight);
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) 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) fhdhigh, (byte) fhdlow,
(byte) shhigh, (byte) shlow,
(byte) nhhigh, (byte) nhlow
};
log.info("下发AGV作业指令 --{}", str1);
log.info("下发AGV作业指令--{}", str);
log.info("下发agv指令数据--{}", Bytes2HexString(b));
OneNDCSocketConnectionAutoRun.write(b);
} }
} }
}
@Override @Override
public byte[] sendAgvOneModeInst(int phase, int index, int result, int startPoint, int nextPoint, int startHigh, int nextHigh) { public byte[] sendAgvOneModeInst(int phase, int index, int result, int startPoint, int nextPoint, int startHigh, int nextHigh) {

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -260,7 +260,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
// TODO Auto-generated catch block // TODO Auto-generated catch block
try { try {
Thread.sleep(5000L); Thread.sleep(5000L);
log.info("再次下发agv数据:" + Bytes2HexString(b)); log.info("再次下发agv数据:" + Bytes2HexString(b));
System.out.println("再次下发agv数据:" + Bytes2HexString(b)); System.out.println("再次下发agv数据:" + Bytes2HexString(b));
dos.write(b); dos.write(b);
dos.flush(); dos.flush();

78
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java

@ -248,45 +248,16 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info(agvaddr + "对应设备号为空!"); log.info(agvaddr + "对应设备号为空!");
return; return;
} }
if (ObjectUtil.isNotEmpty(device)) { if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
String link_three_lamp = (String) device.getExtraValue().get("link_three_lamp"); if (standardAutodoorDeviceDriver.getDoor() == 1) {
if (StrUtil.isNotEmpty(link_three_lamp)) { standardAutodoorDeviceDriver.writing("item_to_command",1);
Device code = deviceAppService.findDeviceByCode(link_three_lamp); }
if (code.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { if (standardAutodoorDeviceDriver.getTo_command() == 1) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) code.getDeviceDriver(); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
lampThreecolorDeviceDriver.writing("to_command", "1");
}
//5秒后发送关门信号
Thread.sleep(5000);
try {
standardAutodoorDeviceDriver.writing("to_open", "0");
standardAutodoorDeviceDriver.writing("to_close", "1");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if (standardAutodoorDeviceDriver.getClose() == 1) {
log.info("读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
}
} else { } else {
try { log.info("未下发NDC信号原因: 读取下发信号值为:{}", standardAutodoorDeviceDriver.getTo_command());
standardAutodoorDeviceDriver.writing("to_open", "1");
standardAutodoorDeviceDriver.writing("to_close", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) {
log.info("下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
}
} }
} }
} else { } else {
@ -300,41 +271,12 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
if (ObjectUtil.isNotEmpty(device)) { if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
String link_three_lamp = (String) device.getExtraValue().get("link_three_lamp");
if (StrUtil.isNotEmpty(link_three_lamp)) {
Device code = deviceAppService.findDeviceByCode(link_three_lamp);
if (code.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) code.getDeviceDriver();
lampThreecolorDeviceDriver.writing("to_command", "0");
}
try {
standardAutodoorDeviceDriver.writing("to_open", "0");
standardAutodoorDeviceDriver.writing("to_close", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
try {
standardAutodoorDeviceDriver.writing("to_close", "1");
standardAutodoorDeviceDriver.writing("to_open", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if (standardAutodoorDeviceDriver.getClose() == 1) {
log.info("读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
}
} }
} }
} else { else {
log.info(device_code + "对应设备号为空!"); log.info(device_code + "对应设备号为空!");
} }
} else { } else {
//上报异常信息 //上报异常信息
//(不需要WCS反馈) //(不需要WCS反馈)

30
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java

@ -9,10 +9,9 @@ import java.util.List;
@Slf4j @Slf4j
public class ItemProtocol { public class ItemProtocol {
public static String item_open = "open"; public static String item_mode = "mode";
public static String item_close = "close"; public static String item_door = "door";
public static String item_to_open = "to_open"; public static String item_to_command = "to_command";
public static String item_to_close = "to_close";
private StandardAutodoorDeviceDriver driver; private StandardAutodoorDeviceDriver driver;
@ -21,21 +20,17 @@ public class ItemProtocol {
this.driver = driver; this.driver = driver;
} }
public int getOpen() { public int getMode() {
return this.getOpcIntegerValue(item_open); return this.getOpcIntegerValue(item_mode);
} }
public int getClose() { public int getDoor() {
return this.getOpcIntegerValue(item_close); return this.getOpcIntegerValue(item_door);
} }
public int getToOpen() { public int getToCommand() {
return this.getOpcIntegerValue(item_to_open); return this.getOpcIntegerValue(item_to_command);
}
public int getToClose() {
return this.getOpcIntegerValue(item_to_close);
} }
public int getOpcIntegerValue(String protocol) { public int getOpcIntegerValue(String protocol) {
@ -61,15 +56,14 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_open, "开到位", "10001")); list.add(new ItemDto(item_mode, "模式", "DB600,B1",Boolean.valueOf(true)));
list.add(new ItemDto(item_close, "关到位", "10002")); list.add(new ItemDto(item_door, "门到位", "DB600,B2"));
return list; return list;
} }
public static List<ItemDto> getWriteableItemDtos() { public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_open, "下发开门", "00001" )); list.add(new ItemDto(item_to_command, "作业命令", "DB601,W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
return list; return list;
} }

55
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java

@ -35,46 +35,24 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
@Autowired @Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
int open = 0;
int close = 0;
int last_open = 0;
int last_close = 0;
int toOpen = 0;
int last_toOpen = 0;
int toClose = 0;
int last_toClose = 0;
String device_code = null; String device_code = null;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
} }
int mode=0;
int door=0;
int to_command=0;
@Override @Override
public void execute() { public void execute() {
String message = null; String message = null;
device_code = this.getDevice().getDevice_code(); device_code = this.getDevice().getDevice_code();
open = this.itemProtocol.getOpen(); mode = this.itemProtocol.getMode();
close = this.itemProtocol.getClose(); door = this.itemProtocol.getDoor();
toOpen = this.itemProtocol.getToOpen(); to_command=this.itemProtocol.getToCommand();
toClose = this.itemProtocol.getToClose();
if (open != last_open) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open);
}
if (close != last_close) {
if(close ==1 ){
this.writing("to_close","0");
}
}
last_open = open;
last_close = close;
last_toClose = toClose;
last_toOpen = toOpen;
} }
@ -110,25 +88,8 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
@Override @Override
public JSONObject getDeviceStatusName() { public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject(); JSONObject jo=new JSONObject();
String open = ""; return jo;
String close = "";
if (this.getOpen() == 0) {
open = "未知";
} else if (this.getOpen() == 1) {
open = "开到位";
}
if (this.getClose() == 0) {
open = "未知";
} else if (this.getClose() == 1) {
open = "关到位";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("open", open);
jo.put("close", close);
jo.put("isOnline", true);
return jo;
} }
@Override @Override

10
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -587,8 +587,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
task_code = CodeUtil.getNewCode("TASK_NO"); task_code = CodeUtil.getNewCode("TASK_NO");
task_code = CommonFinalParam.HYPHEN_ + task_code; task_code = CommonFinalParam.HYPHEN_ + task_code;
} }
String start_device_code = dto.getStart_device_code(); String start_device_code = dto.getStart_point_code();
String next_device_code = dto.getNext_device_code(); String next_device_code = dto.getNext_point_code();
String route_plan_code = dto.getRoute_plan_code(); String route_plan_code = dto.getRoute_plan_code();
dto.setCreate_by(StrUtil.isNotEmpty(currentUsername) ? currentUsername : "LMS"); dto.setCreate_by(StrUtil.isNotEmpty(currentUsername) ? currentUsername : "LMS");
dto.setUpdate_by(currentUsername); dto.setUpdate_by(currentUsername);
@ -599,15 +599,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
dto.setTask_status(TaskStatusEnum.READY.getIndex()); dto.setTask_status(TaskStatusEnum.READY.getIndex());
dto.setStart_point_code(start_device_code); dto.setStart_point_code(start_device_code);
dto.setNext_point_code(next_device_code); dto.setNext_point_code(next_device_code);
dto.setStart_device_code(start_device_code);
dto.setNext_device_code(next_device_code);
if (StrUtil.isEmpty(dto.getPriority())) { if (StrUtil.isEmpty(dto.getPriority())) {
dto.setPriority(CommonFinalParam.ONE); dto.setPriority(CommonFinalParam.ONE);
} }
String plan_code = dto.getRoute_plan_code(); String plan_code = dto.getRoute_plan_code();
// 路由校验 // 路由校验
if (routeLineService if (routeLineService
.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) .getShortPathLines(dto.getStart_point_code(), dto.getNext_point_code(), plan_code)
.size() .size()
== 0) { == 0) {
throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull")); throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull"));

431
acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java

@ -1,431 +0,0 @@
package org.nl.system.service.quartz.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@Slf4j
@Component
public class CreateDDJInst {
/**
* 定时查询堆垛机任务
*/
public void run() {
log.info("定时查询堆垛机任务"+DateUtil.now());
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
List<TaskDto> taskDtos = taskserver.findByTaskStatus("0");
List<TaskDto> taskDtoList = new ArrayList<>();
if (CollUtil.isEmpty(taskDtos) || taskDtos.size() < 1) {
} else {
for (TaskDto taskDto : taskDtos) {
String start_device_code = taskDto.getStart_device_code();
Device startDevice = appService.findDeviceByCode(start_device_code);
String next_device_code = taskDto.getNext_device_code();
Device nextDevice = appService.findDeviceByCode(next_device_code);
//判断有无出入库任务是相同路线
// TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code);
// if (ObjectUtil.isNotEmpty(dto)) {
// continue;
// }
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
taskDtoList.add(taskDto);
}
}
if (CollUtil.isNotEmpty(taskDtoList)) {
taskDtoList = sortInst(taskDtoList);
for (TaskDto taskDto : taskDtoList) {
Device nextDevice = null;
List<String> pathlist;
Device deviceByCode = null;
String taskid = taskDto.getTask_id();
String taskcode = taskDto.getTask_code();
String task_type = taskDto.getTask_type();
String vehiclecode = taskDto.getVehicle_code();
String vehiclecode2 = taskDto.getVehicle_code2();
String priority = taskDto.getPriority();
String start_device_code = taskDto.getStart_device_code();
Device startDevice = appService.findDeviceByCode(start_device_code);
String start_point_code = taskDto.getStart_point_code();
String put_device_code = taskDto.getPut_device_code();
String put_point_code = taskDto.getPut_point_code();
String next_device_code = taskDto.getNext_device_code();
nextDevice = appService.findDeviceByCode(next_device_code);
String next_point_code = taskDto.getNext_point_code();
String start_point_code2 = taskDto.getStart_point_code2();
String start_device_code2 = taskDto.getStart_device_code2();
String next_point_code2 = taskDto.getNext_point_code2();
String next_device_code2 = taskDto.getNext_device_code2();
String route_plan_code = taskDto.getRoute_plan_code();
String vehicleType = taskDto.getVehicle_type();
String agv_system_type = taskDto.getAgv_system_type();
String start_height = taskDto.getStart_height();
String next_height = taskDto.getNext_height();
//同排的货位移库任务
if (StrUtil.equals(taskDto.getStart_device_code(), taskDto.getNext_device_code())) {
//通过起点找路由
List<RouteLineDto> list =
routeLineService.getShortPathLinesByCode(
taskDto.getStart_device_code(), taskDto.getRoute_plan_code());
if (ObjectUtils.isEmpty(list)) {
throw new BadRequestException("路由不通");
}
RouteLineDto routeLineDto = list.get(0);
String[] path = routeLineDto.getPath().split("->");
pathlist = Arrays.asList(path);
deviceByCode = appService.findDeviceByCode(pathlist.get(1));
if (ObjectUtils.isEmpty(deviceByCode)) {
log.error("没有找到DDJ设备");
continue;
}
StandardStackerDeviceDriver standardStackerDeviceDriver;
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver();
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) {
log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code());
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中");
continue;
}
}
next_device_code = start_device_code;
nextDevice = appService.findDeviceByCode(next_device_code);
} else {
List<RouteLineDto> list =
routeLineService.getShortPathLines(
taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code());
if (ObjectUtils.isEmpty(list)) {
throw new BadRequestException("路由不通");
}
RouteLineDto routeLineDto = list.get(0);
String[] path = routeLineDto.getPath().split("->");
pathlist = Arrays.asList(path);
deviceByCode = appService.findDeviceByCode(pathlist.get(1));
if (ObjectUtils.isEmpty(deviceByCode)) {
log.error("没有找到DDJ设备");
continue;
}
StandardStackerDeviceDriver standardStackerDeviceDriver;
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver();
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) {
log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code());
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中");
continue;
}
}
next_device_code = taskDto.getNext_device_code();
/**
* 开始平均分配
*/
String this_coevice_code = taskserver.queryAssignedByDeviceCode(start_device_code, next_device_code);
if (StrUtil.isEmpty(this_coevice_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto routeLineDto1 = shortPathsList.get(0);
String path1 = routeLineDto1.getPath();
String[] str = path1.split("->");
List<String> pathlist1 = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist1.size(); m++) {
String deviceType1 = appService.findDeviceByCode(pathlist1.get(m)).getDevice_type();
if (deviceType1.equals(DeviceType.stacker.name())) {
index = m + 1;
break;
}
/*if (pathlist1.get(m).equals(start_device_code)) {
}*/
}
next_device_code = pathlist1.get(index);
} else {
next_device_code = this_coevice_code;
}
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList) || shortPathsList.size() < 1) {
throw new RuntimeException("路由不通!");
}
}
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + taskDto.getTo_y() + "-" + taskDto.getTo_z();
} else {
next_point_code = next_device_code;
}
nextDevice = appService.findDeviceByCode(next_device_code);
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) {
log.error("输送机,{}未联机或执行中", next_device_code);
((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7");
continue;
}
}
//单台堆垛机最多只能创建固定数量指令
Instruction instruction = new Instruction();
instruction.setInstruction_status(CommonFinalParam.ONE);
List<Instruction> byDeviceCodes = instructionService.findByDeviceCodes(instruction, true);
Instruction instdto = new Instruction();
if (CollUtil.isEmpty(byDeviceCodes)) {
//判断有没有DDJ对接位出入库的指令,只判断终点
List<Instruction> byCodeAndExcute = instructionService.findByNextCode(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令");
continue;
}
instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(taskDto.getRemark());
instdto.setMaterial(taskDto.getMaterial());
instdto.setQuantity(taskDto.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
instdto.setVehicle_code2(vehiclecode2);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(start_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setPut_device_code(put_device_code);
instdto.setPut_point_code(put_point_code);
instdto.setNext_device_code(next_device_code);
instdto.setNext_point_code(next_point_code);
instdto.setStart_point_code2(start_point_code2);
instdto.setStart_device_code2(start_device_code2);
instdto.setNext_point_code2(next_point_code2);
instdto.setNext_device_code2(next_device_code2);
instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
if (ObjectUtil.isNotNull(startDevice) && startDevice.getDevice_type().equals(DeviceType.storage.name())) {
instdto.setFrom_x(taskDto.getFrom_x());
instdto.setFrom_z(taskDto.getFrom_z());
instdto.setFrom_y(taskDto.getFrom_y());
}
if (ObjectUtil.isNotNull(nextDevice) && nextDevice.getDevice_type().equals(DeviceType.storage.name())) {
instdto.setTo_x(taskDto.getTo_x());
instdto.setTo_z(taskDto.getTo_z());
instdto.setTo_y(taskDto.getTo_y());
}
try {
instructionService.create(instdto);
} catch (Exception e) {
taskDto.setRemark(e.getMessage());
taskserver.update(taskDto);
return;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskserver.update(taskDto);
} else {
List<Instruction> insts = new ArrayList<>();
for (Instruction byDeviceCode : byDeviceCodes) {
String nextDeviceCode = byDeviceCode.getNext_device_code();
Device nextdevice = appService.findDeviceByCode(nextDeviceCode);
String startDeviceCode = byDeviceCode.getStart_device_code();
Device startDevice1 = appService.findDeviceByCode(startDeviceCode);
if (startDevice1.getDevice_type().equals(DeviceType.storage.name()) &&
(nextdevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextdevice.getDevice_type().equals(DeviceType.storage.name()))) {
insts.add(byDeviceCode);
}
}
int max = 0;
//非同排的路径
for (Instruction inst : insts) {
List<RouteLineDto> shortPathLines =new ArrayList<>();
if (!(inst.getStart_device_code().equals(inst.getNext_device_code()))) {
shortPathLines = routeLineService.getShortPathLines(inst.getStart_device_code(), inst.getNext_device_code(),
inst.getRoute_plan_code());
if (CollUtil.isEmpty(shortPathLines) || shortPathLines.size() < 1) {
log.error("没有此路由");
throw new BadRequestException("路由不通");
}
}else {
//同排路径
shortPathLines = routeLineService.getShortPathLinesByCode(inst.getStart_device_code(), inst.getRoute_plan_code());
if (CollUtil.isEmpty(shortPathLines) || shortPathLines.size() < 1) {
log.error("没有此路由");
throw new BadRequestException("路由不通");
}
}
RouteLineDto routeLineDto1 = (RouteLineDto) shortPathLines.get(0);
String[] path1 = routeLineDto1.getPath().split("->");
List<String> pathlist1 = Arrays.asList(path1);
if (pathlist1.get(1).equals(pathlist.get(1))) {
max++;
}
}
/*List<DeviceExtra> deviceExtras = deviceExtra.list(Wrappers.lambdaQuery(DeviceExtra.class).
eq(DeviceExtra::getDevice_code, pathlist.get(1)).orderByDesc(DeviceExtra::getCreate_time));*/
String count = deviceByCode.getExtraValue().get("count").toString();
if (StrUtil.isNotEmpty(count)) {
if (max <= Integer.parseInt(count)) {
//判断有没有DDJ对接位出入库的指令,只判断终点
List<Instruction> byCodeAndExcute = instructionService.findByNextCode(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令");
continue;
}
instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(taskDto.getRemark());
instdto.setMaterial(taskDto.getMaterial());
instdto.setQuantity(taskDto.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
instdto.setVehicle_code2(vehiclecode2);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(start_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setPut_device_code(put_device_code);
instdto.setPut_point_code(put_point_code);
instdto.setNext_device_code(next_device_code);
instdto.setNext_point_code(next_point_code);
instdto.setStart_point_code2(start_point_code2);
instdto.setStart_device_code2(start_device_code2);
instdto.setNext_point_code2(next_point_code2);
instdto.setNext_device_code2(next_device_code2);
instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
if (ObjectUtil.isNotNull(startDevice) && startDevice.getDevice_type().equals(DeviceType.storage.name())) {
instdto.setFrom_x(taskDto.getFrom_x());
instdto.setFrom_z(taskDto.getFrom_z());
instdto.setFrom_y(taskDto.getFrom_y());
}
if (ObjectUtil.isNotNull(nextDevice) && nextDevice.getDevice_type().equals(DeviceType.storage.name())) {
instdto.setTo_x(taskDto.getTo_x());
instdto.setTo_z(taskDto.getTo_z());
instdto.setTo_y(taskDto.getTo_y());
}
//判断agv系统
//1、1楼叉车系统
//2、2楼1区域AGV系统
//3、2楼2区域AGV系统 -已废弃
if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) {
// task_type
//1、生箔; Itype=1:取空,取满,放空,放满;
//2、分切 Itype=3取满、取空、放满、放空;
//3、普通任务 Itype=2:取货、放货;
//4、叉车任务
//5、输送任务
//6、行架
//7、立库
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
instdto.setAgv_inst_type(CommonFinalParam.ONE);
} 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 if (StrUtil.equals(task_type, "8")) {
instdto.setAgv_inst_type("2");
} else {
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type());
}
} else {
instdto.setAgv_inst_type("4");
}
try {
instructionService.create(instdto);
} catch (Exception e) {
taskDto.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(taskDto);
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskserver.update(taskDto);
continue;
}
}
}
}
}
//单台堆垛机只能出四五
}
}
private List<TaskDto> sortInst(List<TaskDto> taskDtos) {
Collections.sort(taskDtos, (t1, t2) -> {
//优先级从大到小
int i = t1.getPriority().compareTo(t2.getPriority());
//如果优先级相等
if (i == 0) {
//时间从早到晚
i = t1.getCreate_time().compareTo(t2.getCreate_time());
}
return i;
});
return taskDtos;
}
}

4
acs/nladmin-ui/.env.production

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

2
acs/nladmin-ui/public/config.js

@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8011' VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}, },
prod: { prod: {
VUE_APP_BASE_API: 'http://10.1.3.96:8011' VUE_APP_BASE_API: 'http://192.168.0.8:8011'
} }
} }

654
acs/nladmin-ui/src/views/acs/task/index.vue

@ -4,276 +4,308 @@
<div class="head-container"> <div class="head-container">
<div v-if="crud.props.searchToggle"> <div v-if="crud.props.searchToggle">
<!-- 搜索 --> <!-- 搜索 -->
<el-form <el-input
:inline="true" v-model="query.task_code"
class="demo-form-inline" size="small"
label-position="right" clearable
label-suffix=":" placeholder="输入任务号"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.vehicle_code"
size="small"
clearable
placeholder="输入载具号"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-select
v-model="query.material_type"
clearable
filterable
size="small"
placeholder="物料类型"
class="filter-item"
style="width: 190px"
@change="crud.toQuery"
> >
<el-form-item :label="$t('task.txt_box.Task_status')"> <el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />
<el-select </el-select>
v-model="query.status" <el-select
clearable v-model="query.status"
filterable clearable
size="small" filterable
:placeholder="$t('task.txt_box.Task_status')" size="small"
class="filter-item" placeholder="任务状态"
style="width: 200px" class="filter-item"
@change="crud.toQuery" style="width: 190px"
> @change="crud.toQuery"
<el-option v-for="item in dict.task_status" :key="item.id" :label="item.label" :value="item.value" /> >
</el-select> <el-option v-for="item in dict.task_status" :key="item.id" :label="item.label" :value="item.value" />
</el-form-item> </el-select>
<el-form-item :label="$t('task.txt_box.Task_code')"> <el-input
<el-input v-model="query.point_code"
v-model="query.task_code" size="small"
size="small" clearable
clearable placeholder="输入起点或终点"
:placeholder="$t('task.txt_box.Enter_task_number')" style="width: 200px;"
style="width: 200px;" class="filter-item"
class="filter-item" @keyup.enter.native="crud.toQuery"
@keyup.enter.native="crud.toQuery" />
/>
</el-form-item>
<el-form-item :label="$t('task.txt_box.Task_type')">
<el-select
v-model="query.task_type"
clearable
filterable
size="small"
:placeholder="$t('task.txt_box.Task_type')"
class="filter-item"
style="width: 200px"
@change="crud.toQuery"
>
<el-option v-for="item in dict.task_type" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-form-item :label="$t('task.txt_box.start_or_end')">
<el-input
v-model="query.point_code"
size="small"
clearable
:placeholder="$t('task.txt_box.Origin_or_destination')"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
</el-form-item>
<rrOperation />
</el-form>
</div> </div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission"> <crudOperation :permission="permission">
<el-button <el-button
slot="left" slot="left"
v-permission="['admin','task:add']"
class="filter-item" class="filter-item"
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
@click="formDia=true" @click="formDia=true"
> >
{{ $t('auto.common.Create') }} 新增
</el-button> </el-button>
<el-button <!-- <el-button
slot="right" slot="right"
v-permission="['admin','task:synchronous']"
class="filter-item" class="filter-item"
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-refresh" icon="el-icon-refresh"
@click="reload" @click="reload"
> >
{{ $t('auto.common.synchronous') }} 同步
</el-button> </el-button> -->
</crudOperation> </crudOperation>
<!--表单组件--> <!--表单组件-->
<el-dialog :close-on-click-modal="false" :visible.sync="formDia" :title="crud.status.title" width="1100px"> <el-dialog :close-on-click-modal="false" :visible.sync="formDia" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="135px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-row> <el-form-item v-if="false" label="任务标识" prop="task_id">
<el-col :span="12"> <el-input v-model="form.task_id" style="width: 370px;" />
<div class="grid-content bg-purple" /> </el-form-item>
<el-form-item v-if="false" label="任务标识" prop="task_id"> <el-form-item label="物料类型">
<el-input v-model="form.task_id" style="width: 240px;" /> <el-select
</el-form-item> v-model="form.material"
<el-form-item :label="$t('task.txt_box.Material_type')"> style="width: 370px;"
<el-select filterable
v-model="form.material" placeholder="请选择"
style="width: 370px;" @change="isDisabled=false"
filterable >
:placeholder="$t('task.select.Placeholder')" <el-option
@change="isDisabled=false" v-for="item in dict.material_type"
> :key="item.id"
<el-option :label="item.label"
v-for="item in dict.material_type" :value="item.value"
:key="item.id" />
:label="item.label" </el-select>
:value="item.value" </el-form-item>
/> <el-form-item label="任务类型">
</el-select> <el-select
</el-form-item> v-model="form.task_type"
<el-form-item :label="$t('task.txt_box.Task_type')"> style="width: 370px;"
<el-select filterable
v-model="form.task_type" placeholder="请选择"
style="width: 370px;" @change="isDisabled=false"
filterable >
:placeholder="$t('task.select.Placeholder')" <el-option
@change="isDisabled=false" v-for="item in dict.task_type"
> :key="item.id"
<el-option :label="item.label"
v-for="item in dict.task_type" :value="item.value"
:key="item.id" />
:label="item.label" </el-select>
:value="item.value" </el-form-item>
/> <el-form-item label="移动方向">
</el-select> <el-select
</el-form-item> v-model="form.task_direction"
<el-form-item :label="$t('task.txt_box.Routing_scheme')"> style="width: 370px;"
<el-select filterable
v-model="form.route_plan_code" placeholder="请选择"
style="width: 370px;" @change="isDisabled=false"
filterable >
:placeholder="$t('task.select.Placeholder')" <el-option
default-first-option v-for="item in dict.task_direction"
@change="isDisabled=false" :key="item.id"
> :label="item.label"
<el-option :value="item.value"
v-for="item in routeList" />
:key="item.plan_code" </el-select>
:label="item.plan_name" </el-form-item>
:value="item.plan_code" <el-form-item label="路由方案">
/> <el-select
</el-select> v-model="form.route_plan_code"
</el-form-item> style="width: 370px;"
<el-form-item :label="$t('task.select.Start_point')" prop="start_point_code"> filterable
<el-select placeholder="请选择"
v-model="form.start_point_code" default-first-option
style="width: 370px;" @change="isDisabled=false"
filterable >
clearable <el-option
:placeholder="$t('task.select.Placeholder')" v-for="item in routeList"
@change="showStartStorage" :key="item.plan_code"
> :label="item.plan_name"
<el-option :value="item.plan_code"
v-for="item in deviceList" />
:key="item.device_code" </el-select>
:label="item.device_code" </el-form-item>
:value="item.device_code" <el-form-item label="起点" prop="start_point_code">
/> <el-select
</el-select> v-model="form.start_point_code"
</el-form-item> style="width: 370px;"
<el-form-item :label="$t('task.select.Destination')" prop="next_point_code"> filterable
<el-select placeholder="请选择"
v-model="form.next_point_code" @change="showStartStorage"
style="width: 370px;" >
filterable <el-option
clearable v-for="item in deviceList"
:placeholder="$t('task.select.Placeholder')" :key="item.device_code"
@change="showEndStorage" :label="item.device_code"
> :value="item.device_code"
<el-option />
v-for="item in deviceList" </el-select>
:key="item.device_code" </el-form-item>
:label="item.device_code" <el-form-item v-show="start_flag" label="起点-列" prop="from_y">
:value="item.device_code" <el-select
/> v-model="form.from_y"
</el-select> style="width: 370px;"
</el-form-item> filterable
</el-col> placeholder="请选择"
<el-col :span="12"> @change="isDisabled=false"
<div class="grid-content bg-purple-light" /> >
<el-form-item :label="$t('task.txt_box.Priority')"> <el-option
<el-input v-model="form.priority" style="width: 370px;" @change="isDisabled=false" /> v-for="item in fromYList"
</el-form-item> :key="item.id"
<el-form-item :label="$t('task.txt_box.Vehicle_number')"> :label="item.value"
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" /> :value="item.id"
</el-form-item> />
<el-form-item :label="$t('task.select.Description')" prop="description"> </el-select>
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" /> </el-form-item>
</el-form-item> <el-form-item v-show="start_flag" label="起点-层" prop="from_z">
</el-col> <el-select
</el-row> v-model="form.from_z"
style="width: 370px;"
filterable
placeholder="请选择"
@change="isDisabled=false"
>
<el-option
v-for="item in fromZList"
:key="item.id"
:label="item.value"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="终点" prop="next_point_code">
<el-select
v-model="form.next_point_code"
style="width: 370px;"
filterable
placeholder="请选择"
@change="showEndStorage"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item v-show="end_flag" label="终点-列" prop="to_y">
<el-select
v-model="form.to_y"
style="width: 370px;"
filterable
placeholder="请选择"
@change="isDisabled=false"
>
<el-option
v-for="item in toYList"
:key="item.id"
:label="item.value"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item v-show="end_flag" label="终点-层" prop="to_z">
<el-select
v-model="form.to_z"
style="width: 370px;"
filterable
placeholder="请选择"
@change="isDisabled=false"
>
<el-option
v-for="item in toZList"
:key="item.id"
:label="item.value"
:value="item.id"
@change="isDisabled=false"
/>
</el-select>
</el-form-item>
<el-form-item label="优先级">
<el-input v-model="form.priority" style="width: 370px;" @change="isDisabled=false" />
</el-form-item>
<el-form-item label="载具号">
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" @change="isDisabled=false" />
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="text" @click="formDia=false">{{ $t('task.select.Cancel') }}</el-button> <el-button type="text" @click="formDia=false">取消</el-button>
<el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn"> <el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn">确认</el-button>
{{ $t('task.select.Confirm') }}
</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="small"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="25" /> <el-table-column type="selection" width="25" />
<el-table-column v-if="false" prop="task_id" label="任务标识" /> <el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column <el-table-column prop="task_code" label="任务号" />
prop="task_code" <el-table-column prop="vehicle_code" label="载具号" />
:label="$t('task.txt_box.Task_code')" <el-table-column prop="task_status" label="任务状态">
:min-width="flexWidth('task_code',crud.data,$t('task.txt_box.Task_code'))"
/>
<el-table-column prop="task_type" :label="$t('task.txt_box.Task_type')" width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }} <span v-if="scope.row.task_status==='0' ">就绪</span>
<span v-if="scope.row.task_status==='1' ">执行中</span>
<span v-if="scope.row.task_status==='2' ">完成</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="task_status" :label="$t('task.txt_box.Task_status')" width="150px"> <el-table-column prop="priority" label="任务优先级" min-width="100" show-overflow-tooltip />
<el-table-column prop="start_point_code" label="起点" min-width="100" show-overflow-tooltip />
<!-- <el-table-column prop="start_parent_code" label="父起点点位" min-width="100" show-overflow-tooltip />-->
<el-table-column prop="next_point_code" label="终点" min-width="100" show-overflow-tooltip />
<!-- <el-table-column prop="next_parent_code" label="父终点点位" min-width="100" show-overflow-tooltip />-->
<el-table-column prop="start_point_code2" label="起点2" min-width="100" show-overflow-tooltip />
<el-table-column prop="next_point_code2" label="终点2" min-width="100" show-overflow-tooltip />
<el-table-column prop="put_device_code" label="放货位" min-width="100" show-overflow-tooltip />
<el-table-column prop="compound_task" label="复合任务">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.task_status==='0' ">{{ $t('task.select.Ready') }}</span> <span v-if="scope.row.compound_task==='0' "></span>
<span v-if="scope.row.task_status==='1' ">{{ $t('task.select.In_progress') }}</span> <span v-if="scope.row.compound_task==='1' "></span>
<span v-if="scope.row.task_status==='2' ">{{ $t('task.select.Completed') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="compound_task_data" width="200" label="复合路线" />
prop="priority" <el-table-column prop="matarial" label="物料" />
:label="$t('task.txt_box.Priority')" <el-table-column prop="quantity" label="数量" />
:min-width="flexWidth('priority',crud.data,$t('task.txt_box.Priority'))" <el-table-column prop="remark" label="备注" />
/> <el-table-column prop="create_by" label="创建者" />
<el-table-column <el-table-column prop="create_time" label="创建时间" width="135" />
prop="start_point_code" <el-table-column v-permission="['admin','task:edit','task:del']" fixed="left" label="操作" width="80px" align="center">
:label="$t('task.select.Pickup_point')"
:min-width="flexWidth('start_point_code',crud.data,$t('task.select.Pickup_point'))"
/>
<el-table-column
prop="next_point_code"
:label="$t('task.select.Delivery_point')"
:min-width="flexWidth('next_point_code',crud.data,$t('task.select.Delivery_point'))"
/>
<el-table-column prop="remark" :label="$t('task.select.Remark')" :min-width="flexWidth('remark',crud.data,$t('task.select.Remark'))" />
<el-table-column prop="create_by" :label="$t('task.select.Creator')" :min-width="flexWidth('create_by',crud.data,$t('task.select.Creator'))" />
<el-table-column prop="create_time" :label="$t('task.select.Create_time')" :min-width="flexWidth('create_time',crud.data,$t('task.select.Create_time'))" />
<el-table-column prop="update_by" :label="$t('Inst.table.update_by')" :min-width="flexWidth('update_by',crud.data,$t('Inst.table.update_by'))" />
<el-table-column prop="update_time" :label="$t('Inst.table.update_time')" :min-width="flexWidth('update_time',crud.data,$t('Inst.table.update_time'))" />
<el-table-column v-permission="['admin','task:edit','task:del']" :label="$t('task.select.Operation')" width="150px" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-dropdown trigger="click" @command="handleCommand">
type="text" <span class="el-dropdown-link">
icon="el-icon-finished" <i class="el-icon-menu" />
@click="handleCommand(scope.$index, scope.row,'a')" </span>
>
{{ $t('Inst.table.Finish') }}
</el-button>
<el-dropdown size="mini">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">{{ $t('user.other.More') }}</el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-circle-close"><span @click="handleCommand(scope.$index, scope.row,'b')"> <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
{{ $t('auto.common.Cancel') }}</span> <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
</el-dropdown-item> <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">创建指令</el-dropdown-item>
<el-dropdown-item icon="el-icon-folder-add"><span @click="handleCommand(scope.$index, scope.row,'c')">
{{ $t('task.select.Create_command') }}</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-finished"><span @click="handleCommand(scope.$index, scope.row,'d')">
{{ $t('task.select.Forced_Completed') }}
</span></el-dropdown-item>
<el-dropdown-item icon="el-icon-circle-close"><span @click="handleCommand(scope.$index, scope.row,'e')">
{{ $t('task.select.Cancel_Tasks_And_Commands') }}
</span></el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
@ -286,39 +318,35 @@
</template> </template>
<script> <script>
import crudTask, { cancelAndInst } from '@/api/acs/task/task' import crudTask from '@/api/acs/task/task'
import CRUD, { crud, header, presenter } from '@crud/crud' import CRUD, { crud, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import deviceCrud from '@/api/acs/device/device' import deviceCrud from '@/api/acs/device/device'
import routeCurd from '@/api/acs/route/routePlan' import routeCurd from '@/api/acs/route/routePlan'
import { getDicts } from '@/views/system/dict/dict' import { getDicts } from '@/api/system/dict'
import i18n from '@/i18n'
export default { export default {
name: 'Task', name: 'Task',
components: { pagination, crudOperation, rrOperation }, components: { pagination, crudOperation },
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan', 'empty_shaft_position'], dicts: ['task_status', 'task_type','task_direction'],
mixins: [presenter(), header(), crud()], mixins: [presenter(), header(), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
optShow: { optShow: {
add: false, add: false,
edit: true, edit: true,
del: true, del: true,
reset: false, reset: false,
download: false download: true
}, },
crudMethod: { ...crudTask } crudMethod: { ...crudTask }})
})
}, },
data() { data() {
const checkFromY = (rule, value, callback) => { const checkFromY = (rule, value, callback) => {
if (this.start_flag) { if (this.start_flag) {
if (!value) { if (!value) {
callback(new Error(this.$t('task.select.please_enter_origin_column'))) callback(new Error('请选择起点-列!'))
} else { } else {
callback() callback()
} }
@ -329,7 +357,7 @@ export default {
const checkFromZ = (rule, value, callback) => { const checkFromZ = (rule, value, callback) => {
if (this.start_flag) { if (this.start_flag) {
if (!value) { if (!value) {
callback(new Error(this.$t('task.select.please_enter_origin_level'))) callback(new Error('请选择起点-层!'))
} else { } else {
callback() callback()
} }
@ -340,7 +368,7 @@ export default {
const checkToY = (rule, value, callback) => { const checkToY = (rule, value, callback) => {
if (this.end_flag) { if (this.end_flag) {
if (!value) { if (!value) {
callback(new Error(this.$t('task.select.please_select_destination_column'))) callback(new Error('请选择终点-列!'))
} else { } else {
callback() callback()
} }
@ -351,7 +379,7 @@ export default {
const checkToZ = (rule, value, callback) => { const checkToZ = (rule, value, callback) => {
if (this.end_flag) { if (this.end_flag) {
if (!value) { if (!value) {
callback(new Error(this.$t('task.select.please_select_destination_level'))) callback(new Error('请选择终点-列!'))
} else { } else {
callback() callback()
} }
@ -363,18 +391,11 @@ export default {
formDia: false, formDia: false,
isDisabled: false, isDisabled: false,
deviceList: [], deviceList: [],
empty_shaft_position: [],
materialList: [], materialList: [],
statusList: [], statusList: [],
routeList: [], routeList: [],
agvActionList: [
{ key: '普通任务', value: 1 },
{ key: '取货二次分配', value: 2 },
{ key: '防货二次分配', value: 3 },
{ key: '取放货二次分配', value: 4 }
],
task_type: [], task_type: [],
class_type: [], task_direction: [],
fromYList: [], fromYList: [],
fromZList: [], fromZList: [],
toYList: [], toYList: [],
@ -386,51 +407,27 @@ export default {
edit: ['admin', 'task:edit'], edit: ['admin', 'task:edit'],
del: ['admin', 'task:del'] del: ['admin', 'task:del']
}, },
showAddRowButton: true,
form: { form: {
task_id: null, task_id: null,
vehicle_code: null, vehicle_code: null,
vehicle_code2: null,
vehicle_type: null, vehicle_type: null,
task_type: '1', task_type: '1',
storage_task_type: '', task_direction: null,
task_status: null, task_status: null,
priority: 1, priority: 1,
start_point_code: null, start_point_code: null,
start_point_code2: null,
start_device_code: null, start_device_code: null,
start_device_code2: null,
next_point_code: null, next_point_code: null,
next_point_code2: null,
interaction_json: null,
remark: null, remark: null,
material: null, material: null,
route_plan_code: 'normal', route_plan_code: 'normal',
agv_action_type: 1,
from_x: null, from_x: null,
from_y: null, from_y: null,
from_z: null, from_z: null,
to_x: null, to_x: null,
to_y: null, to_y: null,
to_z: null, to_z: null
from_x2: null,
from_y2: null,
from_z2: null,
to_x2: null,
to_y2: null,
to_z2: null,
agv_system_type: '',
interactionJson: null
}, },
taskStatus: {
task_status: '',
task_id: null
},
extension: [{
name: '',
value: ''
}],
dialogVisible: false,
rules: { rules: {
start_point_code: [ start_point_code: [
{ required: true, message: '起点不能为空', trigger: 'change' } { required: true, message: '起点不能为空', trigger: 'change' }
@ -439,16 +436,16 @@ export default {
{ required: true, message: '终点不能为空', trigger: 'change' } { required: true, message: '终点不能为空', trigger: 'change' }
], ],
from_y: [ from_y: [
{ required: true, message: 'y 不能为空', trigger: 'change' } { validator: checkFromY, trigger: 'change' }
], ],
from_z: [ from_z: [
{ required: true, message: 'Z 不能为空', trigger: 'change' } { validator: checkFromZ, trigger: 'change' }
], ],
to_y: [ to_y: [
{ required: true, message: 'y 不能为空', trigger: 'change' } { validator: checkToY, trigger: 'change' }
], ],
to_z: [ to_z: [
{ required: true, message: 'Z 不能为空', trigger: 'change' } { validator: checkToZ, trigger: 'change' }
] ]
} }
} }
@ -465,71 +462,19 @@ export default {
}) })
}, },
methods: { methods: {
getAgvSystemLabel(value) {
const item = this.dict.label.agv_system_type[value]
return item
},
addNewRow() {
this.extension.push({
name: '',
value: ''
})
},
deleteField(index) { //
if (this.extension.length > 1) {
this.extension.splice(index, 1)
}
},
cancelForm() {
//
this.extension = [{
name: '',
value: ''
}]
this.dialogVisible = false
},
saveForm() {
//
//
this.form.interactionJson = this.extension.reduce((extension, item) => {
extension[item.name] = item.value
return extension
}, {})
this.dialogVisible = false
},
saveBtn() { saveBtn() {
//
this.isDisabled = true
crudTask.add(this.form).then(res => { crudTask.add(this.form).then(res => {
//
this.isDisabled = false
this.crud.toQuery() this.crud.toQuery()
this.formDia = false this.formDia = false
this.isDisabled = true this.isDisabled = true
}) })
this.extension = [{
name: '',
value: ''
}]
//
setTimeout(() => {
this.isDisabled = false //
}, 1000) // 5000 5
},
openDialog() {
this.dialogVisible = true
},
closeDialog() {
this.dialogVisible = false
}, },
// false // false
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
return true return true
}, },
finish(index, row) { finish(index, row) {
this.taskStatus.task_id = row.task_id crudTask.finish(row.task_id).then(res => {
this.taskStatus.task_status = index
crudTask.finish(this.taskStatus).then(res => {
this.crud.toQuery() this.crud.toQuery()
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => { }).catch(err => {
@ -544,14 +489,6 @@ export default {
console.log(err.response.data.message) console.log(err.response.data.message)
}) })
}, },
cancelAndInst(index, row) {
crudTask.cancelAndInst(row.task_id).then(res => {
this.crud.toQuery()
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
},
createInst(index, row) { createInst(index, row) {
crudTask.createInst(row.task_id).then(res => { crudTask.createInst(row.task_id).then(res => {
this.crud.toQuery() this.crud.toQuery()
@ -575,22 +512,16 @@ export default {
'command': command 'command': command
} }
}, },
handleCommand(index, row, command) { handleCommand(command) {
switch (command) { switch (command.command) {
case 'a':// case 'a'://
this.finish('2', row) this.finish(command.index, command.row)
break break
case 'b':// case 'b'://
this.cancel(index, row) this.cancel(command.index, command.row)
break break
case 'c':// case 'c'://
this.createInst(index, row) this.createInst(command.index, command.row)
break
case 'd'://
this.finish('4', row)
break
case 'e'://
this.cancelAndInst('3', row)
break break
} }
}, },
@ -699,14 +630,7 @@ export default {
cursor: pointer; cursor: pointer;
color: #409EFF; color: #409EFF;
} }
.el-icon-arrow-down { .el-icon-arrow-down {
font-size: 12px; font-size: 12px;
} }
.button-container {
display: flex;
justify-content: flex-end;
align-items: flex-end;
}
</style> </style>

87
acs/nladmin-ui/src/views/acs/task/taskFeedback/index.vue

@ -5,7 +5,7 @@
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" /> <crudOperation :permission="permission" />
<!--表单组件--> <!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu" :title="crud.status.title" width="500px"> <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="任务反馈标识" prop="taskback_id"> <el-form-item label="任务反馈标识" prop="taskback_id">
<el-input v-model="form.taskback_id" style="width: 370px;" /> <el-input v-model="form.taskback_id" style="width: 370px;" />
@ -90,51 +90,38 @@
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column v-if="false" prop="taskback_id" label="任务反馈标识" /> <el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="task_id" label="任务标识" /> <el-table-column v-permission="['admin','taskFeedback:edit','taskFeedback:del']" fixed="left" label="操作" width="100px" align="center">
<el-table-column prop="task_code" :label="$t('task.txt_box.Task_code')" :min-width="flexWidth('task_code',crud.data,$t('task.txt_box.Task_code'))" />
<el-table-column prop="task_type" :label="$t('task.txt_box.Task_type')" min-width="150px" />
<el-table-column prop="task_status" :label="$t('task.txt_box.Task_status')" :min-width="flexWidth('task_status',crud.data,$t('task.txt_box.Task_status'))" />
<el-table-column prop="start_point_code" :label="$t('task.select.Starting_point')" :min-width="flexWidth('start_point_code',crud.data,$t('task.txt_box.Starting_point'))" />
<el-table-column prop="next_point_code" :label="$t('task.select.Target_point')" :min-width="flexWidth('next_point_code',crud.data,$t('task.txt_box.Target_point'))" />
<el-table-column prop="vehicle_code" :label="$t('task.txt_box.Vehicle_number')" :min-width="flexWidth('vehicle_code',crud.data,$t('task.txt_box.Vehicle_number'))" />
<el-table-column prop="is_finished" :label="$t('task.select.Is_it_completed')" :min-width="flexWidth('is_finished',crud.data,$t('task.select.Is_it_completed'))" />
<el-table-column prop="error_code" :label="$t('task.select.error_code')" :min-width="flexWidth('error_code',crud.data,$t('task.select.error_code'))" />
<el-table-column prop="start_time" :label="$t('task.select.start_time')" :min-width="flexWidth('start_time',crud.data,$t('task.select.start_time'))" />
<el-table-column prop="finish_time" :label="$t('task.select.finish_time')" :min-width="flexWidth('finish_time',crud.data,$t('task.select.finish_time'))" />
<el-table-column prop="create_type" :label="$t('task.select.create_type')" :min-width="flexWidth('create_type',crud.data,$t('task.select.create_type'))" />
<el-table-column prop="finish_type" :label="$t('task.select.finish_type')" :min-width="flexWidth('finish_type',crud.data,$t('task.select.finish_type'))" />
<el-table-column prop="retry_times" :label="$t('task.select.retry_times')" :min-width="flexWidth('retry_times',crud.data,$t('task.select.retry_times'))" />
<el-table-column prop="remark" :label="$t('task.select.Remark')" :min-width="flexWidth('remark',crud.data,$t('task.select.remark'))" />
<el-table-column prop="create_by" :label="$t('task.select.Creator')" :min-width="flexWidth('create_by',crud.data,$t('task.select.Creator'))" />
<el-table-column prop="create_time" :label="$t('task.select.Create_time')" :min-width="flexWidth('create_time',crud.data,$t('task.select.Create_time'))" />
<el-table-column v-permission="['admin','taskFeedback:edit','taskFeedback:del']" :label="$t('task.select.Operation')" width="200px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-dropdown trigger="click" @command="handleCommand">--> <el-dropdown trigger="click" @command="handleCommand">
<!-- <span class="el-dropdown-link">--> <span class="el-dropdown-link">
<!-- <i class="el-icon-menu" />--> <i class="el-icon-menu" />
<!-- </span>--> </span>
<!-- <el-dropdown-menu slot="dropdown">--> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">{{ $t('task.select.Reset') }}</el-dropdown-item>--> <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">重置</el-dropdown-item>
<!-- <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">{{ $t('task.select.Void') }}</el-dropdown-item>--> <el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">作废</el-dropdown-item>
<!-- </el-dropdown-menu>--> </el-dropdown-menu>
<!-- </el-dropdown>--> </el-dropdown>
<el-button
type="text"
icon="el-icon-refresh"
@click="handleCommand(scope.$index, scope.row,'a')"
>
{{ $t('task.select.Reset') }}
</el-button>
<el-button
type="text"
icon="el-icon-circle-close"
@click="handleCommand(scope.$index, scope.row,'b')"
>
{{ $t('task.select.Void') }}
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="false" prop="taskback_id" label="任务反馈标识" />
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务号" />
<el-table-column prop="task_type" label="任务类型" />
<el-table-column prop="task_status" label="任务状态" />
<el-table-column prop="start_point_code" label="起始点位" />
<el-table-column prop="next_point_code" label="目标点位" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="is_finished" label="是否完成" />
<el-table-column prop="error_code" label="错误编码" />
<el-table-column prop="start_time" label="开始时间" />
<el-table-column prop="finish_time" label="完成时间" />
<el-table-column prop="create_type" label="创建类型" />
<el-table-column prop="finish_type" label="完成类型" />
<el-table-column prop="retry_times" label="重试次数" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" />
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination />
@ -143,11 +130,11 @@
</template> </template>
<script> <script>
import crudTaskFeedback /* { invalid } */ from '@/api/acs/task/taskFeedback' import crudTaskFeedback, { invalid } from '@/api/acs/task/taskFeedback'
import CRUD, { presenter, header, form, crud } from '@crud/crud' import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
// import crudTask from '@/api/acs/task/task' import crudTask from '@/api/acs/task/task'
const defaultForm = { taskback_id: null, task_id: null, task_code: null, vehicle_code: null, vehicle_type: null, task_type: null, task_status: null, is_finished: null, error_code: null, start_time: null, finish_time: null, create_type: null, finish_type: null, retry_times: null, start_point_code: null, start_device_code: null, next_point_code: null, next_device_code: null, remark: null, is_active: null, is_delete: null, create_by: null, create_time: null, update_by: null, update_time: null } const defaultForm = { taskback_id: null, task_id: null, task_code: null, vehicle_code: null, vehicle_type: null, task_type: null, task_status: null, is_finished: null, error_code: null, start_time: null, finish_time: null, create_type: null, finish_type: null, retry_times: null, start_point_code: null, start_device_code: null, next_point_code: null, next_device_code: null, remark: null, is_active: null, is_delete: null, create_by: null, create_time: null, update_by: null, update_time: null }
export default { export default {
@ -207,7 +194,7 @@ export default {
create_time: [ create_time: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' } { required: true, message: '创建时间不能为空', trigger: 'blur' }
] ]
}} } }
}, },
methods: { methods: {
// false // false
@ -237,13 +224,13 @@ export default {
'command': command 'command': command
} }
}, },
handleCommand(index, row, command) { handleCommand(command) {
switch (command) { switch (command.command) {
case 'a':// case 'a'://
this.retry(index, row) this.retry(command.index, command.row)
break break
case 'b':// case 'b'://
this.invalid(index, row) this.invalid(command.index, command.row)
break break
} }
} }

Loading…
Cancel
Save