From 3c3779a57590280ef32ca2e4a96f148b438bc6ef Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期四, 20 三月 2025 18:16:15 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java | 2 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 66 ++++++++------- src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java | 140 +++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index dc8bd4b..36cecc3 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -3145,9 +3145,9 @@ if (Cools.isEmpty(basDevp) || basDevp.getReportSign()!=1){ continue; } - if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){ - continue; - } +// if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){ +// continue; +// } WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne202(staNo); if (Cools.isEmpty(wrkMast)){ continue; @@ -3166,35 +3166,35 @@ // if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { // continue; // } - + if (staProtocol.isEmptyMk()){ + log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo); + continue; + } if (!staProtocol.isLoading()){ log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo); continue; } // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢 - if (staProtocol.isAutoing() - && staProtocol.isLoading() - && staProtocol.isInEnable() - && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000)) - ) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) { - + if (staProtocol.isAutoing() && staProtocol.getWorkNo() == 0) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) { +// && staProtocol.isInEnable() //浠诲姟瀹屾垚 - boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol)); - Thread.sleep(100); - - staProtocol.setWorkNo(wrkMast.getWrkNo()); - staProtocol.setStaNo(144); - devpThread.setPakMk(staProtocol.getSiteId(), false); - boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol)); +// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol)); +// Thread.sleep(100); + StaProtocol staProtocolnew = new StaProtocol(); + staProtocolnew.setSiteId(staProtocol.getSiteId()); + staProtocolnew.setWorkNo(wrkMast.getWrkNo()); + staProtocolnew.setStaNo(144); + devpThread.setPakMk(staProtocolnew.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒"); } wrkMast.setWrkSts(52L); wrkMastMapper.updateById(wrkMast); - Thread.sleep(100); +// Thread.sleep(100); //浠诲姟瀹屾垚 - boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol)); +// boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol)); } } @@ -3401,7 +3401,7 @@ for (int staNo : staNos){ BasDevp basDevp = basDevpService.selectById(staNo); BasDevp basDevp135 = basDevpService.selectById(135); - if (basDevp.getWrkNo()==0 || (basDevp.getWrkNo()<10000 && basDevp.getWrkNo()>9899) ){ + if (basDevp.getWrkNo()==0){ continue; } if (basDevp135.getReportSign()!=0){ @@ -3427,8 +3427,8 @@ } else { staProtocol135 = staProtocol135.clone(); } - if (staProtocol135.getWorkNo()<9900 || staProtocol135.getWorkNo()>9999 || staProtocol135.getWorkNo()==0 - || !staProtocol135.isLoading() || !staProtocol135.isAutoing()){ + if ( staProtocol135.getWorkNo()!=0 + || !staProtocol135.isLoading() || !staProtocol135.isAutoing() || !staProtocol135.isEmptyMk()){ continue; } StaProtocol staProtocol = devpThread.getStation().get(staNo); @@ -3474,21 +3474,25 @@ // } //浠诲姟瀹屾垚 - boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135)); - try{ - Thread.sleep(100); - }catch (Exception e){ } +// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135)); +// try{ +// Thread.sleep(100); +// }catch (Exception e){ } basDevp135.setReportSign(2); basDevpService.updateById(basDevp135); int workNo = commonService.getWorkNo(5); - staProtocol135.setWorkNo(workNo); - staProtocol135.setStaNo(144); - devpThread.setPakMk(staProtocol135.getSiteId(), false); - boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol135)); + + StaProtocol staProtocolnew = new StaProtocol(); + staProtocolnew.setSiteId(staProtocol135.getSiteId()); + staProtocolnew.setWorkNo(workNo); + staProtocolnew.setStaNo(144); + + devpThread.setPakMk(staProtocolnew.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒"); } - boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135)); +// boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135)); } } diff --git a/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java b/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java index 8cce7ea..06f07dd 100644 --- a/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java +++ b/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java @@ -23,7 +23,7 @@ int[] staNos =new int[]{118,120,121}; for (int staNo : staNos){ try{ - ReturnT<String> result = reportToDismantleTheStackHandler.start(staNo); + ReturnT<String> result = reportToDismantleTheStackHandler.start2(staNo); if (result.getCode()==200){ break; } diff --git a/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java b/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java index 017011c..0926e27 100644 --- a/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java +++ b/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java @@ -191,6 +191,146 @@ } return FAIL; } + public ReturnT<String> start2(int staNo) { + try { + Date now = new Date(); + BasDevp basDevp = basDevpService.selectById(staNo); + Integer staOther = getStaOther(staNo); + Integer staEnd = getStaEnd(staNo); + if (staOther==0) return FAIL; + + SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); + StaProtocol staProtocol = devpThread.getStation().get(staNo); + if (staProtocol == null) { + return FAIL; + } else { + staProtocol = staProtocol.clone(); + } + +// StaProtocol staProtocolOther = devpThread.getStation().get(staOther); +// if (staProtocolOther == null) { +// return FAIL; +// } else { +// staProtocolOther = staProtocolOther.clone(); +// } + + + StaProtocol staProtocolEnd = devpThread.getStation().get(staEnd); + if (staProtocolEnd == null) { + return FAIL; + } else { + staProtocolEnd = staProtocolEnd.clone(); + } + + + BasDevp basDevpOther = basDevpService.selectById(staOther); + if (Cools.isEmpty(basDevpOther) || basDevpOther.getReportSign()==1){ + return FAIL; + } + + + BasDevp basDevpEnd = basDevpService.selectById(staEnd); + if (!basDevpEnd.getLoading().equals("Y") || !basDevpEnd.getAutoing().equals("Y") || !basDevpEnd.getEmptyMk().equals("Y")){ + return FAIL; + } + if (!staProtocolEnd.isLoading() || !staProtocolEnd.isAutoing() || !staProtocolEnd.isEmptyMk() ){ + return FAIL; + } + + if ( basDevpEnd.getWrkNo()!=0 || basDevpEnd.getReportSign()!=0){ + return FAIL; + } + if ( staProtocolEnd.getWorkNo()!=0 ){ + return FAIL; + } + + WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 202).eq("source_sta_no", staEnd).eq("wrk_sts",51L)); + if (!Cools.isEmpty(wrkMast1)) return FAIL; + if (!Cools.isEmpty(basDevp) && basDevp.getAutoing().equals("Y") && basDevp.getWrkNo()!=0){ //涓婁紶鍓嶅伐浣滃彿璺熺數鎺х害瀹氫负9992涓帶(妗佹灦)锛氱爜鍨涘畬鎴愪笅鍙戝叆搴撲俊鎭紙浣犲彲浠ヨ嚜瀹氫箟锛� + if (staProtocol.isAutoing() && staProtocol.getWorkNo()!=0){ + WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo())); + if (Cools.isEmpty(wrkMast) || Cools.isEmpty(wrkMast.getSheetNo()) || !wrkMast.getSheetNo().equals("0")){ + return FAIL; + } + List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); + if (Cools.isEmpty(wrkDetls) || wrkDetls.isEmpty()){ + return FAIL; + } + List<WrkDetl> wrkDetlList = new ArrayList<>(); + String signOne = ""; + String signTwo = ""; + for (WrkDetl wrkDetl:wrkDetls){ + if (wrkDetl.getOrigin().equals("1") && signOne.equals("")){ + wrkDetlList.add(wrkDetl); + signOne = "1"; + } else if (wrkDetl.getOrigin().equals("2") && signTwo.equals("")){ + wrkDetlList.add(wrkDetl); + signTwo = "2"; + } + if (!signOne.equals("") && !signTwo.equals("")){ + break; + } + } + SingleMountUnstackingCompleteParam singleMountUnstackingCompleteParam = new SingleMountUnstackingCompleteParam(wrkMast,wrkDetlList); + singleMountUnstackingCompleteParam.setStaStart(staNo); + singleMountUnstackingCompleteParam.setStaEnd(staEnd); +// result = null; +// if (true){ +// return FAIL; +// } + log.error("涓婁紶鏈烘鑷傛椂锛岀珯鐐圭姸鎬侊細"+JSON.toJSONString(basDevpEnd)); + log.error("涓婁紶鏈烘鑷傛椂锛屽伐浣滃彿锛�"+JSON.toJSONString(wrkMast)); + ReturnT<String> result = postMesData(reportOutPath,singleMountUnstackingCompleteParam); +// System.out.println(result); +// if (true){ +// for (WrkDetl wrkDetl:wrkDetls){ +// WrkDetlSingle wrkDetlSingle = new WrkDetlSingle(); +// wrkDetlSingle.sync(wrkDetl); +// wrkDetlSingle.setWrkNo(wrkDetl.getWrkNo().longValue()); +// wrkDetlSingleService.insert(wrkDetlSingle); +// } +// wrkMast.setSheetNo("1"); +// wrkMastService.updateById(wrkMast); +// basDevp.setReportSign(1); +// basDevpService.updateById(basDevp); +// basDevpEnd.setReportSign(1); +// basDevpService.updateById(basDevp); +// return SUCCESS; +// } + if (result.getCode()==200){ + Date nowOne = new Date(); + Date nowTwo = now; + for (WrkDetl wrkDetl:wrkDetls){ + if (wrkDetl.getOrigin().equals("1")){ + now = nowOne; + } else if (wrkDetl.getOrigin().equals("2")){ + now = nowTwo; + } + WrkDetlSingle wrkDetlSingle = new WrkDetlSingle(); + wrkDetlSingle.sync(wrkDetl); + wrkDetlSingle.setWrkNo(wrkDetl.getWrkNo().longValue()); + wrkDetlSingle.setIoTime(now); + wrkDetlSingleService.insert(wrkDetlSingle); + } + wrkMast.setSheetNo("1"); + wrkMastService.updateById(wrkMast); + basDevp.setReportSign(1); + basDevpService.updateById(basDevp); + basDevpEnd.setReportSign(1); + basDevpService.updateById(basDevpEnd); + + return SUCCESS; + }else { + log.error("鎷嗗灈淇℃伅涓婁紶澶辫触"); + } + } + } + }catch (Exception e){ + log.error("寮傚父锛侊紒锛�"+e); + return FAIL; + } + return FAIL; + } private ReturnT<String> postMesData(String erpPath,Object combParam){ if(combParam != null){ -- Gitblit v1.9.1