From 1f87ecc8280b372d8c1b76d66090349651901cab Mon Sep 17 00:00:00 2001 From: zwl <1051256694@qq.com> Date: 星期二, 07 二月 2023 12:48:30 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 135 +++++++++++++++++++++++++++++++------------- 1 files changed, 94 insertions(+), 41 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 c4fcdb6..fda6836 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -125,8 +125,10 @@ // 鍏ュ嚭搴撴ā寮忓垽鏂� // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } - if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } - if ( inSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==101 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==103 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==105 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==107 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢 if (staProtocol.isAutoing() && staProtocol.isLoading() @@ -176,7 +178,9 @@ .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); - if (jsonObject.getInteger("code").equals(200)) { + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); + Integer code = jsonObject.getInteger("code"); + if (code == 200) { StartupDto dto = jsonObject.getObject("data", StartupDto.class); barcodeThread.setBarcode(""); @@ -188,6 +192,15 @@ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); } } else { + staProtocol.setWorkNo((short) 9999); + staProtocol.setStaNo((short)(inSta.getStaNo()-1)); + devpThread.setPakMk(staProtocol.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + + if(!Cools.isEmpty(ledThread)){ + String errorMsg = jsonObject.getString("msg"); + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); + } log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response); } @@ -281,8 +294,12 @@ } // // 鍏ュ嚭搴撴ā寮忓垽鏂� - if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } - + // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } + if ( inSta.getStaNo()==101 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==103 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==105 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; } + if ( inSta.getStaNo()==107 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } +// staProtocol.setPakMk(true); // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) @@ -330,14 +347,14 @@ continue; } String barcode = barcodeThread.getBarcode(); - if(!Cools.isEmpty(barcode)) { - log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); - if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { - continue; - } - } else { - continue; - } +// if(!Cools.isEmpty(barcode)) { +// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); +// if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { +// continue; +// } +// } else { +// continue; +// } // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭� SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); @@ -348,6 +365,8 @@ staProtocol = staProtocol.clone(); } + +// staProtocol.setPakMk(true); // // 鍏ュ嚭搴撴ā寮忓垽鏂� // if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; } if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){ @@ -779,8 +798,10 @@ // 鍏ュ嚭搴撴ā寮忓垽鏂� //if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; } - if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {continue;} - if (wrkMast.getStaNo() == 402 && devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) {continue;} + if (wrkMast.getStaNo() == 101 && devpThread.ioModeOf1F != IoModeType.PAKOUT_MODE) {continue;} + if (wrkMast.getStaNo() == 103 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {continue;} + if (wrkMast.getStaNo() == 105 && devpThread.ioModeOf3F != IoModeType.PAKOUT_MODE) {continue;} + if (wrkMast.getStaNo() == 107 && devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) {continue;} // 鏌ヨ绔欑偣璇︾粏淇℃伅 BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo()); @@ -1245,9 +1266,12 @@ // // 鍏ュ嚭搴撴ā寮忓垽鏂� // if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } - if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } - if ( emptyInSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } - +// if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } +// if ( emptyInSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } + if ( emptyInSta.getStaNo()==101 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; } + if ( emptyInSta.getStaNo()==103 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } + if ( emptyInSta.getStaNo()==105 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; } + if ( emptyInSta.getStaNo()==107 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } // 绔欑偣鏉′欢鍒ゆ柇 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) { @@ -1410,7 +1434,7 @@ // ledCommand.setSourceStaNo(wrkMast.getSourceStaNo()); if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10 ) { List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); - wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme()))); + wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getSpecs()))); } commands.add(ledCommand); } @@ -1423,15 +1447,15 @@ } // 鍛戒护涓嬪彂 ------------------------------------------------------------------------------- if (!commands.isEmpty()) { - if (led.getId() == 7) { - if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { + if (led.getId()>4){ + if (!MessageQueue.offer(SlaveType.Led, led.getId()-4, new Task(3, commands))) { log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕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))) { + }else { + if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); continue; } else { @@ -1513,20 +1537,10 @@ 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("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); - } else { - - } + ledThread.setLedMk(true); + if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { + log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); } else { - ledThread.setLedMk(true); - if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { - log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); - } else { - - } } } } @@ -1750,7 +1764,10 @@ continue; } - LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn.getId()); + LocMast sourceLoc = locMastService.queryDemoSourceLoc0(crn.getId()); + if(sourceLoc == null){ + locMastService.queryDemoSourceLoc(crn.getId()); + } LocMast loc = locMastService.queryDemoLoc(crn.getId()); if (null == sourceLoc || null == loc) { continue; @@ -1890,15 +1907,33 @@ } WrkMast pakout = wrkMastMapper.selectWorkingPakout(inSta.getStaNo()); switch (inSta.getStaNo()) { - case 203://1F + case 101://1F + if (pakout != null) { + if (devpThread.ioModeOf1F != IoModeType.PAKOUT_MODE) { + // 鍑哄簱鍒囨崲涓� + devpThread.ioModeOf1F = IoModeType.PAKOUT_BOOTING; + WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); + if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() + && !devpThread.getStation().get(inSta.getStaNo()-1).isLoading() + && devpThread.getStation().get(inSta.getStaNo()-1).getWorkNo()==0) { + // 鍑哄簱妯″紡 + devpThread.ioModeOf1F = IoModeType.PAKOUT_MODE; + } + } + } else { + // 鍏ュ簱妯″紡 + devpThread.ioModeOf1F = IoModeType.PAKIN_MODE; + } + break; + case 103://2F if (pakout != null) { if (devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) { // 鍑哄簱鍒囨崲涓� devpThread.ioModeOf2F = IoModeType.PAKOUT_BOOTING; WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() - && !devpThread.getStation().get(inSta.getStaNo()+1).isLoading() - && devpThread.getStation().get(inSta.getStaNo()+1).getWorkNo()==0) { + && !devpThread.getStation().get(inSta.getStaNo()-1).isLoading() + && devpThread.getStation().get(inSta.getStaNo()-1).getWorkNo()==0) { // 鍑哄簱妯″紡 devpThread.ioModeOf2F = IoModeType.PAKOUT_MODE; } @@ -1908,7 +1943,25 @@ devpThread.ioModeOf2F = IoModeType.PAKIN_MODE; } break; - case 402://1F + case 105://3F + if (pakout != null) { + if (devpThread.ioModeOf3F != IoModeType.PAKOUT_MODE) { + // 鍑哄簱鍒囨崲涓� + devpThread.ioModeOf3F = IoModeType.PAKOUT_BOOTING; + WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); + if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() + && !devpThread.getStation().get(inSta.getStaNo()-1).isLoading() + && devpThread.getStation().get(inSta.getStaNo()-1).getWorkNo()==0) { + // 鍑哄簱妯″紡 + devpThread.ioModeOf3F = IoModeType.PAKOUT_MODE; + } + } + } else { + // 鍏ュ簱妯″紡 + devpThread.ioModeOf3F = IoModeType.PAKIN_MODE; + } + break; + case 107://4F if (pakout != null) { if (devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) { // 鍑哄簱鍒囨崲涓� -- Gitblit v1.9.1