Browse Source

平板

master
gengby 2 years ago
parent
commit
31a5316243
  1. 4
      nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
  2. 1
      nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java
  3. 74
      nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  4. 62
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java
  5. 250
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java
  6. 633
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java
  7. 7
      nladmin-system/src/main/java/org/nl/hand/rest/HandController.java
  8. 2
      nladmin-system/src/main/java/org/nl/hand/service/HandService.java
  9. 230
      nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java
  10. 3
      qd/src/views/acs/device/config.vue
  11. 458
      qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue

4
nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java

@ -22,7 +22,9 @@ public enum DriverTypeEnum {
HAILIANG_COATING(6, "hailiang_coating", "海亮包装项目-裹膜线体", "conveyor"),
HAILIANG_LABELING(7, "hailiang_labeling", "海亮包装项目-贴标线体", "conveyor");
HAILIANG_LABELING(7, "hailiang_labeling", "海亮包装项目-贴标线体", "conveyor"),
HAILIANG_FLAT(8, "hailiang_flat", "海亮包装项目-平板", "conveyor");
//驱动索引

1
nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java

@ -225,6 +225,7 @@ public interface DeviceService {
void testWrite(Map map);
void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void downDeviceDBPBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);

74
nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -1135,6 +1135,80 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
datatype = "String";
} else if (headtype.startsWith("REAL")) {
datatype = "REAL";
}else if (headtype.startsWith("X")) {
datatype = "Boolean";
}
} else {
//西门子200
if (datatype.indexOf(".") == -1) {
datatype = "Byte";
} else {
datatype = "Boolean";
}
}
item.add(datatype);
item.add("1");
item.add("R/W");
item.add("100");
cellList.add(item.toArray());
}
String[] tableHeaderArr = {"Tag Name", "Address", "Data Type", "Respect Data Type",
"Client Access", "Scan Rate"};
String fileName = "导出文件.csv";
byte[] bytes = ExportCSVUtil.writeCsvAfterToBytes(tableHeaderArr, cellList);
ExportCSVUtil.responseSetProperties(fileName, bytes, response);
}
@Override
public void downDeviceDBPBloadCSV(JSONArray jsonarr, HttpServletResponse response) {
List<Object[]> cellList = new ArrayList<>();
for (int i = 0; i < jsonarr.size(); i++) {
List item = new ArrayList();
JSONObject jo = jsonarr.getJSONObject(i);
String extra_code = jo.getString("extra_code");
//校验数据 格式为: RD1.RD1.A1.mode
int num = countStr(extra_code, ".");
if (num != 3) {
throw new BadRequestException(extra_code + "数据格式不正确");
}
extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length());
extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length());
item.add(extra_code);
item.add(jo.get("extra_name"));
String datatype = jo.getString("extra_name");
//西门子1200、1500 为DB
if (datatype.startsWith("DB")) {
//校验数据 格式为:DB600.B1
// if(datatype.indexOf(".") == -1 ){
// throw new BadRequestException(jo.getString("extra_code") + "点位数据格式不正确");
// }
// int count = countStr(datatype,".");
// if(count != 1){
// throw new BadRequestException(jo.getString("extra_code") + "点位数据格式不正确");
// }
String str1 = datatype.substring(0, datatype.indexOf("."));
String headtype = datatype.substring(str1.length() + 1, datatype.length());
if (headtype.startsWith("B")) {
if (headtype.contains(".")) {
datatype = "Boolean";
} else {
datatype = "Byte";
}
} else if (headtype.startsWith("W")) {
datatype = "Word";
} else if (headtype.startsWith("D")) {
datatype = "DWord";
} else if (headtype.startsWith("S")) {
datatype = "String";
} else if (headtype.startsWith("REAL")) {
datatype = "REAL";
}else if (headtype.startsWith("X")) {
datatype = "Boolean";
}
} else {
//西门子200

62
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java

@ -0,0 +1,62 @@
package org.nl.acs.device_driver.hailiang.hailiang_flat;
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.LinkedList;
import java.util.List;
/**
* 直管包装平板
*
*/
@Service
public class HailiangFlatDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_flat";
}
@Override
public String getDriverName() {
return "海亮平板特殊驱动";
}
@Override
public String getDriverDescription() {
return "海亮平板特殊驱动";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HailiangFlatDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HailiangFlatDeviceDriver.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();
}
}

250
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java

@ -0,0 +1,250 @@
package org.nl.acs.device_driver.hailiang.hailiang_flat;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.opc.Device;
import org.openscada.opc.lib.da.Server;
import java.util.*;
/**
* 宏丰双工位RGV
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HailiangFlatDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
int is_auto = 0;
int is_running = 0;
int mode = 0;
int a_pressure = 0;
int b_pressure = 0;
int outer_diameter = 0;
int length = 0;
int wall_thickness = 0;
int color = 0;
int jackup_num = 0;
int strap_number = 0;
int start = 0;
int stop = 0;
int main_convey1 = 0;
int main_convey1_seat1 = 0;
int main_convey1_seat2 = 0;
int ink_jet = 0;
int ink_jet_seat1 = 0;
int ink_jet_seat2 = 0;
int ink_jet_seat3 = 0;
int main_convey2 = 0;
int main_convey2_seat1 = 0;
int main_convey3_has_pass = 0;
int main_convey3_has_noPass = 0;
int main_convey3_seat1 = 0;
int main_convey3_seat2 = 0;
int cowl_a_cache = 0;
int cowl_a_cache_seat1 = 0;
int cowl_a_cache_seat2 = 0;
int cowl_a_cowl = 0;
int cowl_a_cowl_seat1 = 0;
int cowl_a_cowl_seat2 = 0;
int cowl_a_cowl_pass = 0;
int reverse_convey = 0;
int reverse_convey_seat1 = 0;
int reverse_convey_seat2 = 0;
int reverse_convey_seat3 = 0;
int reverse_convey_pass = 0;
int cowl_b_cache = 0;
int cowl_b_cache_seat1 = 0;
int cowl_b_cache_seat2 = 0;
int cowl_b_cache_pass = 0;
int cowl_b_cowl = 0;
int cowl_b_cowl_seat1 = 0;
int cowl_b_cowl_seat2 = 0;
int cowl_b_cowl_aPass = 0;
int cowl_b_cowl_bPass = 0;
int no_pass_convey_cache_num = 0;
int wrap_ago = 0;
int wrap_ago_seat1 = 0;
int wrap_ago_seat2 = 0;
int wrap_after = 0;
int wrap_after_seat1 = 0;
int wrap_after_seat2 = 0;
int strapping_current_step = 0;
int strapping_seat1 = 0;
int strapping_seat2 = 0;
int strapping_seat3 = 0;
int strapping_seat4 = 0;
int strapping_seat5 = 0;
int strapping_seat6 = 0;
int strapping_seat7 = 0;
int strapping_seat8 = 0;
int strapping_seat9 = 0;
int strapping_seat10 = 0;
int strapping_seat11 = 0;
int strapping_seat12 = 0;
int a_error1_clear = 0;
int b_error1_clear = 0;
int a_error2_clear = 0;
int b_error2_clear = 0;
int wrap_control = 0;
int strapping_finish = 0;
int error_clear = 0;
String device_code;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() throws Exception {
String message = null;
try {
device_code = this.getDeviceCode();
//mode = this.itemProtocol.getMode();
is_auto = this.itemProtocol.getis_auto();
is_running = this.itemProtocol.getis_running();
mode = this.itemProtocol.getmode();
a_pressure = this.itemProtocol.geta_pressure();
b_pressure = this.itemProtocol.getb_pressure();
outer_diameter = this.itemProtocol.getouter_diameter();
length = this.itemProtocol.getlength();
wall_thickness = this.itemProtocol.getwall_thickness();
color = this.itemProtocol.getcolor();
jackup_num = this.itemProtocol.getjackup_num();
strap_number = this.itemProtocol.getstrap_number();
start = this.itemProtocol.getstart();
stop = this.itemProtocol.getstop();
main_convey1 = this.itemProtocol.getmain_convey1();
main_convey1_seat1 = this.itemProtocol.getmain_convey1_seat1();
main_convey1_seat2 = this.itemProtocol.getmain_convey1_seat2();
ink_jet = this.itemProtocol.getink_jet();
ink_jet_seat1 = this.itemProtocol.getink_jet_seat1();
ink_jet_seat2 = this.itemProtocol.getink_jet_seat2();
ink_jet_seat3 = this.itemProtocol.getink_jet_seat3();
main_convey2 = this.itemProtocol.getmain_convey2();
main_convey2_seat1 = this.itemProtocol.getmain_convey2_seat1();
main_convey3_has_pass = this.itemProtocol.getmain_convey3_has_pass();
main_convey3_has_noPass = this.itemProtocol.getmain_convey3_has_noPass();
main_convey3_seat1 = this.itemProtocol.getmain_convey3_seat1();
main_convey3_seat2 = this.itemProtocol.getmain_convey3_seat2();
cowl_a_cache = this.itemProtocol.getcowl_a_cache();
cowl_a_cache_seat1 = this.itemProtocol.getcowl_a_cache_seat1();
cowl_a_cache_seat2 = this.itemProtocol.getcowl_a_cache_seat2();
cowl_a_cowl = this.itemProtocol.getcowl_a_cowl();
cowl_a_cowl_seat1 = this.itemProtocol.getcowl_a_cowl_seat1();
cowl_a_cowl_seat2 = this.itemProtocol.getcowl_a_cowl_seat2();
cowl_a_cowl_pass = this.itemProtocol.getcowl_a_cowl_pass();
reverse_convey = this.itemProtocol.getreverse_convey();
reverse_convey_seat1 = this.itemProtocol.getreverse_convey_seat1();
reverse_convey_seat2 = this.itemProtocol.getreverse_convey_seat2();
reverse_convey_seat3 = this.itemProtocol.getreverse_convey_seat3();
reverse_convey_pass = this.itemProtocol.getreverse_convey_pass();
cowl_b_cache = this.itemProtocol.getcowl_b_cache();
cowl_b_cache_seat1 = this.itemProtocol.getcowl_b_cache_seat1();
cowl_b_cache_seat2 = this.itemProtocol.getcowl_b_cache_seat2();
cowl_b_cache_pass = this.itemProtocol.getcowl_b_cache_pass();
cowl_b_cowl = this.itemProtocol.getcowl_b_cowl();
cowl_b_cowl_seat1 = this.itemProtocol.getcowl_b_cowl_seat1();
cowl_b_cowl_seat2 = this.itemProtocol.getcowl_b_cowl_seat2();
cowl_b_cowl_aPass = this.itemProtocol.getcowl_b_cowl_aPass();
cowl_b_cowl_bPass = this.itemProtocol.getcowl_b_cowl_bPass();
no_pass_convey_cache_num = this.itemProtocol.getno_pass_convey_cache_num();
wrap_ago = this.itemProtocol.getwrap_ago();
wrap_ago_seat1 = this.itemProtocol.getwrap_ago_seat1();
wrap_ago_seat2 = this.itemProtocol.getwrap_ago_seat2();
wrap_after = this.itemProtocol.getwrap_after();
wrap_after_seat1 = this.itemProtocol.getwrap_after_seat1();
wrap_after_seat2 = this.itemProtocol.getwrap_after_seat2();
strapping_current_step = this.itemProtocol.getstrapping_current_step();
strapping_seat1 = this.itemProtocol.getstrapping_seat1();
strapping_seat2 = this.itemProtocol.getstrapping_seat2();
strapping_seat3 = this.itemProtocol.getstrapping_seat3();
strapping_seat4 = this.itemProtocol.getstrapping_seat4();
strapping_seat5 = this.itemProtocol.getstrapping_seat5();
strapping_seat6 = this.itemProtocol.getstrapping_seat6();
strapping_seat7 = this.itemProtocol.getstrapping_seat7();
strapping_seat8 = this.itemProtocol.getstrapping_seat8();
strapping_seat9 = this.itemProtocol.getstrapping_seat9();
strapping_seat10 = this.itemProtocol.getstrapping_seat10();
strapping_seat11 = this.itemProtocol.getstrapping_seat11();
strapping_seat12 = this.itemProtocol.getstrapping_seat12();
a_error1_clear = this.itemProtocol.geta_error1_clear();
b_error1_clear = this.itemProtocol.getb_error1_clear();
a_error2_clear = this.itemProtocol.geta_error2_clear();
b_error2_clear = this.itemProtocol.getb_error2_clear();
wrap_control = this.itemProtocol.getwrap_control();
strapping_finish = this.itemProtocol.getstrapping_finish();
error_clear = this.itemProtocol.geterror_clear();
} catch (Exception var17) {
return;
}
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
}
public boolean exe_business() {
return true;
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
}
public void writing1(int command) {
// String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
// + "." + ItemProtocol.item_to_command1;
//
// String opcservcerid = this.getDevice().getOpc_server_id();
// Server server = ReadUtil.getServer(opcservcerid);
// Map<String, Object> itemMap = new HashMap<String, Object>();
// itemMap.put(to_command1, command);
// ReadUtil.write(itemMap, server);
}
public void writing2(int command) {
// String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
// + "." + ItemProtocol.item_to_command2;
//
// String opcservcerid = this.getDevice().getOpc_server_id();
// Server server = ReadUtil.getServer(opcservcerid);
// Map<String, Object> itemMap = new HashMap<String, Object>();
// itemMap.put(to_command2, command);
// ReadUtil.write(itemMap, server);
}
public void writing(int type, int command) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
}
}

633
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java

@ -0,0 +1,633 @@
package org.nl.acs.device_driver.hailiang.hailiang_flat;
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_is_auto = "is_auto";
//系统运行
public static String item_is_running = "is_running";
//联机模式
public static String item_mode = "mode";
//a测档压力
public static String item_a_pressure = "a_pressure";
//b测档压力
public static String item_b_pressure = "b_pressure";
//管径(mm)
public static String item_outer_diameter = "outer_diameter";
//管长
public static String item_length = "length";
//壁厚
public static String item_wall_thickness = "wall_thickness";
//颜色
public static String item_color = "color";
//合格提升每次提升根数
public static String item_jackup_num = "jackup_num";
//每捆根数
public static String item_strap_number = "strap_number";
//启动
public static String item_start = "start";
//停止
public static String item_stop = "stop";
//主输送一段—-有料
public static String item_main_convey1 = "main_convey1";
//主输送一段—-有料 占位1 2
public static String item_main_convey1_seat1 = "main_convey1_seat1";
public static String item_main_convey1_seat2 = "main_convey1_seat2";
//喷墨
public static String item_ink_jet = "ink_jet";
//喷墨-占位 1 2 3
public static String item_ink_jet_seat1 = "ink_jet_seat1";
public static String item_ink_jet_seat2 = "ink_jet_seat2";
public static String item_ink_jet_seat3 = "ink_jet_seat3";
//主输送二段
public static String item_main_convey2 = "main_convey2";
//主输送二段 占位 1
public static String item_main_convey2_seat1 = "main_convey2_seat1";
//主输送三段—-有料合格
public static String item_main_convey3_has_pass = "main_convey3_has_pass";
//主输送三段—-有料不合格
public static String item_main_convey3_has_noPass = "main_convey3_has_noPass";
//主输送三段—-占位1 2
public static String item_main_convey3_seat1 = "main_convey3_seat1";
public static String item_main_convey3_seat2 = "main_convey3_seat2";
//套帽A缓存—-有料
public static String item_cowl_a_cache = "cowl_a_cache";
//套帽A缓存—-占位 1 2
public static String item_cowl_a_cache_seat1 = "cowl_a_cache_seat1";
public static String item_cowl_a_cache_seat2 = "cowl_a_cache_seat2";
//套帽A套帽—-有料
public static String item_cowl_a_cowl = "cowl_a_cowl";
//套帽A套帽—-占位 1 2
public static String item_cowl_a_cowl_seat1 = "cowl_a_cowl_seat1";
public static String item_cowl_a_cowl_seat2 = "cowl_a_cowl_seat2";
//套帽A套帽—-合格
public static String item_cowl_a_cowl_pass = "cowl_a_cowl_pass";
//反向输送—-有料
public static String item_reverse_convey = "reverse_convey";
//反向输送—-占位 1 2 3
public static String item_reverse_convey_seat1 = "reverse_convey_seat1";
public static String item_reverse_convey_seat2 = "reverse_convey_seat2";
public static String item_reverse_convey_seat3 = "reverse_convey_seat3";
//反向输送—-合格
public static String item_reverse_convey_pass = "reverse_convey_pass";
//套帽B缓存—-有料
public static String item_cowl_b_cache = "cowl_b_cache";
//套帽B缓存—-占位 1 2
public static String item_cowl_b_cache_seat1 = "cowl_b_cache_seat1";
public static String item_cowl_b_cache_seat2 = "cowl_b_cache_seat2";
//套帽B缓存 合格
public static String item_cowl_b_cache_pass = "cowl_b_cache_pass";
//套帽B套帽—-有料
public static String item_cowl_b_cowl = "cowl_b_cowl";
//套帽B套帽—-占位 1 2
public static String item_cowl_b_cowl_seat1 = "cowl_b_cowl_seat1";
public static String item_cowl_b_cowl_seat2 = "cowl_b_cowl_seat2";
//套帽B套帽—-套帽A合格
public static String item_cowl_b_cowl_aPass = "cowl_b_cowl_aPass";
//套帽B套帽—-套帽B合格
public static String item_cowl_b_cowl_bPass = "cowl_b_cowl_bPass";
//不合格输送辊缓存计数
public static String item_no_pass_convey_cache_num = "no_pass_convey_cache_num";
//裹膜前段—-有料
public static String item_wrap_ago = "wrap_ago";
//裹膜前段—-有料 占位1 2
public static String item_wrap_ago_seat1 = "wrap_ago_seat1";
public static String item_wrap_ago_seat2 = "wrap_ago_seat2";
//裹膜后段—-有料
public static String item_wrap_after = "wrap_after";
//裹膜后段—-有料 占位1 2
public static String item_wrap_after_seat1 = "wrap_after_seat1";
public static String item_wrap_after_seat2 = "wrap_after_seat2";
//捆扎当前步骤
public static String item_strapping_current_step = "strapping_current_step";
//捆扎段占位1---12
public static String item_strapping_seat1 = "strapping_seat1";
public static String item_strapping_seat2 = "strapping_seat2";
public static String item_strapping_seat3 = "strapping_seat3";
public static String item_strapping_seat4 = "strapping_seat4";
public static String item_strapping_seat5 = "strapping_seat5";
public static String item_strapping_seat6 = "strapping_seat6";
public static String item_strapping_seat7 = "strapping_seat7";
public static String item_strapping_seat8 = "strapping_seat8";
public static String item_strapping_seat9 = "strapping_seat9";
public static String item_strapping_seat10 = "strapping_seat10";
public static String item_strapping_seat11 = "strapping_seat11";
public static String item_strapping_seat12 = "strapping_seat12";
//A侧摇杆出料异常复位
public static String item_a_error1_clear = "a_error1_clear";
//B侧摇杆出料异常复位
public static String item_b_error1_clear = "b_error1_clear";
//A侧皮带异常复位
public static String item_a_error2_clear = "a_error2_clear";
//B侧皮带异常复位
public static String item_b_error2_clear = "b_error2_clear";
//裹膜机控制权
public static String item_wrap_control = "wrap_control";
//捆扎完成
public static String item_strapping_finish = "strapping_finish";
//故障复位
public static String item_error_clear = "error_clear";
private HailiangFlatDeviceDriver driver;
public ItemProtocol(HailiangFlatDeviceDriver driver) {
this.driver = driver;
}
public int getis_auto() {
return this.getOpcIntegerValue(item_is_auto);
}
public int getis_running() {
return this.getOpcIntegerValue(item_is_running);
}
public int getmode() {
return this.getOpcIntegerValue(item_mode);
}
public int geta_pressure() {
return this.getOpcIntegerValue(item_a_pressure);
}
public int getb_pressure() {
return this.getOpcIntegerValue(item_b_pressure);
}
public int getouter_diameter() {
return this.getOpcIntegerValue(item_outer_diameter);
}
public int getlength() {
return this.getOpcIntegerValue(item_length);
}
public int getwall_thickness() {
return this.getOpcIntegerValue(item_wall_thickness);
}
public int getcolor() {
return this.getOpcIntegerValue(item_color);
}
public int getjackup_num() {
return this.getOpcIntegerValue(item_jackup_num);
}
public int getstrap_number() {
return this.getOpcIntegerValue(item_strap_number);
}
public int getstart() {
return this.getOpcIntegerValue(item_start);
}
public int getstop() {
return this.getOpcIntegerValue(item_stop);
}
public int getmain_convey1() {
return this.getOpcIntegerValue(item_main_convey1);
}
public int getmain_convey1_seat1() {
return this.getOpcIntegerValue(item_main_convey1_seat1);
}
public int getmain_convey1_seat2() {
return this.getOpcIntegerValue(item_main_convey1_seat2);
}
public int getink_jet() {
return this.getOpcIntegerValue(item_ink_jet);
}
public int getink_jet_seat1() {
return this.getOpcIntegerValue(item_ink_jet_seat1);
}
public int getink_jet_seat2() {
return this.getOpcIntegerValue(item_ink_jet_seat2);
}
public int getink_jet_seat3() {
return this.getOpcIntegerValue(item_ink_jet_seat3);
}
public int getmain_convey2() {
return this.getOpcIntegerValue(item_main_convey2);
}
public int getmain_convey2_seat1() {
return this.getOpcIntegerValue(item_main_convey2_seat1);
}
public int getmain_convey3_has_pass() {
return this.getOpcIntegerValue(item_main_convey3_has_pass);
}
public int getmain_convey3_has_noPass() {
return this.getOpcIntegerValue(item_main_convey3_has_noPass);
}
public int getmain_convey3_seat1() {
return this.getOpcIntegerValue(item_main_convey3_seat1);
}
public int getmain_convey3_seat2() {
return this.getOpcIntegerValue(item_main_convey3_seat2);
}
public int getcowl_a_cache() {
return this.getOpcIntegerValue(item_cowl_a_cache);
}
public int getcowl_a_cache_seat1() {
return this.getOpcIntegerValue(item_cowl_a_cache_seat1);
}
public int getcowl_a_cache_seat2() {
return this.getOpcIntegerValue(item_cowl_a_cache_seat2);
}
public int getcowl_a_cowl() {
return this.getOpcIntegerValue(item_cowl_a_cowl);
}
public int getcowl_a_cowl_seat1() {
return this.getOpcIntegerValue(item_cowl_a_cowl_seat1);
}
public int getcowl_a_cowl_seat2() {
return this.getOpcIntegerValue(item_cowl_a_cowl_seat2);
}
public int getcowl_a_cowl_pass() {
return this.getOpcIntegerValue(item_cowl_a_cowl_pass);
}
public int getreverse_convey() {
return this.getOpcIntegerValue(item_reverse_convey);
}
public int getreverse_convey_seat1() {
return this.getOpcIntegerValue(item_reverse_convey_seat1);
}
public int getreverse_convey_seat2() {
return this.getOpcIntegerValue(item_reverse_convey_seat2);
}
public int getreverse_convey_seat3() {
return this.getOpcIntegerValue(item_reverse_convey_seat3);
}
public int getreverse_convey_pass() {
return this.getOpcIntegerValue(item_reverse_convey_pass);
}
public int getcowl_b_cache() {
return this.getOpcIntegerValue(item_cowl_b_cache);
}
public int getcowl_b_cache_seat1() {
return this.getOpcIntegerValue(item_cowl_b_cache_seat1);
}
public int getcowl_b_cache_seat2() {
return this.getOpcIntegerValue(item_cowl_b_cache_seat2);
}
public int getcowl_b_cache_pass() {
return this.getOpcIntegerValue(item_cowl_b_cache_pass);
}
public int getcowl_b_cowl() {
return this.getOpcIntegerValue(item_cowl_b_cowl);
}
public int getcowl_b_cowl_seat1() {
return this.getOpcIntegerValue(item_cowl_b_cowl_seat1);
}
public int getcowl_b_cowl_seat2() {
return this.getOpcIntegerValue(item_cowl_b_cowl_seat2);
}
public int getcowl_b_cowl_aPass() {
return this.getOpcIntegerValue(item_cowl_b_cowl_aPass);
}
public int getcowl_b_cowl_bPass() {
return this.getOpcIntegerValue(item_cowl_b_cowl_bPass);
}
public int getno_pass_convey_cache_num() {
return this.getOpcIntegerValue(item_no_pass_convey_cache_num);
}
public int getwrap_ago() {
return this.getOpcIntegerValue(item_wrap_ago);
}
public int getwrap_ago_seat1() {
return this.getOpcIntegerValue(item_wrap_ago_seat1);
}
public int getwrap_ago_seat2() {
return this.getOpcIntegerValue(item_wrap_ago_seat2);
}
public int getwrap_after() {
return this.getOpcIntegerValue(item_wrap_after);
}
public int getwrap_after_seat1() {
return this.getOpcIntegerValue(item_wrap_after_seat1);
}
public int getwrap_after_seat2() {
return this.getOpcIntegerValue(item_wrap_after_seat2);
}
public int getstrapping_current_step() {
return this.getOpcIntegerValue(item_strapping_current_step);
}
public int getstrapping_seat1() {
return this.getOpcIntegerValue(item_strapping_seat1);
}
public int getstrapping_seat2() {
return this.getOpcIntegerValue(item_strapping_seat2);
}
public int getstrapping_seat3() {
return this.getOpcIntegerValue(item_strapping_seat3);
}
public int getstrapping_seat4() {
return this.getOpcIntegerValue(item_strapping_seat4);
}
public int getstrapping_seat5() {
return this.getOpcIntegerValue(item_strapping_seat5);
}
public int getstrapping_seat6() {
return this.getOpcIntegerValue(item_strapping_seat6);
}
public int getstrapping_seat7() {
return this.getOpcIntegerValue(item_strapping_seat7);
}
public int getstrapping_seat8() {
return this.getOpcIntegerValue(item_strapping_seat8);
}
public int getstrapping_seat9() {
return this.getOpcIntegerValue(item_strapping_seat9);
}
public int getstrapping_seat10() {
return this.getOpcIntegerValue(item_strapping_seat10);
}
public int getstrapping_seat11() {
return this.getOpcIntegerValue(item_strapping_seat11);
}
public int getstrapping_seat12() {
return this.getOpcIntegerValue(item_strapping_seat12);
}
public int geta_error1_clear() {
return this.getOpcIntegerValue(item_a_error1_clear);
}
public int getb_error1_clear() {
return this.getOpcIntegerValue(item_b_error1_clear);
}
public int geta_error2_clear() {
return this.getOpcIntegerValue(item_a_error2_clear);
}
public int getb_error2_clear() {
return this.getOpcIntegerValue(item_b_error2_clear);
}
public int getwrap_control() {
return this.getOpcIntegerValue(item_wrap_control);
}
public int getstrapping_finish() {
return this.getOpcIntegerValue(item_strapping_finish);
}
public int geterror_clear() {
return this.getOpcIntegerValue(item_error_clear);
}
//是否有货
public int hasGoods(int move) {
return move;
}
Boolean isonline;
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.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_is_auto, "手自动", "I18.1"));
list.add(new ItemDto(item_is_running, "系统运行", "M4.2"));
list.add(new ItemDto(item_mode, "联机模式", "DB1.X0.3"));
list.add(new ItemDto(item_a_pressure, "A侧挡压压力", "DB219.D20"));
list.add(new ItemDto(item_b_pressure, "B侧挡压压力", "DB239.D20"));
list.add(new ItemDto(item_outer_diameter, "管径(mm)", "DB1.D6"));
list.add(new ItemDto(item_length, "管长(mm)", "DB1.D2"));
list.add(new ItemDto(item_wall_thickness, "壁厚(mm)", "DB1.D10"));
list.add(new ItemDto(item_color, "颜色", "DB1.W14"));
list.add(new ItemDto(item_jackup_num, "合格每次提升根数", "DB2.W2"));
list.add(new ItemDto(item_strap_number, "每捆根数", "DB2.W4"));
list.add(new ItemDto(item_start, "启动", "M4.0"));
list.add(new ItemDto(item_stop, "停止", "M4.1"));
list.add(new ItemDto(item_main_convey1, "主输送一段-有料", "DB14.X4.0"));
list.add(new ItemDto(item_main_convey1_seat1, "主输送一段-占位1", "I22.4"));
list.add(new ItemDto(item_main_convey1_seat2, "主输送一段-占位2", "I22.5"));
list.add(new ItemDto(item_ink_jet, "喷墨-一段出料完成", "DB14.X3.6"));
list.add(new ItemDto(item_ink_jet_seat1, "喷墨-占位1", "I23.5"));
list.add(new ItemDto(item_ink_jet_seat2, "喷墨-占位2", "I23.4"));
list.add(new ItemDto(item_ink_jet_seat3, "喷墨-占位3", "I39.6"));
list.add(new ItemDto(item_main_convey2, "主输送二段—有料", "DB14.X4.1"));
list.add(new ItemDto(item_main_convey2_seat1, "主输送二段—占位1", "I22.6"));
list.add(new ItemDto(item_main_convey3_has_pass, "主输送三段-有料合格", "DB14.X4.2"));
list.add(new ItemDto(item_main_convey3_has_noPass, "主输送三段-有料不合格", "DB14.X4.3"));
list.add(new ItemDto(item_main_convey3_seat1, "主输送三段-占位1", "I23.0"));
list.add(new ItemDto(item_main_convey3_seat2, "主输送三段-占位2", "I22.7"));
list.add(new ItemDto(item_cowl_a_cache, "套帽A缓存-有料", "DB15.X2.0"));
list.add(new ItemDto(item_cowl_a_cache_seat1, "套帽A缓存-占位1", "I26.0"));
list.add(new ItemDto(item_cowl_a_cache_seat2, "套帽A缓存-占位2", "I26.1"));
list.add(new ItemDto(item_cowl_a_cowl, "套帽A套帽-有料", "DB15.X2.4"));
list.add(new ItemDto(item_cowl_a_cowl_seat1, "套帽A套帽-占位1", "I26.2"));
list.add(new ItemDto(item_cowl_a_cowl_seat2, "套帽A套帽-占位2", "I26.3"));
list.add(new ItemDto(item_cowl_a_cowl_pass, "套帽A套帽-合格", "DB254.X1.6"));
list.add(new ItemDto(item_reverse_convey, "反向输送-有料", "DB14.X4.4"));
list.add(new ItemDto(item_reverse_convey_seat1, "反向输送-占位1", "I23.3"));
list.add(new ItemDto(item_reverse_convey_seat2, "反向输送-占位2", "I23.2"));
list.add(new ItemDto(item_reverse_convey_seat3, "反向输送-占位3", "I23.1"));
list.add(new ItemDto(item_reverse_convey_pass, "反向输送-合格", "DB256.X1.6"));
list.add(new ItemDto(item_cowl_b_cache, "套帽B缓存-有料", "DB15.X2.1"));
list.add(new ItemDto(item_cowl_b_cache_seat1, "套帽B缓存-占位1", "I28.4"));
list.add(new ItemDto(item_cowl_b_cache_seat2, "套帽B缓存-占位2", "I28.5"));
list.add(new ItemDto(item_cowl_b_cache_pass, "套帽B缓存-合格", "DB256.X12.4"));
list.add(new ItemDto(item_cowl_b_cowl, "套帽B套帽-有料", "DB15.X2.5"));
list.add(new ItemDto(item_cowl_b_cowl_seat1, "套帽B套帽-占位1", "I28.6"));
list.add(new ItemDto(item_cowl_b_cowl_seat2, "套帽B套帽-占位2", "I28.7"));
list.add(new ItemDto(item_cowl_b_cowl_aPass, "套帽B套帽-套帽A合格", "DB15.X3.4"));
list.add(new ItemDto(item_cowl_b_cowl_bPass, "套帽B套帽-套帽B合格", "DB15.X3.5"));
list.add(new ItemDto(item_no_pass_convey_cache_num, "不合格输送辊缓存计数", "DB2.W12"));
list.add(new ItemDto(item_wrap_ago, "裹膜前段-有料", "DB3.X48.0"));
list.add(new ItemDto(item_wrap_ago_seat1, "裹膜前段-占位1", "I29.3"));
list.add(new ItemDto(item_wrap_ago_seat2, "裹膜前段-占位2", "I29.4"));
list.add(new ItemDto(item_wrap_after, "裹膜后段-有料", "DB3.X48.1"));
list.add(new ItemDto(item_wrap_after_seat1, "裹膜后段-占位1", "I29.5"));
list.add(new ItemDto(item_wrap_after_seat2, "裹膜后段-占位1", "I29.6"));
list.add(new ItemDto(item_strapping_current_step, "捆扎当前步骤", "DB3.W54"));
list.add(new ItemDto(item_strapping_seat1, "捆扎段占位1", "I32.7"));
list.add(new ItemDto(item_strapping_seat2, "捆扎段占位2", "I29.0"));
list.add(new ItemDto(item_strapping_seat3, "捆扎段占位3", "I33.1"));
list.add(new ItemDto(item_strapping_seat4, "捆扎段占位4", "I29.1"));
list.add(new ItemDto(item_strapping_seat5, "捆扎段占位5", "I34.7"));
list.add(new ItemDto(item_strapping_seat6, "捆扎段占位6", "I29.2"));
list.add(new ItemDto(item_strapping_seat7, "捆扎段占位7", "I29.3"));
list.add(new ItemDto(item_strapping_seat8, "捆扎段占位8", "I29.4"));
list.add(new ItemDto(item_strapping_seat9, "捆扎段占位9", "I29.5"));
list.add(new ItemDto(item_strapping_seat10, "捆扎段占位10", "I29.6"));
list.add(new ItemDto(item_strapping_seat10, "捆扎段占位11", "I35.5"));
list.add(new ItemDto(item_strapping_seat12, "捆扎段占位12", "I36.7"));
list.add(new ItemDto(item_a_error1_clear, "A侧摇杆出料异常复位", "DB214.X10.7"));
list.add(new ItemDto(item_b_error1_clear, "B侧摇杆出料异常复位", "DB234.X10.7"));
list.add(new ItemDto(item_a_error2_clear, "A侧皮带异常复位", "DB201.X14.7"));
list.add(new ItemDto(item_b_error2_clear, "B侧皮带异常复位", "DB221.X14.7"));
list.add(new ItemDto(item_wrap_control, "裹膜机控制权", "DB360.X2.3"));
list.add(new ItemDto(item_strapping_finish, "捆扎完成", "M4.5"));
list.add(new ItemDto(item_error_clear, "故障复位", "M5.2"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
///list.add(new ItemDto(item_is_auto, "手自动", "I18.1"));
//list.add(new ItemDto(item_is_running, "系统运行", "M4.2"));
// list.add(new ItemDto(item_mode, "联机模式", "DB1.DBX0.3"));
// list.add(new ItemDto(item_a_pressure, "A侧挡压压力", "DB219.DBD20"));
// list.add(new ItemDto(item_b_pressure, "B侧挡压压力", "DB239.DBD20"));
list.add(new ItemDto(item_outer_diameter, "管径(mm)", "DB1.D6"));
list.add(new ItemDto(item_length, "管长(mm)", "DB1.D2"));
list.add(new ItemDto(item_wall_thickness, "壁厚(mm)", "DB1.D10"));
list.add(new ItemDto(item_color, "颜色", "DB1.W14"));
list.add(new ItemDto(item_jackup_num, "合格每次提升根数", "DB2.W2"));
list.add(new ItemDto(item_strap_number, "每捆根数", "DB2.W4"));
list.add(new ItemDto(item_start, "启动", "M4.0"));
list.add(new ItemDto(item_stop, "停止", "M4.1"));
list.add(new ItemDto(item_main_convey1, "主输送一段-有料", "DB14.X4.0"));
//list.add(new ItemDto(item_main_convey1_seat1, "主输送一段-占位1", "I22.4"));
//list.add(new ItemDto(item_main_convey1_seat2, "主输送一段-占位2", "I22.5"));
list.add(new ItemDto(item_ink_jet, "喷墨-一段出料完成", "DB14.X3.6"));
//list.add(new ItemDto(item_ink_jet_seat1, "喷墨-占位1", "I23.5"));
//list.add(new ItemDto(item_ink_jet_seat2, "喷墨-占位2", "I23.4"));
// list.add(new ItemDto(item_ink_jet_seat3, "喷墨-占位3", "I39.6"));
list.add(new ItemDto(item_main_convey2, "主输送二段—有料", "DB14.X4.1"));
//list.add(new ItemDto(item_main_convey2_seat1, "主输送二段—占位1", "I22.6"));
list.add(new ItemDto(item_main_convey3_has_pass, "主输送三段-有料合格", "DB14.X4.2"));
list.add(new ItemDto(item_main_convey3_has_noPass, "主输送三段-有料不合格", "DB14.X4.3"));
//list.add(new ItemDto(item_main_convey3_seat1, "主输送三段-占位1", "I23.0"));
//list.add(new ItemDto(item_main_convey3_seat2, "主输送三段-占位2", "I22.7"));
list.add(new ItemDto(item_cowl_a_cache, "套帽A缓存-有料", "DB15.X2.0"));
//list.add(new ItemDto(item_cowl_a_cache_seat1, "套帽A缓存-占位1", "I26.0"));
//list.add(new ItemDto(item_cowl_a_cache_seat2, "套帽A缓存-占位2", "I26.1"));
list.add(new ItemDto(item_cowl_a_cowl, "套帽A套帽-有料", "DB15.X2.4"));
//list.add(new ItemDto(item_cowl_a_cowl_seat1, "套帽A套帽-占位1", "I26.2"));
//list.add(new ItemDto(item_cowl_a_cowl_seat2, "套帽A套帽-占位2", "I26.3"));
list.add(new ItemDto(item_cowl_a_cowl_pass, "套帽A套帽-合格", "DB254.X1.6"));
list.add(new ItemDto(item_reverse_convey, "反向输送-有料", "DB14.X4.4"));
//list.add(new ItemDto(item_reverse_convey_seat1, "反向输送-占位1", "I23.3"));
//list.add(new ItemDto(item_reverse_convey_seat2, "反向输送-占位2", "I23.2"));
//list.add(new ItemDto(item_reverse_convey_seat3, "反向输送-占位3", "I23.1"));
list.add(new ItemDto(item_reverse_convey_pass, "反向输送-合格", "DB256.X1.6"));
list.add(new ItemDto(item_cowl_b_cache, "套帽B缓存-有料", "DB15.X2.1"));
//list.add(new ItemDto(item_cowl_b_cache_seat1, "套帽B缓存-占位1", "I28.4"));
//list.add(new ItemDto(item_cowl_b_cache_seat2, "套帽B缓存-占位2", "I28.5"));
list.add(new ItemDto(item_cowl_b_cache_pass, "套帽B缓存-合格", "DB256.X12.4"));
list.add(new ItemDto(item_cowl_b_cowl, "套帽B套帽-有料", "DB15.X2.5"));
//list.add(new ItemDto(item_cowl_b_cowl_seat1, "套帽B套帽-占位1", "I28.6"));
// list.add(new ItemDto(item_cowl_b_cowl_seat2, "套帽B套帽-占位2", "I28.7"));
list.add(new ItemDto(item_cowl_b_cowl_aPass, "套帽B套帽-套帽A合格", "DB15.X3.4"));
list.add(new ItemDto(item_cowl_b_cowl_bPass, "套帽B套帽-套帽B合格", "DB15.X3.5"));
list.add(new ItemDto(item_no_pass_convey_cache_num, "不合格输送辊缓存计数", "DB2.W12"));
list.add(new ItemDto(item_wrap_ago, "裹膜前段-有料", "DB3.X48.0"));
//list.add(new ItemDto(item_wrap_ago_seat1, "裹膜前段-占位1", "I29.3"));
//list.add(new ItemDto(item_wrap_ago_seat2, "裹膜前段-占位2", "I29.4"));
list.add(new ItemDto(item_wrap_after, "裹膜后段-有料", "DB3.X48.1"));
//list.add(new ItemDto(item_wrap_after_seat1, "裹膜后段-占位1", "I29.5"));
//list.add(new ItemDto(item_wrap_after_seat2, "裹膜后段-占位1", "I29.6"));
list.add(new ItemDto(item_strapping_current_step, "捆扎当前步骤", "DB3.W54"));
//list.add(new ItemDto(item_strapping_seat1, "捆扎段占位1", "I32.7"));
//list.add(new ItemDto(item_strapping_seat2, "捆扎段占位2", "I29.0"));
//list.add(new ItemDto(item_strapping_seat3, "捆扎段占位3", "I33.1"));
//list.add(new ItemDto(item_strapping_seat4, "捆扎段占位4", "I29.1"));
//list.add(new ItemDto(item_strapping_seat5, "捆扎段占位5", "I34.7"));
//list.add(new ItemDto(item_strapping_seat6, "捆扎段占位6", "I29.2"));
// list.add(new ItemDto(item_strapping_seat7, "捆扎段占位7", "I29.3"));
//list.add(new ItemDto(item_strapping_seat8, "捆扎段占位8", "I29.4"));
//list.add(new ItemDto(item_strapping_seat9, "捆扎段占位9", "I29.5"));
//list.add(new ItemDto(item_strapping_seat10, "捆扎段占位10", "I29.6"));
//list.add(new ItemDto(item_strapping_seat10, "捆扎段占位11", "I35.5"));
//list.add(new ItemDto(item_strapping_seat12, "捆扎段占位12", "I36.7"));
list.add(new ItemDto(item_a_error1_clear, "A侧摇杆出料异常复位", "DB214.X10.7"));
list.add(new ItemDto(item_b_error1_clear, "B侧摇杆出料异常复位", "DB234.X10.7"));
list.add(new ItemDto(item_a_error2_clear, "A侧皮带异常复位", "DB201.X14.7"));
list.add(new ItemDto(item_b_error2_clear, "B侧皮带异常复位", "DB221.X14.7"));
list.add(new ItemDto(item_wrap_control, "裹膜机控制权", "DB360.X2.3"));
list.add(new ItemDto(item_strapping_finish, "捆扎完成", "M4.5"));
list.add(new ItemDto(item_error_clear, "故障复位", "M5.2"));
return list;
}
}

7
nladmin-system/src/main/java/org/nl/hand/rest/HandController.java

@ -122,4 +122,11 @@ public class HandController {
public ResponseEntity<JSONObject> putPoint(@RequestBody Map<String, String> param) {
return new ResponseEntity<>(handService.putPoint(param), HttpStatus.OK);
}
@PostMapping("/queryDeviceInfo")
@Log("信号查询(定时)")
@ApiOperation("信号查询(定时)")
public ResponseEntity<JSONObject> queryDeviceInfo() {
return new ResponseEntity<>(handService.queryDeviceInfo(), HttpStatus.OK);
}
}

2
nladmin-system/src/main/java/org/nl/hand/service/HandService.java

@ -70,4 +70,6 @@ public interface HandService {
* @return 提示
*/
JSONObject putPoint(Map<String, String> param);
JSONObject queryDeviceInfo();
}

