Browse Source

Merge pull request 'psh' (#1) from psh into master

Reviewed-on: pangsh/beiterui#1
master
庞晟豪 1 year ago
parent
commit
c28ee20363
  1. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
  2. 24
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  3. 20
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  4. 157
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  5. 9
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
  6. 25
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  7. 8
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
  8. 105
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java
  9. 4
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java
  10. 5
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java
  11. 5
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
  12. 14
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  13. 4
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java
  14. 31
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  15. 125
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/JsonUtl.java
  16. 4
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/rest/TaskController.java
  17. 12
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java
  18. 341
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/AutoCreateInst.java
  19. 30
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/NdcAutoReconnection.java
  20. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java
  21. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java
  22. 42
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java
  23. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java
  24. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/dao/SchBaseTask.java
  25. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  26. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java
  27. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java
  28. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java
  29. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java
  30. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java
  31. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java
  32. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java
  33. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java
  34. 1
      lms/nladmin-ui/src/views/wms/sch/group/index.vue

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java

@ -29,7 +29,7 @@ public interface NDCAgvService {
*/
public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception;
public byte[] sendAgvOneModeInst(int phase, int index,int result);
public byte[] sendAgvOneModeInst(int phase, int index,int result,int startPoint,int nextPoint,int startHigh,int nextHigh);
public byte[] sendAgvTwoModeInst(int phase, int index,int result);

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

@ -75,7 +75,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type());
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);
@ -125,23 +125,35 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@Override
public byte[] sendAgvOneModeInst(int phase, int index, int result) {
public byte[] sendAgvOneModeInst(int phase, int index, int result,int startPoint,int nextPoint,int startHigh,int nextHigh) {
if (phase < 0 || index < 0)
return null;
byte indexhigh = (byte) IntToHexHigh(index);
byte indexlow = (byte) IntToHexLow(index);
byte phasehigh = (byte) IntToHexHigh(phase);
byte phaselow = (byte) IntToHexLow(phase);
byte startPointHigh =(byte) IntToHexHigh(startPoint);
byte startPointLow =(byte) IntToHexLow(startPoint);
byte nextPointHigh =(byte) IntToHexHigh(nextPoint);
byte nextPointLow =(byte) IntToHexLow(nextPoint);
byte startHighHigh =(byte) IntToHexHigh(startHigh);
byte startHighLow =(byte) IntToHexLow(startHigh);
byte nextHighHigh =(byte) IntToHexHigh(nextHigh);
byte nextHighLow =(byte) IntToHexLow(nextHigh);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06,
(byte) 0X00, (byte) 0X0E,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow
(byte) 0X01, (byte) 0X14,
(byte) phasehigh, (byte) phaselow,
(byte) startPointHigh, (byte) startPointLow,
(byte) nextPointHigh, (byte) nextPointLow,
(byte) startHighHigh, (byte) startHighLow,
(byte) nextHighHigh, (byte) nextHighLow
};

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

@ -158,7 +158,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setSend_status("1");
instructionService.update(inst);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
//任务完毕
//(无车id及状态)
@ -168,13 +168,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} else {
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
log.info("指令号:{},已反馈agv任务完成!");
}
//请求删除任务
//(需要WCS反馈)
else if (phase == 0x30) {
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0);
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0);
}
//任务删除确认
//(需要WCS反馈)
@ -185,7 +185,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else {
//上报异常信息
@ -255,7 +255,17 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
try {
Thread.sleep(5000L);
log.info("再次下发agv数据:" + Bytes2HexString(b));
System.out.println("再次下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}

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

@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.agv.ndcone;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
@ -17,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.ext.wms.data.BaseRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
@ -26,7 +28,9 @@ import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
@ -111,7 +115,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (arr[18] * 256 + arr[19] == 0) {
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
//普通站点
@ -121,6 +125,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
TaskDto task =taskService.findById(inst.getTask_id());
int start_height= ObjectUtil.isNotEmpty(task.getStart_height())?Integer.parseInt(task.getStart_height()):0;
int next_height= ObjectUtil.isNotEmpty(task.getNext_height())?Integer.parseInt(task.getNext_height()):0;
String start_point=task.getStart_point_code();
String next_point=task.getNext_point_code();
//分配 车id
//(不需要WCS反馈)
if (phase == 0x02) {
@ -166,30 +176,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
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 {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
data = getData(data, index, inst, task);
//到达取货等待点
//(需要WCS反馈)
} else if (phase == 0x04) {
data = getData(data, index, inst, task);
//取货完毕
//(需要WCS反馈)
} else if (phase == 0x05) {
@ -226,31 +217,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
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.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
data = getData(data, index, inst, task);
//到达放货等待点
//(需要WCS反馈)
} else if (phase == 0x06) {
//到达放货点
//(需要WCS反馈)
} else if (phase == 0x07) {
@ -284,30 +254,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到关联编号{}对应的指令", ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "3");
map.put("device_code", inst.getNext_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);
}
data = getData(data, index, inst, task);
//放货完毕
//(需要WCS反馈)
} else if (phase == 0x09) {
@ -342,25 +290,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到编号{}对应的指令", ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "4");
map.put("device_code", inst.getNext_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
//到达位置点
//(需要WCS反馈)
@ -368,13 +298,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
agvaddr = arr[18] * 256 + arr[19];
agvaddr_copy = agvaddr;
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else if (phase == 0x50) {//进入交通灯区域
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else if (phase == 0x51) {//离开交通灯区域
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
if (!ObjectUtil.isEmpty(data)) {
@ -383,4 +313,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
private byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) {
String next_point;
String start_point;
int next_height;
int start_height;
if(!"2".equals(task.getTask_type())) {
BaseRequest request = new BaseRequest();
request.setRequestNo(IdUtil.simpleUUID());
request.setTaskId(task.getExt_task_id());
JSONObject resp = JSONObject.parseObject(acsToWmsService.feedbackState(request));
if("200".equals(resp.getString("code"))){
start_height=resp.getJSONObject("parameters").getInteger("start_height");
next_height=resp.getJSONObject("parameters").getInteger("next_height");
start_point=resp.getJSONObject("parameters").getString("start_point");
next_point=resp.getJSONObject("parameters").getString("next_point");
task.setStart_height(String.valueOf(start_height));
task.setNext_height(String.valueOf(next_height));
task.setStart_point_code(start_point);
task.setStart_device_code(start_point);
task.setNext_point_code(next_point);
task.setNext_device_code(next_point);
int start_address=deviceService.queryAddressBydeviceCode(start_point);
int next_address=deviceService.queryAddressBydeviceCode(next_point);
taskService.update(task);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, start_height, next_height);
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(),phase);
}else{
log.info("指令号:{},phase:{},acs请求wms申请失败", inst.getInstruction_code(),phase);
}
}else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
return data;
}
}

9
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java

@ -16,7 +16,6 @@ public class ItemProtocol {
public static String item_move = "move";
public static String item_action = "action";
public static String item_error = "error";
public static String item_task = "task";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
@ -50,9 +49,6 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getMaterialType() {
return this.getOpcIntegerValue(item_material_type);
@ -99,8 +95,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
list.add(new ItemDto(item_material_type, "任务号", "DB600.D6"));
list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));
return list;
@ -109,8 +104,6 @@ public class ItemProtocol {
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
return list;
}

25
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -146,16 +146,19 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void execute() {
String message = null;
try {
String device_code = this.getDeviceCode();
devicecode = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
material_type = this.itemProtocol.getMaterialType();
barcode=this.itemProtocol.getBarcode();
if (mode != last_mode) {
this.setRequireSucess(false);
if(mode==2){
this.writing(0);
}
}
if (move != last_move) {
}
@ -196,25 +199,25 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
break;
case 4:
//叫料
if (move==0){
if (move==0 && !requireSucess){
apply(4);
}
break;
case 5:
//满料出库
if(move==1){
if(move==1 && !requireSucess){
apply(5);
}
break;
case 6:
//申请空盘
if (move==0){
if (move==0 && !requireSucess){
apply(6);
}
break;
case 7:
//空托盘出库
if(move==1){
if(move==1 && !requireSucess){
apply(7);
}
break;
@ -238,6 +241,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
last_move = move;
last_task = task;
last_material_type = material_type;
last_barcode=barcode;
}
@ -442,8 +446,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
this.time = date;
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setDevice_code(devicecode);
request.setMaterial_type(String.valueOf(material_type));
request.setVehicle_code(String.valueOf(barcode));
if (devicecode.startsWith("TBX")&&type==5) {
if (devicecode.startsWith("TBX")&&type==5&&barcode>0) {
//满架下料
request.setRequest_medthod_code(RequestMethodEnum.apply_mjxl.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_mjxl.getName());
@ -455,15 +460,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//空托盘出库,包片机和销售出库空位都可以
request.setRequest_medthod_code(RequestMethodEnum.apply_kghjrk.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_kghjrk.getName());
}else if(devicecode.startsWith("BP")){
}else if(devicecode.startsWith("BP")&&material_type>0){
request.setRequest_medthod_code(RequestMethodEnum.apply_bpsl.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_bpsl.getName());
}
String resp = acsToWmsService.applyTask(request);
JSONObject res_jo = JSONObject.parseObject(resp);
if (StrUtil.equals(res_jo.getString("status"), "200")) {
if (StrUtil.equals(res_jo.getString("code"), "200")) {
this.writing(type);
this.setSucess(true);
this.setRequireSucess(true);
log.info("acs申请任务", this.devicecode, "满盅入库任务申请成功!");
}else{
this.writing(99);

8
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java

@ -126,7 +126,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("1");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
agvphase = 0;
index = 0;
inst = null;
@ -141,7 +141,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("2");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
@ -157,7 +157,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("5");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
@ -172,7 +172,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("6");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;

105
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java

@ -1,37 +1,96 @@
package org.nl.acs.device_driver.driver;
import org.nl.acs.ext.wms.data.JsonUtl;
import org.nl.acs.opc.OpcConfig;
import org.nl.acs.opc.OpcServerService;
import org.nl.acs.opc.OpcServerServiceImpl;
import org.nl.acs.opc.*;
import org.nl.acs.udw.UnifiedDataAccessor;
import org.nl.acs.udw.UnifiedDataAccessorFactory;
import org.nl.common.exception.BadRequestException;
import org.nl.acs.udw.UnifiedDataAppService;
import org.nl.config.SpringContextHolder;
import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.ItemState;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.*;
public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver {
UnifiedDataAccessor opcUdw;
private OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService.class);
public AbstractOpcDeviceDriver() {
this.opcUdw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
}
private Date sendTime;
private String last_items;
private int noLog_sendTimeOut;
private Date noLog_sendTime;
private String noLog_last_items;
public AbstractOpcDeviceDriver() {
this.opcUdw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
}
@Override
public UnifiedDataAccessor getOpcValueAccessor() {
return this.opcUdw;
}
public void checkcontrol(Map<String, Object> itemValues) throws Exception {
Group group = opcServerService.getServer(this.getOpcServer());
Map<String, Object> write = new HashMap();
Map<String, Item> readitems = new LinkedHashMap();
List<String> itemsString = new ArrayList();
itemsString = new ArrayList<> (itemValues.keySet());
Iterator is = itemsString.iterator();
while (is.hasNext()) {
String string = (String) is.next();
try {
readitems.put(string, group.addItem(string));
} catch (Exception e) {
e.printStackTrace();
}
}
int i = 0;
while(true) {
//下发信号
control( itemValues);
Map<String, Object> read = new HashMap();
Map<Item, ItemState> itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0]));
Set<Item> items = itemStatus.keySet();
Iterator var15 = items.iterator();
while(var15.hasNext()) {
Item item = (Item)var15.next();
ItemState itemState = (ItemState)itemStatus.get(item);
Object value = OpcUtl.getValue(item, itemState);
read.put(item.getId(), value);
}
boolean check = true;
Iterator var24 = itemsString.iterator();
while(var24.hasNext()) {
String itemString = (String)var24.next();
if (!ObjectUtl.isEquals(itemValues.get(itemString), JsonUtl.parse(read.get(itemString)))) {
check = false;
}
}
if (check) {
return;
}
if (i > 0) {
ThreadUtl.sleep(300L);
}
if (i > 3) {
throw new RuntimeException("写入次数超过3次而失败");
}
++i;
}
}
public boolean control(Map<String, Object> itemValues) {
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
@ -48,7 +107,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
i++;
}
return this.control(p2);
return this.control(p2);
}
@ -70,11 +129,13 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
sb.append(":");
sb.append(JsonUtl.parseWithoutException(udw_value));
sb.append(";");
// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
// need_write = true;
// }
if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
need_write = true;
} else {
//log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
}
}
need_write = true;
// need_write = true;
if (need_write) {
Date date = new Date();
@ -85,9 +146,9 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
this.last_items = this_items;
this.sendTime = date;
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
@ -106,7 +167,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
return true;
} else {
throw new BadRequestException("下发 无内容");
throw new RuntimeException("下发 无内容");
}
}
}

4
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java

@ -63,6 +63,10 @@ public class BaseRequest {
*/
private String state;
/**
* 任务号
*/
private String taskId;
}

5
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java

@ -41,5 +41,10 @@ public class FeedBackTaskStatusRequest extends BaseRequest {
*/
private String action;
/**
* 1-正极板2-负极板3-边负极板
*/
private String material_type;
}

5
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java

@ -127,4 +127,9 @@ public interface AcsToWmsService {
* ACS向WMS反馈任务状态
*/
String notify(BaseRequest request);
/**
* 任务阶段反馈最新点位
*/
String feedbackState(BaseRequest request);
}

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

@ -592,4 +592,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.remove(log_file_type);
}
}
@Override
public String feedbackState(BaseRequest requestParam) {
try {
MDC.put(log_file_type, log_type);
String api = addressService.findByCode("feedbackState").getMethods_url();
log.info("feedbackState-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect));
String result = LmsUtil.notifyAcs(api, requestParam);
log.info("feedbackState-----输出参数{}", result);
return result;
} finally {
MDC.remove(log_file_type);
}
}
}

4
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java

@ -1,6 +1,7 @@
package org.nl.acs.instruction.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.util.ObjectUtil;
import org.nl.common.logging.annotation.Log;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
@ -36,6 +37,9 @@ public class InstructionController {
@ApiOperation("查询指令")
//@PreAuthorize("@el.check('instruction:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
whereJson.put("status", "1");
}
return new ResponseEntity<>(instructionService.queryAll(whereJson, page), HttpStatus.OK);
}

31
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -85,6 +85,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
// private final RedisUtils redisUtils;
@Autowired
InstructionMapper instructionMapper;
@Autowired
TaskMapper taskMapper;
List<Instruction> instructions = new CopyOnWriteArrayList();
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
@ -384,13 +385,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (StrUtil.isEmpty(dto.getLink_num())) {
dto.setIs_send(task.getLink_num());
}
if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
// if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
dto.setInstruction_type(task.getTask_type());
} else if (false) {
} else {
dto.setInstruction_type("3");
}
// } else if (false) {
//
// } else {
// dto.setInstruction_type("3");
// }
// 查询是否存在相同指令号
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {
@ -409,8 +410,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setStart_parent_code(task.getStart_parent_code());
@ -728,7 +729,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void finish(String id) {
Instruction entity = (Instruction) this.findById(id);
InstructionDto entity = this.findById(id);
// if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
@ -807,7 +808,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
finishAndCreateNextInst(entity);
finishAndCreateNextInst((Instruction) entity);
}
}
@ -968,7 +969,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
public void cancel(String id) throws Exception {
// flag= true时取消指令
boolean flag = false;
Instruction entity = (Instruction) this.findById(id);
InstructionDto entity = this.findById(id);
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
@ -987,7 +988,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
// NDC agv指令不当场取消指令,需要等agv上报
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
ndcAgvService.deleteAgvInstToNDC(entity);
ndcAgvService.deleteAgvInstToNDC((Instruction)entity);
} else {
flag = true;
}
@ -1077,7 +1078,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
public void forceCancel(String id) throws Exception {
// flag= true时取消指令
boolean flag = false;
Instruction entity = (Instruction) this.findById(id);
InstructionDto entity = this.findById(id);
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
@ -1133,7 +1134,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
public void cancelNOSendAgv(String id) throws Exception {
// flag= true时取消指令
Instruction entity = (Instruction) this.findById(id);
InstructionDto entity = this.findById(id);
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
@ -1524,7 +1525,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
public void init(String id) {
Instruction inst = (Instruction) this.findById(id);
InstructionDto inst = this.findById(id);
if (inst == null) {
throw new BadRequestException("指令不存在或已删除");
}

125
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/JsonUtl.java

@ -0,0 +1,125 @@
package org.nl.acs.opc;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class JsonUtl {
private static ObjectMapper objectMapper = null;
private static ObjectMapper objectMapperLog = null;
private JsonUtl() {
}
private static ObjectMapper init() {
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule();
// simpleModule.addSerializer(Enum.class, new EnumSerializer());
// simpleModule.addSerializer(Date.class, new DateSerializer());
// simpleModule.addDeserializer(Enum.class, new EnumDeserializer());
// simpleModule.addDeserializer(Date.class, new DateDeserializers.DateDeserializer());
objectMapper.registerModule(simpleModule);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
public static ObjectMapper getInstance() {
if (objectMapper == null) {
Class var0 = JsonUtl.class;
synchronized(JsonUtl.class) {
if (objectMapper == null) {
objectMapper = init();
}
}
}
return objectMapper;
}
public static ObjectMapper getInstanceLog() {
if (objectMapperLog == null) {
Class var0 = JsonUtl.class;
synchronized(JsonUtl.class) {
if (objectMapperLog == null) {
objectMapperLog = init();
objectMapperLog.setSerializationInclusion(Include.NON_NULL);
}
}
}
return objectMapperLog;
}
public static ObjectMapper getObjectMapper() {
return getInstance();
}
public static String parse(Object object) throws RuntimeException {
try {
return getObjectMapper().writeValueAsString(object);
} catch (JsonProcessingException var2) {
throw new RuntimeException(var2);
}
}
public static String parseWithoutException(Object object) {
try {
return parse(object);
} catch (Exception var2) {
return null;
}
}
public static String parseLog(Object object) {
try {
return getInstanceLog().writeValueAsString(object);
} catch (Exception var2) {
return null;
}
}
public static <T> T format(String json, Class<T> clazz) throws RuntimeException {
try {
return getObjectMapper().readValue(json, clazz);
} catch (IOException var3) {
throw new RuntimeException(var3);
}
}
public static <T> List<T> formatList(String json, Class<T> clazz) throws RuntimeException {
try {
JavaType type = getObjectMapper().getTypeFactory().constructParametricType(List.class, new Class[]{clazz});
return (List)getObjectMapper().readValue(json, type);
} catch (IOException var3) {
throw new RuntimeException(var3);
}
}
public static <T, U> Map<T, U> formatMap(String json, Class<T> clazzKey, Class<U> clazzValue) throws RuntimeException {
try {
JavaType type = getObjectMapper().getTypeFactory().constructParametricType(Map.class, new Class[]{clazzKey, clazzValue});
return (Map)getObjectMapper().readValue(json, type);
} catch (IOException var4) {
throw new RuntimeException(var4);
}
}
public static <T> List<List<T>> formatListTwo(String json, Class<T> clazz) throws RuntimeException {
try {
TypeFactory typeFactory = getObjectMapper().getTypeFactory();
JavaType type = typeFactory.constructParametrizedType(List.class, List.class, new Class[]{clazz});
type = typeFactory.constructParametrizedType(List.class, List.class, new JavaType[]{type});
return (List)getObjectMapper().readValue(json, type);
} catch (IOException var4) {
throw new RuntimeException(var4);
}
}
}

4
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/rest/TaskController.java

@ -1,6 +1,7 @@
package org.nl.acs.task.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.common.logging.annotation.Log;
import org.nl.acs.task.domain.Task;
@ -38,6 +39,9 @@ public class TaskController {
//@PreAuthorize("@el.check('task:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
// return new ResponseEntity<>(taskService.queryAllByCache(whereJson, page), HttpStatus.OK);
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
whereJson.put("status", "1");
}
return new ResponseEntity<>(taskService.queryAll(whereJson, page), HttpStatus.OK);
}

12
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java

@ -290,4 +290,16 @@ public class TaskDto implements Serializable {
* 烘箱温度
*/
private String temperature;
/**
* 起点高度
*/
private String start_height;
/**
* 终点高度
*/
private String next_height;
}

341
acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/AutoCreateInst.java

@ -0,0 +1,341 @@
package org.nl.quartz.task;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
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.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
/**
* 自动创建指令
*/
@Slf4j
@Component
public class AutoCreateInst {
/**
* 根据任务状态创建指令生成下一条指令
* 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货
*/
public void run() throws Exception {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
ISysParamService acsConfigService = SpringContextHolder.getBean(ISysParamService.class);
List<TaskDto> list = taskserver.queryByStauts("0");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i);
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
String vehiclecode = acsTask.getVehicle_code();
String priority = acsTask.getPriority();
String start_point_code = acsTask.getStart_point_code();
String start_device_code = acsTask.getStart_device_code();
String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type();
//是否复合任务 =0非复合任务
String compound_task = acsTask.getCompound_task();
String compound_task_data = null;
String next_point_code = acsTask.getNext_point_code();
String next_device_code = acsTask.getNext_device_code();
if (StrUtil.isEmpty(start_device_code)) {
log.info("任务 [" + taskcode + "] 起点设备为空,无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 起点设备为空,无法生成指令。");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (StrUtil.isEmpty(next_device_code)) {
log.info("任务 [" + taskcode + "] 终点设备为空,无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 终点设备为空,无法生成指令。");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
List<Instruction> instructions = instructionService.queryAll("instruction_status < 2");
String maxInstnumber = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
if (ObjectUtils.isNotEmpty(maxInstnumber)) {
if (instructions.size() >= Integer.parseInt(maxInstnumber)) {
log.info("已达到系统参数配置的最大指令数 [" + maxInstnumber + "] ,无法生成指令。");
acsTask.setRemark("已达到系统参数配置的最大指令数 [" + maxInstnumber + "] ,无法生成指令。");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
}
/**
* 开始平均分解校验
*/
String this_device_code = taskserver.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, acsTask.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
if (StrUtil.equals(acsTask.getTask_type(), "2")) {
for (int j = 0; j < pathlist.size(); j++) {
if (j == 0) {
compound_task_data = pathlist.get(j).trim();
} else {
compound_task_data = compound_task_data + "->" + pathlist.get(j).trim();
}
}
next_device_code = pathlist.get(pathlist.size() - 1);
} else {
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
}
} else {
next_device_code = this_device_code;
}
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
log.info("任务 [" + taskcode + "] 路由不通无法生成指令。");
acsTask.setRemark("任务 [" + taskcode + "] 路由不通无法生成指令。");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
Device startdevice = appService.findDeviceByCode(start_device_code);
Device nextdevice = appService.findDeviceByCode(next_device_code);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
if (ObjectUtils.isEmpty(startdevice)) {
log.info("任务 [" + taskcode + "] 起点设备编码 [" + start_device_code + "] 对应设备未找到,无法生成指令。");
continue;
}
if (ObjectUtils.isEmpty(nextdevice)) {
log.info("任务 [" + taskcode + "] 终点设备编码 [" + next_device_code + "] 对应设备未找到,无法生成指令。");
continue;
}
//普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
// StandardEmptyPalletSiteDeviceDriver standardEmptsyPalletSiteDeviceDriver;
// LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
// LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
if (StrUtil.equals(createTaskCheck, "1")) {
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2) {
log.info("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
acsTask.setRemark("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask);
//this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code());
//this.execute_log.log("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
continue;
}
}
// if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
// standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver();
// if (standardEmptsyPalletSiteDeviceDriver.getMode() != 2) {
// log.info("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
// acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// }
// if (startdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
// lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) startdevice.getDeviceDriver();
// if (lnshFoldDiscSiteDeviceDriver.getMode() != 2) {
// log.info("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
// acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// }
//校验 是否同任务是否存在相同终点、未完成的指令
int sameqty = instructionService.querySameDestinationInst(next_point_code);
if (sameqty > 0) {
log.info("存在相同终点的指令,任务号:" + taskcode);
acsTask.setRemark("存在相同终点的指令,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask);
continue;
}
}
//空盘位生成指令需要另外逻辑
// if (nextdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
// lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) nextdevice.getDeviceDriver();
// if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (lnshFoldDiscSiteDeviceDriver.getError() != 0
// || lnshFoldDiscSiteDeviceDriver.getStatus() == 3) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// int max_emptypalletnum = Integer.parseInt(nextdevice.getExtraValue().get("max_emptypalletnum").toString());
// int nowNumber = lnshFoldDiscSiteDeviceDriver.getContainer_qty();
// if (nowNumber >= max_emptypalletnum) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 已满,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 已满,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// // 查看是否有相同终点的指令
// int count = instructionService.queryDeviceInstCount(next_device_code);
// if (count > 0) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 已被占用,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 已被占用,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// //this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code());
// //this.execute_log.log("存在相同终点的指令,任务号:" + taskcode);
// continue;
// }
// next_point_code = next_device_code + "." + (nowNumber + 1);
// } else if (nextdevice.getDeviceDriver() instanceof LnshStationDeviceDriver
// && "true".equals(nextdevice.getExtraValue().get("inspect_in_stocck"))) {
// LnshStationDeviceDriver deviceDriver = (LnshStationDeviceDriver) nextdevice.getDeviceDriver();
// if (deviceDriver.getMode() == 0) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (deviceDriver.getMove() != 0) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 有货,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 有货,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (deviceDriver.getError() != 0) {
// log.info("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// }
// if (startdevice.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
// lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) startdevice.getDeviceDriver();
// if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (lnshFoldDiscSiteDeviceDriver.getError() != 0
// || lnshFoldDiscSiteDeviceDriver.getStatus() == 3) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
//
// int container_qty = lnshFoldDiscSiteDeviceDriver.getContainer_qty();
// int max_emptypalletnum = Integer.parseInt(startdevice.getExtraValue().get("max_emptypalletnum").toString());
// if (container_qty < (max_emptypalletnum / 2)) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 可用托盘数量少于最大托盘数量 [" + max_emptypalletnum + "] / 2,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 可用托盘数量少于最大托盘数量 [" + max_emptypalletnum + "] / 2,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
//
// int count = instructionService.queryDeviceInstCount(start_device_code);
// if (count > 0) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 已被占用,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 已被占用,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// //this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code());
// //this.execute_log.log("存在相同终点的指令,任务号:" + taskcode);
// continue;
// }
//
// start_point_code = start_device_code + ".1";
// } else if (startdevice.getDeviceDriver() instanceof LnshStationDeviceDriver
// && "true".equals(startdevice.getExtraValue().get("inspect_in_stocck"))) {
// LnshStationDeviceDriver deviceDriver = (LnshStationDeviceDriver) startdevice.getDeviceDriver();
// if (deviceDriver.getMode() == 0) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (deviceDriver.getMove() == 0) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 无货,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 无货,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// } else if (deviceDriver.getError() != 0) {
// log.info("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
// acsTask.setRemark("任务 [" + taskcode + "] 起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// }
Instruction instdto = new Instruction();
instdto.setInstruction_type(acsTask.getTask_type());
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setCompound_inst_data(compound_task_data);
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
try {
instructionService.create(instdto);
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
continue;
}
log.info("任务 [" + taskcode + "] 指令成功生成!");
//创建指令后修改任务状态
acsTask.setTask_status("1");
taskserver.update(acsTask);
}
}
}

30
acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/NdcAutoReconnection.java

@ -0,0 +1,30 @@
package org.nl.quartz.task;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.run.AutoRunService;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* NDC自动重连
*/
@Slf4j
@Component
public class NdcAutoReconnection {
@Autowired
ISysParamService paramService;
@Autowired
AutoRunService autoRunService;
public void run(String threadCode) throws Exception {
String[] threadCodes = threadCode.split(",");
for (String code : threadCodes) {
if (!autoRunService.getThreadByCode(code).isAlive()) {
autoRunService.startThread(code);
}
}
}
}

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java

@ -56,6 +56,15 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.status(param), HttpStatus.OK);
}
@PostMapping("/feedbackState")
@Log("ACS系统反馈AGV取放货状态")
@ApiOperation("ACS系统反馈AGV取放货状态")
//@SaCheckPermission("@el.check('schBaseTask:add')")
@SaIgnore
public ResponseEntity<Object> feedbackState(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedbackState(param), HttpStatus.OK);
}
@PostMapping("/notify")
@Log("acs通知wms")
@ApiOperation("acs通知wms")
@ -64,4 +73,13 @@ public class AcsToWmsController {
public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK);
}
// @PostMapping("/notify")
// @Log("acs通知wms")
// @ApiOperation("acs通知wms")
// //@SaCheckPermission("@el.check('schBaseTask:add')")
// @SaIgnore
// public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
// return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK);
// }
}

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java

