|
|
@ -10,6 +10,8 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
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.device.service.DeviceService; |
|
|
|
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.modules.common.exception.BadRequestException; |
|
|
|
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.exception.WDKException; |
|
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
@ -59,6 +62,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { |
|
|
|
private final RouteLineService routeLineService; |
|
|
|
private final AcsToLiKuService acsToLiKuService; |
|
|
|
|
|
|
|
private final ParamService paramService; |
|
|
|
|
|
|
|
|
|
|
|
private String log_file_type = "log_file_type"; |
|
|
|
private String log_type = "LMS请求ACS"; |
|
|
@ -469,6 +474,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { |
|
|
|
String task_type = req.getTask_type(); |
|
|
|
String remark = req.getRemark(); |
|
|
|
Map<String, String> params = req.getParams(); |
|
|
|
String start_height = req.getStart_height(); |
|
|
|
String next_height = req.getNext_height(); |
|
|
|
|
|
|
|
String start_point_code = ""; |
|
|
|
String next_point_code = ""; |
|
|
@ -570,6 +577,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { |
|
|
|
jo.put("remark", remark); |
|
|
|
jo.put("params", params); |
|
|
|
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); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|