Browse Source

更新

master
zhangjiangwei 2 years ago
parent
commit
256409b9fa
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java
  2. 29
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  3. 10
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java
  4. 27
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  5. 7
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  6. 80
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  7. 10
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java
  8. 2
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  9. 10
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java
  10. 224
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

2
acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java

@ -56,4 +56,6 @@ public interface AcsConfig {
String MAXSENDTASKTIME = "maxSendTaskTime"; String MAXSENDTASKTIME = "maxSendTaskTime";
//指令下发立库 //指令下发立库
String INSTSENDLK = "instSendLk"; String INSTSENDLK = "instSendLk";
String SEND_INST = "sendInst";
} }

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

@ -75,7 +75,22 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) { public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String instcode = inst.getInstruction_code(); String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getAgv_inst_type());
String start_height_str = inst.getStart_height();
String next_height_str = inst.getNext_height();
int type;
if (StrUtil.isNotBlank(start_height_str) && StrUtil.isNotBlank(next_height_str)) {
type = 1;
} else if (StrUtil.isNotBlank(start_height_str)) {
type = 2;
} else if (StrUtil.isNotBlank(next_height_str)) {
type = 3;
} else {
type = 4;
}
int start_height = Integer.parseInt(start_height_str);
int next_height = Integer.parseInt(next_height_str);
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);
@ -90,6 +105,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte fhdhigh = (byte) IntToHexHigh(nextAddress); byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte fhdlow = (byte) IntToHexLow(nextAddress); byte fhdlow = (byte) IntToHexLow(nextAddress);
byte prioritylow = (byte) IntToHexLow(priority); byte prioritylow = (byte) IntToHexLow(priority);
byte qhghigh = (byte) IntToHexHigh(start_height);
byte qhglow = (byte) IntToHexLow(start_height);
byte fhghigh = (byte) IntToHexHigh(next_height);
byte fhglow = (byte) IntToHexLow(next_height);
String str = "十进制下发:"; String str = "十进制下发:";
String str1 = "十六进制下发:"; String str1 = "十六进制下发:";
str += "ikey:" + (Integer.parseInt(instcode)); str += "ikey:" + (Integer.parseInt(instcode));
@ -102,6 +121,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
str += "/priority:" + (priority); str += "/priority:" + (priority);
str1 += "/priority:" + hexToString(prioritylow & 0xFF); str1 += "/priority:" + hexToString(prioritylow & 0xFF);
str += "/qhg:" + (start_height);
str1 += "/qhg:" + hexToString(qhghigh & 0XFF) + hexToString(qhglow & 0XFF);
str += "/fhg:" + (next_height);
str1 += "/fhg:" + hexToString(fhghigh & 0XFF) + hexToString(fhglow & 0XFF);
System.out.println(str); System.out.println(str);
System.out.println(str1); System.out.println(str1);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
@ -116,7 +139,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) ikeyhigh, (byte) ikeylow, (byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow, (byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow, (byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow (byte) fhdhigh, (byte) fhdlow,
(byte) qhghigh, (byte) qhglow,
(byte) fhghigh, (byte) fhglow
}; };
log.info("下发AGV作业指令--{}", str1); log.info("下发AGV作业指令--{}", str1);
OneNDCSocketConnectionAutoRun.write(b); OneNDCSocketConnectionAutoRun.write(b);

10
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java

@ -53,6 +53,16 @@ public class CreateTaskRequest extends BaseRequest {
*/ */
String remark; String remark;
/**
* 起点高度
*/
String start_height;
/**
* 终点高度
*/
String next_height;
/** /**
* 扩展属性 * 扩展属性
*/ */

27
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -36,7 +36,7 @@ public class WmsToAcsController {
private final WmsToAcsService wmstoacsService; private final WmsToAcsService wmstoacsService;
@PostMapping("/task") @PostMapping("/task")
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "ACS接收WMS任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("接收WMS任务") @ApiOperation("接收WMS任务")
@SaIgnore @SaIgnore
public ResponseEntity<Object> createFromWms(@RequestBody List<CreateTaskRequest> reqs) { public ResponseEntity<Object> createFromWms(@RequestBody List<CreateTaskRequest> reqs) {
@ -44,7 +44,7 @@ public class WmsToAcsController {
} }
@PostMapping("/cancelTask") @PostMapping("/cancelTask")
@Log(value = "WMS取消任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS取消任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS取消任务") @ApiOperation("WMS取消任务")
@SaIgnore @SaIgnore
public ResponseEntity<Object> cancelFromWms(@RequestBody List<CancelTaskRequest> reqs) throws Exception { public ResponseEntity<Object> cancelFromWms(@RequestBody List<CancelTaskRequest> reqs) throws Exception {
@ -52,21 +52,21 @@ public class WmsToAcsController {
} }
@PostMapping("/updateDeviceGoodsFromWms") @PostMapping("/updateDeviceGoodsFromWms")
@Log(value = "WMS修改点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS修改点位状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS修改点位状态") @ApiOperation("WMS修改点位状态")
public ResponseEntity<Object> updateDeviceGoodsFromWms(@RequestBody String whereJson) { public ResponseEntity<Object> updateDeviceGoodsFromWms(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
} }
@PostMapping("/areaControl") @PostMapping("/areaControl")
@Log(value = "区域控制",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "区域控制", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("区域控制") @ApiOperation("区域控制")
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK);
} }
@PostMapping("/action") @PostMapping("/action")
@Log(value = "WMS下发点位信号",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS下发点位信号", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS下发点位信号") @ApiOperation("WMS下发点位信号")
@SaIgnore @SaIgnore
public ResponseEntity<Object> putAction(@RequestBody String whereJson) throws Exception { public ResponseEntity<Object> putAction(@RequestBody String whereJson) throws Exception {
@ -74,7 +74,7 @@ public class WmsToAcsController {
} }
@PostMapping("/querydevice") @PostMapping("/querydevice")
@Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS查询设备状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS查询设备状态") @ApiOperation("WMS查询设备状态")
@SaIgnore @SaIgnore
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception { public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception {
@ -82,20 +82,27 @@ public class WmsToAcsController {
} }
@PostMapping("/queryDeviceDBValue") @PostMapping("/queryDeviceDBValue")
@Log(value = "WMS查询设备DB值",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS查询设备DB值", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS查询设备DB值") @ApiOperation("WMS查询设备DB值")
@SaIgnore @SaIgnore
public ResponseEntity<Object> queryDeviceDBValue(@RequestBody String whereJson){ public ResponseEntity<Object> queryDeviceDBValue(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK);
} }
@PostMapping("/putPlusPullAction") @PostMapping("/putPlusPullAction")
@Log(value = "WMS下发插拔轴动作",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "WMS下发插拔轴动作", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS下发插拔轴动作") @ApiOperation("WMS下发插拔轴动作")
@SaIgnore @SaIgnore
public ResponseEntity<Object> putPlusPullAction(@RequestBody String whereJson){ public ResponseEntity<Object> putPlusPullAction(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK);
} }
@PostMapping("/deviceOption")
@Log(value = "WMS下发设备暂停恢复", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS下发设备暂停恢复")
@SaIgnore
public ResponseEntity<Object> deviceOption(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.deviceOption(whereJson), HttpStatus.OK);
}
} }

7
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java

@ -83,4 +83,11 @@ public interface WmsToAcsService {
Map<String, Object> putPlusPullAction(String whereJson); Map<String, Object> putPlusPullAction(String whereJson);
/**
* 设备暂停恢复
*
* @param whereJson 条件
* @return JSONObject
*/
JSONObject deviceOption(String whereJson);
} }

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

@ -10,6 +10,8 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.common.IDriverService; import org.nl.acs.common.IDriverService;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
@ -32,6 +34,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.exception.WDKException;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
@ -59,6 +62,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final RouteLineService routeLineService; private final RouteLineService routeLineService;
private final AcsToLiKuService acsToLiKuService; private final AcsToLiKuService acsToLiKuService;
private final ParamService paramService;
private String log_file_type = "log_file_type"; private String log_file_type = "log_file_type";
private String log_type = "LMS请求ACS"; private String log_type = "LMS请求ACS";
@ -469,6 +474,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String task_type = req.getTask_type(); String task_type = req.getTask_type();
String remark = req.getRemark(); String remark = req.getRemark();
Map<String, String> params = req.getParams(); Map<String, String> params = req.getParams();
String start_height = req.getStart_height();
String next_height = req.getNext_height();
String start_point_code = ""; String start_point_code = "";
String next_point_code = ""; String next_point_code = "";
@ -570,6 +577,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("remark", remark); jo.put("remark", remark);
jo.put("params", params); jo.put("params", params);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
jo.put("start_height", start_height);
jo.put("next_height", next_height);
TaskDto task_dto = jo.toJavaObject(TaskDto.class); TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try { try {
@ -604,5 +613,76 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
} }
/**
* 设备暂停恢复
*
* @param whereJson 条件
* @return JSONObject
*/
@Override
public JSONObject deviceOption(String whereJson) {
try {
MDC.put(log_file_type, log_type);
log.info("deviceOption-----输入参数{}", whereJson);
String option = JSONObject.parseObject(whereJson).getString("option");
JSONObject resultJSON = new JSONObject();
switch (option) {
case "1":
// 急停AGV车辆
byte[] bytes1 = {
(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0C,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X08,
(byte) 0X32, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X01
};
OneNDCSocketConnectionAutoRun.write(bytes1);
System.out.println("下发agv指令数据:" + NDCAgvServiceImpl.Bytes2HexString(bytes1));
break;
case "2":
// 恢复急停AGV车辆
byte[] bytes2 = {
(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0C,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X08,
(byte) 0X32, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X00
};
OneNDCSocketConnectionAutoRun.write(bytes2);
System.out.println("下发agv指令数据:" + NDCAgvServiceImpl.Bytes2HexString(bytes2));
break;
case "3":
ParamDto sysParam3 = paramService.findByCode(AcsConfig.SEND_INST);
sysParam3.setValue("0");
paramService.update(sysParam3);
break;
case "4":
ParamDto sysParam4 = paramService.findByCode(AcsConfig.SEND_INST);
sysParam4.setValue("1");
paramService.update(sysParam4);
break;
default:
resultJSON.put("status", HttpStatus.BAD_REQUEST.value());
resultJSON.put("message", "未知操作类型");
return resultJSON;
}
resultJSON.put("status", HttpStatus.OK.value());
resultJSON.put("message", "操作成功");
return resultJSON;
} finally {
MDC.remove(log_file_type);
}
}
} }

10
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java

@ -348,4 +348,14 @@ public class InstructionDto implements Serializable {
*/ */
private String agv_system_type; private String agv_system_type;
/**
* 起点高度
*/
private String start_height;
/**
* 终点高度
*/
private String next_height;
} }

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

