From b75e8ba916f7ec85e6eafdc736f1a9c2a4aeed39 Mon Sep 17 00:00:00 2001 From: ytfl <ytfl@qq.com> Date: 星期二, 15 七月 2025 14:06:53 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 70 ++++++++++++++++++++++++++++++----- 1 files changed, 60 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 f662ddf..f2c011c 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -13,7 +13,6 @@ import com.zy.asrs.mapper.WrkMastMapper; import com.zy.asrs.service.*; import com.zy.asrs.utils.Utils; -import com.zy.asrs.utils.VersionUtils; import com.zy.common.constant.RedisConstantType; import com.zy.common.model.LocTypeDto; import com.zy.common.model.MatDto; @@ -644,6 +643,10 @@ */ public synchronized void crnMove() { for (CrnSlave crn : slaveProperties.getCrn()) { + if (crn.getId() == 1) { + continue; + } + // 鑾峰彇鍫嗗灈鏈轰俊鎭� CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); CrnProtocol crnProtocol = crnThread.getCrnProtocol(); @@ -963,7 +966,7 @@ if (crnProtocol.getCrnNo() == 1) { //鍒ゆ柇鍫嗗灈鏈哄拰褰撳墠浠诲姟鏄惁澶勪簬涓�涓贩閬� - if (Utils.getLaneByLocNo(wrkMast.getLocNo()) != crnProtocol.getCrnLane()) { + if (Utils.getLaneByLocNo(wrkMast.getSourceLocNo()) != crnProtocol.getCrnLane()) { //鍒ゆ柇鍫嗗灈鏈烘墍鍦ㄥ贩閬撴槸鍚﹀瓨鍦ㄥ叾浠栦换鍔★紝濡傚瓨鍦ㄥ垯浼樺厛鎵ц List<WrkMast> currentWrkMasts = wrkMastService.selectLaneWrkMast(crnProtocol.getCrnLane(), false); if (!currentWrkMasts.isEmpty()) { @@ -2207,13 +2210,16 @@ ArrayList<Integer> list = new ArrayList<Integer>(){{add(2003);add(2002);}}; for (Integer staNo : list) { Integer devpId = null; + Integer rgvStaNoDevpId = null; Integer rgvStaNo = null; if (staNo == 2003) { devpId = 1; rgvStaNo = 2002; + rgvStaNoDevpId = 2; }else { devpId = 2; rgvStaNo = 2003; + rgvStaNoDevpId = 1; } SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devpId); @@ -2229,12 +2235,54 @@ if (staProtocol.isAutoing() && staProtocol.isLoading() -// && staProtocol.isInEnable() + && staProtocol.isInEnable() && staProtocol.getWorkNo() > 0 ) { WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() .eq("wrk_no", staProtocol.getWorkNo())); + + if (wrkMast == null) { + continue; + } + if (wrkMast.getWrkSts() == 201) { + continue; + } + + SiemensDevpThread devpThread2 = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvStaNoDevpId); + if (devpThread2 == null) { + continue; + } + StaProtocol staProtocolRgvStaNo = devpThread2.getStation().get(rgvStaNo); + if (staProtocolRgvStaNo == null) { + continue; + } + + if (!staProtocolRgvStaNo.isAutoing()) { + continue; + } + + if (staProtocolRgvStaNo.isLoading()) { + continue; + } + + // 鑾峰彇RGV淇℃伅 + RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, 1); + if (rgvThread == null) { + continue; + } + + RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); + if (rgvProtocol == null) { + continue; + } + + if (rgvProtocol.statusType1 != RgvStatusType.IDLE && rgvProtocol.getTaskNo1() != 0) { + continue; + } + + Object object = redisUtil.get(RedisConstantType.RGV_MOVE_LOCK + wrkMast.getWrkNo()); + if (object != null) { continue; } @@ -2255,6 +2303,7 @@ wrkMast.setWrkSts(201L);//201.RGV鎼繍涓� wrkMast.setModiTime(new Date()); wrkMastService.updateById(wrkMast); + redisUtil.set(RedisConstantType.RGV_MOVE_LOCK + wrkMast.getWrkNo(), "lock", 60 * 60); } } } @@ -2283,18 +2332,23 @@ continue; } + if (wrkMast.getWrkSts() != 201) { + continue; + } + Integer devpId = null; Integer devpStaNo = null; String locNo = null; + Long updateWrkSts = null; if (wrkMast.getIoType() < 100) { //鍏ュ簱 - wrkMast.setWrkSts(2L); + updateWrkSts = 2L; devpId = 1; devpStaNo = 2003; locNo = wrkMast.getLocNo(); }else { //鍑哄簱 - wrkMast.setWrkSts(15L); + updateWrkSts = 15L; devpId = 2; devpStaNo = 2002; locNo = wrkMast.getSourceLocNo(); @@ -2323,11 +2377,7 @@ if (!result) { throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); } - - Date now = new Date(); - wrkMast.setModiTime(now); - wrkMastService.updateById(wrkMast); - + wrkMastMapper.updateWrkSts(updateWrkSts, wrkMast.getWrkNo()); rgvThread.setResetFlag1(true); } } -- Gitblit v1.9.1