| | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | |
| | | if (!staProtocol.isPakMkRun() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMkRun(true); |
| | | } |
| | | |
| | | if (!staProtocol.isPakMkTask() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMkTask(true); |
| | | } |
| | | } |
| | | } |
| | | int[] staW = new int[]{1004,1014,1020}; |
| | | |
| | | //条码 |
| | | // Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB400.100.0",(short) (barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | Integer siteId = staW[i]; // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,6, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | if (!Cools.isEmpty(barcode) && !barcode.equals("000000")){ |
| | | staProtocol.setBarcodeNow(barcode); |
| | | } else if (Cools.isEmpty(barcode)){ |
| | | staProtocol.setBarcodeNow("-"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //条码 |
| | | // Thread.sleep(50); |
| | | int[] staW = new int[]{1004,1014,1020}; |
| | | |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4)); |
| | | if (result3.IsSuccess) { |
| | |
| | | staProtocol.setHighErr(status[2]); // 高超限 |
| | | staProtocol.setLeftErr(status[3]); // 左超限 |
| | | staProtocol.setRightErr(status[4]); // 右超限 |
| | | staProtocol.setWeightErr(status[5]); // 超重 |
| | | staProtocol.setBarcodeErr(status[6]); // 扫码失败 |
| | | } |
| | | } |
| | | |
| | | try{ |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0",(short) (staNoSize*4)); |
| | | if (resultErr.IsSuccess){ |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setSiteId(siteId); |
| | | boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4, 1); |
| | | staProtocol.setErrOther1(statusErr[0]); // 电路保护器断开 |
| | | staProtocol.setErrOther2(statusErr[1]); // 光电异常 |
| | | staProtocol.setErrOther3(statusErr[2]); // 运行超时 |
| | | staProtocol.setErrOther4(statusErr[3]); // 占位超时 |
| | | staProtocol.setErrOther5(statusErr[4]); // 有任务无货故障 |
| | | staProtocol.setErrOther6(statusErr[5]); // 变频器故障 |
| | | staProtocol.setErrOther7(statusErr[6]); // 接触器故障 |
| | | staProtocol.setErrOther8(statusErr[7]); // 顶升电机接触器故障 |
| | | } |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | if (result.IsSuccess) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置入库标记 |
| | | */ |
| | | @Override |
| | | public void setPakMkTask(Integer siteId, boolean pakMk) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null != staProtocol) { |
| | | staProtocol.setPakMkTask(pakMk); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置入库标记 |
| | | */ |
| | | @Override |
| | | public void setPakMkRun(Integer siteId, boolean pakMk) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null != staProtocol) { |
| | | staProtocol.setPakMkRun(pakMk); |
| | | } |
| | | } |
| | | /** |
| | | * 设置入库标记 |
| | | */ |