230
nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java

@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver;
import org.nl.acs.device_driver.hailiang.hailiang_flat.HailiangFlatDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.ProduceshiftorderdetailService;
@ -406,52 +408,196 @@ public class HandServiceImpl implements HandService {
public JSONObject putPoint(Map<String, String> param) {
// 返回值
JSONObject resultJSON = new JSONObject();
// 参数校验
String outerDiameter = param.get("outer_diameter");
if (StrUtil.isEmpty(outerDiameter)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "管径不能为空");
return resultJSON;
}
String length = param.get("length");
if (StrUtil.isEmpty(length)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "管长不能为空");
return resultJSON;
}
String color = param.get("color");
if (StrUtil.isEmpty(color)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "颜色不能为空");
return resultJSON;
}
String jackupNum = param.get("jackup_num");
if (StrUtil.isEmpty(jackupNum)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "合格提升每次提升根数不能为空");
return resultJSON;
}
String strapNumber = param.get("strap_number");
if (StrUtil.isEmpty(strapNumber)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "每捆根数不能为空");
return resultJSON;
String name = param.get("name");
String type = param.get("type");
String value = param.get("value");
Device device = deviceAppService.findDeviceByCode("PB01");
HailiangFlatDeviceDriver hailiangFlatDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangFlatDeviceDriver){
hailiangFlatDeviceDriver = (HailiangFlatDeviceDriver) device.getDeviceDriver();
if (type.equals("1")){
hailiangFlatDeviceDriver.writing(name,value);
}else if (type.equals("2")){
int realValue = hailiangFlatDeviceDriver.getItemProtocol().getOpcIntegerValue(name);
if (realValue == 0){
realValue = 1;
} else if (realValue == 1){
realValue = 0;
}
hailiangFlatDeviceDriver.writing(name,String.valueOf(realValue));
} else {
hailiangFlatDeviceDriver.writing(name,value);
}
}
// 获取设备驱动
HaiLiangFeedingTrunkDeviceDriver driver = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class).get(0);
// 写信号
driver.writing("to_outer_diameter", outerDiameter);
driver.writing("to_length", length);
driver.writing("to_color", color);
driver.writing("to_jackup_num", jackupNum);
driver.writing("to_one_strapping_qty", strapNumber);
// 返回
resultJSON.put("code", "1");
resultJSON.put("desc", "下发成功");
return resultJSON;
}
@Override
public JSONObject queryDeviceInfo() {
Device device = deviceAppService.findDeviceByCode("PB01");
JSONObject resp = new JSONObject();
HailiangFlatDeviceDriver hailiangFlatDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangFlatDeviceDriver){
hailiangFlatDeviceDriver = (HailiangFlatDeviceDriver) device.getDeviceDriver();
int is_auto = hailiangFlatDeviceDriver.getIs_auto();
int is_running = hailiangFlatDeviceDriver.getIs_running();
int mode = hailiangFlatDeviceDriver.getMode();
int a_pressure = hailiangFlatDeviceDriver.getA_pressure();
int b_pressure = hailiangFlatDeviceDriver.getB_pressure();
int outer_diameter = hailiangFlatDeviceDriver.getOuter_diameter();
int length = hailiangFlatDeviceDriver.getLength();
int wall_thickness = hailiangFlatDeviceDriver.getWall_thickness();
int color = hailiangFlatDeviceDriver.getColor();
int jackup_num = hailiangFlatDeviceDriver.getJackup_num();
int strap_number = hailiangFlatDeviceDriver.getStrap_number();
int start = hailiangFlatDeviceDriver.getStart();
int stop = hailiangFlatDeviceDriver.getStop();
int main_convey1 = hailiangFlatDeviceDriver.getMain_convey1();
int main_convey1_seat1 = hailiangFlatDeviceDriver.getMain_convey1_seat1();
int main_convey1_seat2 = hailiangFlatDeviceDriver.getMain_convey1_seat2();
int ink_jet = hailiangFlatDeviceDriver.getInk_jet();
int ink_jet_seat1 = hailiangFlatDeviceDriver.getInk_jet_seat1();
int ink_jet_seat2 = hailiangFlatDeviceDriver.getInk_jet_seat2();
int ink_jet_seat3 = hailiangFlatDeviceDriver.getInk_jet_seat3();
int main_convey2 = hailiangFlatDeviceDriver.getMain_convey2();
int main_convey2_seat1 = hailiangFlatDeviceDriver.getMain_convey2_seat1();
int main_convey3_has_pass = hailiangFlatDeviceDriver.getMain_convey3_has_pass();
int main_convey3_has_noPass = hailiangFlatDeviceDriver.getMain_convey3_has_noPass();
int main_convey3_seat1 = hailiangFlatDeviceDriver.getMain_convey3_seat1();
int main_convey3_seat2 = hailiangFlatDeviceDriver.getMain_convey3_seat2();
int cowl_a_cache = hailiangFlatDeviceDriver.getCowl_a_cache();
int cowl_a_cache_seat1 = hailiangFlatDeviceDriver.getCowl_a_cache_seat1();
int cowl_a_cache_seat2 = hailiangFlatDeviceDriver.getCowl_a_cache_seat2();
int cowl_a_cowl = hailiangFlatDeviceDriver.getCowl_a_cowl();
int cowl_a_cowl_seat1 = hailiangFlatDeviceDriver.getCowl_a_cowl_seat1();
int cowl_a_cowl_seat2 = hailiangFlatDeviceDriver.getCowl_a_cowl_seat2();
int cowl_a_cowl_pass = hailiangFlatDeviceDriver.getCowl_a_cowl_pass();
int reverse_convey = hailiangFlatDeviceDriver.getReverse_convey();
int reverse_convey_seat1 = hailiangFlatDeviceDriver.getReverse_convey_seat1();
int reverse_convey_seat2 = hailiangFlatDeviceDriver.getReverse_convey_seat2();
int reverse_convey_seat3 = hailiangFlatDeviceDriver.getReverse_convey_seat3();
int reverse_convey_pass = hailiangFlatDeviceDriver.getReverse_convey_pass();
int cowl_b_cache = hailiangFlatDeviceDriver.getCowl_b_cache();
int cowl_b_cache_seat1 = hailiangFlatDeviceDriver.getCowl_b_cache_seat1();
int cowl_b_cache_seat2 = hailiangFlatDeviceDriver.getCowl_b_cache_seat2();
int cowl_b_cache_pass = hailiangFlatDeviceDriver.getCowl_b_cache_pass();
int cowl_b_cowl = hailiangFlatDeviceDriver.getCowl_b_cowl();
int cowl_b_cowl_seat1 = hailiangFlatDeviceDriver.getCowl_b_cowl_seat1();
int cowl_b_cowl_seat2 = hailiangFlatDeviceDriver.getCowl_b_cowl_seat2();
int cowl_b_cowl_aPass = hailiangFlatDeviceDriver.getCowl_b_cowl_aPass();
int cowl_b_cowl_bPass = hailiangFlatDeviceDriver.getCowl_b_cowl_bPass();
int no_pass_convey_cache_num = hailiangFlatDeviceDriver.getNo_pass_convey_cache_num();
int wrap_ago = hailiangFlatDeviceDriver.getWrap_ago();
int wrap_ago_seat1 = hailiangFlatDeviceDriver.getWrap_ago_seat1();
int wrap_ago_seat2 = hailiangFlatDeviceDriver.getWrap_ago_seat2();
int wrap_after = hailiangFlatDeviceDriver.getWrap_after();
int wrap_after_seat1 = hailiangFlatDeviceDriver.getWrap_after_seat1();
int wrap_after_seat2 = hailiangFlatDeviceDriver.getWrap_after_seat2();
int strapping_current_step = hailiangFlatDeviceDriver.getStrapping_current_step();
int strapping_seat1 = hailiangFlatDeviceDriver.getStrapping_seat1();
int strapping_seat2 = hailiangFlatDeviceDriver.getStrapping_seat2();
int strapping_seat3 = hailiangFlatDeviceDriver.getStrapping_seat3();
int strapping_seat4 = hailiangFlatDeviceDriver.getStrapping_seat4();
int strapping_seat5 = hailiangFlatDeviceDriver.getStrapping_seat5();
int strapping_seat6 = hailiangFlatDeviceDriver.getStrapping_seat6();
int strapping_seat7 = hailiangFlatDeviceDriver.getStrapping_seat7();
int strapping_seat8 = hailiangFlatDeviceDriver.getStrapping_seat8();
int strapping_seat9 = hailiangFlatDeviceDriver.getStrapping_seat9();
int strapping_seat10 = hailiangFlatDeviceDriver.getStrapping_seat10();
int strapping_seat11 = hailiangFlatDeviceDriver.getStrapping_seat11();
int strapping_seat12 = hailiangFlatDeviceDriver.getStrapping_seat12();
int a_error1_clear = hailiangFlatDeviceDriver.getA_error1_clear();
int b_error1_clear = hailiangFlatDeviceDriver.getB_error1_clear();
int a_error2_clear = hailiangFlatDeviceDriver.getA_error2_clear();
int b_error2_clear = hailiangFlatDeviceDriver.getB_error2_clear();
int wrap_control = hailiangFlatDeviceDriver.getWrap_control();
int strapping_finish = hailiangFlatDeviceDriver.getStrapping_finish();
int error_clear = hailiangFlatDeviceDriver.getError_clear();
resp.put("code","1");
resp.put("desc","查询成功");
JSONObject result = new JSONObject();
result.put("is_auto",is_auto);
result.put("is_running",is_running);
result.put("mode",mode);
result.put("a_pressure",a_pressure);
result.put("b_pressure",b_pressure);
result.put("outer_diameter",outer_diameter);
result.put("length",length);
result.put("wall_thickness",wall_thickness);
result.put("color",color);
result.put("jackup_num",jackup_num);
result.put("strap_number",strap_number);
result.put("start",start);
result.put("stop",stop);
result.put("main_convey1",main_convey1);
result.put("main_convey1_seat1",main_convey1_seat1);
result.put("main_convey1_seat2",main_convey1_seat2);
result.put("ink_jet",ink_jet);
result.put("ink_jet_seat1",ink_jet_seat1);
result.put("ink_jet_seat2",ink_jet_seat2);
result.put("ink_jet_seat3",ink_jet_seat3);
result.put("main_convey2",main_convey2);
result.put("main_convey2_seat1",main_convey2_seat1);
result.put("main_convey3_has_pass",main_convey3_has_pass);
result.put("main_convey3_has_noPass",main_convey3_has_noPass);
result.put("main_convey3_seat1",main_convey3_seat1);
result.put("main_convey3_seat2",main_convey3_seat2);
result.put("cowl_a_cache",cowl_a_cache);
result.put("cowl_a_cache_seat1",cowl_a_cache_seat1);
result.put("cowl_a_cache_seat2",cowl_a_cache_seat2);
result.put("cowl_a_cowl",cowl_a_cowl);
result.put("cowl_a_cowl_seat1",cowl_a_cowl_seat1);
result.put("cowl_a_cowl_seat2",cowl_a_cowl_seat2);
result.put("cowl_a_cowl_pass",cowl_a_cowl_pass);
result.put("reverse_convey",reverse_convey);
result.put("reverse_convey_seat1",reverse_convey_seat1);
result.put("reverse_convey_seat2",reverse_convey_seat2);
result.put("reverse_convey_seat3",reverse_convey_seat3);
result.put("reverse_convey_pass",reverse_convey_pass);
result.put("cowl_b_cache",cowl_b_cache);
result.put("cowl_b_cache_seat1",cowl_b_cache_seat1);
result.put("cowl_b_cache_seat2",cowl_b_cache_seat2);
result.put("cowl_b_cache_pass",cowl_b_cache_pass);
result.put("cowl_b_cowl",cowl_b_cowl);
result.put("cowl_b_cowl_seat1",cowl_b_cowl_seat1);
result.put("cowl_b_cowl_seat2",cowl_b_cowl_seat2);
result.put("cowl_b_cowl_aPass",cowl_b_cowl_aPass);
result.put("cowl_b_cowl_bPass",cowl_b_cowl_bPass);
result.put("no_pass_convey_cache_num",no_pass_convey_cache_num);
result.put("wrap_ago",wrap_ago);
result.put("wrap_ago_seat1",wrap_ago_seat1);
result.put("wrap_ago_seat2",wrap_ago_seat2);
result.put("wrap_after",wrap_after);
result.put("wrap_after_seat1",wrap_after_seat1);
result.put("wrap_after_seat2",wrap_after_seat2);
result.put("strapping_current_step",strapping_current_step);
result.put("strapping_seat1",strapping_seat1);
result.put("strapping_seat2",strapping_seat2);
result.put("strapping_seat3",strapping_seat3);
result.put("strapping_seat4",strapping_seat4);
result.put("strapping_seat5",strapping_seat5);
result.put("strapping_seat6",strapping_seat6);
result.put("strapping_seat7",strapping_seat7);
result.put("strapping_seat8",strapping_seat8);
result.put("strapping_seat9",strapping_seat9);
result.put("strapping_seat10",strapping_seat10);
result.put("strapping_seat11",strapping_seat11);
result.put("strapping_seat12",strapping_seat12);
result.put("a_error1_clear",a_error1_clear);
result.put("b_error1_clear",b_error1_clear);
result.put("a_error2_clear",a_error2_clear);
result.put("b_error2_clear",b_error2_clear);
result.put("wrap_control",wrap_control);
result.put("strapping_finish",strapping_finish);
result.put("error_clear",error_clear);
resp.put("result",result);
return resp;
}
resp.put("code","0");
resp.put("desc","查询失败");
return resp;
}
}

