Browse Source

rev:更新

master
gengby 10 months ago
parent
commit
c9dd732db0
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
  2. 30
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  3. 20
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  4. 8
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  5. 1
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  6. 31
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  7. 3
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  8. 12
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

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

@ -40,4 +40,6 @@ public interface NDCAgvService {
* @return * @return
*/ */
public boolean createChargingTaskToNDC(String carno); public boolean createChargingTaskToNDC(String carno);
public boolean deviceOption(String option);
} }

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

@ -16,6 +16,7 @@ import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl; 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.service.ParamService;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
@ -228,6 +229,35 @@ public class NDCAgvServiceImpl implements NDCAgvService {
return true; 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) { String hexToString(int i) {
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase(); return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
} }

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

@ -114,9 +114,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (phase == 0x67) { if (phase == 0x67) {
//故障信息 //故障信息
if (arr[18] * 256 + arr[19] == 0) { this.error = 0;
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} }
@ -159,8 +158,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
return; return;
} }
if (ObjectUtil.isEmpty(device)){ if (ObjectUtil.isEmpty(device)) {
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
return; return;
} }
//校验agv上报站点编号与指令起始点相同 //校验agv上报站点编号与指令起始点相同
@ -229,8 +228,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
return; return;
} }
if (ObjectUtil.isEmpty(device)){ if (ObjectUtil.isEmpty(device)) {
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
return; return;
} }
//校验agv上报站点编号与指令起始点相同 //校验agv上报站点编号与指令起始点相同
@ -298,8 +297,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info(agvaddr + "对应设备号为空!"); log.info(agvaddr + "对应设备号为空!");
return; return;
} }
if (ObjectUtil.isEmpty(device)){ if (ObjectUtil.isEmpty(device)) {
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
return; return;
} }
//校验agv上报站点编号与指令起始点相同 //校验agv上报站点编号与指令起始点相同
@ -368,8 +367,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info(agvaddr + "对应设备号为空!"); log.info(agvaddr + "对应设备号为空!");
return; return;
} }
if (ObjectUtil.isEmpty(device)){ if (ObjectUtil.isEmpty(device)) {
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); log.info(agvaddr + "对应设备号{},对应的设备信息为空!", device_code);
return; return;
} }
//校验agv上报站点编号与指令起始点相同 //校验agv上报站点编号与指令起始点相同
@ -462,6 +461,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
jo.put("positionY", this.getY()); jo.put("positionY", this.getY());
//角度 //角度
jo.put("positionAngle", this.getAngle()); jo.put("positionAngle", this.getAngle());
jo.put("errorCode", this.getError());
return jo; return jo;
} }

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

@ -48,6 +48,14 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK); 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") @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修改点位状态")

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

@ -85,4 +85,5 @@ public interface WmsToAcsService {
Map<String,Object> test(); Map<String,Object> test();
Map<String,Object> deviceOption(JSONObject param);
} }

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

@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.service.impl; 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.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -10,6 +11,7 @@ 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.NDCAgvService;
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;
@ -36,6 +38,7 @@ 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;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -58,6 +61,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final DeviceAppService deviceAppService; private final DeviceAppService deviceAppService;
private final RouteLineService routeLineService; private final RouteLineService routeLineService;
private final AcsToLiKuService acsToLiKuService; private final AcsToLiKuService acsToLiKuService;
@Autowired
private NDCAgvService ndcAgvService;
private String log_file_type = "log_file_type"; private String log_file_type = "log_file_type";
@ -453,9 +458,29 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override @Override
public Map<String, Object> test() { public Map<String, Object> test() {
System.out.println("进来了......"); System.out.println("进来了......");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("a","a"); map.put("a", "a");
map.put("b","b"); 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; return map;
} }

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

@ -1070,6 +1070,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
removeByCodeFromCache(entity.getInstruction_code()); removeByCodeFromCache(entity.getInstruction_code());
TaskDto taskDto = taskService.findByCodeFromCache(entity.getTask_code());
taskDto.setTask_status("3");
taskService.update(taskDto);
} }
@Override @Override

12
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -1015,11 +1015,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
entity.getStart_device_code(), entity.getStart_device_code(),
entity.getNext_device_code(), entity.getNext_device_code(),
entity.getRoute_plan_code()); entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType(); if (ObjectUtil.isNotEmpty(shortPathsList)){
// != 0 为agv任务 String type = shortPathsList.get(0).getType();
if (!StrUtil.equals(type, "0")) { // != 0 为agv任务
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { if (!StrUtil.equals(type, "0")) {
agvService.markComplete(entity.getTask_code()); if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
agvService.markComplete(entity.getTask_code());
}
} }
} }
} }

Loading…
Cancel
Save