|
|
@ -15,15 +15,8 @@ import org.nl.acs.device.service.DeviceService; |
|
|
|
import org.nl.acs.device_driver.DeviceDriver; |
|
|
|
import org.nl.acs.device_driver.FeedLmsRealFailed; |
|
|
|
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; |
|
|
|
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
|
import org.nl.acs.history.ErrorUtil; |
|
|
@ -36,21 +29,16 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl; |
|
|
|
import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
|
import org.nl.acs.monitor.DeviceStageMonitor; |
|
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
|
import org.nl.acs.region.domain.Region; |
|
|
|
import org.nl.acs.region.service.RegionService; |
|
|
|
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.config.SpringContextHolder; |
|
|
|
import org.nl.config.lucene.service.LuceneExecuteLogService; |
|
|
|
import org.nl.config.lucene.service.dto.LuceneLogDto; |
|
|
|
import org.nl.config.thread.ThreadPoolExecutorUtil; |
|
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
|
import org.nl.config.SpringContextHolder; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -226,26 +214,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
|
//放货确认
|
|
|
|
if (standardOrdinarySiteDeviceDriver.getOption() == 1) { |
|
|
|
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); |
|
|
|
standardOrdinarySiteDeviceDriver.setOption(0); |
|
|
|
} else { |
|
|
|
log.info("等待一体机进行放货确认,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行放货确认,设备号" + device.getDevice_code() + ",指令号" + ikey); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行放货确认,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.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); |
|
|
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase); |
|
|
|
standardOrdinarySiteDeviceDriver.setIndex(index); |
|
|
|
standardOrdinarySiteDeviceDriver.setInst(inst); |
|
|
|
} else { |
|
|
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
@ -302,103 +280,45 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到指令号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (ObjectUtil.isEmpty(inst.getCarno())) { |
|
|
|
inst.setCarno(String.valueOf(carno)); |
|
|
|
instructionService.update(inst); |
|
|
|
} |
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
|
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); |
|
|
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase); |
|
|
|
standardOrdinarySiteDeviceDriver.setIndex(index); |
|
|
|
standardOrdinarySiteDeviceDriver.setInst(inst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 到达放货点
|
|
|
|
//(Itype=1/2/3,需要WCS反馈)
|
|
|
|
else if (phase == 0x07) { |
|
|
|
if (agvaddr == 0) { |
|
|
|
agvaddr = agvaddr_copy; |
|
|
|
} |
|
|
|
if (agvaddr < 1) { |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.device_code(device_code) |
|
|
|
.content("agv地址参数有误,phase:" + phase) |
|
|
|
.build(); |
|
|
|
logDto.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (agvaddr != 0) { |
|
|
|
CommonFinalParam commonFinalParam = new CommonFinalParam(); |
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { |
|
|
|
String[] point = old_device_code.split(commonFinalParam.getBARRE()); |
|
|
|
device_code = point[0]; |
|
|
|
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { |
|
|
|
String[] point = old_device_code.split("\\."); |
|
|
|
device_code = point[0]; |
|
|
|
emptyNum = point[1]; |
|
|
|
} else { |
|
|
|
device_code = old_device_code; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
|
log.info("未找到指令号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
|
//卸货确认
|
|
|
|
if (standardOrdinarySiteDeviceDriver.getOption() == 2) { |
|
|
|
//放货确认
|
|
|
|
if (standardOrdinarySiteDeviceDriver.getOption() == 1) { |
|
|
|
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst, standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.device_code(this.getDeviceCode()) |
|
|
|
.content("agvphase:" + phase + "反馈:" + data) |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行放货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值:" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.build(); |
|
|
|
logDto.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto); |
|
|
|
standardOrdinarySiteDeviceDriver.setOption(0); |
|
|
|
LuceneLogDto logDto1 = LuceneLogDto.builder() |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行放货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值:" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.build(); |
|
|
|
logDto1.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto1); |
|
|
|
} else { |
|
|
|
log.info("等待一体机进行卸货确认,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey); |
|
|
|
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst.getInstruction_code(), standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行放货确认,设备号" + device.getDevice_code() + ",指令号" + ikey); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行卸货确认,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.content("等待一体机进行放货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值:" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//放货完成
|
|
|
|
//(Itype=1/2/3,需要WCS反馈)
|
|
|
|
else if (phase == 0x09) { |
|
|
|
// 到达放货点
|
|
|
|
//(Itype=1/2/3,需要WCS反馈)
|
|
|
|
else if (phase == 0x07) { |
|
|
|
if (agvaddr == 0) { |
|
|
|
agvaddr = agvaddr_copy; |
|
|
|
} |
|
|
@ -447,11 +367,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase); |
|
|
|
standardOrdinarySiteDeviceDriver.setIndex(index); |
|
|
|
standardOrdinarySiteDeviceDriver.setInst(inst); |
|
|
|
|
|
|
|
} 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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//todo 待完善
|
|
|
|
else if (phase == 0x4D) { |
|
|
|
|
|
|
|
//放货完成
|
|
|
|
//(Itype=1/2/3,需要WCS反馈)
|
|
|
|
else if (phase == 0x09) { |
|
|
|
if (agvaddr == 0) { |
|
|
|
agvaddr = agvaddr_copy; |
|
|
|
} |
|
|
@ -488,80 +419,41 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到指令号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
//通道1
|
|
|
|
Region region = regionService.findByCode("1"); |
|
|
|
if (StrUtil.equals(region.getIs_charge(), CommonFinalParam.ZERO)) { |
|
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
|
//卸货确认
|
|
|
|
if (standardOrdinarySiteDeviceDriver.getOption() == 2) { |
|
|
|
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst.getInstruction_code(), standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.device_code(this.getDeviceCode()) |
|
|
|
.content("agvphase:" + phase + "反馈:" + data) |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行卸货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值:" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.build(); |
|
|
|
logDto.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto); |
|
|
|
region.setIs_charge("1"); |
|
|
|
region.setHas_agv("1"); |
|
|
|
regionService.updateById(region); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
standardOrdinarySiteDeviceDriver.setOption(0); |
|
|
|
LuceneLogDto logDto1 = LuceneLogDto.builder() |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行卸货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值:" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.build(); |
|
|
|
logDto1.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto1); |
|
|
|
|
|
|
|
//todo 待完善
|
|
|
|
else if (phase == 0x4E) { |
|
|
|
if (agvaddr == 0) { |
|
|
|
agvaddr = agvaddr_copy; |
|
|
|
} |
|
|
|
if (agvaddr < 1) { |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.device_code(device_code) |
|
|
|
.content("agv地址参数有误,phase:" + phase) |
|
|
|
.build(); |
|
|
|
logDto.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (agvaddr != 0) { |
|
|
|
CommonFinalParam commonFinalParam = new CommonFinalParam(); |
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { |
|
|
|
String[] point = old_device_code.split(commonFinalParam.getBARRE()); |
|
|
|
device_code = point[0]; |
|
|
|
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { |
|
|
|
String[] point = old_device_code.split("\\."); |
|
|
|
device_code = point[0]; |
|
|
|
emptyNum = point[1]; |
|
|
|
} else { |
|
|
|
device_code = old_device_code; |
|
|
|
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst.getInstruction_code(), standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey); |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|
.instruct_code(inst.getInstruction_code()) |
|
|
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) |
|
|
|
.content("等待一体机进行卸货确认,指令号:" + inst.getInstruction_code() + ",设备号:" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption()) |
|
|
|
.build(); |
|
|
|
logDto.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
|
log.info("未找到指令号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
Region region = regionService.findByCode("1"); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (phase == 0x70) { |
|
|
|
} else if (phase == 0x70) { |
|
|
|
//x坐标
|
|
|
|
x = ikey; |
|
|
|
LuceneLogDto logDto = LuceneLogDto.builder() |
|
|
|