Browse Source

master备份

master2
涂强 1 month ago
parent
commit
629ae5d3b1
  1. 179
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java
  2. 4
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/PdaController.java
  3. 7
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/PdaServiceImpl.java
  4. 2
      acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

179
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java

@ -781,41 +781,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
//通道1
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString()) ) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 0) {
region.setIs_charge("1");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 1) {
region.setIs_charge("0");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(0);
}
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name()+"被管制!")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@ -823,11 +791,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
region.setIs_charge("1");
region.setHas_agv("1");
regionService.updateById(region);
}
}
}
else if (phase == 0x4E) {
} else if (phase == 0x4E) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
@ -866,48 +835,17 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("reqWms"))
&& StrUtil.equals("true", device.getExtraValue().get("reqWms").toString())) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 0) {
region.setIs_charge("0");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 1) {
region.setIs_charge("1");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setCloseCount(0);
}
}else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name()+"被管制!")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
}
}
@ -1054,21 +992,82 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
last_status = status;
} //进入区域(phase值)
else if (phase == 0x50) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "自动门开门")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("open"))
&& StrUtil.equals("true", device.getExtraValue().get("open").toString())) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 0) {
region.setIs_charge("1");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getOpenCount() == 1) {
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name() + "被管制!")
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
}
//离开区域(phase值)
else if (phase == 0x51) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "自动门关门")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Region region = regionService.findByCode("1");
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("close"))
&& StrUtil.equals("true", device.getExtraValue().get("close").toString())) {
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 0) {
region.setIs_charge("0");
region.setHas_agv("0");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setOpenCount(standardOrdinarySiteDeviceDriver.getOpenCount() + 1);
}
if (standardOrdinarySiteDeviceDriver.getCloseCount() == 1) {
region.setIs_charge("1");
region.setHas_agv("1");
regionService.updateById(region);
standardOrdinarySiteDeviceDriver.setCloseCount(0);
}
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(region.getRegion_name() + "被管制!")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
}
}
//上报异常信息
//(不需要WCS反馈)

4
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/PdaController.java

@ -88,8 +88,8 @@ public class PdaController {
}
@PostMapping("/queryTaskIds")
@Log("查询任务")
@ApiOperation("查询任务")
@Log("查询任务")
@ApiOperation("查询任务")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryTaskIds() throws Exception {

7
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/PdaServiceImpl.java

@ -210,7 +210,7 @@ public class PdaServiceImpl implements PdaService {
}
JSONObject resultJson = new JSONObject();
Instruction instruction = instructionService.findByTaskid(dto.getTask_id(), "instruction_status <2 ");
if (instruction!=null){
if (instruction != null) {
resultJson.put("message", "有指令未完成!");
return resultJson;
}
@ -240,6 +240,7 @@ public class PdaServiceImpl implements PdaService {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("task_id", obj.getString("task_code"));
json.put("task_name", obj.getString("task_code") + " - " + obj.getString("start_device_code") + "-->" + obj.getString("next_device_code"));
result.add(json);
}
return result;
@ -251,7 +252,7 @@ public class PdaServiceImpl implements PdaService {
String task_code = jsonObject.getString("task_id");
JSONObject resultJson = new JSONObject();
TaskDto dto = taskserver.findByCode(task_code);
if (Integer.parseInt(dto.getTask_status())==0) {
if (Integer.parseInt(dto.getTask_status()) == 0) {
try {
taskserver.cancel(dto.getTask_id());
} catch (Exception e) {
@ -350,7 +351,7 @@ public class PdaServiceImpl implements PdaService {
jo.put("x", agvNdcTwoDeviceDriver.getX());
jo.put("y", agvNdcTwoDeviceDriver.getY());
jo.put("angle", agvNdcTwoDeviceDriver.getAngle());
ja.put(agvNdcTwoDeviceDriver.getDevice().getDevice_code(),jo);
ja.put(agvNdcTwoDeviceDriver.getDevice().getDevice_code(), jo);
}
backja.add(ja);
}

2
acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -10,7 +10,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hanguodoushan}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:jinbao}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}

Loading…
Cancel
Save