| | |
| | | } |
| | | |
| | | |
| | | // 外形检测 - 1楼 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.1", (short)48); |
| | | if (result4.IsSuccess) { |
| | | StaProtocol staProtocol100 = station.get(100); |
| | | StaProtocol staProtocol110 = station.get(110); |
| | | for (int i=0 ;i<6;i++){ |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result4.Content, i, 1); |
| | | if (i==0){ |
| | | }else if (i==1){ |
| | | staProtocol100.setFrontErr(status[3]);// 前超限 |
| | | staProtocol100.setBackErr(status[4]);// 后超限 |
| | | staProtocol100.setHighErr(status[5]); // 高超限 |
| | | staProtocol100.setLeftErr(status[6]);// 左超限 |
| | | }else if (i==2){ |
| | | staProtocol100.setRightErr(status[0]);// 右超限 |
| | | |
| | | staProtocol110.setFrontErr(status[1]); |
| | | staProtocol110.setBackErr(status[2]); |
| | | staProtocol110.setHighErr(status[3]); |
| | | staProtocol110.setLeftErr(status[4]); |
| | | staProtocol110.setRightErr(status[5]); |
| | | }else if (i==3){ |
| | | }else if (i==4){ |
| | | staProtocol100.setBarcodeErr(status[2]); |
| | | staProtocol110.setBarcodeErr(status[3]); |
| | | }else if (i==5){ |
| | | staProtocol100.setWeightErr(status[0]); |
| | | staProtocol110.setWeightErr(status[1]); |
| | | staProtocol100.setBarcodeErr(status[2]); |
| | | staProtocol110.setBarcodeErr(status[3]); |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> resultError = siemensS7Net.Read("DB101.102", (short) (8)); |
| | | if (resultError.IsSuccess) { |
| | | ArrayList<Integer> staNoError = new ArrayList<Integer>() {{ |
| | | add(102); |
| | | add(201); |
| | | add(211); |
| | | }}; |
| | | for (int i = 0; i < staNoError.size(); i++) { |
| | | Integer siteId = staNoError.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultError.Content, i * 4 + 2, 1); |
| | | staProtocol.setFrontErr(status[0]);// 前超限 |
| | | staProtocol.setBackErr(status[1]);// 后超限 |
| | | staProtocol.setHighErr(status[2]);// 高超限 |
| | | staProtocol.setLeftErr(status[3]);// 左超限 |
| | | staProtocol.setRightErr(status[4]);// 右超限 |
| | | staProtocol.setWeightErr(status[5]); // 超重 |
| | | staProtocol.setBarcodeErr(status[6]);// 扫码失败 |
| | | } |
| | | |
| | | } |
| | | |
| | | |