3
qd/src/views/acs/device/config.vue

@ -102,6 +102,7 @@ import hailiang_lettering from '@/views/acs/device/driver/hailing_zgbz/hailiang_
import hailiang_risking from '@/views/acs/device/driver/hailing_zgbz/hailiang_risking'
import hailiang_strapping from '@/views/acs/device/driver/hailing_zgbz/hailiang_strapping'
import hailiang_coating from '@/views/acs/device/driver/hailing_zgbz/hailiang_coating'
import hailiang_flat from '@/views/acs/device/driver/hailing_zgbz/hailiang_flat'
import hailiang_special_pick_station from '@/views/acs/device/driver/hailiang_one/hailiang_special_pick_station'
import hailiang_special_empty_station from '@/views/acs/device/driver/hailiang_one/hailiang_special_empty_station'
@ -116,7 +117,7 @@ export default {
lamp_three_color, standard_storage, special_ordinary_site, standard_scanner, standard_conveyor_control_with_scanner,
standard_conveyor_control_with_plcscanner, standard_conveyor_control, standard_conveyor_monitor, weighing_site, machines_site, non_line_manipulator_inspect_site,
non_line_inspect_site, manipulator_inspect_site_NDC, standard_manipulator_stacking_site,
standard_photoelectric_inspect_site, ndxy_special,
standard_photoelectric_inspect_site, ndxy_special, hailiang_flat,
hailiang_labeling, hailiang_feeding_trunk, hailiang_feeding, hailiang_lettering, hailiang_risking, hailiang_strapping, hailiang_coating,
hailiang_special_pick_station, hailiang_special_empty_station, hailiang_special_full_station, hailiang_special_pour_station, hailiang_special_device },
dicts: ['device_type'],

