| | |
| | | // add(2045);add(2046);add(2047);add(2048); |
| | | // add(2101);add(2102);add(2103);add(2104);add(2105);add(2106);add(2107);add(2108);add(2109);add(2110); |
| | | // add(2111);add(2112);add(2113);add(2114);add(2115);add(2116);add(2117);add(2118);add(2119);add(2120); |
| | | // add(4001);add(4003);add(4004);add(4006); |
| | | add(4001);add(4003);add(4004);add(4006); |
| | | }}; |
| | | |
| | | // 站点偏移量映射表 |
| | |
| | | }}; |
| | | |
| | | public static final Map<Integer, Integer> siteErrOffsetMap = new HashMap<Integer, Integer>() {{ |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270); |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270);put(4001,294); |
| | | |
| | | }}; |
| | | |
| | | // 特殊站点集合 |
| | | private static final Set<Integer> specialSites = new HashSet<>( |
| | | Arrays.asList(1001,1005,1008,1011,1015,1019,1022,1025,1029, 1032,1039,2004,2001,2007,2010,2016,2013,2019,2022,2025,4001,4004)); |
| | | Arrays.asList(1001,1005,1008,1011,1015,1019,1022,1025,1029, 1032,1039,2004,2001,2007,2010,2016,2013,2019,2022,2025,2028,4001,4004)); |
| | | |
| | | // 特殊站点集合 |
| | | private static final Set<Integer> specialSites2 = new HashSet<>( |
| | |
| | | add(3); add(4); add(5); |
| | | }}; |
| | | public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ |
| | | add(1103);add(1036);add(1047); |
| | | add(1103);add(1036);add(1047);add(2037); |
| | | }}; |
| | | |
| | | private Integer count=0; |
| | |
| | | public static int getOffsetBySiteId2(int siteId) { |
| | | int offset = 0; |
| | | if (specialSites.contains(siteId)) { |
| | | offset = 72; // 特殊站点占 96 |
| | | offset = 72; // 特殊站点占 72 |
| | | } else { |
| | | offset = 60; // 普通站点占 72 |
| | | offset = 60; // 普通站点占 60 |
| | | } |
| | | return offset; |
| | | } |
| | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3, 1); |
| | | staProtocol.setAutoing(!status[0]); // 自动 |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 4, 3); |
| | | |
| | | staProtocol.setLoading(!status1[0]); // 有物 |
| | | boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(result.Content, offset + 54, 1); |
| | | boolean loading = false; |
| | | if(!status1[0]) |
| | | // && statusErr[2]) |
| | | { |
| | | loading = true; |
| | | } |
| | | staProtocol.setLoading(loading); // 有物 |
| | | |
| | | staProtocol.setInEnable(status1[2]); // 可入 |
| | | staProtocol.setOutEnable(status1[2]);// 可出 |
| | |
| | | //条码扫描器 |
| | | |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | | OperateResultExOne<byte[]> reasultBarcode1 = siemensS7Net.Read("DB101.780", (short) 8);//1036 |
| | | OperateResultExOne<byte[]> reasultBarcode2 = siemensS7Net.Read("DB104.548", (short) 8);//1047 |
| | | OperateResultExOne<byte[]> reasultBarcode3 = siemensS7Net.Read("DB102.2780", (short) 8);//1103 |
| | | OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB201.344", (short) 8); |
| | | OperateResultExOne<byte[]> reasultBarcode1 = siemensS7Net.Read("DB101.780", (short) 4);//1036 |
| | | OperateResultExOne<byte[]> reasultBarcode2 = siemensS7Net.Read("DB104.548", (short) 4);//1047 |
| | | OperateResultExOne<byte[]> reasultBarcode3 = siemensS7Net.Read("DB102.2780", (short) 4);//1103 |
| | | OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB201.344", (short) 4);//2037 |
| | | OperateResultExOne<byte[]> reasultBarcode5 = siemensS7Net.Read("DB400.112", (short) 4);//4001 |
| | | |
| | | if(barcodeList.get(0) == 0){ |
| | | if(reasultBarcode1.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | }else if(barcodeList.get(0) == 3){ |
| | | if(reasultBarcode4.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode4.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + +1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | if(reasultBarcode5.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(1); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode5.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + +1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | |