| | |
| | | if (wrkMast.getSourceStaNo()==145){ |
| | | staNo = 147; |
| | | } |
| | | if (wrkMast.getSourceStaNo()==1908 || wrkMast.getSourceStaNo()==1901){ |
| | | staNo = 1907; |
| | | } |
| | | staProtocol.setStaNo(staNo); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | log.error("{}库位异常,未检索到相应工作档!", shallowLocNo); |
| | | } else { |
| | | if (waitWrkMast.getWrkSts() == 11) { |
| | | if (waitWrkMast.getIoPri() + 100000D < 99999999) { |
| | | if (waitWrkMast.getIoPri() + 100000D < 999999999D) { |
| | | waitWrkMast.setIoPri(waitWrkMast.getIoPri()+100000D); |
| | | } else { |
| | | waitWrkMast.setIoPri(99999999D); |
| | | waitWrkMast.setIoPri(999999999D); |
| | | } |
| | | waitWrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(waitWrkMast) == 0) { |
| | |
| | | */ |
| | | public synchronized void storeEmptyPlt() { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | if (devp.getId()==1) continue; |
| | | // if (devp.getId()==1) continue; |
| | | // 遍历空板入库口 |
| | | for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) { |
| | | // 获取空板入库站信息 |
| | |
| | | // 站点条件判断 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | | && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0) && staProtocol.isPakMk()) { |
| | | |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setIoType(10); |
| | | param.setSourceStaNo(emptyInSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String path = "/rpc/pakin/loc/v1"; |
| | | |
| | | if (staProtocol.getStaNo()==1908){ |
| | | param.setRgvNo(1); |
| | | path = "/rpc/pakin/empty/loc/v1"; |
| | | } |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setPath(path) |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | Integer staNo = dto.getStaNo(); |
| | | if (staProtocol.getStaNo()==1908){ |
| | | staNo = 1907; |
| | | } |
| | | // 更新站点信息 且 下发plc命令 |
| | | staProtocol.setWorkNo(dto.getWorkNo()); |
| | | staProtocol.setStaNo(dto.getStaNo()); |
| | | staProtocol.setStaNo(staNo); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 入库 ===>> 空栈板初始化入库,1楼叠盘机叠盘 |
| | | */ |
| | | public synchronized void storeEmptyPlt2() { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | if (devp.getId()==2) continue; |
| | | // 遍历空板入库口 |
| | | for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) { |
| | | // 获取空板入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | // 站点条件判断 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | | && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0) && staProtocol.isPakMk()) { |
| | | try { |
| | | WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(staProtocol.getSiteId() + 19999L); |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | | WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),staProtocol.getSiteId()); |
| | | wrkMastSta1.setType(2); |
| | | wrkMastSta1.setWrkType(1);//工作类型 1:取(叠盘) 2:拆盘 3:取放 5:满取 6:满放 |
| | | wrkMastStaMapper.insert(wrkMastSta1); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // /** |
| | | // * 入库 ===>> 空栈板初始化入库,1楼叠盘机叠盘 |
| | | // */ |
| | | // public synchronized void storeEmptyPlt2() { |
| | | // for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // if (devp.getId()==2) continue; |
| | | // // 遍历空板入库口 |
| | | // for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) { |
| | | // // 获取空板入库站信息 |
| | | // SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | // StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo()); |
| | | // if (staProtocol == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // |
| | | // // 站点条件判断 |
| | | // if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | | // && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0) && staProtocol.isPakMk()) { |
| | | // try { |
| | | // WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(staProtocol.getSiteId() + 19999L); |
| | | // if (Cools.isEmpty(wrkMastSta)){ |
| | | // WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),staProtocol.getSiteId()); |
| | | // wrkMastSta1.setType(2); |
| | | // wrkMastSta1.setWrkType(1);//工作类型 1:取(叠盘) 2:拆盘 3:取放 5:满取 6:满放 |
| | | // wrkMastStaMapper.insert(wrkMastSta1); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 空栈板初始化入库,叉车入库站放货 |
| | |
| | | if (Cools.isEmpty(wrkDetls)){ |
| | | continue; |
| | | } |
| | | Integer count1 = wrkDetlService.count1(); |
| | | Integer count11 = wrkDetlService.count11(); |
| | | // Integer count1 = wrkDetlService.count1(); |
| | | Integer count111 = wrkDetlService.count111(); |
| | | // Integer count11 = wrkDetlService.count11(); |
| | | Integer count2 = wrkDetlService.count2(wrkDetls.get(0).getOrderNo()); |
| | | Integer count3 = wrkDetlService.count3(); |
| | | wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count1+count11,count2,count3))); |
| | | wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count111,count2,count3))); |
| | | } |
| | | commands.add(ledCommand); |
| | | } |
| | |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) { |
| | | if (staProtocol.getWorkNo() != 0 || staProtocol.isLoading()) { |
| | | reset = false; |
| | | break; |
| | | } |
| | |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | if (led.getId() == 7) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } else { |
| | | // if (led.getId() == 7) { |
| | | // ledThread.setLedMk(true); |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | // log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // } else { |
| | | // |
| | | // } |
| | | // } else { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | } |