rev:更新
This commit is contained in:
@@ -40,4 +40,6 @@ public interface NDCAgvService {
|
||||
* @return
|
||||
*/
|
||||
public boolean createChargingTaskToNDC(String carno);
|
||||
|
||||
public boolean deviceOption(String option);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -228,6 +229,35 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deviceOption(String option) {
|
||||
byte high;
|
||||
byte low;
|
||||
if (option.equals("1")) {
|
||||
high = (byte) IntToHexHigh(00);
|
||||
low = (byte) IntToHexHigh(01);
|
||||
} else if (option.equals("2")) {
|
||||
high = (byte) IntToHexHigh(00);
|
||||
low = (byte) IntToHexHigh(00);
|
||||
} else {
|
||||
throw new BadRequestException("操作类型有误!");
|
||||
}
|
||||
byte[] b = new byte[]{(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) high, (byte) low
|
||||
};
|
||||
log.info("下发AGV设备暂停恢复--{}", Bytes2HexString(b));
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
return true;
|
||||
}
|
||||
|
||||
String hexToString(int i) {
|
||||
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
|
||||
}
|
||||
|
||||
@@ -114,9 +114,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (phase == 0x67) {
|
||||
//故障信息
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
this.error = 0;
|
||||
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
@@ -159,8 +158,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(device)){
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
@@ -229,8 +228,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(device)){
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
@@ -298,8 +297,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(device)){
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
@@ -368,8 +367,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(device)){
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
@@ -462,6 +461,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
jo.put("positionY", this.getY());
|
||||
//角度
|
||||
jo.put("positionAngle", this.getAngle());
|
||||
jo.put("errorCode", this.getError());
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,14 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceOption")
|
||||
@Log(value = "设备暂停恢复",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("设备暂停恢复")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> deviceOption(@RequestBody JSONObject param) throws Exception {
|
||||
return new ResponseEntity<>(wmstoacsService.deviceOption(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDeviceGoodsFromWms")
|
||||
@Log(value = "WMS修改点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("WMS修改点位状态")
|
||||
|
||||
@@ -85,4 +85,5 @@ public interface WmsToAcsService {
|
||||
Map<String,Object> test();
|
||||
|
||||
|
||||
Map<String,Object> deviceOption(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.common.IDriverService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
||||
@@ -36,6 +38,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -58,6 +61,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
@Autowired
|
||||
private NDCAgvService ndcAgvService;
|
||||
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
@@ -453,9 +458,29 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> test() {
|
||||
System.out.println("进来了......");
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("a","a");
|
||||
map.put("b","b");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("a", "a");
|
||||
map.put("b", "b");
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> deviceOption(JSONObject param) {
|
||||
String option = param.getString("option");
|
||||
Assert.notBlank(option, "参数不能为空");
|
||||
try {
|
||||
ndcAgvService.deviceOption(option);
|
||||
} catch (Exception e) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
map.put("data", new JSONObject());
|
||||
return map;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("status", 200);
|
||||
map.put("message", "操作成功!");
|
||||
map.put("data", new JSONObject());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -1070,6 +1070,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(entity.getTask_code());
|
||||
taskDto.setTask_status("3");
|
||||
taskService.update(taskDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1015,11 +1015,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
entity.getStart_device_code(),
|
||||
entity.getNext_device_code(),
|
||||
entity.getRoute_plan_code());
|
||||
String type = shortPathsList.get(0).getType();
|
||||
// != 0 为agv任务
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
agvService.markComplete(entity.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(shortPathsList)){
|
||||
String type = shortPathsList.get(0).getType();
|
||||
// != 0 为agv任务
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
agvService.markComplete(entity.getTask_code());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user