rev 海柔输送线驱动

This commit is contained in:
USER-20220102CG\noblelift
2023-11-22 13:31:45 +08:00
parent 1954538af6
commit d34baf0cce
3 changed files with 62 additions and 82 deletions

View File

@@ -73,7 +73,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
Boolean isonline = true; Boolean isonline = true;
String message = null; String message = null;
Boolean iserror = false; Boolean iserror = false;
private Date instruction_require_time; private Date instruction_require_time = new Date();
private int instruction_require_time_out = 30000; private int instruction_require_time_out = 30000;
boolean requireSucess = false; boolean requireSucess = false;
@@ -100,7 +100,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
if (mode != last_mode) { if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记"); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
} }
if (move != last_move && barcode != last_barcode){ if (move != last_move){
message = null; message = null;
requireSucess =false; requireSucess =false;
if (move == 1 && barcode.length() > 0){ if (move == 1 && barcode.length() > 0){
@@ -110,6 +110,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
} }
} }
// if(move ==0 && barcode.length()>0 && !requireSucess ){ // if(move ==0 && barcode.length()>0 && !requireSucess ){
// ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest(); // ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
// NodeStates nodeStates = new NodeStates(); // NodeStates nodeStates = new NodeStates();

View File

@@ -184,57 +184,78 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
} }
} }
//取关联设备 list //取关联设备 list 要求:先配置外侧的站点
//遍历 //遍历
List<String> haiRouDeviceCodeList = this.getExtraDeviceCodes("link_device_code"); List<String> haiRouDeviceCodeList = this.getExtraDeviceCodes("link_device_code");
for(int i=0;i<haiRouDeviceCodeList.size();i++){ for (int i = 0; i < haiRouDeviceCodeList.size(); i++) {
Device haiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i)); Device waiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i));
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver; HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver;
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver_wait; HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver2;
if(haiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) { if (waiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) haiRouDevice.getDeviceDriver(); hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) waiRouDevice.getDeviceDriver();
//判断对接位当前条码是否有任务,有任务就不合并等待位。 //判断对接位当前条码是否有任务,有任务就不合并等待位。
TaskDto vehicle_dto = taskServer.findByContainer(hailiangHrSsxDeviceDriver.getBarcode()); TaskDto vehicle_dto = taskServer.findByContainer(hailiangHrSsxDeviceDriver.getBarcode());
if (vehicle_dto == null) { if (vehicle_dto == null) {
//获取关联设备(等待位) //如果设备满足请求条件、并且超过等待时间 则就直接请求
String wait_device_code = ObjectUtil.isNotEmpty(haiRouDevice.getExtraValue().get("link_device_code")) ? haiRouDevice.getExtraValue().get("link_device_code").toString() : ""; if(hailiangHrSsxDeviceDriver.getMove() == 0){
if (StrUtil.isNotEmpty(wait_device_code)) { requireSucess =false;
Device wait_device = deviceAppservice.findDeviceByCode(wait_device_code); }
if (wait_device != null && wait_device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) { if (hailiangHrSsxDeviceDriver.getMode() == 2 &&
hailiangHrSsxDeviceDriver_wait = (HailiangHrSsxDeviceDriver) haiRouDevice.getDeviceDriver(); hailiangHrSsxDeviceDriver.getMove() == 1 &&
//对接位有货有码后30秒内等待位也有货有码的话就一起申请lms任务。否则单独申请任务 ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver.getBarcode()) &&
if (hailiangHrSsxDeviceDriver_wait.getInstruction_require_time().getTime() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime() < (long)this.instruction_require_time_out){ !requireSucess
JSONObject reqParam = new JSONObject(); ) {
//半成品库任务 //判断是否超过等待时间
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode()); if (new Date().getTime() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime()
//具体海柔出入库任务类型 > Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
reqParam.put("item_type", DeviceEnum.getTypeByCode(hailiangHrSsxDeviceDriver.getDevice_code())); //否则对接位单独申请任务
reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code()); JSONObject reqParam = new JSONObject();
reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode()); reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("device_code_two", hailiangHrSsxDeviceDriver_wait.getDevice_code()); reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code());
reqParam.put("vehicle_code_two", hailiangHrSsxDeviceDriver_wait.getBarcode()); reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode());
//向lms请求任务 //联调时加上
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam); // HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { // if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true; // requireSucess = true;
} // }
}else { log.info("单工位请求成功");
//否则对接位单独申请任务 requireSucess = true;
JSONObject reqParam = new JSONObject();
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code()); } else {
reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode()); //否则判断另一个位置
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam); Device neiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i+1));
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (neiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
hailiangHrSsxDeviceDriver2 = (HailiangHrSsxDeviceDriver) neiRouDevice.getDeviceDriver();
if (hailiangHrSsxDeviceDriver2.getMode() == 2 &&
hailiangHrSsxDeviceDriver2.getMove() == 1 &&
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver2.getBarcode())
) {
JSONObject reqParam = new JSONObject();
//半成品库任务
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
//具体海柔出入库任务类型
reqParam.put("item_type", DeviceEnum.getTypeByCode(hailiangHrSsxDeviceDriver.getDevice_code()));
reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code());
reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode());
reqParam.put("device_code_two", hailiangHrSsxDeviceDriver2.getDevice_code());
reqParam.put("vehicle_code_two", hailiangHrSsxDeviceDriver2.getBarcode());
//向lms请求任务
// 联调时加上
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// }
log.info("双工位请求成功");
requireSucess = true; requireSucess = true;
} }
} }
} }
} else {
//todo 输出不满足的原因
} }
} }
} }
} }

View File

@@ -1,48 +1,6 @@
<template> <template>
<!--标准版-输送机-关联扫码器--> <!--标准版-输送机-关联扫码器-->
<div> <div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span">输送系统</span> <span class="role-span">输送系统</span>