| | |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | News.error(methodName + ":扫码失败,请重试"); |
| | | News.error(methodName + ":扫码失败,请重试"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | continue; |
| | |
| | | if (wrkMast != null) { |
| | | News.error(methodName + ":工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | if (ledThread != null) { |
| | | News.error(methodName + ":扫码失败,请重试"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={"+ wrkMast.getWrkNo() + "}, 请手动取消已存在工作档")); |
| | | News.error(methodName + ":扫码失败,请重试"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={" + wrkMast.getWrkNo() + "}, 请手动取消已存在工作档")); |
| | | } |
| | | continue; |
| | | } |
| | |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | News.error(methodName + ":更新plc站点信息失败"); |
| | | News.error(methodName + ":更新plc站点信息失败"); |
| | | |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } |
| | | News.error(methodName +":请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | News.error(methodName + ":请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | |
| | | } |
| | | |
| | |
| | | News.error(methodName + ":更新工作档失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | } |
| | | } else { |
| | | News.error(methodName +":发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | News.error(methodName + ":发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | } |
| | | |
| | | } |
| | |
| | | locMast.setLocSts("Q"); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | | News.error(methodName+ ":修改库位状态失败"); |
| | | News.error(methodName + ":修改库位状态失败"); |
| | | |
| | | throw new CoolException("修改库位状态失败"); |
| | | } |
| | |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | //查询工作档 |
| | | List<WrkMast> wrkMasts= wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("crn_no",crnSlave.getCrnOutStn()) |
| | | .and() |
| | | .gt("io_type",100) |
| | | .orderBy("appe_time") |
| | | ); |
| | | if(Cools.isEmpty(wrkMasts)){ |
| | | continue; |
| | | } |
| | | //遍历任务档,按生成时间进行排序 |
| | | for (WrkMast wrkMast: wrkMasts) { |
| | | // 判断工作档条件 |
| | | if (wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) { |
| | | continue; |
| | | } |
| | | CrnSlave.CrnStn crnStn = null; |
| | | for (CrnSlave.CrnStn crnStn1 : crnSlave.getCrnOutStn()) { |
| | | if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) { |
| | | crnStn = crnStn1; |
| | | break; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (Cools.isEmpty(crnStn)) { |
| | | continue; |
| | | } |
| | | |
| | | // 遍历堆垛机出库站 |
| | | for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { |
| | | // 获取堆垛机出库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) { |
| | | |
| | | |
| | | // 查询工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | // 判断工作档条件 |
| | | if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) { |
| | | continue; |
| | | } |
| | | // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // public synchronized void crnStnToOutStn1() { |
| | | // String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | // |
| | | // for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | // // 遍历堆垛机出库站 |
| | | // for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { |
| | | // // 获取堆垛机出库站信息 |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | // StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | | // if (staProtocol == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) { |
| | | // // 查询工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId()); |
| | | // if (wrkMast == null) { |
| | | // continue; |
| | | // } |
| | | // // 判断工作档条件 |
| | | // if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) { |
| | | // continue; |
| | | // } |
| | | // // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档 |
| | | // CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo()); |
| | | // CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | // if (crnProtocol.statusType == CrnStatusType.FETCHING || crnProtocol.statusType == CrnStatusType.PUTTING) { |
| | | // // 移动中 |
| | | // continue; |
| | | // } |
| | | // // 判断堆垛机状态等待确认 |
| | | // if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue()) |
| | | // && crnProtocol.statusType == CrnStatusType.WAITING |
| | | // && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | // |
| | | // // 命令下发区 -------------------------------------------------------------------------- |
| | | // |
| | | // // 下发站点信息 |
| | | // staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | // staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | // if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // // 更新工作档状态为14失败 |
| | | // wrkMast.setWrkSts(14L); |
| | | // wrkMast.setCrnEndTime(new Date()); |
| | | // if (wrkMastMapper.updateById(wrkMast) != 0) { |
| | | // // 复位堆垛机 |
| | | // crnThread.setResetFlag(true); |
| | | // } else { |
| | | // News.error(methodName + ":更新工作档的工作状态为14失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 入出库 ===>> 堆垛机入出库作业下发 |
| | |
| | | */ |
| | | public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol) { |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | |
| | | for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) { |
| | | // 获取工作状态为11(生成出库ID)的出库工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo()); |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo()); |
| | | //按照工作档出库 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("crn_no", slave.getId()) |
| | | .and() |
| | | .gt("io_type", 100) |
| | | .orderBy("appe_time") |
| | | ); |
| | | if (!Cools.isEmpty(wrkMasts)) { |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | if (wrkMast == null) { |
| | | CrnSlave.CrnStn crnStn = null; |
| | | for (CrnSlave.CrnStn crnStn1 : slave.getCrnOutStn()) { |
| | | if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) { |
| | | crnStn = crnStn1; |
| | | break; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (Cools.isEmpty(crnStn)) { |
| | | continue; |
| | | } |
| | | // 工作档状态判断 |
| | | if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) { |
| | | News.error(methodName + ":查询工作档数据不符合条件--入出类型/站点, 工作号={},源库位={},入出类型={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType()); |
| | | if (wrkMast.getSourceStaNo() == null) { |
| | | log.error("查询工作档数据不符合条件--入出类型/站点, 工作号={},源库位={},入出类型={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType()); |
| | | continue; |
| | | } |
| | | |
| | | // 获取源库位信息 |
| | | LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) { |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | // 获取目标库位信息 |
| | | LocMast sta = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (null == sta) { |
| | | News.error(methodName + ":工作档库位移转失败,原因:检索目标库位失败!工作号={},源库位={}", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | News.error(methodName + ":工作档库位移转失败,原因:检索目标库位失败!工作号={},源库位={}", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | return; |
| | | } |
| | | // 获取堆垛机信息 并 判断是否可入出 |
| | |
| | | ledCommand.setIoType(wrkMast.getIoType()); |
| | | ledCommand.setTitle(wrkMast.getIoType$()); |
| | | |
| | | switch (wrkMast.getIoType()){ |
| | | switch (wrkMast.getIoType()) { |
| | | case 10: |
| | | case 110: |
| | | ledCommand.setEmptyMk(true); |
| | |
| | | // |
| | | // |
| | | // } |
| | | |
| | | public synchronized void outOfDevp() { |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectPick(); |
| | | for (WrkMast wrkMast : wrkMasts) { |