| | |
| | | // 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(2121);add(2122); |
| | | add(4001);add(4003);add(4004);add(4006); |
| | | }}; |
| | | |
| | |
| | | put(2031, 120);put(2032, 124);put(2033, 128);put(2034, 132);put(2035, 136); |
| | | put(2037, 144); |
| | | |
| | | put(4001, 240);put(4002, 244);put(4003, 248);put(4004, 252);put(4005, 256); |
| | | put(4006, 260); |
| | | put(2101, 160);put(2102, 164);put(2103, 168);put(2104, 172);put(2105, 176); |
| | | put(2106, 180);put(2107, 184);put(2108, 188);put(2109, 192);put(2110, 196); |
| | | put(2111, 200);put(2112, 204);put(2113, 208);put(2114, 212);put(2115, 216); |
| | | put(2116, 220);put(2117, 224);put(2118, 228);put(2119, 232);put(2120, 236); |
| | | put(2121, 240);put(2122, 244); |
| | | put(4001, 248);put(4002, 252);put(4003, 256);put(4004, 260);put(4005, 264); |
| | | put(4006, 268); |
| | | // 其他站点同理继续加 |
| | | }}; |
| | | |
| | | public static final Map<Integer, Integer> siteErrOffsetMap = new HashMap<Integer, Integer>() {{ |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270);put(4001,294); |
| | | put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 278);put(4001,302); |
| | | |
| | | }}; |
| | | public static final Map<Integer, Integer> siteAgvOffsetMap = new HashMap<Integer, Integer>() {{ |
| | | put(1037, 0);put(1039, 2);put(1041, 4);put(2033, 0);put(2034,2);put(4003,4);put(4006,6); |
| | | |
| | | }}; |
| | | |
| | | public static final Map<Integer, Integer> site2lBarcodeOffsetMap = new HashMap<Integer, Integer>() {{//2楼pda写入条码 |
| | | put(2102, 2280);put(2105, 3048);put(2112, 4840);put(2115, 5608); |
| | | |
| | | }}; |
| | | |
| | |
| | | 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 |
| | | result6 = siemensS7Net.Read("DB202.0", (short) (7400));//2101-2122 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (354)); |
| | | result6 = siemensS7Net.Read("DB202.0", (short) (2024));//2101-2122 |
| | | resultErr = siemensS7Net.Read("DB3.0", (short) (386)); |
| | | // resultAgv = siemensS7Net.Read("DB901.0", (short) (7)); //agv取放货请求 |
| | | // resultPlc = siemensS7Net.Read("DB902.0", (short) (7)); //输送线确认 |
| | | resultArm5 = siemensS7Net.Read("DB202.4328", (short) (254));//2110 |
| | | resultArm6 = siemensS7Net.Read("DB202.6888", (short) (254));//2120 |
| | | resultArm5 = siemensS7Net.Read("DB202.4328", (short) (256));//2110 |
| | | resultArm6 = siemensS7Net.Read("DB202.6888", (short) (256));//2120 |
| | | } |
| | | |
| | | |
| | |
| | | if (siteId == 2110) { |
| | | if (resultArm5.IsSuccess) { |
| | | // 转换为字符串 |
| | | String resultString = siemensS7Net.getByteTransform().TransString(resultArm5.Content, 2, 252,"UTF-8"); |
| | | String resultString = siemensS7Net.getByteTransform().TransString(resultArm5.Content, 2, 254,"UTF-8"); |
| | | // 去除可能的空字符 |
| | | // resultString = resultString.TrimEnd('\0'); |
| | | // System.out.println("2110Barcode:"+resultString); |
| | |
| | | } else if (siteId == 2120){ |
| | | if (resultArm6.IsSuccess) { |
| | | // 转换为字符串 |
| | | String resultString = siemensS7Net.getByteTransform().TransString(resultArm6.Content, 2, 252,"UTF-8"); |
| | | String resultString = siemensS7Net.getByteTransform().TransString(resultArm6.Content, 2, 254,"UTF-8"); |
| | | // 去除可能的空字符 |
| | | // resultString = resultString.TrimEnd('\0'); |
| | | // System.out.println("2120Barcode:"+resultString); |
| | |
| | | staProtocol.setAutoing(!status[0]); // 自动 |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 4, 3); |
| | | boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 8, 3); |
| | | // boolean[] statusSign = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetSign, 3); |
| | | boolean[] statusSign = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetSign, 3); |
| | | |
| | | boolean loading = false; |
| | | if(!status1[0]) |
| | |
| | | staProtocol.setDataError(statusErr[18]); |
| | | |
| | | //信号 |
| | | // staProtocol.setSensorGArrive(statusSign[0]); |
| | | // staProtocol.setSensorGDec(statusSign[1]); |
| | | // staProtocol.setSensorGArrive2(statusSign[2]); |
| | | // staProtocol.setSensorLimit(statusSign[3]); |
| | | // staProtocol.setEmergency(statusSign[4]); |
| | | // staProtocol.setSensorGLeave(statusSign[5]); |
| | | // staProtocol.setSensorGLeave2(statusSign[6]); |
| | | // staProtocol.setSensorCUp(statusSign[7]); |
| | | // staProtocol.setSensorCDown(statusSign[8]); |
| | | // staProtocol.setLiftMotorFr(statusSign[9]); |
| | | // staProtocol.setLineMotorFr(statusSign[10]); |
| | | // staProtocol.setTranMotorFr(statusSign[11]); |
| | | // staProtocol.setRst1(statusSign[12]); |
| | | // staProtocol.setRst2(statusSign[13]); |
| | | // staProtocol.setRst3(statusSign[14]); |
| | | // staProtocol.setRst4(statusSign[15]); |
| | | // staProtocol.setSensorArriveD(statusSign[16]); |
| | | // staProtocol.setSensorDecD(statusSign[17]); |
| | | // staProtocol.setSensorArriveL(statusSign[18]); |
| | | // staProtocol.setSensorDecL(statusSign[19]); |
| | | // staProtocol.setSensorArriveR(statusSign[20]); |
| | | // staProtocol.setSensorDecR(statusSign[21]); |
| | | staProtocol.setSensorGArrive(statusSign[0]); |
| | | staProtocol.setSensorGDec(statusSign[1]); |
| | | staProtocol.setSensorGArrive2(statusSign[2]); |
| | | staProtocol.setSensorLimit(statusSign[3]); |
| | | staProtocol.setEmergency(statusSign[4]); |
| | | staProtocol.setSensorGLeave(statusSign[5]); |
| | | staProtocol.setSensorGLeave2(statusSign[6]); |
| | | staProtocol.setSensorCUp(statusSign[7]); |
| | | staProtocol.setSensorCDown(statusSign[8]); |
| | | staProtocol.setLiftMotorFr(statusSign[9]); |
| | | staProtocol.setLineMotorFr(statusSign[10]); |
| | | staProtocol.setTranMotorFr(statusSign[11]); |
| | | staProtocol.setRst1(statusSign[12]); |
| | | staProtocol.setRst2(statusSign[13]); |
| | | staProtocol.setRst3(statusSign[14]); |
| | | staProtocol.setRst4(statusSign[15]); |
| | | staProtocol.setSensorArriveD(statusSign[16]); |
| | | staProtocol.setSensorDecD(statusSign[17]); |
| | | staProtocol.setSensorArriveL(statusSign[18]); |
| | | staProtocol.setSensorDecL(statusSign[19]); |
| | | staProtocol.setSensorArriveR(statusSign[20]); |
| | | staProtocol.setSensorDecR(statusSign[21]); |
| | | |
| | | // Integer offsetAgv = siteAgvOffsetMap.get(siteId); |
| | | // |
| | |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | if(siteId == 2110){ |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | if(staProtocol.isWriteMk() && staProtocol.isErrorMk()){ |
| | | try { |
| | | // 日志记录异常情况 |
| | |
| | | }else{ |
| | | write1 = siemensS7Net.Write("DB200." + (offset + offset2 + 12), staProtocol.getStaNo().intValue()); // 目标站 |
| | | } |
| | | }else if(siteId < 4000){ |
| | | }else if(siteId < 2121){ |
| | | write = siemensS7Net.Write("DB201." + (offset + offset2), staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(200); |
| | | if(specialSites2.contains(siteId)){ |
| | |
| | | }else{ |
| | | write1 = siemensS7Net.Write("DB201." + (offset + offset2 + 12), staProtocol.getStaNo().intValue()); // 目标站 |
| | | } |
| | | } else if(siteId < 4000){ |
| | | Integer offsetBarcode = site2lBarcodeOffsetMap.get(siteId); |
| | | write = siemensS7Net.Write("DB202." + offsetBarcode, staProtocol.getBarcode()); // 条码 |
| | | write1 = siemensS7Net.Write("DB202." + offsetBarcode, staProtocol.getBarcode()); |
| | | Thread.sleep(200); |
| | | }else{ |
| | | write = siemensS7Net.Write("DB400." + (offset + offset2), staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(200); |