@ -15,7 +15,10 @@ public interface AcsToWmsService {
/** 任务反馈 */
BaseResponse status(JSONObject param);
/** 任务反馈 */
/** 任务阶段反馈最新点位 */
BaseResponse feedbackState(JSONObject param);
/** acs通知wms */
BaseResponse notify(JSONObject param);
}

42
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java

@ -11,6 +11,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.ext.service.AcsToWmsService;
@ -39,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -179,4 +181,44 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return BaseResponse.responseOk(requestNo, "反馈成功!");
}
/**
* 任务阶段反馈最新点位
* todo
* */
@Override
public BaseResponse feedbackState(JSONObject param) {
String requestNo = param.getString("requestNo");
String taskId = param.getString("taskId");
BaseResponse result = BaseResponse.build(requestNo);
try {
SchBaseTask schBaseTask=taskService.getById(taskId);
if(ObjectUtil.isEmpty(schBaseTask)){
throw new BadRequestException("任务不存在!taskId:"+taskId);
}
AbstractTask task = taskFactory.getTask(schBaseTask.getConfig_code());
// 执行创建任务
task.feedbackState(param,schBaseTask,result);
taskService.update(schBaseTask);
Map<String, String> map=new HashMap<>();
map.put("start_point",schBaseTask.getPoint_code1());
map.put("next_point",schBaseTask.getPoint_code2());
map.put("start_height",schBaseTask.getPoint_code1_height());
map.put("next_height",schBaseTask.getPoint_code2_height());
result.setParameters(map);
} catch (Exception e) {
String message = ObjectUtil.isEmpty(e.getMessage())
? ((InvocationTargetException) e).getTargetException().getMessage()
: e.getMessage();
log.error("ACS请求LMS出现错误: {}", message);
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
result.setMessage(message);
result.setRequestNo(requestNo);
// 消息通知
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
NoticeTypeEnum.EXCEPTION.getCode());
}
return result;
}
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java

