| | |
| | | add(2016);add(2018); |
| | | add(2019);add(2021); |
| | | add(2022);add(2024); |
| | | add(2028);add(2030); |
| | | add(2025);add(2027); |
| | | add(2031);add(2033); |
| | | add(2034);add(2035);add(2037); |
| | | add(2041);add(2042);add(2043);add(2044); |
| | | 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(2041);add(2042);add(2043);add(2044); |
| | | // 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); |
| | | }}; |
| | | |
| | | // 站点偏移量映射表 |
| | |
| | | }}; |
| | | |
| | | public static final Map<Integer, Integer> siteErrOffsetMap = new HashMap<Integer, Integer>() {{ |
| | | put(1036, 512);put(1103, 476);put(1047, 452); |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270); |
| | | |
| | | }}; |
| | | |
| | | // 特殊站点集合 |
| | | 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,2030,4001,4004)); |
| | | Arrays.asList(1001,1005,1008,1011,1015,1019,1022,1025,1029, 1032,1039,2004,2001,2007,2010,2016,2013,2019,2022,2025,4001,4004)); |
| | | |
| | | // 特殊站点集合 |
| | | private static final Set<Integer> specialSites2 = new HashSet<>( |
| | |
| | | public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{ |
| | | add(0); add(1); add(2); |
| | | }}; |
| | | public static final ArrayList<Integer> BarcodeListMat = new ArrayList<Integer>() {{ |
| | | add(3); add(4); |
| | | public static final ArrayList<Integer> BarcodeList2 = new ArrayList<Integer>() {{ |
| | | add(3); add(4); add(5); |
| | | }}; |
| | | public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ |
| | | add(1103);add(1036);add(1047); |
| | |
| | | return staNos1; |
| | | case 2: |
| | | return staNos2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | } |
| | | |
| | | private ArrayList<Integer> getBarcodeList() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | return BarcodeList; |
| | | case 2: |
| | | return BarcodeList2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | |
| | | OperateResultExOne<byte[]> result3 = null;//1042-1053 |
| | | OperateResultExOne<byte[]> result4 = null;//1054-1079 |
| | | OperateResultExOne<byte[]> result5 = null;//1080-1110 |
| | | OperateResultExOne<byte[]> resultErr = null;//1080-1110 |
| | | OperateResultExOne<byte[]> resultErr = null; |
| | | if(staNoSize == 99){ |
| | | result1 = siemensS7Net.Read("DB100.0", (short) (2768));//1001-1028 |
| | | result2 = siemensS7Net.Read("DB101.0", (short) (1268));//1029-1037 |
| | | result3 = siemensS7Net.Read("DB104.0", (short) (1268));//1042-1053 |
| | | result4 = siemensS7Net.Read("DB103.0", (short) (2824));//1054-1079 |
| | | result5 = siemensS7Net.Read("DB102.0", (short) (3428));//1080-1110 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (536));//1080-1110 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (536)); |
| | | }else{ |
| | | result1 = siemensS7Net.Read("DB200.0", (short) (3000));//2001-2030 |
| | | result2 = siemensS7Net.Read("DB201.0", (short) (720));//2031-2037 |
| | | result3 = siemensS7Net.Read("DB400.0", (short) (600));//4001-4006 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (354)); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setSiteId(siteId); |
| | | if (staNoSize == 99) { |
| | | if (siteId < 1029) { |
| | | result = result1; |
| | |
| | | } |
| | | } |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeList = BarcodeList; |
| | | |
| | | 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("DB104.180", (short) 184); |
| | | if(reasultBarcode1.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode1.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB201.344", (short) 8); |
| | | if(barcodeList.get(0) == 0){ |
| | | if(reasultBarcode1.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode1.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | if(reasultBarcode2.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(1); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode2.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | if(reasultBarcode2.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(1); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode2.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | if(reasultBarcode3.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(2); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | // News.error(JSON.toJSONString(barcode+"线程"+barcodeId)); |
| | | if(reasultBarcode3.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(2); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | if(reasultBarcode4.IsSuccess){ |
| | | Integer barcodeId = barcodeList.get(0); |
| | | String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode3.Content, 0)); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + +1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |