| | |
| | | } |
| | | } |
| | | if (wrkMast != null) { |
| | | // News.warn(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | // if (devp.getId() == 2) { |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // } |
| | | // |
| | | // // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "工作档已存在该条码号===>>" + barcode; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // } |
| | | News.warn(""+mark+" - 4"+" - 满托盘入库工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | if (devp.getId() == 2) { |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "工作档已存在该条码号===>>" + barcode; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | |
| | | // ledThread.errorReset(); |
| | | } |
| | | } else { |
| | | News.error(""+mark+" - 5"+" - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | News.error(""+mark+" - 5"+" - 满板入库请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | if(devp.getId() == 2) { |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | |
| | | } |
| | | // ledThread.errorReset(); |
| | | } |
| | | Thread.sleep(500); |
| | | } else { |
| | | staProtocol.setWorkNo((short)9991); |
| | | staProtocol.setStaNo((short)100); |
| | |
| | | MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | } |
| | | News.error(""+mark+" - 3"+" - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | News.error(""+mark+" - 3"+" - 空板入库请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index*6, (short)4); |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + index*6+4, (short)2); |
| | | OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + (index*6+4), (short)2); |
| | | //OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB1000." + index*4, (short)4); |
| | | if(readResult.IsSuccess && readResult1.IsSuccess){ |
| | | short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 2); |
| | | if(staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)){ |
| | | int workNo = siemensS7Net.getByteTransform().TransInt32(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 0); |
| | | if(staProtocol.getWorkNo().equals((short)workNo) && staProtocol.getStaNo().equals(staNo)){ |
| | | //任务命令写入成功 |
| | | writeFlag = true; |
| | | log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | |
| | | log.error("写入输送线命令尝试5次失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | //重新添加数据到任务队列 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol)); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol)); |
| | | read();//读取1次设备状态 |
| | | return; |
| | | } else { |