rev ndc执行状态
This commit is contained in:
@@ -12,6 +12,9 @@ import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
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.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -64,6 +67,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
try {
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
@@ -117,12 +121,45 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
if (phase == 0x01) {
|
||||
//开始任务/上报订单号
|
||||
for (Instruction inst : insts) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
instructionService.update(inst);
|
||||
if (ObjectUtil.isNotEmpty(insts)) {
|
||||
Boolean flag = false;
|
||||
Instruction instruction = insts.get(0);
|
||||
TaskDto taskDto = taskService.findByTaskCode(instruction.getTask_code());
|
||||
if (taskDto != null) {
|
||||
List<TaskDto> taskDtos = taskService.findByLinkNumFromCache(taskDto.getLink_num());
|
||||
if (taskDtos != null) {
|
||||
if (taskDtos.size() == 1) {
|
||||
for (Instruction inst : insts) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
instructionService.update(inst);
|
||||
log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
|
||||
flag = true;
|
||||
}
|
||||
} else if (taskDtos.size() == 2) {
|
||||
for (int i = 0; i < insts.size(); i++) {
|
||||
Instruction inst = insts.get(i);
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
instructionService.update(inst);
|
||||
if (i == 1) {
|
||||
flag = true;
|
||||
}
|
||||
log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
|
||||
}
|
||||
// for (Instruction inst : insts) {
|
||||
// inst.setInstruction_status("1");
|
||||
// inst.setAgv_jobno(String.valueOf(index));
|
||||
// instructionService.update(inst);
|
||||
// log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else if (phase == 0x1A) {
|
||||
//任务完毕(无车id及状态
|
||||
// for (Instruction inst : insts) {
|
||||
|
||||
@@ -138,10 +138,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//取满箱任务起点 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -173,11 +175,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//取满箱任务起点 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
//入缓存线任务的起点有专机满料位 出缓存的起点是缓存线
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -209,10 +213,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//双任务-取满箱任务起点2 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -243,10 +249,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//双任务-取满箱任务起点2 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -277,6 +285,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位入到缓存线有到达送满框
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -311,11 +320,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -348,6 +359,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//送满框1 只有满料位到缓存线才有送满框1
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -380,11 +392,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位、缓存线到倒料位、清洗储料仓才有倒料完毕1
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -416,6 +430,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线放满完成后才有到达取空框1 取空框是缓存线才有
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -447,11 +462,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -483,6 +500,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线入库才有取空框1完毕
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -514,6 +532,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达送满框2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -545,6 +564,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到送满框完毕
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -577,6 +597,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达取空框2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -608,6 +629,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达取空框完毕2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -640,11 +662,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -678,10 +702,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有任务都有到达送空框1
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -714,10 +740,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有任务都有到送空框1完毕
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -750,10 +778,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有双任务都有到达送空框2
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -786,10 +816,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有双任务都有送空框完毕2
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -841,7 +873,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x71) {
|
||||
x = ikey;
|
||||
|
||||
@@ -248,8 +248,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
+ "," + two_barcode1 + "," + two_barcode2 + "," + two_barcode3 + "," + two_barcode4 + "," + two_barcode5
|
||||
+ "," + two_barcode6 + "," + two_barcode7 + "," + two_barcode8 + "," + two_barcode9 + "," + two_barcode10
|
||||
+ "," + three_barcode1 + "," + three_barcode2 + "," + three_barcode3 + "," + three_barcode4 + "," + three_barcode5
|
||||
+ "," + three_barcode6 + "," + three_barcode7 + "," + three_barcode8 + "," + three_barcode9 + "," + three_barcode10
|
||||
+ "," + prepare_barcode + "," + prepare_barcode;
|
||||
+ "," + three_barcode6 + "," + three_barcode7 + "," + three_barcode8 + "," + three_barcode9 + "," + three_barcode10;
|
||||
|
||||
if (!StrUtil.equals(material_spec, last_material_spec)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号material_spec:" + last_material_spec + "->" + material_spec);
|
||||
|
||||
@@ -153,6 +153,9 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
||||
}
|
||||
|
||||
if (device_code.equals("A1_XY_50_8_M")) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "进来了........");
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst));
|
||||
|
||||
@@ -569,8 +569,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.equals(type, StatusEnum.PAUSE_TYPE.getCode())) {
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_pause", "1");
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_pause_out_check", "1");
|
||||
} else if (StrUtil.equals(type, StatusEnum.RESUME_TYPE.getCode())) {
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_pause", "0");
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_pause_out_check", "0");
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
@@ -683,8 +685,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> putAction(String jsonObject) throws Exception {
|
||||
log.info("接收WMS下发动作信号,下发参数:{}", JSON.toJSONString(jsonObject));
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
log.info("putAction--------------:输入参数" + datas.toString());
|
||||
HailiangAutoCacheLineDeviceDriver hailiangAutoCacheLineDeviceDriver;
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String device_code = data.getString("device_code");
|
||||
@@ -694,12 +697,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.writing(code, value);
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("putAction--------------:输出参数" + resultJson.toString());
|
||||
log.info("接收WMS暂停或恢复缓存线,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ public interface InstructionService {
|
||||
* @param to_task_type 缓存线任务类型
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> issued(String inst_code, String to_priority_layer, String barcodeArr, String to_task_type,String to_open_check_barcode);
|
||||
public Map<String, Object> issued(String inst_code, String to_priority_layer, String barcodeArr, String to_task_type, String to_open_check_barcode);
|
||||
|
||||
/**
|
||||
* 自动创建指令时,根据任务信息创建指令对象
|
||||
@@ -341,4 +341,11 @@ public interface InstructionService {
|
||||
* @return
|
||||
*/
|
||||
Instruction createInstDtoByTask(TaskDto taskDto, String link_no);
|
||||
|
||||
/**
|
||||
* 取消缓存线指令时清除agv上报信息
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
void removeCacheLinePhase(Instruction dto);
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancel(String id) throws Exception {
|
||||
// flag= true时取消指令
|
||||
boolean flag = false;
|
||||
@@ -958,11 +958,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
entity.setInstruction_status("3");
|
||||
this.update(entity);
|
||||
removeCacheLinePhase(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelByLinkNum(String linkNum) {
|
||||
List<Instruction> insts = this.findByLinkNum(linkNum);
|
||||
if (insts != null) {
|
||||
@@ -978,7 +979,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceCancel(String id) throws Exception {
|
||||
// flag= true时取消指令
|
||||
boolean flag = false;
|
||||
@@ -1020,7 +1021,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceCancelByLinkNum(String linkNum) throws Exception {
|
||||
List<Instruction> insts = this.findByLinkNum(linkNum);
|
||||
if (insts != null) {
|
||||
@@ -1036,6 +1037,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelNoSendAgv(String id) throws Exception {
|
||||
// flag= true时取消指令
|
||||
Instruction entity = this.findById(id);
|
||||
@@ -1415,4 +1417,25 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
instDto.setAgv_system_type(taskDto.getAgv_system_type());
|
||||
return instDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCacheLinePhase(Instruction dto) {
|
||||
if (dto != null) {
|
||||
String start_point_code = dto.getStart_device_code();
|
||||
String next_point_code = dto.getNext_device_code();
|
||||
String put_point_code = dto.getPut_device_code();
|
||||
Device start_device = deviceAppService.findDeviceByCode(start_point_code);
|
||||
Device next_device = deviceAppService.findDeviceByCode(next_point_code);
|
||||
Device put_device = deviceAppService.findDeviceByCode(put_point_code);
|
||||
HailiangAutoCacheLineDeviceDriver hailiangAutoCacheLineDeviceDriver;
|
||||
if (put_device != null && put_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) put_device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(0, 0, null);
|
||||
}
|
||||
if (start_device != null && next_device != null && start_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver && next_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) start_device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(0, 0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,11 +412,11 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
Object obj = accessor_value.getValue(relate);
|
||||
sb.append("key:" + relate + "value:" + obj + ";");
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||
//lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||
|
||||
} else {
|
||||
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class LuceneIndexWriter {
|
||||
private static IndexWriter indexWriter;
|
||||
private static volatile IndexWriter indexWriter;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -27,16 +27,16 @@ public class LuceneIndexWriter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**当当前线程结束时,自动关闭IndexWriter,使用Runtime对象*/
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
closeIndexWriter();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Runtime.getRuntime().addShutdownHook(new Thread(){
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// closeIndexWriter();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
/**在线程结束时,自动关闭IndexWriter*/
|
||||
public static IndexWriter getIndexWriter() {
|
||||
@@ -47,7 +47,7 @@ public class LuceneIndexWriter {
|
||||
* @throws CorruptIndexException */
|
||||
public static void closeIndexWriter() throws Exception {
|
||||
if(indexWriter != null) {
|
||||
indexWriter.close();
|
||||
// indexWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("建立索引共耗时{}毫秒", endTime - startTime);
|
||||
indexWriter.commit();
|
||||
MDC.put("DEVICECODE", luceneLogDto.getDevice_code());
|
||||
// MDC.put("DEVICECODE", luceneLogDto.getDevice_code());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.acsEnum.AgvTypeEnum;
|
||||
@@ -47,6 +48,9 @@ public class AutoCreateInst {
|
||||
//查询所有诺宝AGV任务
|
||||
List<TaskDto> list = taskService.queryAll("task_status = '0' and agv_system_type = '1' ");
|
||||
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
//根据LINK_NUM分组任务
|
||||
Map<String, List<TaskDto>> link_num_tasks = Optional
|
||||
.ofNullable(list)
|
||||
@@ -77,7 +81,6 @@ public class AutoCreateInst {
|
||||
if (StrUtil.equals(taskDto.getIs_send(), StatusEnum.NO_SEND.getCode())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//生产指令关联编号
|
||||
String link_no = CodeUtil.getNewCode("LINK_NO");
|
||||
|
||||
@@ -96,7 +99,6 @@ public class AutoCreateInst {
|
||||
taskService.update(taskDto);
|
||||
|
||||
} else if (tasks.size() == TASK_SIZE_2) {
|
||||
|
||||
//生产指令关联编号
|
||||
String link_no = CodeUtil.getNewCode("LINK_NO");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user