From c23fa558197ba32ea4d65c799bc3fbd9a047e6c1 Mon Sep 17 00:00:00 2001 From: yxFwq <1> Date: 星期四, 24 十月 2024 12:56:23 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 135 ++++++++++++++++++++++++++++++++------------ 1 files changed, 98 insertions(+), 37 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 63c57cb..2e74e09 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -59,7 +59,8 @@ // private static final int[][] execute = new int[][]{{1,4},{2,4},{3,4},{4,4},{5,6},{6,6},{7,4},{8,4},{9,3},{10,4},{11,4}}; private static final int[][] execute = new int[][]{{1,4},{2,4},{3,4},{4,4},{5,6},{6,6},{7,4},{8,4},{9,3},{10,4},{11,4}}; - private static final Integer jarMaxLoc = 7; +// private static final Integer jarMaxLoc1 = 7; + private static Integer jarMaxLoc = 0; private static final Float jarTemperature = 50F; @Autowired private CommonService commonService; @@ -235,7 +236,7 @@ staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(wrkMast.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,238); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -280,7 +281,7 @@ staProtocol.setStaNo(dto.getRgvSstaNo()); } - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,283); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -419,7 +420,7 @@ staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(wrkMast.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,422); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -464,7 +465,7 @@ staProtocol.setStaNo(dto.getRgvSstaNo()); } - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,467); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -634,7 +635,7 @@ staProtocol.setWorkNo(wrkMast111.getWrkNo()); staProtocol.setStaNo(wrkMast111.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,637); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { if (ledThread != null) { @@ -692,7 +693,7 @@ staProtocol.setStaNo(dto.getRgvSstaNo()); } - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,695); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { if (ledThread != null) { @@ -840,8 +841,8 @@ staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(wrkMast.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); - log.info("閿佸畾鏍囪flase===銆婲===銆嬬珯鐐瑰彿锛歿}锛屽伐浣滃彿锛歿}锛屾潯鐮�:{}",staProtocol.getStaNo(),staProtocol.getWorkNo(),barcode); + devpThread.setPakMk(staProtocol.getSiteId(), false,843); + log.info("閿佸畾鏍囪flase===銆婲===銆嬬珯鐐瑰彿锛歿}锛屽伐浣滃彿锛歿}锛屾潯鐮�:{}",staProtocol.getSiteId(),staProtocol.getWorkNo(),barcode); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { if (ledThread != null) { @@ -889,7 +890,7 @@ staProtocol.setStaNo(dto.getRgvSstaNo()); } - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,892); log.info("閿佸畾鏍囪flase===銆婲===銆嬬珯鐐瑰彿锛歿}锛屽伐浣滃彿锛歿}锛屾潯鐮�:{}",staProtocol.getStaNo(),staProtocol.getWorkNo(),barcode); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { @@ -985,7 +986,7 @@ staNo = 147; } staProtocol.setStaNo(staNo); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,988); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (result) { // 鏇存柊宸ヤ綔涓绘。 @@ -1093,7 +1094,7 @@ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(dto.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,1096); // ledThread.errorReset(); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { @@ -1208,7 +1209,7 @@ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(dto.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,1211); // ledThread.errorReset(); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { @@ -2322,7 +2323,7 @@ staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(wrkMast.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,2325); if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(99, crnCommand.getCrnNo()-2))) { log.error("杈撻�佺嚎閿佸畾鍛戒护涓嬪彂澶辫触锛屽爢鍨涙満鍙�={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), crnCommand.getCrnNo()-2); @@ -4084,7 +4085,7 @@ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 staProtocol.setWorkNo(dto.getWorkNo()); staProtocol.setStaNo(dto.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,4087); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -4147,7 +4148,7 @@ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 staProtocol.setWorkNo(dto.getWorkNo()); staProtocol.setStaNo(dto.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,4150); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -4210,7 +4211,7 @@ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 staProtocol.setWorkNo(dto.getWorkNo()); staProtocol.setStaNo(dto.getStaNo()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + devpThread.setPakMk(staProtocol.getSiteId(), false,4213); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); @@ -5107,12 +5108,16 @@ break; } BasJar basJar = basJarMapper.selectById(jarSlave.getId()); + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + break; + } int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", basJar.getRegion()).lt("status", 17).gt("status", 11)); if (count>0){ break; } if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){ - if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)==7){ + if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(), 3).equals(jarMaxLoc)){ JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId()); JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol(); if (jarOtherProtocol == null) { @@ -5653,7 +5658,7 @@ List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{ add(4); }}); - if (basJarMastList.size() != jarMaxLoc){ + if (basJarMastList.isEmpty()){ return false; } @@ -5696,8 +5701,15 @@ log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo()); return false; } - if (!basJar.getJarCount().equals(jarMaxLoc)){ - log.error("{}鍙风~鍖栫綈鏌ヨ璁惧搴撳瓨鏁板紓甯革紒锛侊紒搴撳瓨寰呭叆鏁帮細{}",jarProtocol.getJarNo(),basJar.getJarCount()); + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + return false; + } +// if (!basJar.getJarCount().equals(jarMaxLoc)){ +// log.error("{}鍙风~鍖栫綈鏌ヨ璁惧搴撳瓨鏁板紓甯革紒锛侊紒搴撳瓨寰呭叆鏁帮細{}",jarProtocol.getJarNo(),basJar.getJarCount()); +// return false; +// } + if (basJarMastList.size() != jarMaxLoc){ return false; } @@ -5734,14 +5746,14 @@ List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{ add(6); }}); - if (basJarMastList.size() != jarMaxLoc){ - return false; - } // if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0 -// && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=7 -// && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=14){ +// && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=jarMaxLoc +// && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=jarMaxLoc*2){ // return false; // } + if (basJarMastList.isEmpty()){ + return false; + } BasJarMast basJarMastSign = basJarMastList.get(0); if (Cools.isEmpty(basJarMastSign)){ @@ -5783,6 +5795,13 @@ log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo()); return false; } + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + return false; + } + if (basJarMastList.size() != jarMaxLoc){ + return false; + } //闂ㄤ綔涓� 鏃� if (jarProtocol.isAutoing() && jarProtocol.statusType == JarStatusType.WAITING2 && jarProtocol.jarErr==0 @@ -5814,6 +5833,12 @@ if (wrkMastExecuteService.getWrkMastExecuteByJarIdCount(jarSlave.getId())!=0){ return false; } + List<BasJarMast> basJarMastList1 = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getJarOtherId(), new ArrayList<Integer>() {{ + add(0);add(1);add(2);add(3); + }}); + if (!basJarMastList1.isEmpty()){ + return false; + } List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{ add(8); }}); @@ -5823,12 +5848,6 @@ List<BasJarMast> basJarMastList10 = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{ add(10); }}); - if (basJarMastList10.size()==jarMaxLoc){ - return false; - } - if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0 && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=7){ - return false; - } BasJarMast jarMastByJarIdMin = basJarMastService.getJarMastByJarIdMin(jarSlave.getId(),8,8); if (Cools.isEmpty(jarMastByJarIdMin)){ @@ -5869,6 +5888,17 @@ BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo()); if (Cools.isEmpty(basJar)){ log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo()); + return false; + } + + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + return false; + } + if (basJarMastList10.size()==jarMaxLoc){ + return false; + } + if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0 && !basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(), 4).equals(jarMaxLoc)){ return false; } @@ -8365,7 +8395,14 @@ continue; } SteProtocol steProtocol = steThread.getSteProtocol(); - if (steProtocol == null || steProtocol.getChargeStatus()!=0) { + if (steProtocol == null) { + continue; + } + if (Cools.isEmpty(steProtocol.getChargeStatus())) { + log.error("{}鍙峰皬杞︼紝鍏呯數鐘舵�佷俊鎭紓甯革紝灏忚溅淇℃伅锛歿}",steProtocol.getSteNo(),steProtocol.toString()); + continue; + } + if (steProtocol.getChargeStatus()!=0) { continue; } WrkMastExecute wrkMastExecuteByCharge = wrkMastExecuteService.getWrkMastExecuteByCharge(steSlave.getId()); @@ -8479,7 +8516,14 @@ continue; } SteProtocol steProtocol = steThread.getSteProtocol(); - if (steProtocol == null || steProtocol.getChargeStatus()!=1) { + if (steProtocol == null) { + continue; + } + if (Cools.isEmpty(steProtocol.getChargeStatus())) { + log.error("{}鍙峰皬杞︼紝鍏呯數鐘舵�佷俊鎭紓甯革紝灏忚溅淇℃伅锛歿}",steProtocol.getSteNo(),steProtocol.toString()); + continue; + } + if (steProtocol.getChargeStatus()!=1) { continue; } @@ -8640,6 +8684,16 @@ if (basJarMastList.isEmpty()){ continue; } + BasJar basJar = basJarMapper.selectById(jarNo); + if (Cools.isEmpty(basJar)){ + log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarNo); + continue; + } + + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + continue; + } if (basJarMastList.size()>0 && basJarMastList.size()<jarMaxLoc){ jarNoList.add(jarNo); } @@ -8702,6 +8756,10 @@ log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo()); continue; } + jarMaxLoc = basJar.getJarCount(); + if (jarMaxLoc == 0) { + continue; + } List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{ add(0); add(1); @@ -8709,13 +8767,16 @@ add(3); add(4); }}); - DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); + Integer count = basJarMastList.size(); ArrayList<Integer> wrkNoList = new ArrayList<>(); - for (Integer staNoEnt : staNos){ + DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); StaProtocol staProtocolEnt = devpThread.getStation().get(staNoEnt); - if (staProtocolEnt != null && staProtocolEnt.getWorkNo()!=0 && !wrkNoList.contains(staProtocolEnt.getWorkNo())){ + if (staProtocolEnt == null || (staProtocolEnt.isLoading() && staProtocolEnt.getWorkNo()==0)){ + log.error("绔欑偣寮傚父,璁℃暟鍔犱竴锛岀珯鐐瑰彿锛�"+staNoEnt); + count++; + } else if (staProtocolEnt != null && staProtocolEnt.getWorkNo()!=0 && !wrkNoList.contains(staProtocolEnt.getWorkNo())){ if (staProtocolEnt.getStaNo().equals(basJar.getEntStaNo$())){ count++; wrkNoList.add(staProtocolEnt.getWorkNo()); -- Gitblit v1.9.1