add 包装码垛机械手工位

This commit is contained in:
USER-20220102CG\noblelift
2023-05-04 16:13:34 +08:00
parent 993b2c6944
commit cdd4592594
18 changed files with 3437 additions and 203 deletions

View File

@@ -57,7 +57,10 @@ public enum DriverTypeEnum {
LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "嘉耐-码垛机械手工位", "station"),
LNSH_ONE_RGV(55, "lnsh_one_rgv", "嘉耐单工位RGV", "rgv");
LNSH_ONE_RGV(55, "lnsh_one_rgv", "嘉耐单工位RGV", "rgv"),
LNSH_PACKAGE_PALLETIZING_MANIPULATOR_SITE(56, "lnsh_package_palletizing_manipulator_site", "嘉耐-包装码垛机械手工位", "station");
//驱动索引
private int index;

View File

@@ -1,11 +1,13 @@
package org.nl.acs.device_driver.driver;
import lombok.extern.slf4j.Slf4j;
import org.jinterop.dcom.common.JIException;
import org.nl.acs.ext.wms.data.JsonUtl;
import org.nl.acs.opc.*;
import org.nl.exception.WDKException;
import org.nl.modules.udw.UnifiedDataAccessor;
import org.nl.modules.udw.UnifiedDataAccessorFactory;
import org.nl.modules.udw.UnifiedDataAppService;
import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.AddFailedException;
import org.openscada.opc.lib.da.Group;
@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
@Slf4j
public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver {
UnifiedDataAccessor opcUdw;
@@ -38,7 +41,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
public void checkcontrol(Map<String, Object> itemValues) throws JIException, AddFailedException {
public void checkcontrol(Map<String, Object> itemValues) throws Exception {
Group group = opcServerService.getServer(this.getOpcServer());
Map<String, Object> write = new HashMap();
Map<String, Item> readitems = new LinkedHashMap();
@@ -134,11 +137,13 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
sb.append(":");
sb.append(JsonUtl.parseWithoutException(udw_value));
sb.append(";");
// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
// need_write = true;
// }
if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
need_write = true;
} else {
log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
}
}
need_write = true;
// need_write = true;
if (need_write) {
Date date = new Date();
@@ -149,9 +154,9 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
this.last_items = this_items;
this.sendTime = date;
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);

View File

@@ -27,7 +27,7 @@ public interface OpcDeviceDriver extends DeviceDriver {
//设备扩展表【acs_device_extra】
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
JSONArray arr = extraTab.query("filed_type='02' and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0);
JSONArray arr = extraTab.query(" (filed_type='02' or filed_type='03' )and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0);
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
OpcItemDto dto = new OpcItemDto();

View File

@@ -74,7 +74,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
int last_container_type = 0;
int barcode = 0;
int last_barcode = 0;
int to_command =0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
@@ -127,6 +127,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
barcode = this.itemProtocol.getBarcode();
hasGoods = this.itemProtocol.getMove();
container_type = this.itemProtocol.getContainer_type();
to_command = this.itemProtocol.getToCommand();
if (mode != last_mode) {
this.setRequireSucess(false);

View File

@@ -344,6 +344,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (mode != last_mode) {
this.setRequireSucess(false);
this.setResultSucess(false);
if(mode ==2 ){
this.writing(0);
}
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code,"","","信号mode" + last_mode + "->" + mode);
}
@@ -685,7 +688,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
log.debug("设备运转模式:等待工作");
return;
case 2:
this.writing(0);
break;
case 4:
//排产单确认

View File

@@ -0,0 +1,984 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_palletizing_manipulator_site;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_ioaction = "ioaction";
public static String item_error = "error";
public static String item_task = "task";
public static String item_weight = "weight";
public static String item_barcode = "barcode";
public static String item_material = "material";
public static String item_qty = "qty";
public static String item_batch = "batch";
public static String item_specifications = "specifications";
public static String item_open_time = "open_time";
public static String item_standby_time = "standby_time";
public static String item_production_time = "production_time";
public static String item_error_time = "error_time";
public static String item_order_No = "order_No";
public static String item_order_qty = "order_qty";
public static String item_total_split = "total_split";
public static String item_xContainer_length = "xContainer_length";
public static String item_yContainer_length = "yContainer_length";
public static String item_container_getQty = "container_getQty";
public static String item_getX_offset = "getX_offset";
public static String item_getY_offset = "getY_offset";
public static String item_product_code = "product_code";
public static String item_AlongSide = "AlongSide";
public static String item_BshortSide = "BshortSide";
public static String item_Htrapezoidal = "Htrapezoidal";
public static String item_Wthickness = "Wthickness";
public static String item_tray_qty = "tray_qty";
public static String item_tray_high = "tray_high";
public static String item_crib_category = "crib_category";
public static String item_palletX1_line = "palletX1_line";
public static String item_palletY1_row = "palletY1_row";
public static String item_palletA1_angle = "palletA1_angle";
public static String item_palletX2_line = "palletX2_line";
public static String item_palletY2_row = "palletY2_row";
public static String item_palletA2_angle = "palletA2_angle";
public static String item_palletX3_line = "palletX3_line";
public static String item_palletY3_row = "palletY3_row";
public static String item_palletA3_angle = "palletA3_angle";
public static String item_pressCribX1_line = "pressCribX1_line";
public static String item_pressCribY1_row = "pressCribY1_row";
public static String item_pressCribA1_angle = "pressCribA1_angle";
public static String item_pressCribX2_line = "pressCribX2_line";
public static String item_pressCribY2_row = "pressCribY2_row";
public static String item_pressCribA2_angle = "pressCribA2_angle";
public static String item_pressCribX3_line = "pressCribX3_line";
public static String item_pressCribY3_row = "pressCribY3_row";
public static String item_pressCribA3_angle = "pressCribA3_angle";
public static String item_Zoffset = "Zoffset";
public static String item_pallet_layerQty = "pallet_layerQty";
public static String item_pressCrib_layerQty = "pressCrib_layerQty";
public static String item_codeLayerX1_interval = "codeLayerX1_interval";
public static String item_codeLayerY1_interval = "codeLayerY1_interval";
public static String item_codeLayerX2_interval = "codeLayerX2_interval";
public static String item_codeLayerY2_interval = "codeLayerY2_interval";
public static String item_codeLayerX3_interval = "codeLayerX3_interval";
public static String item_codeLayerY3_interval = "codeLayerY3_interval";
public static String item_codeLayerX1_offset = "codeLayerX1_offset";
public static String item_codeLayerY1_offset = "codeLayerY1_offset";
public static String item_codeLayerX2_offset = "codeLayerX2_offset";
public static String item_codeLayerY2_offset = "codeLayerY2_offset";
public static String item_codeLayerX3_offset = "codeLayerX3_offset";
public static String item_codeLayerY3_offset = "codeLayerY3_offset";
public static String item_pressLayerX1_interval = "pressLayerX1_interval";
public static String item_pressLayerY1_interval = "pressLayerY1_interval";
public static String item_pressLayerX2_interval = "pressLayerX2_interval";
public static String item_pressLayerY2_interval = "pressLayerY2_interval";
public static String item_pressLayerX3_interval = "pressLayerX3_interval";
public static String item_pressLayerY3_interval = "pressLayerY3_interval";
public static String item_pressLayerX1_offset = "pressLayerX1_offset";
public static String item_pressLayerY1_offset = "pressLayerY1_offset";
public static String item_pressLayerX2_offset = "pressLayerX2_offset";
public static String item_pressLayerY2_offset = "pressLayerY2_offset";
public static String item_pressLayerX3_offset = "pressLayerX3_offset";
public static String item_pressLayerY3_offset = "pressLayerY3_offset";
public static String item_one_cribTotal = "one_cribTotal";
public static String item_two_cribTotal = "two_cribTotal";
public static String item_one_qty = "one_qty";
public static String item_two_qty = "two_qty";
public static String item_tool_coordinate = "tool_coordinate";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_to_barcode = "to_barcode";
public static String item_to_feedback = "to_feedback";
public static String item_to_error = "to_error";
public static String item_to_material_qty = "to_material_qty";
public static String item_to_allow_pallet_qty = "to_allow_pallet_qty";
public static String item_to_material_type = "to_material_type";
public static String item_to_material_code = "to_material_code";
public static String item_to_order_No = "to_order_No";
public static String item_to_order_qty = "to_order_qty";
public static String item_to_product_code = "to_product_code";
public static String item_to_AlongSide = "to_AlongSide";
public static String item_to_BshortSide = "to_BshortSide";
public static String item_to_Htrapezoidal = "to_Htrapezoidal";
public static String item_to_Wthickness = "to_Wthickness";
public static String item_to_tray_qty = "to_tray_qty";
public static String item_to_tray_high = "to_tray_high";
public static String item_to_crib_category = "to_crib_category";
public static String item_to_palletX1_line = "to_palletX1_line";
public static String item_to_palletY1_row = "to_palletY1_row";
public static String item_to_palletA1_angle = "to_palletA1_angle";
public static String item_to_palletX2_line = "to_palletX2_line";
public static String item_to_palletY2_row = "to_palletY2_row";
public static String item_to_palletA2_angle = "to_palletA2_angle";
public static String item_to_palletX3_line = "to_palletX3_line";
public static String item_to_palletY3_row = "to_palletY3_row";
public static String item_to_palletA3_angle = "to_palletA3_angle";
public static String item_to_pressCribX1_line = "to_pressCribX1_line";
public static String item_to_pressCribY1_row = "to_pressCribY1_row";
public static String item_to_pressCribA1_angle = "to_pressCribA1_angle";
public static String item_to_pressCribX2_line = "to_pressCribX2_line";
public static String item_to_pressCribY2_row = "to_pressCribY2_row";
public static String item_to_pressCribA2_angle = "to_pressCribA2_angle";
public static String item_to_pressCribX3_line = "to_pressCribX3_line";
public static String item_to_pressCribY3_row = "to_pressCribY3_row";
public static String item_to_pressCribA3_angle = "to_pressCribA3_angle";
public static String item_to_Zoffset = "to_Zoffset";
public static String item_to_pallet_layerQty = "to_pallet_layerQty";
public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty";
public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval";
public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval";
public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval";
public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval";
public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval";
public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval";
public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset";
public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset";
public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset";
public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset";
public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset";
public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset";
public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval";
public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval";
public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval";
public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval";
public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval";
public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval";
public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset";
public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset";
public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset";
public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset";
public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset";
public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset";
public static String item_to_one_cribTotal = "to_one_cribTotal";
public static String item_to_two_cribTotal = "to_two_cribTotal";
public static String item_to_one_qty = "to_one_qty";
public static String item_to_two_qty = "to_two_qty";
public static String item_to_tool_coordinate = "to_tool_coordinate";
public static String item_to_xContainer_length = "to_xContainer_length";
public static String item_to_yContainer_length = "to_yContainer_length";
public static String item_to_container_getQty = "to_container_getQty";
public static String item_to_getX_offset = "to_getX_offset";
public static String item_to_getY_offset = "to_getY_offset";
Boolean isonline;
private LnshPackagePalletizingManipulatorSiteDeviceDriver driver;
public ItemProtocol(LnshPackagePalletizingManipulatorSiteDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getIoAction() {
return this.getOpcIntegerValue(item_ioaction);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getBarcode() {
return this.getOpcIntegerValue(item_barcode);
}
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
public int getQty() {
return this.getOpcIntegerValue(item_qty);
}
public String getSpecifications() {
return this.getOpcStringValue(item_specifications);
}
public int getBatch() {
return this.getOpcIntegerValue(item_batch);
}
public int getOpen_time() {
return this.getOpcIntegerValue(item_open_time);
}
public int getStandby_time() {
return this.getOpcIntegerValue(item_standby_time);
}
public int getProduction_time() {
return this.getOpcIntegerValue(item_production_time);
}
public int getError_time() {
return this.getOpcIntegerValue(item_error_time);
}
public String getOrder_No() {
return this.getOpcStringValue(item_order_No);
}
public int getTotal_split() {
return this.getOpcIntegerValue(item_total_split);
}
public int getOrder_qty() {
return this.getOpcIntegerValue(item_order_qty);
}
public int getXContainer_length() {
return this.getOpcIntegerValue(item_xContainer_length);
}
public int getYContainer_length() {
return this.getOpcIntegerValue(item_yContainer_length);
}
public int getContainer_getQty() {
return this.getOpcIntegerValue(item_container_getQty);
}
public int getGetX_offset() {
return this.getOpcIntegerValue(item_getX_offset);
}
public int getGetY_offset() {
return this.getOpcIntegerValue(item_getY_offset);
}
public int getProduct_code() {
return this.getOpcIntegerValue(item_product_code);
}
public int getAlongSide() {
return this.getOpcIntegerValue(item_AlongSide);
}
public int getBshortSide() {
return this.getOpcIntegerValue(item_BshortSide);
}
public int getHtrapezoidal() {
return this.getOpcIntegerValue(item_Htrapezoidal);
}
public int getWthickness() {
return this.getOpcIntegerValue(item_Wthickness);
}
public int getTray_qty() {
return this.getOpcIntegerValue(item_tray_qty);
}
public int getTray_high() {
return this.getOpcIntegerValue(item_tray_high);
}
public int getCrib_category() {
return this.getOpcIntegerValue(item_crib_category);
}
public int getPalletX1_line() {
return this.getOpcIntegerValue(item_palletX1_line);
}
public int getPalletY1_row() {
return this.getOpcIntegerValue(item_palletY1_row);
}
public int getPalletA1_angle() {
return this.getOpcIntegerValue(item_palletA1_angle);
}
public int getPalletX2_line() {
return this.getOpcIntegerValue(item_palletX2_line);
}
public int getPalletY2_row() {
return this.getOpcIntegerValue(item_palletY2_row);
}
public int getPalletA2_angle() {
return this.getOpcIntegerValue(item_palletA2_angle);
}
public int getPalletX3_line() {
return this.getOpcIntegerValue(item_palletX3_line);
}
public int getPalletY3_row() {
return this.getOpcIntegerValue(item_palletY3_row);
}
public int getPalletA3_angle() {
return this.getOpcIntegerValue(item_palletA3_angle);
}
public int getPressCribX1_line() {
return this.getOpcIntegerValue(item_pressCribX1_line);
}
public int getPressCribY1_row() {
return this.getOpcIntegerValue(item_pressCribY1_row);
}
public int getPressCribA1_angle() {
return this.getOpcIntegerValue(item_pressCribA1_angle);
}
public int getPressCribX2_line() {
return this.getOpcIntegerValue(item_pressCribX2_line);
}
public int getPressCribY2_row() {
return this.getOpcIntegerValue(item_pressCribY2_row);
}
public int getPressCribA2_angle() {
return this.getOpcIntegerValue(item_pressCribA2_angle);
}
public int getPressCribX3_line() {
return this.getOpcIntegerValue(item_pressCribX3_line);
}
public int getPressCribY3_row() {
return this.getOpcIntegerValue(item_pressCribY3_row);
}
public int getPressCribA3_angle() {
return this.getOpcIntegerValue(item_pressCribA3_angle);
}
public int getZoffset() {
return this.getOpcIntegerValue(item_Zoffset);
}
public int getPallet_layerQty() {
return this.getOpcIntegerValue(item_pallet_layerQty);
}
public int getPressCrib_layerQty() {
return this.getOpcIntegerValue(item_pressCrib_layerQty);
}
public int getCodeLayerX1_interval() {
return this.getOpcIntegerValue(item_codeLayerX1_interval);
}
public int getCodeLayerY1_interval() {
return this.getOpcIntegerValue(item_codeLayerY1_interval);
}
public int getCodeLayerX2_interval() {
return this.getOpcIntegerValue(item_codeLayerX2_interval);
}
public int getCodeLayerY2_interval() {
return this.getOpcIntegerValue(item_codeLayerY2_interval);
}
public int getCodeLayerX3_interval() {
return this.getOpcIntegerValue(item_codeLayerX3_interval);
}
public int getcodeLayerY3_interval() {
return this.getOpcIntegerValue(item_codeLayerY3_interval);
}
public int getCodeLayerX1_offset() {
return this.getOpcIntegerValue(item_codeLayerX1_offset);
}
public int getCodeLayerY1_offset() {
return this.getOpcIntegerValue(item_codeLayerY1_offset);
}
public int getCodeLayerX2_offset() {
return this.getOpcIntegerValue(item_codeLayerX2_offset);
}
public int getCodeLayerY2_offset() {
return this.getOpcIntegerValue(item_codeLayerY2_offset);
}
public int getCodeLayerX3_offset() {
return this.getOpcIntegerValue(item_codeLayerX3_offset);
}
public int getCodeLayerY3_offset() {
return this.getOpcIntegerValue(item_codeLayerY3_offset);
}
public int getPressLayerX1_interval() {
return this.getOpcIntegerValue(item_pressLayerX1_interval);
}
public int getPressLayerY1_interval() {
return this.getOpcIntegerValue(item_pressLayerY1_interval);
}
public int getPressLayerX2_interval() {
return this.getOpcIntegerValue(item_pressLayerX2_interval);
}
public int getPressLayerY2_interval() {
return this.getOpcIntegerValue(item_pressLayerY2_interval);
}
public int getPressLayerX3_interval() {
return this.getOpcIntegerValue(item_pressLayerX3_interval);
}
public int getPressLayerY3_interval() {
return this.getOpcIntegerValue(item_pressLayerY3_interval);
}
public int getPressLayerX1_offset() {
return this.getOpcIntegerValue(item_pressLayerX1_offset);
}
public int getPressLayerY1_offset() {
return this.getOpcIntegerValue(item_pressLayerY1_offset);
}
public int getPressLayerX2_offset() {
return this.getOpcIntegerValue(item_pressLayerX2_offset);
}
public int getPressLayerY2_offset() {
return this.getOpcIntegerValue(item_pressLayerY2_offset);
}
public int getPressLayerX3_offset() {
return this.getOpcIntegerValue(item_pressLayerX3_offset);
}
public int getPressLayerY3_offset() {
return this.getOpcIntegerValue(item_pressLayerY3_offset);
}
public int getOne_cribTotal() {
return this.getOpcIntegerValue(item_one_cribTotal);
}
public int getTwo_cribTotal() {
return this.getOpcIntegerValue(item_two_cribTotal);
}
public int getOne_qty() {
return this.getOpcIntegerValue(item_one_qty);
}
public int getTwo_qty() {
return this.getOpcIntegerValue(item_two_qty);
}
public int getTool_coordinate() {
return this.getOpcIntegerValue(item_tool_coordinate);
}
public int getTo_feedback() {
return this.getOpcIntegerValue(item_to_feedback);
}
public int getTo_error() {
return this.getOpcIntegerValue(item_to_error);
}
public int getTo_material_qty() {
return this.getOpcIntegerValue(item_to_material_qty);
}
public int getTo_allow_pallet_qty() {
return this.getOpcIntegerValue(item_to_allow_pallet_qty);
}
public int getTo_material_type() {
return this.getOpcIntegerValue(item_to_material_type);
}
public String getTo_material_code() {
return this.getOpcStringValue(item_to_material_code);
}
public String getTo_order_No() {
return this.getOpcStringValue(item_to_order_No);
}
public int getToProduct_code() {
return this.getOpcIntegerValue(item_to_product_code);
}
public int getToAlongSide() {
return this.getOpcIntegerValue(item_to_AlongSide);
}
public int getToBshortSide() {
return this.getOpcIntegerValue(item_to_BshortSide);
}
public int getToHtrapezoidal() {
return this.getOpcIntegerValue(item_to_Htrapezoidal);
}
public int getToWthickness() {
return this.getOpcIntegerValue(item_to_Wthickness);
}
public int getToTray_qty() {
return this.getOpcIntegerValue(item_to_tray_qty);
}
public int getToTray_high() {
return this.getOpcIntegerValue(item_to_tray_high);
}
public int getToCrib_category() {
return this.getOpcIntegerValue(item_to_crib_category);
}
public int getToPalletX1_line() {
return this.getOpcIntegerValue(item_to_palletX1_line);
}
public int getToPalletY1_row() {
return this.getOpcIntegerValue(item_to_palletY1_row);
}
public int getToPalletA1_angle() {
return this.getOpcIntegerValue(item_to_palletA1_angle);
}
public int getToPalletX2_line() {
return this.getOpcIntegerValue(item_to_palletX2_line);
}
public int getToPalletY2_row() {
return this.getOpcIntegerValue(item_to_palletY2_row);
}
public int getToPalletA2_angle() {
return this.getOpcIntegerValue(item_to_palletA2_angle);
}
public int getToPalletX3_line() {
return this.getOpcIntegerValue(item_to_palletX3_line);
}
public int getToPalletY3_row() {
return this.getOpcIntegerValue(item_to_palletY3_row);
}
public int getToPalletA3_angle() {
return this.getOpcIntegerValue(item_to_palletA3_angle);
}
public int getToPressCribX1_line() {
return this.getOpcIntegerValue(item_to_pressCribX1_line);
}
public int getToPressCribY1_row() {
return this.getOpcIntegerValue(item_to_pressCribY1_row);
}
public int getToPressCribA1_angle() {
return this.getOpcIntegerValue(item_to_pressCribA1_angle);
}
public int getToPressCribX2_line() {
return this.getOpcIntegerValue(item_to_pressCribX2_line);
}
public int getToPressCribY2_row() {
return this.getOpcIntegerValue(item_to_pressCribY2_row);
}
public int getToPressCribA2_angle() {
return this.getOpcIntegerValue(item_to_pressCribA2_angle);
}
public int getToPressCribX3_line() {
return this.getOpcIntegerValue(item_to_pressCribX3_line);
}
public int getToPressCribY3_row() {
return this.getOpcIntegerValue(item_to_pressCribY3_row);
}
public int getToPressCribA3_angle() {
return this.getOpcIntegerValue(item_to_pressCribA3_angle);
}
public int getToZoffset() {
return this.getOpcIntegerValue(item_to_Zoffset);
}
public int getToPallet_layerQty() {
return this.getOpcIntegerValue(item_to_pallet_layerQty);
}
public int getToPressCrib_layerQty() {
return this.getOpcIntegerValue(item_to_pressCrib_layerQty);
}
public int getToCodeLayerX1_interval() {
return this.getOpcIntegerValue(item_to_codeLayerX1_interval);
}
public int getToCodeLayerY1_interval() {
return this.getOpcIntegerValue(item_to_codeLayerY1_interval);
}
public int getToCodeLayerX2_interval() {
return this.getOpcIntegerValue(item_to_codeLayerX2_interval);
}
public int getToCodeLayerY2_interval() {
return this.getOpcIntegerValue(item_to_codeLayerY2_interval);
}
public int getToCodeLayerX3_interval() {
return this.getOpcIntegerValue(item_to_codeLayerX3_interval);
}
public int getTocodeLayerY3_interval() {
return this.getOpcIntegerValue(item_to_codeLayerY3_interval);
}
public int getToCodeLayerX1_offset() {
return this.getOpcIntegerValue(item_to_codeLayerX1_offset);
}
public int getToCodeLayerY1_offset() {
return this.getOpcIntegerValue(item_to_codeLayerY1_offset);
}
public int getToCodeLayerX2_offset() {
return this.getOpcIntegerValue(item_to_codeLayerX2_offset);
}
public int getToCodeLayerY2_offset() {
return this.getOpcIntegerValue(item_to_codeLayerY2_offset);
}
public int getToCodeLayerX3_offset() {
return this.getOpcIntegerValue(item_to_codeLayerX3_offset);
}
public int getToCodeLayerY3_offset() {
return this.getOpcIntegerValue(item_to_codeLayerY3_offset);
}
public int getToPressLayerX1_interval() {
return this.getOpcIntegerValue(item_to_pressLayerX1_interval);
}
public int getToPressLayerY1_interval() {
return this.getOpcIntegerValue(item_to_pressLayerY1_interval);
}
public int getToPressLayerX2_interval() {
return this.getOpcIntegerValue(item_to_pressLayerX2_interval);
}
public int getToPressLayerY2_interval() {
return this.getOpcIntegerValue(item_to_pressLayerY2_interval);
}
public int getToPressLayerX3_interval() {
return this.getOpcIntegerValue(item_to_pressLayerX3_interval);
}
public int getToPressLayerY3_interval() {
return this.getOpcIntegerValue(item_to_pressLayerY3_interval);
}
public int getToPressLayerX1_offset() {
return this.getOpcIntegerValue(item_to_pressLayerX1_offset);
}
public int getToPressLayerY1_offset() {
return this.getOpcIntegerValue(item_to_pressLayerY1_offset);
}
public int getToPressLayerX2_offset() {
return this.getOpcIntegerValue(item_to_pressLayerX2_offset);
}
public int getToPressLayerY2_offset() {
return this.getOpcIntegerValue(item_to_pressLayerY2_offset);
}
public int getToPressLayerX3_offset() {
return this.getOpcIntegerValue(item_to_pressLayerX3_offset);
}
public int getToPressLayerY3_offset() {
return this.getOpcIntegerValue(item_to_pressLayerY3_offset);
}
public int getToOne_cribTotal() {
return this.getOpcIntegerValue(item_to_one_cribTotal);
}
public int getToTwo_cribTotal() {
return this.getOpcIntegerValue(item_to_two_cribTotal);
}
public int getToOne_qty() {
return this.getOpcIntegerValue(item_to_one_qty);
}
public int getToTwo_qty() {
return this.getOpcIntegerValue(item_to_two_qty);
}
public int getToTool_coordinate() {
return this.getOpcIntegerValue(item_to_tool_coordinate);
}
public int getTo_order_qty() {
return this.getOpcIntegerValue(item_to_order_qty);
}
public int getToXContainer_length() {
return this.getOpcIntegerValue(item_to_xContainer_length);
}
public int getToYContainer_length() {
return this.getOpcIntegerValue(item_to_yContainer_length);
}
public int getToContainer_getQty() {
return this.getOpcIntegerValue(item_to_container_getQty);
}
public int getToGetX_offset() {
return this.getOpcIntegerValue(item_to_getX_offset);
}
public int getToGetY_offset() {
return this.getOpcIntegerValue(item_to_getY_offset);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
//是否有货
public int hasGoods(int move) {
return move;
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isBlank(value)) {
} else {
return value;
}
return "";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB58.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB58.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电信号", "DB58.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB58.B3"));
list.add(new ItemDto(item_ioaction, "进出信号", "DB58.B4"));
list.add(new ItemDto(item_error, "故障代码", "DB58.B5"));
list.add(new ItemDto(item_task, "任务号", "DB58.D6"));
list.add(new ItemDto(item_weight, "重量", "DB112.D10"));
list.add(new ItemDto(item_batch, "批次", "DB112.D14"));
list.add(new ItemDto(item_specifications, "规格", "DB112.STRING18.256"));
list.add(new ItemDto(item_material, "物料", "DB112.STRING274.256"));
list.add(new ItemDto(item_barcode, "条码", "DB112.W530"));
list.add(new ItemDto(item_product_code, "产品编号", "DB58.W788"));
list.add(new ItemDto(item_AlongSide, "A长边", "DB58.W790"));
list.add(new ItemDto(item_BshortSide, "B短边", "DB58.W792"));
list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB58.W794"));
list.add(new ItemDto(item_Wthickness, "W厚度", "DB58.W796"));
list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB58.W798"));
list.add(new ItemDto(item_tray_high, "垛盘高度", "DB58.W800"));
list.add(new ItemDto(item_crib_category, "垛型类别", "DB58.W802"));
list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB58.W804"));
list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB58.W806"));
list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB58.W808"));
list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB58.W810"));
list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB58.W812"));
list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB58.W814"));
list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB58.W816"));
list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB58.W818"));
list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB58.W820"));
list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB58.W822"));
list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB58.W824"));
list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB58.W826"));
list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB58.W828"));
list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB58.W830"));
list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB58.W832"));
list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB58.W834"));
list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB58.W836"));
list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB58.W838"));
list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB58.W840"));
list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB58.W842"));
list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB58.W844"));
list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB58.W846"));
list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB58.W848"));
list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB58.W850"));
list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB58.W852"));
list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB58.W854"));
list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB58.W856"));
list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB58.W858"));
list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB58.W860"));
list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB58.W862"));
list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB58.W864"));
list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB58.W866"));
list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB58.W868"));
list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB58.W870"));
list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB58.W872"));
list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB58.W874"));
list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB58.W876"));
list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB58.W878"));
list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB58.W880"));
list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB58.W882"));
list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB58.W884"));
list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB58.W886"));
list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB58.W888"));
list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB58.W890"));
list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB58.W892"));
list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB58.W894"));
list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB58.W896"));
list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB58.W898"));
list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB58.W900"));
list.add(new ItemDto(item_xContainer_length, "1#X托盘长度", "DB58.W902"));
list.add(new ItemDto(item_yContainer_length, "1#Y托盘长度", "DB58.W904"));
list.add(new ItemDto(item_container_getQty, "1#托盘抓取数", "DB58.W906"));
list.add(new ItemDto(item_getX_offset, "1#抓取X偏移", "DB58.W908"));
list.add(new ItemDto(item_getY_offset, "1#抓取Y偏移", "DB58.W910"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB59.W0", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "DB59.W2"));
list.add(new ItemDto(item_to_task, "任务号", "DB59.D4"));
list.add(new ItemDto(item_to_barcode, "条码", "DB59.W8"));
list.add(new ItemDto(item_to_material_type, "托盘类型", "DB59.D264"));
list.add(new ItemDto(item_to_product_code, "产品编号", "DB59.W266"));
list.add(new ItemDto(item_to_AlongSide, "A长边", "DB59.W268"));
list.add(new ItemDto(item_to_BshortSide, "B短边", "DB59.W270"));
list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB59.W272"));
list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB59.W274"));
list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB59.W276"));
list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB59.W278"));
list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB59.W280"));
list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB59.W282"));
list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB59.W284"));
list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB59.W286"));
list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB59.W288"));
list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB59.W290"));
list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB59.W292"));
list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB59.W294"));
list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB59.W296"));
list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB59.W298"));
list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB59.W300"));
list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB59.W302"));
list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB59.W304"));
list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB59.W306"));
list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB59.W308"));
list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB59.W310"));
list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB59.W312"));
list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB59.W314"));
list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB59.W316"));
list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB59.W318"));
list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB59.W320"));
list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB59.W322"));
list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB59.W324"));
list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB59.W326"));
list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB59.W328"));
list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB59.W330"));
list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB59.W332"));
list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB59.W334"));
list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB59.W336"));
list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB59.W338"));
list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB59.W340"));
list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB59.W342"));
list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB59.W344"));
list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB59.W346"));
list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB59.W348"));
list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB59.W350"));
list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB59.W352"));
list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB59.W354"));
list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB59.W356"));
list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB59.W358"));
list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB59.W360"));
list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB59.W362"));
list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB59.W364"));
list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB59.W366"));
list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB59.W368"));
list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB59.W370"));
list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB59.W372"));
list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB59.W374"));
list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB59.W376"));
list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB59.W378"));
list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB59.W380"));
list.add(new ItemDto(item_to_order_qty, "工单数量", "DB59.W382"));
list.add(new ItemDto(item_to_xContainer_length, "1#X托盘长度", "DB59.W384"));
list.add(new ItemDto(item_to_yContainer_length, "1#Y托盘长度", "DB59.W386"));
list.add(new ItemDto(item_to_container_getQty, "1#托盘抓取数", "DB59.W388"));
list.add(new ItemDto(item_to_getX_offset, "1#抓取X偏移", "DB59.W390"));
list.add(new ItemDto(item_to_getY_offset, "1#抓取Y偏移", "DB59.W392"));
return list;
}
}

View File

@@ -0,0 +1,63 @@
package org.nl.acs.device_driver.lnsh.lnsh_package_palletizing_manipulator_site;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 嘉耐-包装码垛机械手工位
*
*/
@Service
public class LnshPackagePalletizingManipulatorSiteDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "lnsh_package_palletizing_manipulator_site";
}
@Override
public String getDriverName() {
return "嘉耐-包装码垛机械手工位";
}
@Override
public String getDriverDescription() {
return "嘉耐-包装码垛机械手工位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new LnshPackagePalletizingManipulatorSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return LnshPackagePalletizingManipulatorSiteDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.station);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -62,6 +62,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int action;
int io_action;
int task = 0;
int to_command = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
@@ -167,7 +168,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
encoder_qty = this.itemProtocol.getEncoder_qty();
status = this.itemProtocol.getStatus();
unqualified_qty = this.itemProtocol.getUnqualified_qty();
to_command = this.itemProtocol.getToCommand();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));

View File

@@ -117,7 +117,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
int last_Wthickness = 0;
int batch = 0;
int last_batch = 0;
int to_command =0;
int status = 0;
int last_status = 0;
@@ -164,6 +164,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
encoder_qty = this.itemProtocol.getEncoder_qty();
status = this.itemProtocol.getStatus();
unqualified_qty = this.itemProtocol.getUnqualified_qty();
to_command = this.itemProtocol.getToCommand();
if (mode != last_mode) {
this.setRequireSucess(false);

View File

@@ -113,6 +113,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
int container_type =0;
int batch = 0;
int last_batch = 0;
int to_command =0;
@Override
public Device getDevice() {
@@ -139,6 +140,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
batch = this.itemProtocol.getBatch();
specifications = this.itemProtocol.getSpecifications();
container_type = itemProtocol.getContainer_type();
to_command = this.itemProtocol.getToCommand();
if (mode != last_mode) {
this.setRequireSucess(false);
if (last_mode == 11) {

View File

@@ -353,6 +353,9 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
if (mode != last_mode) {
this.setRequireSucess(false);
this.setResultSucess(false);
if(mode ==2 ){
this.writing(0);
}
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code,"","","信号mode" + last_mode + "->" + mode);
}
@@ -707,7 +710,6 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
log.debug("设备运转模式:等待工作");
return;
case 2:
this.writing(0);
break;
case 4:
//排产单确认

View File

@@ -22,6 +22,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
String message;
int maxResartNum;
private Server server;
private Group group;
boolean flag = false;
private int all_null;
private Map<String, OpcItemDto> itemSearchCache;
@@ -52,12 +53,12 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
private OpcItemDto getItem(String item) {
OpcItemDto x = (OpcItemDto)this.itemSearchCache.get(item);
OpcItemDto x = (OpcItemDto) this.itemSearchCache.get(item);
if (x == null) {
Iterator var3 = this.protocols.iterator();
while(var3.hasNext()) {
OpcItemDto dto = (OpcItemDto)var3.next();
while (var3.hasNext()) {
OpcItemDto dto = (OpcItemDto) var3.next();
if (StrUtil.equals(item, dto.getItem_code())) {
x = dto;
this.itemSearchCache.put(item, dto);
@@ -80,18 +81,28 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
}
private void runOld() {
while(true) {
while (true) {
start:
try {
if (this.group != null) {
group.clear();
group.remove();
log.trace("{} 清理group{}");
}
if (this.server != null) {
server.disconnect();
log.trace("{} server{}");
}
this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
this.server.addStateListener(this);
Group group = this.server.addGroup();
group = this.server.addGroup();
List<String> itemsString = new ArrayList();
Iterator var3 = this.protocols.iterator();
while(var3.hasNext()) {
OpcItemDto protocol = (OpcItemDto)var3.next();
while (var3.hasNext()) {
OpcItemDto protocol = (OpcItemDto) var3.next();
String item = protocol.getItem_code();
itemsString.add(item);
}
@@ -101,8 +112,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
StringBuilder err_message = new StringBuilder();
Iterator var6 = itemsString.iterator();
while(var6.hasNext()) {
String string = (String)var6.next();
while (var6.hasNext()) {
String string = (String) var6.next();
try {
Item item = group.addItem(string);
@@ -137,13 +148,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
boolean time_out = false;
while(DeviceOpcSynchronizeAutoRun.isRun) {
while (DeviceOpcSynchronizeAutoRun.isRun) {
long begin = System.currentTimeMillis();
if (log.isTraceEnabled()) {
log.trace("{} 开始记时{}", tag, DateUtil.now());
}
Map<Item, ItemState> itemStatus = group.read(true, (Item[])itemsMap.values().toArray(new Item[0]));
Map<Item, ItemState> itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
long end = System.currentTimeMillis();
long duration = end - begin;
if (log.isTraceEnabled()) {
@@ -164,9 +175,9 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
Set<Item> items = itemStatus.keySet();
Iterator var18 = items.iterator();
while(var18.hasNext()) {
Item item = (Item)var18.next();
ItemState itemState = (ItemState)itemStatus.get(item);
while (var18.hasNext()) {
Item item = (Item) var18.next();
ItemState itemState = (ItemState) itemStatus.get(item);
Object value = OpcUtl.getValue(item, itemState);
if (value != null) {
valueAllNotNull = true;
@@ -194,7 +205,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
log.trace("{} 计算完成耗时{}", tag, end - begin);
}
ThreadUtl.sleep((long)OpcConfig.synchronized_millisecond);
ThreadUtl.sleep((long) OpcConfig.synchronized_millisecond);
if (this.error_num != 0) {
this.error_num = 0;
this.message = null;
@@ -204,35 +215,27 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
int random = (new Random()).nextInt(10) + 1;
random *= 1000;
if (this.all_null < 3) {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空,暂定{}s", tag, 5000 + random);
}
ThreadUtl.sleep((long)(5000 + random));
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,5000 + random);
ThreadUtl.sleep((long) (5000 + random));
} else if (this.all_null < 6) {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空,暂定{}s", tag, 30000 + random);
}
ThreadUtl.sleep((long)(30000 + random));
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,30000 + random);
ThreadUtl.sleep((long) (1000 + random));
log.warn("重新创建server");
break start;
} else if (this.all_null < 12) {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空,暂定{}ms", tag, '\uea60' + random);
}
ThreadUtl.sleep((long)('\uea60' + random));
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random);
ThreadUtl.sleep((long) ('\uea60' + random));
} else {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空,暂定{}ms", tag, 120000 + random);
}
ThreadUtl.sleep((long)(120000 + random));
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random);
ThreadUtl.sleep((long) (120000 + random));
}
++this.all_null;
} else {
this.all_null = 0;
}
// break start;
}
log.warn("opc线程停止。。。");
@@ -256,17 +259,16 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
log.warn(error_message, var27);
}
ThreadUtl.sleep((long)(OpcConfig.synchronized_exception_wait_second * 1000));
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
++this.error_num;
if (this.error_num > 3 && !StrUtil.equals(this.message, error_message)) {
this.message = error_message;
this.message = error_message;
}
}
}
}
private void runNew() {
Async20Access accessor = null;
@@ -363,19 +365,10 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
accessor_value.setValue(itemId, value);
// if (value != null) {
// if (log.isTraceEnabled()) {
// log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
// }
// } else if (log.isInfoEnabled()) {
// log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()});
// }
log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
OpcItemDto itemDto = this.getItem(itemId);
// if (Boolean.TRUE.equals(itemDto.getNeed_log())) {
// this.logItemChanged(itemId, accessor_value, value, itemDto);
// }
this.logItemChanged(itemId, accessor_value, value, itemDto);
} catch (Exception var7) {
@@ -396,11 +389,14 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
Object obj = accessor_value.getValue(relate);
sb.append("key:" + relate + "value:" + obj + ";");
}
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(),itemId, his, value, sb});
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb});
if(!itemId.endsWith("heartbeat") || !itemId.endsWith("time") ) {
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb});
}
} else {
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(),itemId, his, value});
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value});
if(!itemId.endsWith("heartbeat") || !itemId.endsWith("time") ) {
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value});
}
}
}

