add: 添加AGV进入离开烘箱区域反馈,下发管芯托盘信息
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -10,6 +11,8 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -27,9 +30,13 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
@@ -52,6 +59,11 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
boolean bConnected = true;
|
||||
|
||||
boolean isReConnect = false;
|
||||
int i = 1 ;
|
||||
boolean requireSucessRegion = false;
|
||||
boolean requireSucessTake = false;
|
||||
boolean requireSucessPut = false;
|
||||
|
||||
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
@@ -195,7 +207,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
|
||||
agvNdcTwoDeviceDriver.setInstruction(null);
|
||||
}else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.setInstruction(null);
|
||||
}
|
||||
@@ -231,18 +243,47 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
standardAutodoorDeviceDriver.writing("to_open", "1");
|
||||
standardAutodoorDeviceDriver.writing("to_close", "0");
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) {
|
||||
log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}else {
|
||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region");
|
||||
if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
|
||||
String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code");
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
|
||||
OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
|
||||
String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ?
|
||||
"two" : Integer.parseInt(region) == 3 ? "three" : null;
|
||||
Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
|
||||
String regionCode = "region_" + s;
|
||||
String s1 = Integer.parseInt(region) == 1 ? "2" : Integer.parseInt(region) == 2 ?
|
||||
"6" : Integer.parseInt(region) == 3 ? "8" : null;
|
||||
if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
|
||||
hxhj.writing("to_"+regionCode, s1);
|
||||
log.info("下发AGV进入区域{}信号值为:{}", region, s1);
|
||||
} else {
|
||||
log.info("区域{}信号{}未清除,导致不满足下发AGV进入区域信号", region, regionCode);
|
||||
}
|
||||
if (hxhj.getMode() == 2 && StrUtil.isNotEmpty(s1) && ((Integer) aClass.getField(regionCode).get(hxhj) == 2)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
requireSucessRegion = true;
|
||||
} else {
|
||||
log.error("AGV进入区域{}信号{}行架未接收{},请检查;或行架正在执行中:{}", region, regionCode,s1, hxhj.getMode());
|
||||
}
|
||||
} else {
|
||||
log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
standardAutodoorDeviceDriver.writing("to_open", "1");
|
||||
standardAutodoorDeviceDriver.writing("to_close", "0");
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) {
|
||||
log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -257,19 +298,50 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
standardAutodoorDeviceDriver.writing("to_close", "1");
|
||||
standardAutodoorDeviceDriver.writing("to_open", "0");
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region");
|
||||
if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
|
||||
String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code");
|
||||
if(requireSucessTake || requireSucessPut){
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
|
||||
OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
|
||||
String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ?
|
||||
"two" : Integer.parseInt(region) == 3 ? "three" : null;
|
||||
Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
|
||||
String regionCode = "region_" + s;
|
||||
if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) {
|
||||
hxhj.writing("to_"+regionCode, "0");
|
||||
log.info("下发AGV离开区域{}信号值为:{}", region, 0);
|
||||
} else {
|
||||
log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", region, regionCode);
|
||||
}
|
||||
if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
requireSucessPut = false;
|
||||
requireSucessTake = false;
|
||||
} else {
|
||||
log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", region, regionCode, hxhj.getMode());
|
||||
}
|
||||
} else {
|
||||
log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode);
|
||||
}
|
||||
}else{
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
standardAutodoorDeviceDriver.writing("to_close", "1");
|
||||
standardAutodoorDeviceDriver.writing("to_open", "0");
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else {
|
||||
log.info(device_code + "对应设备号为空!");
|
||||
}
|
||||
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
@@ -283,6 +355,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcTwoDeviceDriver.processSocket(arr);
|
||||
if(phase == 0x05 && "3".equals(inst.getInstruction_type()) && requireSucessRegion){
|
||||
requireSucessPut = true;
|
||||
requireSucessRegion = false;
|
||||
}else if(phase == 0x0E && "8".equals(inst.getInstruction_type()) && requireSucessRegion){
|
||||
requireSucessTake = true;
|
||||
requireSucessRegion = false;
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.processSocket(arr);
|
||||
@@ -298,12 +377,10 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("agv上报不是0073类型动作,不处理");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1543,7 +1544,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(5);
|
||||
TaskDto byTaskCode = taskService.findByTaskCode(inst.getTask_code());
|
||||
Map map = new HashMap();
|
||||
if(StrUtil.isNotEmpty(byTaskCode.getInteraction_json())){
|
||||
String interaction_json = byTaskCode.getInteraction_json();
|
||||
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
|
||||
String to_material = jsonObject.getString("to_material");
|
||||
String to_spec = jsonObject.getString("to_spec");
|
||||
String to_qty = jsonObject.getString("to_qty");
|
||||
map.put("to_command",5);
|
||||
map.put("to_material",to_material);
|
||||
map.put("to_spec",to_spec);
|
||||
map.put("to_qty",to_qty);
|
||||
paperTubePickSiteDeviceDriver.writing(map);
|
||||
}else{
|
||||
map.put("to_command",5);
|
||||
paperTubePickSiteDeviceDriver.writing(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,13 @@ public class ItemProtocol {
|
||||
public static String item_x_position = "x";
|
||||
//y轴坐标
|
||||
public static String item_y_position = "y";
|
||||
//区域一
|
||||
public static String item_region_one = "region_one";
|
||||
//区域二
|
||||
public static String item_region_two = "region_two";
|
||||
//区域三
|
||||
public static String item_region_three = "region_three";
|
||||
|
||||
|
||||
//下发命令
|
||||
public static String item_to_command = "to_command";
|
||||
@@ -37,6 +44,12 @@ public class ItemProtocol {
|
||||
public static String item_to_onset = "to_onset";
|
||||
//下发目标站
|
||||
public static String item_to_target = "to_target";
|
||||
//下发区域一
|
||||
public static String item_to_region_one = "to_region_one";
|
||||
//下发区域二
|
||||
public static String item_to_region_two = "to_region_two";
|
||||
//下发区域三
|
||||
public static String item_to_region_three = "to_region_three";
|
||||
//下发任务号
|
||||
public static String item_to_task = "to_task";
|
||||
|
||||
@@ -82,6 +95,30 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
public int getTo_region_one() {
|
||||
return this.getOpcIntegerValue(item_to_region_one);
|
||||
}
|
||||
|
||||
public int getTo_region_two() {
|
||||
return this.getOpcIntegerValue(item_to_region_two);
|
||||
}
|
||||
|
||||
public int getTo_region_three() {
|
||||
return this.getOpcIntegerValue(item_to_region_three);
|
||||
}
|
||||
|
||||
public int getRegion_one() {
|
||||
return this.getOpcIntegerValue(item_region_one);
|
||||
}
|
||||
|
||||
public int getRegion_two() {
|
||||
return this.getOpcIntegerValue(item_region_two);
|
||||
}
|
||||
|
||||
public int getRegion_three() {
|
||||
return this.getOpcIntegerValue(item_region_three);
|
||||
}
|
||||
|
||||
public int getTo_task() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
@@ -150,6 +187,9 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10"));
|
||||
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14"));
|
||||
list.add(new ItemDto(item_region_one, "区域一", "DB1.REAL18"));
|
||||
list.add(new ItemDto(item_region_two, "区域二", "DB1.REAL22"));
|
||||
list.add(new ItemDto(item_region_three, "区域三", "DB1.REAL26"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -159,6 +199,9 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2"));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
|
||||
list.add(new ItemDto(item_to_region_one, "下发区域一", "DB2.D6"));
|
||||
list.add(new ItemDto(item_to_region_two, "下发区域二", "DB2.D6"));
|
||||
list.add(new ItemDto(item_to_region_three, "下发区域三", "DB2.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,19 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int last_heartbeat = 0;
|
||||
int to_command = 0;
|
||||
int last_to_command = 0;
|
||||
public int region_one = 0;
|
||||
public int last_region_one = 0;
|
||||
public int region_two = 0;
|
||||
public int last_region_two = 0;
|
||||
public int region_three = 0;
|
||||
public int last_region_three = 0;
|
||||
public int to_region_one = 0;
|
||||
public int last_to_region_one = 0;
|
||||
public int to_region_two = 0;
|
||||
public int last_to_region_two = 0;
|
||||
public int to_region_three = 0;
|
||||
public int last_to_region_three = 0;
|
||||
|
||||
|
||||
int to_target = 0;
|
||||
int last_to_target = 0;
|
||||
@@ -183,6 +196,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
to_onset = this.itemProtocol.getTo_onset();
|
||||
x_position = this.itemProtocol.getX_position();
|
||||
y_position = this.itemProtocol.getY_position();
|
||||
region_one = this.itemProtocol.getRegion_one();
|
||||
region_two = this.itemProtocol.getRegion_two();
|
||||
region_three = this.itemProtocol.getRegion_three();
|
||||
to_region_one = this.itemProtocol.getTo_region_one();
|
||||
to_region_two = this.itemProtocol.getTo_region_two();
|
||||
to_region_three = this.itemProtocol.getTo_region_three();
|
||||
iserror = this.itemProtocol.device_status;
|
||||
|
||||
if (mode != last_mode) {
|
||||
@@ -262,6 +281,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
last_to_onset = to_onset;
|
||||
last_x_position = x_position;
|
||||
last_y_position = y_position;
|
||||
last_region_one = region_one;
|
||||
last_region_two = region_two;
|
||||
last_region_three = region_three;
|
||||
|
||||
}
|
||||
|
||||
public List<TaskDto> sortTask(List<TaskDto> taskDtos) {
|
||||
|
||||
@@ -50,11 +50,45 @@
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电气调度号" label-width="150px">
|
||||
<el-switch v-model="form.OPCServer" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="选择区域" prop="region">
|
||||
<el-select
|
||||
v-model="form.region"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in region"
|
||||
:key="item.region_number"
|
||||
:label="item.region_name"
|
||||
:value="item.region_number"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关联设备" prop="device_code" label-width="135px">
|
||||
<el-select
|
||||
v-model="form.link_device_code"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_name"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
@@ -161,6 +195,7 @@ import {
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
|
||||
@@ -184,6 +219,7 @@ export default {
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
deviceList: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
@@ -195,7 +231,12 @@ export default {
|
||||
is_pickup: true,
|
||||
is_release: true
|
||||
},
|
||||
rules: {}
|
||||
rules: {},
|
||||
region: [
|
||||
{ region_name: '区域一', region_number: '1' },
|
||||
{ region_name: '区域二', region_number: '2' },
|
||||
{ region_name: '区域三', region_number: '3' }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -234,6 +275,9 @@ export default {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user