Browse Source

更新

master
gengby 2 years ago
parent
commit
23db0a4248
  1. 63
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  2. 9
      acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java
  3. 8
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  4. 7
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java
  5. 8
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
  6. 190
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  7. 19
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  8. 2
      acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  9. 14
      acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  10. 129
      acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
  11. 32
      acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NdcAutoReconnection.java
  12. 4
      acs/hd/nladmin-system/src/main/resources/config/application-dev.yml
  13. 2
      acs/qd/.env.development

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

@ -22,6 +22,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.DeviceType; import org.nl.acs.opc.DeviceType;
import org.nl.exception.BadRequestException; import org.nl.exception.BadRequestException;
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
import org.nl.utils.SpringContextHolder; import org.nl.utils.SpringContextHolder;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -181,7 +182,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}; };
log.info("下发AGV作业指令--{}", str1); log.info("下发AGV作业指令--{}", str1);
// NDCSocketConnectionAutoRun.write(b); NDCSocketConnectionAutoRun.write(b);
System.out.println("下发agv指令数据:" + Bytes2HexString(b)); System.out.println("下发agv指令数据:" + Bytes2HexString(b));
} }
} finally { } finally {
@ -240,63 +241,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte indexlow = (byte) IntToHexLow(index); byte indexlow = (byte) IntToHexLow(index);
byte phasehigh = (byte) IntToHexHigh(phase); byte phasehigh = (byte) IntToHexHigh(phase);
byte phaselow = (byte) IntToHexLow(phase); byte phaselow = (byte) IntToHexLow(phase);
byte resulthigh = (byte) IntToHexHigh(result);
byte resultlow = (byte) IntToHexLow(result);
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE)); byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
byte[] b = new byte[]{};
switch (type) {
case 0:
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow
};
break;
case 1:
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0D,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X08,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow,
(byte) resulthigh, (byte) resultlow
};
break;
case 2:
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow
};
break;
case 5:
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow
};
break;
case 7:
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08, (byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A, (byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X01, (byte) 0X00, (byte) 0X01,
@ -306,8 +252,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) 0X01, (byte) 0X12, (byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow (byte) phasehigh, (byte) phaselow
}; };
break;
}
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); System.out.println("反馈agv动作数据:" + Bytes2HexString(b));

9
acs/hd/nladmin-system/src/main/java/org/nl/acs/config/server/impl/AcsConfigServiceImpl.java

@ -67,7 +67,7 @@ public class AcsConfigServiceImpl implements AcsConfigService, ApplicationAutoIn
public List<AcsConfigDto> queryAll(Map whereJson) { public List<AcsConfigDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("sys_param"); WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONArray arr = wo.query().getResultJSONArray(0); JSONArray arr = wo.query().getResultJSONArray(0);
List<AcsConfigDto> list =arr.toJavaList(AcsConfigDto.class); List<AcsConfigDto> list = arr.toJavaList(AcsConfigDto.class);
return list; return list;
} }
@ -83,8 +83,11 @@ public class AcsConfigServiceImpl implements AcsConfigService, ApplicationAutoIn
public AcsConfigDto findByCode(String code) { public AcsConfigDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("sys_param"); WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class); if (ObjectUtil.isNotEmpty(json)) {
return obj; final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class);
return obj;
}
return null;
} }
@Override @Override

8
acs/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -28,6 +28,7 @@ import org.nl.acs.device_driver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
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.acs.opc.DeviceType;
import org.nl.exception.BadRequestException; import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.start.auto.initial.ApplicationAutoInitial; import org.nl.start.auto.initial.ApplicationAutoInitial;
@ -238,7 +239,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
log.info("设备删除成功!"); log.info("设备删除成功!");
if (deviceByCode != null) { if (deviceByCode != null) {
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) { DeviceDriverDefination deviceDriverDefination = deviceByCode.getDeviceDriverDefination();
String name = "";
if (ObjectUtil.isNotEmpty(deviceDriverDefination)){
name = deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
}
if (StrUtil.equals("storage", name)) {
storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'"); storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'");
} else { } else {

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

@ -129,4 +129,11 @@ public class AcsToWmsController {
public ResponseEntity<Object> feedbackDeviceStatus(@RequestBody String device_code, String code, String value) { public ResponseEntity<Object> feedbackDeviceStatus(@RequestBody String device_code, String code, String value) {
return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK); return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK);
} }
@PostMapping("/feedbackAgvTakePutStatus")
@Log("反馈agv取放货状态")
@ApiOperation("反馈agv取放货状态")
public ResponseEntity<Object> feedbackAgvTakePutStatus(@RequestBody JSONObject param) {
return new ResponseEntity<>(acstowmsService.feedbackAgvTakePutStatus(param), HttpStatus.OK);
}
} }