@ -302,8 +302,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
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()); dto.setInstruction_type(task.getTask_type());
} else if (false) {
} else { } else {
dto.setInstruction_type("3"); dto.setInstruction_type("3");
} }

10
acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java

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

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

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
@ -13,6 +14,8 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -31,128 +34,139 @@ public class AutoCreateInst {
* 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货 * 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货
*/ */
public void run() throws Exception { public void run() throws Exception {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class); ParamService paramService = SpringContextHolder.getBean(ParamService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); ParamDto sendInst = paramService.findByCode(AcsConfig.SEND_INST);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); if ("1".equals(sendInst.getValue())) {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
List<TaskDto> list = taskserver.queryAll("task_status = '0'"); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
for (int i = 0; i < list.size(); i++) { RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
TaskDto acsTask = list.get(i); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
if(StrUtil.equals(acsTask.getTask_type(),"7") && !StrUtil.startWith(acsTask.getTask_code(), "-") ){
continue; List<TaskDto> list = taskserver.queryAll("task_status = '0'");
} for (int i = 0; i < list.size(); i++) {
String taskid = acsTask.getTask_id(); TaskDto acsTask = list.get(i);
String taskcode = acsTask.getTask_code(); if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
String task_type = acsTask.getTask_type(); continue;
String vehiclecode = acsTask.getVehicle_code(); }
String storage_task_type = acsTask.getStorage_task_type(); String taskid = acsTask.getTask_id();
String priority = acsTask.getPriority(); String taskcode = acsTask.getTask_code();
String is_send = acsTask.getIs_send(); String task_type = acsTask.getTask_type();
String vehiclecode = acsTask.getVehicle_code();
String storage_task_type = acsTask.getStorage_task_type();
String priority = acsTask.getPriority();
String is_send = acsTask.getIs_send();
String start_device_code = acsTask.getStart_device_code(); String start_device_code = acsTask.getStart_device_code();
String start_point_code = acsTask.getStart_point_code(); String start_point_code = acsTask.getStart_point_code();
String put_device_code = acsTask.getPut_device_code(); String put_device_code = acsTask.getPut_device_code();
String put_point_code = acsTask.getPut_point_code(); String put_point_code = acsTask.getPut_point_code();
String next_device_code = acsTask.getNext_device_code(); String next_device_code = acsTask.getNext_device_code();
String next_point_code = acsTask.getNext_point_code(); String next_point_code = acsTask.getNext_point_code();
String start_point_code2 = acsTask.getStart_point_code2(); String start_point_code2 = acsTask.getStart_point_code2();
String start_device_code2 = acsTask.getStart_device_code2(); String start_device_code2 = acsTask.getStart_device_code2();
String next_point_code2 = acsTask.getNext_point_code2(); String next_point_code2 = acsTask.getNext_point_code2();
String next_device_code2 = acsTask.getNext_device_code2(); String next_device_code2 = acsTask.getNext_device_code2();
String route_plan_code = acsTask.getRoute_plan_code(); String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type(); String vehicleType = acsTask.getVehicle_type();
String agv_system_type = acsTask.getAgv_system_type(); String agv_system_type = acsTask.getAgv_system_type();
String start_height = acsTask.getStart_height();
String next_height = acsTask.getNext_height();
if (StrUtil.equals(is_send, "0")) {
continue;
}
//校验路由关系 if (StrUtil.equals(is_send, "0")) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); continue;
if (ObjectUtils.isEmpty(shortPathsList)) { }
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) { //校验路由关系
continue; List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
} if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
RouteLineDto routeLineDto = shortPathsList.get(0); if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
String path = routeLineDto.getPath(); continue;
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
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);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { RouteLineDto routeLineDto = shortPathsList.get(0);
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); String path = routeLineDto.getPath();
} else { String type = routeLineDto.getType();
next_point_code = next_device_code; String[] str = path.split("->");
} List<String> pathlist = Arrays.asList(str);
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);
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;
}
Instruction instdto = new Instruction();
instdto.setInstruction_type(task_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.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("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
instdto.setAgv_inst_type("1");
try {
instructionService.create(instdto);
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
continue;
}
//创建指令后修改任务状态
acsTask.setTask_status("1");
taskserver.update(acsTask);
Instruction instdto = new Instruction();
instdto.setInstruction_type(task_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.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("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instdto.setAgv_system_type(agv_system_type);
instdto.setAgv_inst_type("1");
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
try {
instructionService.create(instdto);
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
continue;
}
//创建指令后修改任务状态
acsTask.setTask_status("1");
taskserver.update(acsTask);
}
} }
} }
} }

Loading…
Cancel
Save