fix 纸管库

This commit is contained in:
USER-20220102CG\noblelift
2023-04-26 19:00:36 +08:00
parent e158d84afb
commit 6b5d0b4473
3 changed files with 47 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ public class ItemProtocol {
public static String item_inventory_qty ="inventory_qty";
public static String item_out_finish = "out_finish";
public static String item_material = "material";
public static String item_error = "error";
public static String item_to_target = "to_target";
@@ -48,6 +49,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_out_finish);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
@@ -100,6 +105,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_inventory_qty, "库存数量", "DB101.W4"));
list.add(new ItemDto(item_out_finish, "出库完成 ", "DB101.W6"));
list.add(new ItemDto(item_material, "物料", "DB101.STRING8.50"));
list.add(new ItemDto(item_error, "error ", "DB101.W58"));
return list;
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.paper_tube_device;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -12,6 +13,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -63,6 +65,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
int mode = 0;
int inventory_qty =0;
int out_finish =0;
int error =0;
String material = null;
Boolean isonline = true;
@@ -75,6 +78,7 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
int last_mode = 0;
int last_inventory_qty =0;
int last_out_finish =0;
int last_error = 0;
String last_material = null;
String device_code;
@@ -97,25 +101,45 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
inventory_qty = this.itemProtocol.getInventory_qty();
out_finish =this.itemProtocol.getOut_finish();
material = this.itemProtocol.getMaterial();
error = this.itemProtocol.getError();
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
} else {
this.setIsonline(true);
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (inventory_qty != last_inventory_qty) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号inventory_qty" + last_inventory_qty + "->" + inventory_qty);
}
if (out_finish != last_out_finish) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号out_finish" + last_out_finish + "->" + out_finish);
}
if (!StrUtil.equals(material,last_material)) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号material" + last_material + "->" + material);
}
if (error != last_error) {
if(error > 0){
this.setIserror(true);
} else {
if(error > 0){
this.setIserror(false);
}
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号out_finish" + last_out_finish + "->" + out_finish);
}
if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
} else {
this.setIsonline(true);
this.setIserror(false);
}
last_mode = mode;
last_inventory_qty = inventory_qty;
last_out_finish = out_finish;
last_error = error;
last_material = material;
}
@@ -155,9 +179,11 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError())));
jo.put("inventory_qty", inventory_qty);
jo.put("out_finish", out_finish);
jo.put("material", material);
jo.put("isOnline", this.getIsonline());
return jo;
}