Browse Source

更新

master
汪菘 2 years ago
parent
commit
0801b0a50a
  1. 7
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvService.java
  2. 2
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java
  3. 47
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  4. 6
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java
  5. 2
      hd/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java
  6. 2
      hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 43
      hd/nladmin-system/src/main/java/org/nl/hand/andxy/rest/Ndxy1HandController.java
  8. 9
      hd/nladmin-system/src/main/java/org/nl/hand/andxy/rest/NdxyHandController.java
  9. 4
      hd/nladmin-system/src/main/java/org/nl/hand/andxy/service/NdxyHandService.java
  10. 343
      hd/nladmin-system/src/main/java/org/nl/hand/andxy/service/impl/NdxyHandServiceImpl.java
  11. 2986
      hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

7
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvService.java

@ -182,4 +182,11 @@ public interface AgvService {
String queryDeviceStation();
/**
* 下发充电任务
* @param carno
* @return
*/
public boolean createChargingTaskToNDC(String carno);
}

2
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java

@ -22,7 +22,7 @@ public class AgvDto implements Serializable {
* EXECUTING正在执行运单
* CHARGING正在充电
*/
private String state;
private String state="IDLE";
/**
* 机器人的剩余电量值单位整数百分比

47
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java

@ -40,6 +40,7 @@ import org.nl.acs.opc.DeviceType;
import org.nl.acs.task.service.TaskService;
import org.nl.exception.BadRequestException;
import org.nl.logger.BusinessLogger;
import org.nl.modules.system.util.CodeUtil;
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
import org.nl.utils.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
@ -2002,6 +2003,52 @@ public class AgvServiceImpl implements AgvService {
return ret;
}
@Override
public boolean createChargingTaskToNDC(String carno) {
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
String instcode = CodeUtil.getNewCode("INSTRUCT_NO");
byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode));
String str = "十进制下发:";
String str1 = "十六进制下发:";
str += "carno:" + (Integer.parseInt(carno));
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
str += "/instcode:" + (instcode);
str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF);
System.out.println(str);
System.out.println(str1);
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) 0X64, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) instcodehigh, (byte) instcodelow,
(byte) carhigh, (byte) carlow
};
log.info("下发AGV充电任务--{}", str1);
try{
NDCSocketConnectionAutoRun.write(b);
} catch (Exception e){
e.getMessage();
return false;
}
System.out.println("下发agv充电任务数据:" + Bytes2HexString(b));
return true;
}
public static void main(String[] args) {
String address = "L1-01-01";
if (address.indexOf("-") > 0) {

6
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java

@ -324,7 +324,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setTask_status("0");
dto.setPriority("101");
dto.setPriority("1");
NdxySpecialDeviceDriver ndxySpecialDeviceDriver;
String next_device_code = "";
List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal");
@ -395,7 +395,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setTask_status("0");
dto.setPriority("101");
dto.setPriority("1");
NdxySpecialDeviceDriver ndxySpecialDeviceDriver;
String next_device_code = "";
List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal");
@ -602,7 +602,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
String task_code = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + task_code);
dto.setTask_status("0");
dto.setPriority("101");
dto.setPriority("1");
RouteLineDto jo = routeLineServer.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {

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

@ -46,7 +46,7 @@ public class TaskDto implements Serializable {
/**
* 任务优先级
*/
private String priority;
private String priority="1";
/**
* 创建类型

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

@ -424,7 +424,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public List<TaskDto> queryByStauts(String status) {
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0);
JSONArray arr = wo.query("task_status = '" + status + "'" +"order by create_time").getResultJSONArray(0);
List<TaskDto> list = JSONArray.toList(arr, TaskDto.class);
return list;
}

43
hd/nladmin-system/src/main/java/org/nl/hand/andxy/rest/Ndxy1HandController.java

@ -0,0 +1,43 @@
package org.nl.hand.andxy.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.annotation.rest.AnonymousPostMapping;
import org.nl.hand.andxy.service.NdxyHandService;
import org.nl.modules.system.service.UserService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author qxuan
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "纽迪希亚手持接口")
@RequestMapping("/api/andxy1/hand")
@Slf4j
public class Ndxy1HandController {
private final PasswordEncoder passwordEncoder;
private final UserService userService;
private final NdxyHandService HandService;
@AnonymousPostMapping("/createChargingTask")
@Log("创建任务")
@ApiOperation("创建任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
}
}

9
hd/nladmin-system/src/main/java/org/nl/hand/andxy/rest/NdxyHandController.java

@ -179,4 +179,13 @@ public class NdxyHandController {
public ResponseEntity<JSONObject> queryagvStatus() {
return new ResponseEntity<>(HandService.queryagvStatus(), HttpStatus.OK);
}
@AnonymousPostMapping("/createChargingTask")
@Log("创建任务")
@ApiOperation("创建任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
}
}

4
hd/nladmin-system/src/main/java/org/nl/hand/andxy/service/NdxyHandService.java

@ -130,4 +130,8 @@ public interface NdxyHandService {
* @return AGV状态数组
*/
JSONObject queryagvStatus();
Map<String, Object> createChargingTask(Map<String, String> whereJson);
}

343
hd/nladmin-system/src/main/java/org/nl/hand/andxy/service/impl/NdxyHandServiceImpl.java

@ -28,6 +28,7 @@ import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
@ -45,6 +46,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -61,6 +63,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
private final PasswordEncoder passwordEncoder;
private final DeviceService deviceService;
private final DeviceAppService deviceAppService;
private final RouteLineService routeLineService;
private final AgvService agvService;
InstructionService instructionService = null;
@ -114,10 +117,10 @@ public class NdxyHandServiceImpl implements NdxyHandService {
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
if (ndxySpecialDeviceDriver.getHasGoods() == 0) {
if (ndxySpecialDeviceDriver.getMove() == 0) {
status = "0";
status_name = "空";
} else if (ndxySpecialDeviceDriver.getHasGoods() == 1) {
} else if (ndxySpecialDeviceDriver.getMove() == 1) {
status = "1";
status_name = "有货";
}
@ -128,6 +131,10 @@ public class NdxyHandServiceImpl implements NdxyHandService {
// if (ndxySpecialDeviceDriver.getChecked()) {
// status = "3";
// status_name = "已选择";
// }
// if (ndxySpecialDeviceDriver.getChecked() && ndxySpecialDeviceDriver.getHasGoods() == 1) {
// status = "4";
// status_name = "已选择且有货";
// }
Device device_code1 = deviceAppService.findDeviceByCode(devicejo.optString("device_code"));
@ -230,10 +237,10 @@ public class NdxyHandServiceImpl implements NdxyHandService {
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
if (ndxySpecialDeviceDriver.getHasGoods() == 0) {
if (ndxySpecialDeviceDriver.getMove() == 0) {
status = "0";
status_name = "无货";
} else if (ndxySpecialDeviceDriver.getHasGoods() == 1) {
} else if (ndxySpecialDeviceDriver.getMove() == 1) {
status = "1";
status_name = "有货";
}
@ -241,10 +248,14 @@ public class NdxyHandServiceImpl implements NdxyHandService {
status = "2";
status_name = "故障";
}
if (ndxySpecialDeviceDriver.getChecked()) {
status = "3";
status_name = "已选择";
}
// if (ndxySpecialDeviceDriver.getChecked()) {
// status = "3";
// status_name = "已选择";
// }
// if (ndxySpecialDeviceDriver.getChecked() && ndxySpecialDeviceDriver.getHasGoods() == 1) {
// status = "4";
// status_name = "已选择且有货";
// }
Device device_code1 = deviceAppService.findDeviceByCode(devicejo.optString("device_code"));
jo.put("status", status);
jo.put("status_name", status_name);
@ -400,12 +411,12 @@ public class NdxyHandServiceImpl implements NdxyHandService {
@Override
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
//查询位完成的指令
JSONObject resultJson = new JSONObject();
HashMap<String, String> map = new HashMap<>();
String key = jsonObject.get("keyword");
String start_point = jsonObject.get("start_devicecode");
String next_point = jsonObject.get("next_devicecode");
String type = jsonObject.get("type");
map.put("flag", "4");
if (StrUtil.isNotEmpty(key)) {
map.put("key", "%" + key + "%");
@ -417,10 +428,40 @@ public class NdxyHandServiceImpl implements NdxyHandService {
map.put("next_point", "%" + next_point + "%");
}
JSONArray resultArr = WQL.getWO("QNDXY_QUERY003").addParamMap(map).addParamMap((HashMap) jsonObject).process().getResultJSONArray(0);
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
return resultJson;
JSONArray array = new JSONArray();
if (type.equals("1")) {
for (int i = 0; i < resultArr.size(); i++) {
JSONObject js = resultArr.getJSONObject(i);
Device device = deviceAppService.findDeviceByCode(js.getString("next_devicecode"));
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("put_storage"))) {
if (StrUtil.equals(device.getExtraValue().get("put_storage").toString(),"true")) {
array.add(js);
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", array);
return resultJson;
}
if (type.equals("2")) {
for (int i = 0; i < resultArr.size(); i++) {
JSONObject js = resultArr.getJSONObject(i);
Device device = deviceAppService.findDeviceByCode(js.getString("start_devicecode"));
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("outbound"))) {
if (StrUtil.equals(device.getExtraValue().get("outbound").toString(), "true")) {
array.add(js);
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", array);
return resultJson;
}
return null;
}
@Override
@ -442,9 +483,8 @@ public class NdxyHandServiceImpl implements NdxyHandService {
if (StrUtil.isEmpty(routeplan_type)) {
throw new BadRequestException("路由方案类型不能为空!");
}
if (StrUtil.isEmpty(priority)) {
priority = "1";
}
priority = "1";
if (start_devicecode.equals(next_devicecode)) {
resultJson.put("code", "0");
@ -486,6 +526,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
String key = jsonObject.get("keyword");
String start_point = jsonObject.get("start_devicecode");
String next_point = jsonObject.get("next_devicecode");
String type = jsonObject.get("type");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "2");
if (StrUtil.isNotEmpty(key)) {
@ -499,11 +540,41 @@ public class NdxyHandServiceImpl implements NdxyHandService {
}
//查询有任务 但是没有指令的任务
JSONArray result = WQL.getWO("QNDXY_QUERY003").addParamMap(map).process().getResultJSONArray(0);
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", result);
return resultJson;
JSONArray array = new JSONArray();
if (type.equals("1")) {
for (int i = 0; i < result.size(); i++) {
JSONObject js = result.getJSONObject(i);
Device device = deviceAppService.findDeviceByCode(js.getString("next_devicecode"));
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("put_storage"))) {
if (StrUtil.equals(device.getExtraValue().get("put_storage").toString(),"true")) {
array.add(js);
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", array);
return resultJson;
}
if (type.equals("2")) {
for (int i = 0; i < result.size(); i++) {
JSONObject js = result.getJSONObject(i);
Device device = deviceAppService.findDeviceByCode(js.getString("start_devicecode"));
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("outbound"))) {
if (StrUtil.equals(device.getExtraValue().get("outbound").toString(), "true")) {
array.add(js);
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", array);
return resultJson;
}
return null;
}
@ -512,9 +583,10 @@ public class NdxyHandServiceImpl implements NdxyHandService {
//修改任务的状态
String device_code = jsonObject.get("device_code");
String type = jsonObject.get("status_type");
String number = jsonObject.get("number");
JSONObject resultJson = new JSONObject();
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//纽迪希亚专用
@ -522,55 +594,181 @@ public class NdxyHandServiceImpl implements NdxyHandService {
DeviceDto dto = deviceService.findByCode(device_code);
//修改
//选中
if (type.equals("1")) {
int num = 0;
JSONArray acs_deviceja = WQLObject.getWQLObject("acs_device").query("region = '" + dto.getRegion() + "'", "seq_num,device_name").getResultJSONArray(0);
for (int i = 0; i < acs_deviceja.size(); i++) {
JSONObject devicejo = acs_deviceja.getJSONObject(i);
String deviceCode = devicejo.optString("device_code");
Device device1 = appService.findDeviceByCode(deviceCode);
if (device1.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device1.getDeviceDriver();
if (ndxySpecialDeviceDriver.getChecked()) {
num++;
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("outbound"))) {
if (StrUtil.equals(device.getExtraValue().get("outbound").toString(), "true")) {
for (int i = 0; i < Integer.parseInt(number); i++) {
TaskDto taskDto = new TaskDto();
String now = DateUtil.now();
taskDto.setTask_id(IdUtil.simpleUUID());
taskDto.setCreate_by(device.getDevice_code());
taskDto.setUpdate_by(device.getDevice_code());
taskDto.setTask_status("0");
taskDto.setPriority("1");
String next_device_code = "";
List<RouteLineDto> list = routeLineService.getShortPathLinesByCode(device_code, "normal");
for (int j = 0; j < list.size(); j++) {
RouteLineDto routeLineDto = list.get(j);
next_device_code = routeLineDto.getNext_device_code();
}
if (StrUtil.isEmpty(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
taskDto.setStart_point_code(device_code);
taskDto.setStart_device_code(device_code);
taskDto.setNext_point_code(next_device_code);
taskDto.setNext_device_code(next_device_code);
taskDto.setUpdate_time(now);
taskDto.setCreate_time(now);
String task_code = CodeUtil.getNewCode("TASK_NO");
taskDto.setTask_code("-" + task_code);
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.fromObject(taskDto);
wo.insert(json);
}
//纽迪希亚专用
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
ndxySpecialDeviceDriver.setChecked(true);
}
}
}
if (num != 0) {
resultJson.put("code", "0");
resultJson.put("desc", "只能选择一个站点");
resultJson.put("result", new JSONObject());
return resultJson;
}
//纽迪希亚专用
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
if (ndxySpecialDeviceDriver.getChecked()) {
resultJson.put("code", "0");
resultJson.put("desc", "该站点已经被选中");
resultJson.put("code", "1");
resultJson.put("desc", "更新成功");
resultJson.put("result", new JSONObject());
return resultJson;
}
}
//判断当前设备是否为入库位
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("put_storage"))) {
if (StrUtil.equals(device.getExtraValue().get("put_storage").toString(), "true")) {
int moveNumber = 0;
//纽迪希亚专用
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
if (ndxySpecialDeviceDriver.getMove() != 0) {
moveNumber += 1;
}
//查询关联设备
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("link_device_code"))) {
Object[] arr = (Object[]) device.getExtraValue().get("link_device_code");
String[] str_arr = new String[arr.length];
for (int j = 0; j < arr.length; j++) {
str_arr[j] = (String) arr[j];
}
//获得每个关联设备
for (int j = 0; j < str_arr.length; j++) {
String link_device_code = str_arr[j];
Device relevance_device = appService.findDeviceByCode(link_device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
moveNumber += 1;
}
}
}
}
for (int i = 0; i < 5 - moveNumber; i++) {
TaskDto taskDto = new TaskDto();
String now = DateUtil.now();
taskDto.setTask_id(IdUtil.simpleUUID());
taskDto.setCreate_by(device.getDevice_code());
taskDto.setUpdate_by(device.getDevice_code());
taskDto.setTask_status("0");
taskDto.setPriority("1");
String start_device_code = "";
List<RouteLineDto> list = routeLineService.getPathLinesByCode(device_code, "normal");
for (int j = 0; j < list.size(); j++) {
RouteLineDto routeLineDto = list.get(j);
start_device_code = routeLineDto.getDevice_code();
}
ndxySpecialDeviceDriver.setChecked(true);
if (StrUtil.isEmpty(start_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
taskDto.setStart_point_code(start_device_code);
taskDto.setStart_device_code(start_device_code);
taskDto.setNext_point_code(device_code);
taskDto.setNext_device_code(device_code);
taskDto.setUpdate_time(now);
taskDto.setCreate_time(now);
String task_code = CodeUtil.getNewCode("TASK_NO");
taskDto.setTask_code("-" + task_code);
if (!ndxySpecialDeviceDriver.getChecked() && !ndxySpecialDeviceDriver.getChoose()) {
resultJson.put("code", "0");
resultJson.put("desc", "该条线不满足运输条件");
resultJson.put("result", new JSONObject());
return resultJson;
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.fromObject(taskDto);
wo.insert(json);
}
ndxySpecialDeviceDriver.setChecked(true);
resultJson.put("code", "1");
resultJson.put("desc", "更新成功");
resultJson.put("result", new JSONObject());
return resultJson;
}
}
}
// int num = 0;
// JSONArray acs_deviceja = WQLObject.getWQLObject("acs_device").query("region = '" + dto.getRegion() + "'", "seq_num,device_name").getResultJSONArray(0);
// for (int i = 0; i < acs_deviceja.size(); i++) {
// JSONObject devicejo = acs_deviceja.getJSONObject(i);
// String deviceCode = devicejo.optString("device_code");
// Device device1 = appService.findDeviceByCode(deviceCode);
// if (device1.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
// ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device1.getDeviceDriver();
// if (ndxySpecialDeviceDriver.getChecked()) {
// num++;
// }
// }
// }
// if (num != 0) {
// resultJson.put("code", "0");
// resultJson.put("desc", "只能选择一个站点");
// resultJson.put("result", new JSONObject());
// return resultJson;
// }
//
// //纽迪希亚专用
// if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
// ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
// if (ndxySpecialDeviceDriver.getChecked()) {
// resultJson.put("code", "0");
// resultJson.put("desc", "该站点已经被选中");
// resultJson.put("result", new JSONObject());
// return resultJson;
// }
//
// ndxySpecialDeviceDriver.setChecked(true);
//
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
//
// if (!ndxySpecialDeviceDriver.getChecked() && !ndxySpecialDeviceDriver.getChoose()) {
// resultJson.put("code", "0");
// resultJson.put("desc", "该条线不满足运输条件");
// resultJson.put("result", new JSONObject());
// return resultJson;
// }
// }
}
//清空
//强制完成
if (type.equals("2")) {
//纽迪希亚专用
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
@ -578,6 +776,15 @@ public class NdxyHandServiceImpl implements NdxyHandService {
ndxySpecialDeviceDriver.setChecked(false);
}
}
//入窑
if (type.equals("3")) {
//纽迪希亚专用
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
ndxySpecialDeviceDriver.setChecked(false);
ndxySpecialDeviceDriver.writing(1,4);
}
}
resultJson.put("code", "1");
resultJson.put("desc", "更新成功");
resultJson.put("result", new JSONObject());
@ -798,6 +1005,17 @@ public class NdxyHandServiceImpl implements NdxyHandService {
return jo;
}
@Override
public Map<String, Object> createChargingTask(Map<String, String> whereJson) {
String type = whereJson.get("type");
AgvService agvService = SpringContextHolder.getBean(AgvServiceImpl.class);
agvService.createChargingTaskToNDC(type);
JSONObject jo = new JSONObject();
jo.put("code", "1");
jo.put("desc", "创建成功");
return jo;
}
@Override
public Map<String, Object> createTask2(Map<String, String> whereJson) {
String type = whereJson.get("type");
@ -857,7 +1075,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
@Override
public JSONObject point2(Map<String, String> param) {
// 返回值
// 返回值
JSONObject resultJSON = new JSONObject();
// 参数校验
@ -934,7 +1152,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
@Override
public JSONObject queryagvStatus() {
// 获取所有AGV对象
// 获取所有AGV对象
Map<String, AgvDto> agvMap = agvService.findAllAgvFromCache();
// 返回数组
@ -956,7 +1174,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
agvStatus.put("error", agv.getErrorBuf());
break;
case "IDLE":
status = "空闲状态";
status = "无故障";
break;
case "EXECUTING":
status = "正在执行运单";
@ -980,4 +1198,5 @@ public class NdxyHandServiceImpl implements NdxyHandService {
resultJSON.put("result", result);
return resultJSON;
}
}

2986
hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

File diff suppressed because it is too large
Loading…
Cancel
Save