| | |
| | | public static final ArrayList<Integer> staNos1= new ArrayList<Integer>() {{ |
| | | add(1001);add(1002);add(1003);add(1004);add(1005);add(1006);add(1007);add(1008);add(1009);add(1010); |
| | | add(1011);add(1012);add(1013);add(1014);add(1015);add(1016);add(1017);add(1018);add(1019); |
| | | add(1020);add(1021);add(1022);add(1023);add(1024);add(1071); |
| | | add(1020);add(1021);add(1022);add(1023);add(1024);add(1701); |
| | | }}; |
| | | public static final ArrayList<Integer> staNos2= new ArrayList<Integer>() {{ |
| | | add(1025);add(1026);add(1027);add(1028);add(1029);add(1030);add(1031);add(1032);add(1033); |
| | | add(1034);add(1035);add(1036);add(1037);add(1039);add(1040);add(1041);add(1042);add(1043); |
| | | add(1044);add(1045);add(1046);add(1047);add(1048); |
| | | add(1034);add(1035);add(1036);add(1037);add(1038);add(1039);add(1040);add(1041);add(1042);add(1043); |
| | | add(1044);add(1045);add(1046);add(1047);add(1048);add(1702); |
| | | }}; |
| | | |
| | | |
| | | public static final ArrayList<Integer> BarcodeList1 = new ArrayList<Integer>() {{ |
| | | add(1002); add(1004);add(1006); add(1008); |
| | | add(5);add(6);add(7);add(8); |
| | | }}; |
| | | public static final ArrayList<Integer> BarcodeList2 = new ArrayList<Integer>() {{ |
| | | add(1); add(2); add(3); add(4); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> ErrList1 = new ArrayList<Integer>() {{ |
| | | add(1002); add(1004);add(1006); add(1008); |
| | | }}; |
| | | public static final ArrayList<Integer> ErrList2 = new ArrayList<Integer>() {{ |
| | | add(1041); add(1043);add(1045); add(1047); |
| | | }}; |
| | | |
| | |
| | | return BarcodeList2; |
| | | }else { |
| | | return BarcodeList1; |
| | | } |
| | | |
| | | } |
| | | |
| | | private ArrayList<Integer> getErrList() { |
| | | if (slave.getId() == 1){ |
| | | return ErrList2; |
| | | }else { |
| | | return ErrList1; |
| | | } |
| | | |
| | | } |
| | |
| | | News.info("SiemensDevp"+" - 1"+" - 输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format( "【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensDevp"+" - 2"+" - 输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // News.error("SiemensDevp"+" - 2"+" - 输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | siemensS7Net.ConnectClose(); |
| | | initSite(); |
| | |
| | | } else { |
| | | initSite(); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensCrn"+" - 4"+" - 读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | // News.error("SiemensCrn"+" - 4"+" - 读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | return; |
| | | } |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Integer> errList = getErrList(); |
| | | // 外形检测 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.800", (short) (barcodeList.size() *6)); // 不连续,多读中间一个 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.800", (short) (errList.size() *6)); // 不连续,多读中间一个 |
| | | if (resultErr.IsSuccess){ |
| | | for (int i = 0;i<barcodeList.size();i++){ |
| | | StaProtocol staProtocol = station.get(barcodeList.get(i)); |
| | | for (int i = 0;i<errList.size();i++){ |
| | | StaProtocol staProtocol = station.get(errList.get(i)); |
| | | short goodsHeight = siemensS7Net.getByteTransform().TransInt16(resultErr.Content, i * 4); |
| | | staProtocol.setGoodsHeight(goodsHeight); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4+2, 1); |
| | |
| | | int writeCount = 0; |
| | | do { |
| | | write = siemensS7Net.Write("DB100." + address, staProtocol.getWorkNo()); // 工作号 |
| | | write1 = siemensS7Net.Write("DB100." + (address + 2), staProtocol.getStaNo()); // 目标站 |
| | | write1 = siemensS7Net.Write("DB100." + (address + 4), staProtocol.getStaNo()); // 目标站 |
| | | Thread.sleep(200); |
| | | if(write.IsSuccess && write1.IsSuccess){ |
| | | break; |