8
acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java

@ -132,6 +132,14 @@ public interface AcsToWmsService {
*/ */
HttpResponse feedbackDeviceStatus(String device_code, String code, String value); HttpResponse feedbackDeviceStatus(String device_code, String code, String value);
/**
* 反馈AGV取放货状态
*
* @param param
* @return
*/
HttpResponse feedbackAgvTakePutStatus(JSONObject param);
/** /**
* 反馈AGV设备信息 * 反馈AGV设备信息
* *

190
acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -50,8 +50,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Value("${acsTowms.token}") @Value("${acsTowms.token}")
public String token; public String token;
private String log_file_type="log_file_type"; private String log_file_type = "log_file_type";
private String log_type="ACS请求WMS"; private String log_type = "ACS请求WMS";
@Override @Override
public String applyTaskToWms(String device_code, String container_code, int height, int weight) { public String applyTaskToWms(String device_code, String container_code, int height, int weight) {
@ -96,7 +96,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// logServer.log("", "applyTaskToWms", type, jo.toString(), result2.body(), String.valueOf(result2.getStatus()), url, container_code); // logServer.log("", "applyTaskToWms", type, jo.toString(), result2.body(), String.valueOf(result2.getStatus()), url, container_code);
log.info("applyTaskToWms-----输出参数{}", result2.body()); log.info("applyTaskToWms-----输出参数{}", result2.body());
return result2.body(); return result2.body();
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -136,7 +136,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("applyTaskManipulatorToWms-----输出参数{}", result2.body()); log.info("applyTaskManipulatorToWms-----输出参数{}", result2.body());
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -177,7 +177,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("applyOuttoKiln-----输出参数{}", result2.body()); log.info("applyOuttoKiln-----输出参数{}", result2.body());
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -218,14 +218,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("lnshApplyTaskToWms-----输出参数{}", result2.body()); log.info("lnshApplyTaskToWms-----输出参数{}", result2.body());
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
} }
@Override @Override
public HttpResponse applyBarcode(JSONObject json) { public HttpResponse applyBarcode(JSONObject json) {
try { try {
@ -261,7 +260,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("lnshApplyTaskToWms-----输出参数{}", result2.body()); log.info("lnshApplyTaskToWms-----输出参数{}", result2.body());
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -302,7 +301,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("lnshApplyTaskToWms-----输出参数{}", result2.body()); log.info("lnshApplyTaskToWms-----输出参数{}", result2.body());
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -332,7 +331,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject jo = JSONObject.parseObject(result.body()); JSONObject jo = JSONObject.parseObject(result.body());
return jo; return jo;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -361,7 +360,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("getVehicleTokiln----返回参数{}", result.body()); log.info("getVehicleTokiln----返回参数{}", result.body());
JSONObject jo = JSONObject.parseObject(result.body()); JSONObject jo = JSONObject.parseObject(result.body());
return jo; return jo;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -390,7 +389,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("getVehicleTokiln----返回参数{}", result.body()); log.info("getVehicleTokiln----返回参数{}", result.body());
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -419,7 +418,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
log.info("outKiln----返回参数{}", result.body()); log.info("outKiln----返回参数{}", result.body());
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -448,7 +447,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("enterOrder----返回参数{}", result.body()); log.info("enterOrder----返回参数{}", result.body());
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -459,7 +458,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
@ -468,7 +467,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String url = wmsurl + methods_url; String url = wmsurl + methods_url;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("device_code",device_code); json.put("device_code", device_code);
log.info("getVehicleCode----请求参数{}", json.toString()); log.info("getVehicleCode----请求参数{}", json.toString());
HttpResponse result = null; HttpResponse result = null;
@ -490,7 +489,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
@ -499,7 +498,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String url = wmsurl + methods_url; String url = wmsurl + methods_url;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("vehicle_code",vehicle_code); json.put("vehicle_code", vehicle_code);
log.info("getVehiclePoint----请求参数{}", json.toString()); log.info("getVehiclePoint----请求参数{}", json.toString());
HttpResponse result = null; HttpResponse result = null;
@ -519,49 +518,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public HttpResponse feedbackTaskStatusToWms(JSONArray data) { public HttpResponse feedbackTaskStatusToWms(JSONArray data) {
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
HttpResponse result2 = null;
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url();
try {
result2 = HttpRequest.post(wmsurl + methods_url)
.header("Authorization", token).body(String.valueOf(data))
.execute();
System.out.println(result2);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
} finally { String type = "";
MDC.remove(log_file_type); if (result2.getStatus() == 200) {
} type = "info";
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); } else {
type = "error";
String task_code = ""; }
for (int i = 0; i < data.size(); i++) {
JSONObject json = (JSONObject) data.get(i);
task_code = json.getString("task_code");
}
TaskDto taskDto = taskService.findByCode(task_code);
String vehicle_code = taskDto.getVehicle_code();
HttpResponse result2 = null;
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url();
try {
result2 = HttpRequest.post(wmsurl + methods_url)
.header("Authorization", token).body(String.valueOf(data))
.execute();
System.out.println(result2);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
String type = ""; // logServer.log(task_code, "feedbackTaskStatusToWms", type, data.toString(), result2.body(), String.valueOf(result2.getStatus()), wmsurl + methods_url, vehicle_code);
if (result2.getStatus() == 200) { JSONObject jo = JSONObject.parseObject(result2.body());
type = "info"; log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
} else { return result2;
type = "error"; } finally {
MDC.remove(log_file_type);
} }
// logServer.log(task_code, "feedbackTaskStatusToWms", type, data.toString(), result2.body(), String.valueOf(result2.getStatus()), wmsurl + methods_url, vehicle_code);
JSONObject jo = JSONObject.parseObject(result2.body());
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
return result2;
} }
@Override @Override
@ -597,7 +586,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
resultJson.put("data", new JSONArray()); resultJson.put("data", new JSONArray());
log.info("feedbackPointStatusToWms----输出参数{}", resultJson.toString()); log.info("feedbackPointStatusToWms----输出参数{}", resultJson.toString());
return resultJson; return resultJson;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -605,26 +594,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public JSONArray getDeviceStatusToWms() { public JSONArray getDeviceStatusToWms() {
try { try {
MDC.put(log_file_type,log_type); MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms"); AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url; String url = wmsurl + methods_url;
String result = ""; String result = "";
try { try {
result = HttpRequest.get(url) result = HttpRequest.get(url)
.execute().body(); .execute().body();
System.out.println(result); System.out.println(result);
log.info("getTaskStatusToWms----返回参数{}", result); log.info("getTaskStatusToWms----返回参数{}", result);
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
JSONArray jsonArray = JSONArray.parseArray(result); JSONArray jsonArray = JSONArray.parseArray(result);
return jsonArray; return jsonArray;
}finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
} }
@ -656,7 +645,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -692,7 +681,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -733,7 +722,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -765,7 +754,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result2; return result2;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -800,7 +789,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -839,7 +828,38 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type);
}
}
@Override
public HttpResponse feedbackAgvTakePutStatus(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
JSONArray ja = new JSONArray();
ja.add(param);
AddressDto addressDto = addressService.findByCode("feedbackAgvTakePutStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
HttpResponse result = null;
log.info("feedbackDeviceStatus----请求参数{}", param);
try {
result = HttpRequest.post(url)
.body(String.valueOf(ja))
.execute();
System.out.println(result);
log.info("feedbackDeviceStatus----返回参数{}", result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
} finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -868,7 +888,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -899,7 +919,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(msg); System.out.println(msg);
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }
@ -927,7 +947,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
return result; return result;
} finally { } finally {
MDC.remove(log_file_type); MDC.remove(log_file_type);
} }

19
acs/hd/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.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;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@ -64,6 +65,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String task_code = task.getString("task_code"); String task_code = task.getString("task_code");
String start_point_code = task.getString("start_device_code"); String start_point_code = task.getString("start_device_code");
String next_point_code = task.getString("next_device_code"); String next_point_code = task.getString("next_device_code");
String priority = task.getString("priority");
String start_device_code = ""; String start_device_code = "";
String next_device_code = ""; String next_device_code = "";
String start_parent_code = ""; String start_parent_code = "";
@ -77,6 +79,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (StrUtil.isEmpty(next_point_code)) { if (StrUtil.isEmpty(next_point_code)) {
throw new WDKException("终点不能为空"); throw new WDKException("终点不能为空");
} }
if (StrUtil.isEmpty(priority)){
throw new WDKException("优先级不能为空");
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0); JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) { if (!ObjectUtil.isEmpty(start_device_json)) {
@ -88,7 +93,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code"); next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
next_parent_code = next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("parent_storage_code"); next_parent_code = next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("parent_storage_code");
} }
String priority = task.getString("priority");
String vehicle_code = task.getString("vehicle_code"); String vehicle_code = task.getString("vehicle_code");
String vehicle_type = task.getString("vehicle_type"); String vehicle_type = task.getString("vehicle_type");
String route_plan_code = task.getString("route_plan_code"); String route_plan_code = task.getString("route_plan_code");
@ -129,6 +134,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
} }
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("task_id", IdUtil.simpleUUID());
jo.put("task_code", task_code); jo.put("task_code", task_code);
jo.put("ext_task_uuid", ext_task_uuid); jo.put("ext_task_uuid", ext_task_uuid);
jo.put("start_point_code", start_point_code); jo.put("start_point_code", start_point_code);
@ -207,17 +213,18 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
log.info("cancelFromWms--------------:输入参数" + tasks.toString()); log.info("cancelFromWms--------------:输入参数" + tasks.toString());
for (int i = 0; i < tasks.size(); i++) { for (int i = 0; i < tasks.size(); i++) {
JSONObject task = tasks.getJSONObject(i); JSONObject task = tasks.getJSONObject(i);
String task_uuid = task.getString("task_id"); //String task_uuid = task.getString("task_id");
String task_code = task.getString("task_code"); String task_code = task.getString("task_code");
String vehicle_code = task.getString("vehicle_code"); String vehicle_code = task.getString("vehicle_code");
String params = task.getString("params"); String params = task.getString("params");
if (StrUtil.isEmpty(task_uuid)) {
throw new WDKException("任务标识不能为空");
}
if (StrUtil.isEmpty(task_code)) { if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空"); throw new WDKException("任务号不能为空");
} }
TaskDto taskDto = TaskService.findByCode(task_code);
String task_uuid = taskDto.getTask_id();
if (StrUtil.isEmpty(task_uuid)) {
throw new WDKException("任务标识不能为空");
}
String cancelTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CANCELTASKCHECK); String cancelTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CANCELTASKCHECK);
if (StrUtil.equals(cancelTaskCheck, "1")) { if (StrUtil.equals(cancelTaskCheck, "1")) {
TaskService.cancel(task_uuid); TaskService.cancel(task_uuid);

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

@ -508,7 +508,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void finish(String id) throws Exception { public void finish(String id) throws Exception {
Instruction entity = this.findById(id); Instruction entity = this.findById(id);
//if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
entity.setUpdate_time(now); entity.setUpdate_time(now);

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

@ -605,10 +605,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
JSONObject feed_jo = new JSONObject(); JSONObject feed_jo = new JSONObject();
Instruction inst = instructionservice.findByTaskcodeToWms(entity.getTask_code()); Instruction inst = instructionservice.findByTaskcodeToWms(entity.getTask_code());
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid()); //feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
feed_jo.put("task_code", entity.getTask_code()); feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status()); feed_jo.put("task_status", entity.getTask_status());
feed_jo.put("car_no", inst.getCarno()); //feed_jo.put("car_no", inst.getCarno());
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);
String message = null; String message = null;
@ -729,13 +729,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
//判断是否为WMS下发的任务,如果是反馈任务状态给WMS //判断是否为WMS下发的任务,如果是反馈任务状态给WMS
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS); String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
//反馈wms任务状态---取消
JSONObject feed_jo = new JSONObject(); JSONObject feed_jo = new JSONObject();
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
feed_jo.put("task_code", entity.getTask_code()); feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status()); feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);
acstowmsService.feedbackTaskStatusToWms(ja); try {
acstowmsService.feedbackTaskStatusToWms(ja);
log.info("agv取消任务反馈成功,任务号{}",entity.getTask_code());
} catch (Exception e){
log.info("agv取消任务反馈失败,任务号{}",entity.getTask_code());
e.printStackTrace();
}
} }
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(entity.getStart_device_code(), entity.getNext_device_code(), entity.getRoute_plan_code()); List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(entity.getStart_device_code(), entity.getNext_device_code(), entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType(); String type = shortPathsList.get(0).getType();

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

@ -3,9 +3,9 @@ package org.nl.start.auto.run;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.config.AcsConfig; import org.nl.acs.config.AcsConfig;
@ -17,6 +17,7 @@ import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver; import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.traffic_light.TrafficLightDeviceDriver; import org.nl.acs.device_driver.traffic_light.TrafficLightDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
@ -26,10 +27,6 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl; import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.utils.SpringContextHolder; import org.nl.utils.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -93,6 +90,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
port = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT)); port = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT));
byte[] b = new byte[1028]; byte[] b = new byte[1028];
s = new Socket(ip, port); s = new Socket(ip, port);
System.out.println("Agv链接成功");
dos = new DataOutputStream(s.getOutputStream()); dos = new DataOutputStream(s.getOutputStream());
dis = new DataInputStream(s.getInputStream()); dis = new DataInputStream(s.getInputStream());
@ -159,18 +157,28 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
StandardStorageDeviceDriver standardStorageDeviceDriver; StandardStorageDeviceDriver standardStorageDeviceDriver;
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver; StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
OumulongPlcDeviceDriver oumulongPlcDeviceDriver; OumulongPlcDeviceDriver oumulongPlcDeviceDriver;
TrafficLightDeviceDriver trafficLightDeviceDriver; TrafficLightDeviceDriver trafficLightDeviceDriver;
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
if (phase == 0x01) { if (phase == 0x01) {
data = AgvService.sendAgvOneModeInst(phase, index); //data = AgvService.sendAgvOneModeInst(phase, index);
if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
inst.setAgv_jobno(String.valueOf(index)); inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status("1"); inst.setSend_status("1");
instructionService.update(inst); instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0); data = AgvService.sendAgvOneModeInst(phase, index, 0);
// 反馈wms任务状态---执行中
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_code", inst.getTask_code());
feed_jo.put("task_status", "1");
JSONArray ja = new JSONArray();
ja.add(feed_jo);
acsToWmsService.feedbackTaskStatusToWms(ja);
log.info("agv任务状态-执行中反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} }
flag = true; flag = true;
} }
@ -187,6 +195,29 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
break; break;
} }
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
JSONObject map = new JSONObject();
map.put("task_code", inst.getTask_code());
map.put("status", "1");
map.put("device_code", device_code);
map.put("vehicle_code", inst.getVehicle_code());
HttpResponse httpResponse = acsToWmsService.feedbackAgvTakePutStatus(map);
String body = httpResponse.body();
JSONObject resJson = JSONObject.parseObject(body);
String message = resJson.getString("message");
int status = Integer.parseInt(resJson.getString("status"));
if (status == 200) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
log.info("agv请求取货反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} else {
log.info("agv请求取货,wms系统不允许取货,设备号{},任务号{},原因{}", device_code, inst.getTask_code(), message);
}
}
//检测站点 //检测站点
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
@ -238,6 +269,29 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
break; break;
} }
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
JSONObject map = new JSONObject();
map.put("task_code", inst.getTask_code());
map.put("status", "2");
map.put("device_code", device_code);
map.put("vehicle_code", inst.getVehicle_code());
HttpResponse httpResponse = acsToWmsService.feedbackAgvTakePutStatus(map);
String body = httpResponse.body();
JSONObject resJson = JSONObject.parseObject(body);
String message = resJson.getString("message");
int status = Integer.parseInt(resJson.getString("status"));
if (status == 200) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
log.info("agv取货完成反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} else {
log.info("agv请求取货完成请求离开,wms系统不允许离开,设备号{},任务号{},原因{}", device_code, inst.getTask_code(), message);
}
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0) { if (standardInspectSiteDeviceDriver.getMove() == 0) {
@ -288,6 +342,30 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
break; break;
} }
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
JSONObject map = new JSONObject();
map.put("task_code", inst.getTask_code());
map.put("status", "3");
map.put("device_code", device_code);
map.put("vehicle_code", inst.getVehicle_code());
HttpResponse httpResponse = acsToWmsService.feedbackAgvTakePutStatus(map);
String body = httpResponse.body();
JSONObject resJson = JSONObject.parseObject(body);
String message = resJson.getString("message");
int status = Integer.parseInt(resJson.getString("status"));
if (status == 200) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
log.info("agv请求放货反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} else {
log.info("agv请求放货,wms系统不允许放货,设备号{},任务号{},原因{}", device_code, inst.getTask_code(), message);
}
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0) { if (standardInspectSiteDeviceDriver.getMove() == 0) {
@ -325,6 +403,29 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
break; break;
} }
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
JSONObject map = new JSONObject();
map.put("task_code", inst.getTask_code());
map.put("status", "4");
map.put("device_code", device_code);
map.put("vehicle_code", inst.getVehicle_code());
HttpResponse httpResponse = acsToWmsService.feedbackAgvTakePutStatus(map);
String body = httpResponse.body();
JSONObject resJson = JSONObject.parseObject(body);
String message = resJson.getString("message");
int status = Integer.parseInt(resJson.getString("status"));
if (status == 200) {
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
log.info("agv放货完成反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} else {
log.info("agv放货完成请求离开,wms系统不允许离开,设备号{},任务号{},原因{}", device_code, inst.getTask_code(), message);
}
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) { if (standardInspectSiteDeviceDriver.getMove() != 0) {
@ -363,6 +464,15 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) {
inst.setInstruction_status("2"); inst.setInstruction_status("2");
instructionService.finish(inst); instructionService.finish(inst);
//反馈wms任务状态---完成
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_code", inst.getTask_code());
feed_jo.put("task_status", "2");
JSONArray ja = new JSONArray();
ja.add(feed_jo);
acsToWmsService.feedbackTaskStatusToWms(ja);
log.info("agv任务完成反馈成功,设备号{},任务号{}", device_code, inst.getTask_code());
} }
data = AgvService.sendAgvOneModeInst(phase, index, 0); data = AgvService.sendAgvOneModeInst(phase, index, 0);
} }
@ -503,6 +613,9 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dto.setName(String.valueOf(carno)); dto.setName(String.valueOf(carno));
dto.setEnergyLevel(String.valueOf(ikey)); dto.setEnergyLevel(String.valueOf(ikey));
} }
if (!ObjectUtil.isEmpty(data)) {
write(data);
}
} else { } else {
System.out.println("agv上报不是0073类型动作,不处理"); System.out.println("agv上报不是0073类型动作,不处理");

32
acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NdcAutoReconnection.java

@ -0,0 +1,32 @@
package org.nl.start.auto.run;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* ndc掉线自动重连
*/
@Slf4j
@Component
public class NdcAutoReconnection {
@Autowired
AcsConfigService acsConfigService;
@Autowired
AutoRunService autoRunService;
public void run(String threadCode) throws Exception {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.NDC_RECONNECTION).toString(), "1")) {
if (!autoRunService.getThreadByCode(threadCode).isAlive()) {
autoRunService.startThread(threadCode);
}
}
}
}

4
acs/hd/nladmin-system/src/main/resources/config/application-dev.yml

@ -8,11 +8,11 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:szhr}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root} username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd} # password: ${DB_PWD:P@ssw0rd}
password: ${DB_PWD:Root.123456} password: ${DB_PWD:password}
# password: ${DB_PWD:123456} # password: ${DB_PWD:123456}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5

2
acs/qd/.env.development

@ -1,7 +1,7 @@
ENV = 'development' ENV = 'development'
# 接口地址 # 接口地址
VUE_APP_BASE_API = 'http://192.168.81.140:8010' VUE_APP_BASE_API = 'http://127.0.0.1:8010'
VUE_APP_WS_API = 'ws://127.0.0.1:8010' VUE_APP_WS_API = 'ws://127.0.0.1:8010'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件

Loading…
Cancel
Save