View File

@@ -13,7 +13,7 @@ public interface OpcServerService {
void reload();
Group getServer(String var1);
Group getServer(String var1) throws Exception;
void writeInteger(String var1, ItemValue... var2);

View File

@@ -1,5 +1,6 @@
package org.nl.acs.opc;
import cn.hutool.core.util.StrUtil;
import org.jinterop.dcom.common.JIException;
import org.nl.acs.device_driver.driver.ItemValue;
import org.nl.exception.WDKException;
@@ -65,79 +66,86 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
this.opcServerManageDtos = Collections.synchronizedMap(this.opcServerManageDtos);
}
public synchronized Group getServer(String code) {
Group group = null;
group = (Group) this.groups.get(code);
if (group != null) {
try {
if (group.isActive()) {
return group;
public synchronized Group getServer(String code) throws Exception {
synchronized(this.buildLock(code)) {
Group group = null;
group = (Group)this.groups.get(code);
if (group != null) {
label68: {
Group var10000;
try {
if (!group.isActive()) {
break label68;
}
var10000 = group;
} catch (JIException var14) {
log.error(code, var14);
break label68;
}
return var10000;
}
} catch (JIException var9) {
var9.printStackTrace();
}
}
Server server = (Server) this.servers.get(code);
boolean needcreate = false;
if (server == null) {
needcreate = true;
} else {
try {
group = server.findGroup(OpcConfig.opc_server_default_group);
} catch (UnknownHostException
| JIException
| UnknownGroupException
| NotConnectedException
| IllegalArgumentException var8) {
var8.printStackTrace();
Server server = (Server)this.servers.get(code);
boolean needcreate = false;
String groupName = code;
if (server == null) {
needcreate = true;
} else {
try {
group = server.findGroup(groupName);
} catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) {
log.error(code, var13);
needcreate = true;
}
}
if (needcreate) {
OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code);
if (dto == null) {
throw new Exception(code + "{} 不存在");
}
if (server == null) {
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
}
try {
group = server.addGroup(groupName);
} catch (Exception var12) {
this.clearServer(code);
ThreadUtl.sleep(5000L);
log.warn("获取opc出错重新获取", code, var12);
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
try {
group = server.addGroup(groupName);
} catch (Exception var11) {
throw new Exception(var12);
}
}
this.servers.put(code, server);
this.groups.put(code, group);
}
return group;
}
if (needcreate) {
OpcServerManageDto dto = (OpcServerManageDto) this.opcServerManageDtos.get(code);
if (dto == null) {
throw new WDKException("code 不存在");
}
server = OpcServerUtl.getServerWithOutException(
dto.getOpc_host(),
dto.getCls_id(),
dto.getUser(),
dto.getPassword(),
dto.getDomain());
// server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
try {
group = server.addGroup(OpcConfig.opc_server_default_group);
} catch (Exception var7) {
throw new WDKException(var7);
}
this.servers.put(code, server);
this.groups.put(code, group);
}
return group;
}
public synchronized void clearServer(String code) {
try {
Server server = (Server) this.servers.get(code);
if (server!=null){
public void clearServer(String code) {
synchronized(this.buildLock(code)) {
try {
Server server = (Server)this.servers.get(code);
server.disconnect();
} catch (Exception var5) {
}
} catch (Exception e) {
e.printStackTrace();
log.error("清理server异常,",e.getMessage());
this.servers.remove(code);
this.groups.remove(code);
}
this.servers.remove(code);
this.groups.remove(code);
}
public void writeInteger(String code, ItemValue... values) {
@@ -148,7 +156,17 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
this.clearServer(code);
log.warn("写入出错opc server {} 重新加载", code, var4);
ThreadUtl.sleep(5000L);
throw var4;
}
}
private String buildLock(String key) {
if (StrUtil.isEmpty(key)) {
key = "";
}
StringBuilder builder = new StringBuilder();
builder.append("OpcServerService.");
builder.append(key);
String lock = builder.toString().intern();
return lock;
}
}

View File

@@ -163,15 +163,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
logServer.deviceExecuteLog("ndc", "","","接收agv上报设备" + device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
StandardStorageDeviceDriver standardStorageDeviceDriver;
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver;
LnshStationDeviceDriver lnshStationDeviceDriver;
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
try {
@@ -241,9 +238,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
lnshStationDeviceDriver.writing(5);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshStationDeviceDriver.writing(5);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshStationDeviceDriver.getTo_command() == 5 ){
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于5,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈");
}
@@ -255,9 +261,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
lnshPalletizingManipulatorSiteDeviceDriver.writing(12);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorSiteDeviceDriver.writing(12);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 12 ){
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于12,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈");
}
@@ -269,9 +285,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
lnshPalletizingManipulatorDeviceDriver.writing(12);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorDeviceDriver.writing(12);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 12 ){
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于12,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈");
}
@@ -338,11 +363,16 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (lnshStationDeviceDriver.getMove() == 0 && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("5");
instructionService.update(inst);
lnshStationDeviceDriver.writing(2);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
if(lnshStationDeviceDriver.getTo_command() == 2 ){
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于2,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈");
}
@@ -351,11 +381,23 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("5");
instructionService.update(inst);
lnshPalletizingManipulatorSiteDeviceDriver.writing(10);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorSiteDeviceDriver.writing(10);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 10 ){
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于10,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈");
}
@@ -367,28 +409,27 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (lnshPalletizingManipulatorDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("5");
instructionService.update(inst);
lnshPalletizingManipulatorDeviceDriver.writing(10);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorDeviceDriver.writing(10);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 10 ){
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于10,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈");
}
}
// if(!inst.getTask_code().startsWith("-")) {
// //反馈wms系统动作完成
// inst.setFinish_type("1");
// instructionService.update(inst);
// JSONObject feedjo = new JSONObject();
// feedjo.put("status","1");
// feedjo.put("device_code",device_code);
// feedjo.put("vehicle_code",inst.getVehicle_code());
// feedjo.put("task_code",inst.getTask_code());
// JSONArray feedja = JSONArray.parseArray(String.valueOf(feedjo));
// acsToWmsService.feedbackActionStatusToWms(feedja);
// }
}
// 到达扫码点
else if (phase == 0x06) {
@@ -404,12 +445,31 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (lnshLaminatingMachineDeviceDriver.getMode() != 0 && lnshLaminatingMachineDeviceDriver.getMode() != 6) {
inst.setExecute_status("9");
instructionService.update(inst);
lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code());
lnshLaminatingMachineDeviceDriver.writing(1);
try {
lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code());
lnshLaminatingMachineDeviceDriver.writing(1);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
}
//如果组盘绑定条码成功就允许agv离开
if (lnshLaminatingMachineDeviceDriver.getMode() == 6 && lnshLaminatingMachineDeviceDriver.getResult()) {
lnshLaminatingMachineDeviceDriver.writing(6);
try {
lnshLaminatingMachineDeviceDriver.writing(6);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
// if(lnshLaminatingMachineDeviceDriver.getTo_command() == 6 ){
// inst.setExecute_status("5");
// instructionService.update(inst);
// data = AgvService.sendAgvOneModeInst(phase, index, 0);
// flag = true;
// } else {
// logServer.deviceExecuteLog("ndc","","","组盘绑定条码成功发命令不等于6,无法反馈");
// }
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
@@ -458,10 +518,23 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (lnshStationDeviceDriver.getMode() != 0 && lnshStationDeviceDriver.getMove() == 0
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("3");
instructionService.update(inst);
lnshStationDeviceDriver.writing(6);
lnshStationDeviceDriver.writing("to_task",inst.getInstruction_code());
try {
lnshStationDeviceDriver.writing(6);
lnshStationDeviceDriver.writing("to_task",inst.getInstruction_code());
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshStationDeviceDriver.getTo_command() == 6 ){
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于6,无法反馈");
}
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
@@ -473,11 +546,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("3");
instructionService.update(inst);
lnshPalletizingManipulatorSiteDeviceDriver.writing(13);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorSiteDeviceDriver.writing(13);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 13 ){
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于13,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈");
}
@@ -487,11 +569,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorDeviceDriver.getMove() == 0
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("3");
instructionService.update(inst);
lnshPalletizingManipulatorDeviceDriver.writing(13);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorDeviceDriver.writing(13);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 13 ){
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于13,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈");
}
@@ -540,11 +631,21 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (lnshStationDeviceDriver.getMove() == 1
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshStationDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshStationDeviceDriver.writing(3);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshStationDeviceDriver.getTo_command() == 3 ){
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于3,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈");
}
@@ -555,11 +656,21 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 1
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshPalletizingManipulatorSiteDeviceDriver.writing(11);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorSiteDeviceDriver.writing(11);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 11 ){
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于11,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈");
}
@@ -570,11 +681,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorDeviceDriver.getMove() == 1
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshPalletizingManipulatorDeviceDriver.writing(11);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
try {
lnshPalletizingManipulatorDeviceDriver.writing(11);
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 11 ){
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于11,无法反馈");
}
} else {
logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈");
}