rev 海柔输送线驱动
This commit is contained in:
@@ -73,7 +73,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
private Date instruction_require_time;
|
||||
private Date instruction_require_time = new Date();
|
||||
private int instruction_require_time_out = 30000;
|
||||
boolean requireSucess = false;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记");
|
||||
}
|
||||
if (move != last_move && barcode != last_barcode){
|
||||
if (move != last_move){
|
||||
message = null;
|
||||
requireSucess =false;
|
||||
if (move == 1 && barcode.length() > 0){
|
||||
@@ -110,6 +110,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if(move ==0 && barcode.length()>0 && !requireSucess ){
|
||||
// ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
|
||||
// NodeStates nodeStates = new NodeStates();
|
||||
|
||||
@@ -184,57 +184,78 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
}
|
||||
|
||||
//取关联设备 list
|
||||
//取关联设备 list 要求:先配置外侧的站点
|
||||
//遍历
|
||||
List<String> haiRouDeviceCodeList = this.getExtraDeviceCodes("link_device_code");
|
||||
for(int i=0;i<haiRouDeviceCodeList.size();i++){
|
||||
Device haiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i));
|
||||
for (int i = 0; i < haiRouDeviceCodeList.size(); i++) {
|
||||
Device waiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i));
|
||||
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver;
|
||||
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver_wait;
|
||||
if(haiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
||||
hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) haiRouDevice.getDeviceDriver();
|
||||
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver2;
|
||||
if (waiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
||||
hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) waiRouDevice.getDeviceDriver();
|
||||
//判断对接位当前条码是否有任务,有任务就不合并等待位。
|
||||
TaskDto vehicle_dto = taskServer.findByContainer(hailiangHrSsxDeviceDriver.getBarcode());
|
||||
if (vehicle_dto == null) {
|
||||
//获取关联设备(等待位)
|
||||
String wait_device_code = ObjectUtil.isNotEmpty(haiRouDevice.getExtraValue().get("link_device_code")) ? haiRouDevice.getExtraValue().get("link_device_code").toString() : "";
|
||||
if (StrUtil.isNotEmpty(wait_device_code)) {
|
||||
Device wait_device = deviceAppservice.findDeviceByCode(wait_device_code);
|
||||
if (wait_device != null && wait_device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
||||
hailiangHrSsxDeviceDriver_wait = (HailiangHrSsxDeviceDriver) haiRouDevice.getDeviceDriver();
|
||||
//对接位有货有码后,30秒内等待位也有货有码的话,就一起申请lms任务。否则单独申请任务
|
||||
if (hailiangHrSsxDeviceDriver_wait.getInstruction_require_time().getTime() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime() < (long)this.instruction_require_time_out){
|
||||
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", hailiangHrSsxDeviceDriver_wait.getDevice_code());
|
||||
reqParam.put("vehicle_code_two", hailiangHrSsxDeviceDriver_wait.getBarcode());
|
||||
//向lms请求任务
|
||||
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
requireSucess = true;
|
||||
}
|
||||
}else {
|
||||
//否则对接位单独申请任务
|
||||
JSONObject reqParam = new JSONObject();
|
||||
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
|
||||
//如果设备满足请求条件、并且超过等待时间 则就直接请求
|
||||
if(hailiangHrSsxDeviceDriver.getMove() == 0){
|
||||
requireSucess =false;
|
||||
}
|
||||
if (hailiangHrSsxDeviceDriver.getMode() == 2 &&
|
||||
hailiangHrSsxDeviceDriver.getMove() == 1 &&
|
||||
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver.getBarcode()) &&
|
||||
!requireSucess
|
||||
) {
|
||||
//判断是否超过等待时间
|
||||
if (new Date().getTime() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime()
|
||||
> Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
|
||||
//否则对接位单独申请任务
|
||||
JSONObject reqParam = new JSONObject();
|
||||
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
|
||||
reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code());
|
||||
reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode());
|
||||
//联调时加上
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
// requireSucess = true;
|
||||
// }
|
||||
log.info("单工位请求成功");
|
||||
requireSucess = true;
|
||||
|
||||
reqParam.put("device_code_one", hailiangHrSsxDeviceDriver.getDevice_code());
|
||||
reqParam.put("vehicle_code_one", hailiangHrSsxDeviceDriver.getBarcode());
|
||||
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
} else {
|
||||
//否则判断另一个位置
|
||||
Device neiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i+1));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
//todo 输出不满足的原因
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,48 +1,6 @@
|
||||
<template>
|
||||
<!--标准版-输送机-关联扫码器-->
|
||||
<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">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
|
||||
Reference in New Issue
Block a user