458
qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue

@ -0,0 +1,458 @@
<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>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.OPCServer" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<!-- <el-row>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="检验有货">-->
<!-- <el-switch v-model="form.inspect_in_stocck" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="忽视取货校验" label-width="150px">-->
<!-- <el-switch v-model="form.ignore_pickup_check" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="忽视放货校验" label-width="150px">-->
<!-- <el-switch v-model="form.ignore_release_check" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="申请任务">-->
<!-- <el-switch v-model="form.apply_task" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="手动生成任务" label-width="150px">-->
<!-- <el-switch v-model="form.manual_create_task" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="申请空盘" prop="device_code">-->
<!-- <el-select-->
<!-- v-model="form.apply_empty"-->
<!-- filterable-->
<!-- multiple-->
<!-- placeholder="请选择"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in deviceList"-->
<!-- :key="item.device_code"-->
<!-- :label="item.device_name"-->
<!-- :value="item.device_code"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">AGV相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<!-- <el-row>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="取货">-->
<!-- <el-switch v-model="form.pickup" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="放货">-->
<!-- <el-switch v-model="form.is_release" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].db" size="mini" class="edit-input" @input="finishReadEdit(data1[scope.$index])" />
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].db" size="mini" class="edit-input" @input="finishWriteEdit(data2[scope.$index])" />
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
export default {
name: 'StandardManipulatorInspectSite',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
apply_empty: [],
manual_create_task: true,
is_pickup: true,
is_release: true
},
rules: {}
}
},
created() {
this.$nextTick(() => {
//
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
//
if (data.form) {
const arr = Object.keys(data.form)
//
if (arr.length > 0) {
this.form = data.form
}
}
//
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
//
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
})
},
methods: {
finishReadEdit(data) {
// code,mode
if (data.code.indexOf('mode') !== -1) {
const dbValue = data.db
// .
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .
const afterStr = dbValue.match(/\.(\S*)/)[1]
//
const endNumber = afterStr.substring(1)
//
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('move') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('action') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data1[val].code.indexOf('ioaction') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
}
}
}
},
finishWriteEdit(data) {
// code,mode
if (data.code.indexOf('to_command') !== -1) {
const dbValue = data.db
// .
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .
const afterStr = dbValue.match(/\.(\S*)/)[1]
//
const endNumber = afterStr.substring(1)
//
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_target') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data2[val].code.indexOf('to_task') !== -1) {
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
}
}
}
},
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
//
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // DBItem
this.data1.forEach(item => {
const str = item.code
// .
if (str.search('.') !== -1) {
//
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// .
if (str.search('.') !== -1) {
//
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save