@ -141,4 +141,10 @@ public class SchBasePoint implements Serializable {
@TableField(exist = false)
private String group_id;
@ApiModelProperty(value = "取货等待点")
private String start_wait_point;
@ApiModelProperty(value = "放货等待点")
private String next_wait_point;
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/dao/SchBaseTask.java

@ -120,4 +120,10 @@ public class SchBaseTask implements Serializable {
@ApiModelProperty(value = "修改时间")
private String update_time;
@ApiModelProperty(value = "点位1高度")
private String point_code1_height="0";
@ApiModelProperty(value = "点位2高度")
private String point_code2_height="0";
}

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.point.service.ISchBasePointService;
@ -23,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
@ -227,4 +230,16 @@ public abstract class AbstractTask {
this.updateStatus(task_code, status);
}
/**
* 任务阶段反馈最新点位
*
* @param param
* @throws BadRequestException
*/
public void feedbackState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) throws BadRequestException {
this.feedbackTaskState(param,schBaseTask,result);
}
protected abstract void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask,BaseResponse result);
}

13
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -85,7 +86,8 @@ public class BPSLTask extends AbstractTask {
continue;
}
// 设置起点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
// 取料先去等待点
task.setPoint_code1(point.getStart_wait_point());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
@ -214,4 +216,13 @@ public class BPSLTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data());
SchBasePoint point = this.findNextPoint(jsonObject);
// 设置起点并修改创建成功状态
schBaseTask.setPoint_code1(point.getPoint_code());
}
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -175,4 +176,9 @@ public class KGHJRKTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
}
}

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -30,6 +31,7 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @Author: psh
@ -241,4 +243,9 @@ public class MJXLTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//无需重算,返回当前点位即可
}
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -181,4 +182,9 @@ public class TBXBKJTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
}
}

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -88,7 +89,8 @@ public class XSCKTask extends AbstractTask {
continue;
}
// 设置起点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
// 取料先去等待点
task.setPoint_code1(point.getStart_wait_point());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
@ -226,4 +228,14 @@ public class XSCKTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
// 重算最优点
SchBasePoint nextPoint=pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code2()));
SchBasePoint point = this.findNextPoint(nextPoint,JSONObject.parseObject(schBaseTask.getExt_group_data()));
// 设置起点并修改创建成功状态
schBaseTask.setPoint_code1(point.getPoint_code());
}
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -88,4 +89,9 @@ public class ZJBZKDDTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
}
}

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java

