From 114657d034c80ca40f08d767a71d169c34bde0b5 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期二, 16 四月 2024 23:50:07 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/task/AgvWrkMastScheduler.java | 174 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 144 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/AgvWrkMastScheduler.java b/src/main/java/com/zy/asrs/task/AgvWrkMastScheduler.java index a706936..4eb2f8d 100644 --- a/src/main/java/com/zy/asrs/task/AgvWrkMastScheduler.java +++ b/src/main/java/com/zy/asrs/task/AgvWrkMastScheduler.java @@ -1,18 +1,23 @@ package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.plugins.Page; import com.core.common.Cools; +import com.zy.asrs.entity.AgvBasDevp; import com.zy.asrs.entity.AgvWrkMast; +import com.zy.asrs.service.AgvBasDevpService; import com.zy.asrs.service.AgvWrkMastService; import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.AgvWrkMastHandler; +import com.zy.common.entity.Parameter; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; +import java.util.ArrayList; import java.util.List; /** @@ -31,32 +36,38 @@ AgvWrkMastHandler agvWrkMastHandler; @Autowired AgvWrkMastService agvWrkMastService; + @Autowired + AgvBasDevpService agvBasDevpService; /* - 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负205.宸ヤ綔瀹屾垚 涓� 锛�1.鍏ュ簱 || 53锛屾嫞鏂欏叆搴�)鐨勬暟鎹� + 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负205.宸ヤ綔瀹屾垚 涓� 锛�1.鍏ュ簱 || 53锛屾嫞鏂欏叆搴� || 57.鐩樼偣鍏ュ簱 || 10.绌烘澘鍏ュ簱 || 11.搴撴牸绉昏浇)鐨勬暟鎹� */ - @Scheduled(cron = "0/5 * * * * ? ") + @Scheduled(cron = "0/10 * * * * ? ") public void excutePutwayWrk(){ List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>() .eq("wrk_sts", 205) .andNew().eq("io_type",53) - .or().eq("io_type",1)); + .or().eq("io_type",1) + .or().eq("io_type",57) + .or().eq("io_type",10) + .or().eq("io_type",11)); if(!Cools.isEmpty(agvWrkMastList)){ agvWrkMastList.stream().forEach(agvWrkMast -> { - ReturnT<String> returnT = agvWrkMastHandler.completedPutWayWrk(agvWrkMast); + agvWrkMastHandler.completedPutWayWrk(agvWrkMast); }); } } /* - 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负205.宸ヤ綔瀹屾垚 涓� 101鍑哄簱绫诲瀷鐨勬暟鎹� + 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负206.鍑哄簱瀹屾垚 涓� (101.鍑哄簱 || 110.绌烘澘鍑哄簱) */ - @Scheduled(cron = "0/5 * * * * ? ") + @Scheduled(cron = "0/10 * * * * ? ") public void excuteCarryWrk(){ List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>() - .eq("wrk_sts", 207) - .eq("io_type",101)); + .eq("wrk_sts", 206) + .andNew().eq("io_type",110) + .or().eq("io_type",101)); if(!Cools.isEmpty(agvWrkMastList)){ agvWrkMastList.stream().forEach(agvWrkMast -> { ReturnT<String> returnT = agvWrkMastHandler.completedCarryWrk(agvWrkMast); @@ -65,20 +76,100 @@ } /* - putaway锛氫笂鏋� + 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负206.鍑哄簱瀹屾垚 涓� (101.鍑哄簱 || 110.绌烘澘鍑哄簱) */ - @Scheduled(cron = "0/5 * * * * ? ") - public void startPutwayWrk(){ + @Scheduled(cron = "0/10 * * * * ? ") + public void excuteCarryWrk2(){ + List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>() + .eq("wrk_sts", 208) + .andNew().eq("io_type",110) + .or().eq("io_type",101)); + if(!Cools.isEmpty(agvWrkMastList)){ + agvWrkMastList.stream().forEach(agvWrkMast -> { + ReturnT<String> returnT = agvWrkMastHandler.completedCarryWrk2(agvWrkMast); + }); + } + } + + /* + putaway锛氫笂鏋� + 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负201.鐢熸垚鍏ュ簱浠诲姟ID 涓�(鍑哄簱绫诲瀷涓� 53.鎷f枡鍐嶅叆搴� || 1.鍏ュ簱 || 10.绌烘澘鍏ュ簱鏍� || 57.鐩樼偣鍐嶅叆搴�)鐨勬暟鎹� + */ + @Scheduled(cron = "0/10 * * * * ? ") + public void startPutwayWrk(){ List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50) ,new EntityWrapper<AgvWrkMast>() - .eq("wrk_sts", 201) //201.鐢熸垚鍏ュ簱浠诲姟ID - .andNew().eq("io_type", 53).or() //53.鎷f枡鍐嶅叆搴� - .eq("io_type", 1)).getRecords(); + .eq("wrk_sts", 201) + .andNew().eq("io_type", 53) + .or().eq("io_type", 1) + .or().eq("io_type", 10) + .or().eq("io_type", 57)).getRecords(); if(!Cools.isEmpty(agvWrkMastList)){ + agvWrkMastList.forEach(agvWrkMast -> { + try { + agvWrkMastHandler.startPutWayWrk(agvWrkMast); + } catch (IOException e) { + log.error(e.getMessage()); + } + }); + } + } + + /* + carry锛氭惉杩愶紝缁熸寚鍑哄簱銆佺Щ搴撱�佺偣鍒扮偣鎼繍绛� + 瀹氭椂澶勭悊AGV宸ヤ綔妗d腑宸ヤ綔鐘舵�佷负21.鐢熸垚鍑哄簱浠诲姟 涓�(鍑哄簱绫诲瀷涓� 101.鍑哄簱 || 103.鎷f枡鍑哄簱 || 11.搴撴牸绉绘牻 || 110.绌烘澘鍑哄簱 || 107.鐩樼偣鍑哄簱)鐨勬暟鎹� + */ + @Scheduled(cron = "0/10 * * * * ? ") + public void startCarryWrk(){ + List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50) + ,new EntityWrapper<AgvWrkMast>() + .eq("wrk_sts", 21) + //.like("loc_no","@") + .andNew().eq("io_type", 101) + .or().eq("io_type", 103) + .or().eq("io_type", 11) + .or().eq("io_type", 110) + .or().eq("io_type", 107)).getRecords(); + + if(!Cools.isEmpty(agvWrkMastList)){ + List<String> devNos = new ArrayList<>(); + agvWrkMastList.forEach(agvWrkMast -> { + try { + + //杩囨护璇ユ壒宸ヤ綔妗d腑閲嶅鐨勫嚭绔欑偣 + if (devNos.contains(agvWrkMast.getLocNo())){ + return; + } + devNos.add(agvWrkMast.getLocNo()); + + //妫�娴嬪綋鍓嶅伐浣滀换鍔′腑鐨勭珯鐐规槸鍚﹀凡鏈夋湁浣滀笟涓殑浠诲姟 + AgvWrkMast agvWrkMastWorking = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>() + .eq("loc_no", agvWrkMast.getLocNo()) + .ge("wrk_sts", 202L)); + + if(!Cools.isEmpty(agvWrkMastWorking)){ + return; + } + + agvWrkMastHandler.startPutWayWrk(agvWrkMast); + } catch (IOException e) { + log.error(e.getMessage()); + } + }); + } + } + + /* + 瀹氭椂澶勭悊绛夊緟鎵ц鐨勪换鍔� 宸ヤ綔鐘舵�佷负21.鐢熸垚鍑哄簱浠诲姟 涓旂洰鏍囧簱浣嶄腑涓嶅惈@瀛楃 + */ + //@Scheduled(cron = "0/10 * * * * ? ") + public void dealWatiWrk(){ + List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectReadyAgvWrkMast(); + if(!Cools.isEmpty(agvWrkMastList)){ try { - ReturnT<String> returnT = agvWrkMastHandler.startPutWayWrk(agvWrkMastList); + ReturnT<String> returnT = agvWrkMastHandler.dealWatiWrk(agvWrkMastList); } catch (IOException e) { log.error(e.getMessage()); } @@ -86,23 +177,46 @@ } /* - carry锛氭惉杩愶紝缁熸寚鍑哄簱銆佺Щ搴撱�佺偣鍒扮偣鎼繍绛� + 鑷姩鐢熸垚绌烘澘鍑哄簱浠诲姟 */ - @Scheduled(cron = "0/5 * * * * ? ") - public void startCarryWrk(){ + @Scheduled(cron = "0/10 * * * * ? ") + public void autoEmptyOut(){ + boolean packageEmptyAutoOUt = Cools.eq("Y",Parameter.get().getPackageEmptyAutoOUt()); + boolean mateEmptyAutoOut = Cools.eq("Y",Parameter.get().getMateEmptyAutoOut()); + boolean boxEmptyAutoOut = Cools.eq("Y",Parameter.get().getBoxEmptyAutoOut()); - List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50) - ,new EntityWrapper<AgvWrkMast>() - .eq("wrk_sts", 21) //21.鐢熸垚鍑哄簱浠诲姟 - .andNew().eq("io_type", 101).or() - .eq("io_type", 103)).getRecords(); - - if(!Cools.isEmpty(agvWrkMastList)){ - try { - ReturnT<String> returnT = agvWrkMastHandler.startCarryWrk(agvWrkMastList); - } catch (IOException e) { - log.error(e.getMessage()); - } + if(!packageEmptyAutoOUt && !mateEmptyAutoOut && !boxEmptyAutoOut){ + return; } + + List<Integer> locType1Condition = new ArrayList<>(); + if(packageEmptyAutoOUt){ + locType1Condition.add(1); + } + if(mateEmptyAutoOut){ + locType1Condition.add(2); + } + if(boxEmptyAutoOut){ + locType1Condition.add(3); + } + + //鎵惧嚭闇�瑕佽ˉ鏂欑殑绔欑偣 + Wrapper<AgvBasDevp> wrapper = new EntityWrapper<AgvBasDevp>() + .eq("in_enable", "Y") + .eq("loc_sts", "O") + .in("loc_type1", locType1Condition); + + List<AgvBasDevp> agvBasDevpList = agvBasDevpService.selectList(wrapper); + for (AgvBasDevp agvBasDevp : agvBasDevpList){ + try { + agvWrkMastHandler.autoEmptyOut(agvBasDevp); + }catch (Exception e){ + log.error(e.getMessage()); + e.printStackTrace(); + } + + } + } + } -- Gitblit v1.9.1