|  |  |  | 
|---|
|  |  |  | //        // 更新入出库模式 | 
|---|
|  |  |  | //        updateIoMode(); | 
|---|
|  |  |  | int staNoSize = staNos.size(); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*4)); | 
|---|
|  |  |  | if (result.IsSuccess) { | 
|---|
|  |  |  | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*2)); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2)); | 
|---|
|  |  |  | if (result.IsSuccess && result4.IsSuccess) { | 
|---|
|  |  |  | for (int i = 0; i < staNoSize; i++) { | 
|---|
|  |  |  | Integer siteId = staNos.get(i); // 站点编号 | 
|---|
|  |  |  | StaProtocol staProtocol = station.get(siteId); | 
|---|
|  |  |  | 
|---|
|  |  |  | staProtocol.setSiteId(siteId); | 
|---|
|  |  |  | station.put(siteId, staProtocol); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4));     // 工作号 | 
|---|
|  |  |  | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*2));     // 工作号 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4 + 2));   // 目标站 | 
|---|
|  |  |  | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result4.Content, i*2));   // 目标站 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        Thread.sleep(200); | 
|---|
|  |  |  | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | Thread.sleep(200); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.100", (short) (staNoSize * 2)); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB102.100", (short) (staNoSize * 2)); | 
|---|
|  |  |  | if (result1.IsSuccess) { | 
|---|
|  |  |  | for (int i = 0; i < staNoSize; i++) { | 
|---|
|  |  |  | Integer siteId = staNos.get(i); // 站点编号 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //条码扫描器 | 
|---|
|  |  |  | Thread.sleep(200); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.150",(short)(barcodeSize*8)); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize*8)); | 
|---|
|  |  |  | if (result2.IsSuccess) { | 
|---|
|  |  |  | for (int i = 0; i < barcodeSize; i++) { | 
|---|
|  |  |  | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //RGV小车 | 
|---|
|  |  |  | Thread.sleep(200); | 
|---|
|  |  |  | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.160",(short)2); | 
|---|
|  |  |  | if (result3.IsSuccess) { | 
|---|
|  |  |  | Integer siteId = 16; | 
|---|
|  |  |  | StaProtocol staProtocol = station.get(siteId); | 
|---|
|  |  |  | if (null == staProtocol) { | 
|---|
|  |  |  | staProtocol = new StaProtocol(); | 
|---|
|  |  |  | staProtocol.setSiteId(siteId); | 
|---|
|  |  |  | station.put(siteId, staProtocol); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        //RGV小车 | 
|---|
|  |  |  | //        Thread.sleep(200); | 
|---|
|  |  |  | //        OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.160",(short)2); | 
|---|
|  |  |  | //        if (result3.IsSuccess) { | 
|---|
|  |  |  | //            Integer siteId = 16; | 
|---|
|  |  |  | //            StaProtocol staProtocol = station.get(siteId); | 
|---|
|  |  |  | //            if (null == staProtocol) { | 
|---|
|  |  |  | //                staProtocol = new StaProtocol(); | 
|---|
|  |  |  | //                staProtocol.setSiteId(siteId); | 
|---|
|  |  |  | //                station.put(siteId, staProtocol); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0))); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | short[] array = new short[2]; | 
|---|
|  |  |  | array[0] = staProtocol.getWorkNo(); | 
|---|
|  |  |  | array[1] = staProtocol.getStaNo(); | 
|---|
|  |  |  | OperateResult write = siemensS7Net.Write("DB100." + index*4, array); | 
|---|
|  |  |  | //        OperateResult write = siemensS7Net.Write("DB100." + index*4, array); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo());    // 工作号 | 
|---|
|  |  |  | //        Thread.sleep(500); | 
|---|
|  |  |  | //        OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo());    // 目标站 | 
|---|
|  |  |  | OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo());    // 工作号 | 
|---|
|  |  |  | Thread.sleep(500); | 
|---|
|  |  |  | OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo());    // 目标站 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!write.IsSuccess) { | 
|---|
|  |  |  | staProtocol = station.get(staProtocol.getSiteId()); | 
|---|