From f6decf71aa936d019a7732970744c6c33f5e6175 Mon Sep 17 00:00:00 2001 From: lsh <lsh123456> Date: 星期三, 12 十月 2022 16:07:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 124 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 114 insertions(+), 10 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 37d31cf..ac67afc 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -103,7 +103,7 @@ for (DevpSlave devp : slaveProperties.getDevp()) { // 閬嶅巻鍏ュ簱鍙� for (DevpSlave.Sta inSta : devp.getInSta()) { -// inSta.setStaNo(102); + inSta.setStaNo(102); // 鑾峰彇鏉$爜鎵弿浠俊鎭� BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); if (barcodeThread == null) { @@ -167,7 +167,7 @@ try { LocTypeDto locTypeDto = new LocTypeDto(staProtocol); -// locTypeDto.setLocType1((short)1); + locTypeDto.setLocType1((short)1); SearchLocParam param = new SearchLocParam(); param.setBarcode(barcode); param.setIoType(1); @@ -2001,19 +2001,40 @@ break; case 3://瀹屾垚娴嬭瘯淇″彿 olsStatus = 3; - newStatus = 5; + newStatus = 4; newSingle = 0;//娴嬭瘯瀹屾垚锛屽瘎瀛樺櫒鍦板潃娓呴浂锛�3===>>0 break; case 5://鏆傚仠淇″彿 - olsStatus = 5;//plc缁欏嚭鏆傚仠淇″彿 - newStatus = 6;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast + olsStatus = 99;//plc缁欏嚭鏆傚仠淇″彿 + newStatus = 0;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast newSingle = 6;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�5===>>6 + break; + case 7://绱ф�ュ嚭搴撶‘璁ゅ厖鐢电嚎宸茬粡鎷斿嚭 + olsStatus = 99;//plc缁欏嚭鏆傚仠淇″彿 + newStatus = 0;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast + newSingle = 6;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�7===>>6 + break; + case 8://瑙i櫎鏆傚仠 + olsStatus = 99; + newStatus = 0; + newSingle = 0;//娴嬭瘯澶嶆牳锛屽瘎瀛樺櫒鍦板潃锛�8===>>0 + break; + case 11://鍏ュ簱鍓嶅垽鏂厖鐢电嚎鏄惁鏀惧ソ + olsStatus = 99; + newStatus = 0; + newSingle = 11;// + break; + case 12://鍏呯數绾挎斁濂� + olsStatus = 99; + newStatus = 0; + newSingle = 0;//娴嬭瘯澶嶆牳锛屽瘎瀛樺櫒鍦板潃锛�12===>>0 break; } TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() .eq("channel",(i+1)).eq("status",olsStatus));//鏌ユ壘鍘熸潵鐨勭姸鎬� - if(null != testMast && devpThread.startSignal[i] == 1){ + if(null != testMast && + (devpThread.startSignal[i] == 1 || devpThread.startSignal[i] == 3)){ testMast.setStatus(newStatus); testMast.setModiTime(new Date()); if(!testMastService.update(testMast,new EntityWrapper<TestMast>() @@ -2023,15 +2044,98 @@ //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被 StaProtocol staProtocol = new StaProtocol(); staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧� - staProtocol.setStaNo((short)newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,浠�1鏀逛负2 + staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,1==>2鎴�3==>0,5==>6 boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); if(!result){ - throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); + log.error("鏇存柊娴嬭瘯淇″彿澶辫触===>>[channel:{},locNo:{},barcode:{}]", i+1, testMast.getLocNo(), testMast.getBarcode()); +// throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); } else { devpThread.startSignal[i] = newSingle; } - } - + }else if (devpThread.startSignal[i] == 5){ + SearchLocParam param = new SearchLocParam(); + param.setBarcode(i+1+""); + String response = new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath("/mobile/test/suspend/auth") + .setJson(JSON.toJSONString(param)) + .build() + .doPost(); + JSONObject jsonObject = JSON.parseObject(response); + if (jsonObject.getInteger("code").equals(200)) { + //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被 + StaProtocol staProtocol = new StaProtocol(); + staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧� + staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,5==>6 + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if(!result){ + log.error("鏆傚仠娴嬭瘯澶辫触===>>["+i+1+"]鍙烽�氶亾"); +// throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); + } else { + devpThread.startSignal[i] = newSingle; + } + } else { + log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl+"/mobile/test/suspend/auth", JSON.toJSONString(param), response); + } + }else if (devpThread.startSignal[i] == 7){ + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + if (locMast.getLocSts().equals("F")){ + locMast.setPackStatus(7); //7.绱ф�ュ嚭搴� + locMastService.update(locMast,new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + } + //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被 + StaProtocol staProtocol = new StaProtocol(); + staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧� + staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,7==>6 + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if(!result){ + log.error("鏇存柊搴撲綅绱ф�ュ嚭搴撲俊鍙峰け璐�===>>[channel:{},locNo:{},barcode:{}]", i+1, locMast.getLocNo(), locMast.getBarcode()); +// throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); + } else { + devpThread.startSignal[i] = newSingle; + } + }else if (devpThread.startSignal[i] == 8){ + //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被 + StaProtocol staProtocol = new StaProtocol(); + staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧� + staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,8==>0 + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if(!result){ +// log.error("鏇存柊搴撲綅绱ф�ュ嚭搴撲俊鍙峰け璐�===>>[channel:{},locNo:{},barcode:{}]", i+1, locMast.getLocNo(), locMast.getBarcode()); +// throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); + } else { + devpThread.startSignal[i] = newSingle; + } + }else if (devpThread.startSignal[i] == 11){ + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + if (locMast.getLocSts().equals("O")){ + locMast.setLocSts("X"); + locMastService.update(locMast,new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + } + }else if (devpThread.startSignal[i] == 12){ + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + if (locMast.getLocSts().equals("X")){ + locMast.setLocSts("O"); + locMastService.update(locMast,new EntityWrapper<LocMast>() + .eq("channel",(i+1))); + } + //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被 + StaProtocol staProtocol = new StaProtocol(); + staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧� + staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,12==>0 + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if(!result){ +// log.error("鏇存柊搴撲綅绱ф�ュ嚭搴撲俊鍙峰け璐�===>>[channel:{},locNo:{},barcode:{}]", i+1, locMast.getLocNo(), locMast.getBarcode()); +// throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i); + } else { + devpThread.startSignal[i] = newSingle; + } + }else { } } } -- Gitblit v1.9.1