@ -11,6 +11,7 @@ import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -279,4 +280,10 @@ public class GHSFMTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
}
}

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java

@ -6,10 +6,12 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.ext.service.WmsToAcsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
@ -97,7 +99,8 @@ public class GHSQHTask extends AbstractTask {
log.info("未找到当前符合允许放货的缓存点,暂不生成任务Vehicle_type:{}",schBasePoint.getVehicle_type());
return;
}
this.createTask(schBasePoint,nextPoint.getPoint_code());
// 放料先去等待点
this.createTask(schBasePoint,nextPoint.getNext_wait_point());
}
@ -292,4 +295,17 @@ public class GHSQHTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@SneakyThrows
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
SchBasePoint startPoint=pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
SchBasePoint nextPoint=this.findNextPoint(startPoint);
if(ObjectUtil.isEmpty(nextPoint)){
throw new Exception("当前起点"+schBaseTask.getPoint_code1()+"未找到合适的放货点位");
}
schBaseTask.setPoint_code2(nextPoint.getPoint_code());
}
}

1
lms/nladmin-ui/src/views/wms/sch/group/index.vue

@ -253,6 +253,7 @@
<!-- <el-table-column prop="is_first_flow_task" label="是否首个流程任务" :min-width="flexWidth('is_first_flow_task',crud.data,'是否首个流程任务')"/>-->
<!-- <el-table-column prop="flow_code" label="流程编码" :min-width="flexWidth('flow_code',crud.data,'流程编码')"/>-->
<!-- <el-table-column prop="flow_num" label="流程顺序" :min-width="flexWidth('flow_num',crud.data,'流程顺序')"/>-->
<el-table-column prop="move_way" label="移动途径" :min-width="flexWidth('move_way',crud.data,'移动途径')" />
<el-table-column prop="before_task_code" label="上一任务" :min-width="flexWidth('before_task_code',crud.data,'上一任务')" />
<el-table-column prop="next_task_code" label="下一任务" :min-width="flexWidth('next_task_code',crud.data,'上一任务')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />

Loading…
Cancel
Save