This commit is contained in:
loujf
2022-08-22 13:25:44 +08:00
parent ce7da68064
commit fb888a0f5b
4 changed files with 148 additions and 23 deletions

View File

@@ -1,5 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
@@ -21,7 +23,10 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.exception.WDKException;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -180,7 +185,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
break;
case 4:
//申请入窑
if(move ==1 && !requireSucess && StrUtil.isNotEmpty(this.barcode)){
if(move == 1 && !requireSucess && StrUtil.isNotEmpty(this.barcode)){
applyIn();
}
break;
@@ -190,6 +195,12 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
outKiln();
}
break;
// case 6:
// //入货架扫码
// if (!requireSucess && this.move != 0 && StrUtil.isNotEmpty(this.barcode)) {
// intoKiln();
// }
// break;
}
switch (flag) {
@@ -250,6 +261,39 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
}
}
/**
* 入货架扫码
*
* @param
*/
public synchronized boolean intoKiln() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
Instruction inst = instructionService.findByCode(String.valueOf(task));
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("task_code",inst.getTask_code());
HttpResponse result = acsToWmsService.applyIntoKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
this.writing(1);
this.setRequireSucess(true);
}
}
return true;
}
}
/**
* 申请出窑
*
@@ -409,6 +453,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
@@ -417,6 +462,18 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
} else if (this.getMode() == 4) {
mode = "申请入窑";
} else if (this.getMode() == 5) {
mode = "申请出窑";
}
if (this.getMove() == 0) {
move = "无货";
} else if (this.getMove() == 1) {
move = "有货";
} else if (this.getMove() == 2) {
move = "有托盘有货";
}
jo.put("device_name", this.getDevice().getDevice_name());

View File

@@ -768,6 +768,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
mandatoryPalletizing("1");
}
break;
case 12:
//申请空盘入库
if (!requireSucess) {
applyEmptyIn();
}
}
switch (flag) {
@@ -1314,6 +1319,38 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
}
}
/**
* 申请空盘入库
*
* @param
*/
public synchronized boolean applyEmptyIn() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(getStation-1).replace("\"",""));
json.put("type","3");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
return true;
}
}
public boolean exe_business() {
return true;
}
@@ -1366,9 +1403,55 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
jo.put("device_code", device.getDevice_code());
jo.put("mode", this.getMode());
jo.put("status", this.getStatus());
String mode = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
} else if (this.getMode() == 4) {
mode = "人工排产确认";
} else if (this.getMode() == 5) {
mode = "获取托盘信息";
} else if (this.getMode() == 6) {
mode = "码垛完成";
} else if (this.getMode() == 7) {
mode = "码垛强制完成";
} else if (this.getMode() == 8) {
mode = "申请空盘";
} else if (this.getMode() == 9) {
mode = "工单完成";
} else if (this.getMode() == 10) {
mode = "叫料";
} else if (this.getMode() == 11) {
mode = "强制去包装";
} else if (this.getMode() == 12) {
mode = "申请空盘入库";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
String onoff_status = "";
if (this.getOnoff_status() == 1) {
onoff_status = "关机";
} else if (this.getOnoff_status() == 2) {
onoff_status = "开机";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("onoff_status", onoff_status);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("putStation", this.getPut_station());
@@ -1380,7 +1463,6 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
jo.put("production_time", this.getProduction_time());
jo.put("error_time", this.getError_time());
jo.put("order_No", this.getOrder_No());
jo.put("onoff_status", this.getOnoff_status());
jo.put("getStation", this.getGetStation());
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());

View File

@@ -97,7 +97,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="关联下料设备" prop="device_code">
<el-form-item label="关联设备" prop="device_code">
<el-select
v-model="form.link_device_code"
filterable
@@ -112,21 +112,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联上料设备" prop="device_code" label-width="200">
<el-select
v-model="form.link_device_code2"
multiple
filterable
reserveKeyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
@@ -312,8 +297,7 @@ export default {
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: [],
link_device_code2: []
link_device_code: []
},
rules: {}
}

View File

@@ -38,6 +38,7 @@
<span>设备绑定</span>
<el-select
filterable
clearable
v-model="style.device"
size="mini"
@change="$_changeDevice"
@@ -70,6 +71,7 @@
<span>设备选择</span>
<el-select
filterable
clearable
v-model="style.imageUrl"
size="mini"
@change="$_changeImageUrl"