From 3cf7b6ddf3bfa30027c8d3acee422aefb92a4c1a Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 03 九月 2024 14:00:49 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 69 +++++++++++++++++++++++++++++++--- 1 files changed, 62 insertions(+), 7 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 de9a092..55f8f67 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -112,6 +112,7 @@ for (DevpSlave.Sta inSta : devp.getInSta()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); + BarcodeThread barcodeThreadMat = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcodeMat()); LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); @@ -124,7 +125,14 @@ if (barcodeThread == null) { continue; } + + if (barcodeThreadMat == null) { + continue; + } + String barcode = barcodeThread.getBarcode(); + + String barcodeMat = barcodeThreadMat.getBarcode(); // 灏哄妫�娴嬪紓甯� boolean back = false; String errMsg = ""; @@ -154,7 +162,8 @@ } if (!back && staProtocol.isBarcodeErr()) { errMsg = "鎵爜澶辫触"; - back = true; + log.error("鐗╂枡鐮佹壂鐮佸け璐�"); +// back = true; } // 閫�鍥� if (back) { @@ -184,6 +193,18 @@ && staProtocol.isPakMk()) { if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode); + + staProtocol.setWorkNo(wrkNo); + News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo); + wrkNo++; + staProtocol.setStaNo(inSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + log.error("杈撻�佺嚎涓嬪彂1锛�"+wrkNo+","+inSta.getBackSta()); + continue; + } + if(Cools.isEmpty(barcodeMat) || "NG".endsWith(barcodeMat) || "NoRead".equals(barcodeMat) || "00000000".equals(barcodeMat)) { + News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcodeMat(), barcodeMat); staProtocol.setWorkNo(wrkNo); News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo); @@ -262,6 +283,30 @@ News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触"); throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); + } + } else if (jsonObject.getInteger("code").equals(700)) { + SearchLocParam param2 = new SearchLocParam(); + param2.setBarcode(barcode); + param2.setBarcodeMat(barcodeMat); + param2.setSourceStaNo(inSta.getStaNo()); + param2.setLocType1(locTypeDto.getLocType1()); + String response2 = new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath("/rpc/pakin/yk/loc/v33") + .setJson(JSON.toJSONString(param2)) + .build() + .doPost(); + JSONObject jsonObject2 = JSON.parseObject(response2); + if (jsonObject2.getInteger("code").equals(200)) { + log.info("鑷姩缁勬墭鎴愬姛锛侊紒"); + } else { + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "鑷姩缁勬墭澶辫触锛侊紒锛乥arcodeMat==>"+barcodeMat)); + News.error(methodName + "==>缁勬墭澶辫触:璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/yk/loc/v33", JSON.toJSONString(param), response); + } + try{ + Thread.sleep(500); + } catch (Exception e){ + } } else { staProtocol.setWorkNo(wrkNo); @@ -530,7 +575,7 @@ String barcode = barcodeThread.getBarcode(); if(!Cools.isEmpty(barcode)) { // log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); - if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { + if("00000000".equals(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { staProtocol.setWorkNo(wrkNo++); staProtocol.setStaNo(pickSta.getBackSta().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -620,7 +665,7 @@ log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶆垚鍔�===>>" + jsonObject.toJSONString()); try { // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 - staProtocol.setWorkNo(wrkMast.getWrkNo()); + staProtocol.setWorkNo(dto.getWorkNo()); staProtocol.setStaNo((short)161); devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -2586,15 +2631,25 @@ continue; } //鍒ゆ柇宸ヤ綔缁撴潫浣嶇疆鐘舵�� + boolean signDev = false; BasDevp devNo = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", wrkMastSta.getStaEnd())); + if (devNo.getDevNo()==113){ + BasDevp devNo114 = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 114)); + if (!Cools.isEmpty(devNo114)){ + if (devNo114.getOutEnable().equals("Y")){ + signDev = true; + } + } + } if (!Cools.isEmpty(devNo)){ if (devNo.getAutoing().equals("Y") && !devNo.getWrkNo().equals(0) && !devNo.getLoading().equals("N")){ continue; } - if (!devNo.getAutoing().equals("Y") || !devNo.getWrkNo().equals(0) || !devNo.getLoading().equals("N")){ - continue; - } - if (devNo.getDevNo()==113){ + if (!signDev && devNo.getDevNo()==113){ + if (!devNo.getAutoing().equals("Y") || !devNo.getWrkNo().equals(0) || !devNo.getLoading().equals("N")){ + wrkEnable = true; + continue; + } if (!devNo.getOutEnable().equals("Y")){ wrkEnable = true; continue; -- Gitblit v1.9.1