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. 7
      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. 14
      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;
/** /**
* 扩展属性 * 扩展属性
*/ */

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

@ -98,4 +98,11 @@ public class WmsToAcsController {
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;
} }

14
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,6 +34,10 @@ public class AutoCreateInst {
* 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货 * 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货
*/ */
public void run() throws Exception { public void run() throws Exception {
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
ParamDto sendInst = paramService.findByCode(AcsConfig.SEND_INST);
if ("1".equals(sendInst.getValue())) {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class); TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@ -70,6 +77,9 @@ public class AutoCreateInst {
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")) { if (StrUtil.equals(is_send, "0")) {
continue; continue;
@ -142,6 +152,9 @@ public class AutoCreateInst {
instdto.setAgv_inst_type("1"); instdto.setAgv_inst_type("1");
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
try { try {
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
@ -156,3 +169,4 @@ public class AutoCreateInst {
} }
} }
} }
}

Loading…
Cancel
Save