| | |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | | */ |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | public synchronized void generateStoreWrkFile(Integer mark) throws InterruptedException { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | //调用外形检测 |
| | | if (!shape(devp, staProtocol, devpThread, inSta)) { |
| | | continue; |
| | | } |
| | | |
| | | //LED |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // 入出库模式判断 |
| | | // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } |
| | | // if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { |
| | | // continue; |
| | | // } |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (!staProtocol.isLoading()){ |
| | | continue; |
| | | } |
| | | String barcode11 = barcodeThread.getBarcode(); |
| | | if (Cools.isEmpty(barcode11)){ |
| | | if (staProtocol.isAutoing()&& !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9999 && staProtocol.isPakMk() && staProtocol.getStamp()==2){ |
| | | staProtocol.setStamp(3); |
| | | News.info(""+mark+" - 7"+" - 扫码失败2 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode11, inSta.getStaNo()); |
| | | staProtocol.setWorkNo((short) 9989); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() > 9990 |
| | | && staProtocol.getWorkNo()!=9999 && staProtocol.getWorkNo()!=9992 && staProtocol.getWorkNo()!=0 |
| | | && staProtocol.isPakMk() && staProtocol.getStamp()>=2 && staProtocol.getStamp()!=3) {// && !Cools.isEmpty(barcode)) { |
| | | News.warnNoLog(""+mark+" - 0"+" - 开始执行"); |
| | | // try { |
| | | // Thread.sleep(300); |
| | | // }catch (Exception e){} |
| | | |
| | | |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | |
| | | } |
| | | continue; |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() > 9990 |
| | | && staProtocol.getWorkNo() != 9999 && staProtocol.getWorkNo() != 9992 && staProtocol.getWorkNo() != 0 |
| | | && staProtocol.isPakMk()) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行"); |
| | | |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | |
| | | }else { |
| | | News.errorNoLog(""+mark+" - 6"+" - 站点信息不符合入库条件!!!"+" 自动信号:"+staProtocol.isAutoing()+"、可入信号:" + staProtocol.isInEnable() |
| | | +"、空板信号:"+ staProtocol.isEmptyMk()+"、工作号:" + staProtocol.getWorkNo() |
| | | +"、锁定标记"+ staProtocol.isPakMk()+"、入库印记:" + staProtocol.getStamp()); |
| | | + "、锁定标记" + staProtocol.isPakMk()); |
| | | } |
| | | |
| | | } |
| | |
| | | }else { |
| | | News.errorNoLog(""+mark+" - 6"+" - 站点信息不符合入库条件!!!"+" 自动信号:"+staProtocol.isLoading()+"、可入信号:" + staProtocol.isInEnable() |
| | | +"、空板信号:"+ staProtocol.isEmptyMk()+"、工作号:" + staProtocol.getWorkNo() |
| | | +"、锁定标记"+ staProtocol.isPakMk()+"、入库印记:" + staProtocol.getStamp()); |
| | | + "、锁定标记" + staProtocol.isPakMk()); |
| | | } |
| | | } |
| | | } |
| | |
| | | && staProtocol.isInEnable() |
| | | && staProtocol.isEmptyMk() |
| | | && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) |
| | | && staProtocol.isPakMk()&& staProtocol.getStamp()>=2) { |
| | | && staProtocol.isPakMk()) { |
| | | News.warnNoLog(""+mark+" - 0"+" - 开始执行:空栈板初始化入库,叉车入库站放货"); |
| | | |
| | | try { |
| | |
| | | if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) { |
| | | continue; |
| | | } |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | // if (!commands.isEmpty()) { |
| | | // if (led.getId() < 7) { |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { |
| | | // News.error(""+mark+" - 2"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // continue; |
| | | // } else { |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | // } else { |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | // News.error(""+mark+" - 3"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // continue; |
| | | // } else { |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | if (!commands.isEmpty()) { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public short wrkNo = 9999; |
| | | |
| | | |
| | | private boolean shape(DevpSlave devp, StaProtocol staProtocol, DevpThread devpThread, DevpSlave.Sta sta) throws InterruptedException { |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = ""; |
| | | if (staProtocol.isFrontErr()) { |
| | | errMsg = "前超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isBackErr()) { |
| | | errMsg = "后超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isHighErr()) { |
| | | errMsg = "高超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isLeftErr()) { |
| | | errMsg = "左超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isRightErr()) { |
| | | errMsg = "右超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isWeightErr()) { |
| | | errMsg = "超重"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isBarcodeErr()) { |
| | | errMsg = "扫码失败"; |
| | | back = true; |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | if (!staProtocol.isLoading()) { |
| | | return true; |
| | | } |
| | | if (!staProtocol.isPakMk()) { |
| | | return true; |
| | | } |
| | | staProtocol.setWorkNo(wrkNo); |
| | | News.warn("{}入库回退:{},任务号:{}", sta.getStaNo(), errMsg, wrkNo); |
| | | staProtocol.setStaNo(sta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Led, sta.getLed(), new Task(5, errMsg)); |
| | | Thread.sleep(500); |
| | | } |
| | | return true; |
| | | } |
| | | } |