From 6d5f1246b33256861c18786626a58613469f951d Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期五, 23 五月 2025 15:49:33 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 108 insertions(+), 0 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 f6068c0..c5ade16 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.exception.CoolException; import com.zy.asrs.domain.enums.TaskStatusType; +import com.zy.asrs.domain.enums.WorkNoType; import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.GenerateAgvTaskParam; import com.zy.asrs.mapper.*; import com.zy.asrs.service.*; +import com.zy.asrs.utils.Utils; +import com.zy.common.service.CommonService; import com.zy.common.utils.HttpHandler; import com.zy.core.DevpThread; import com.zy.core.cache.MessageQueue; @@ -60,6 +63,8 @@ private ApiLogService apiLogService; @Autowired private OpenService openService; + @Autowired + private CommonService commonService; @Value("${wcs.urlWcs}") private String wcsUrl; @Value("${wcs.inboundTaskApplyPathWcs}") @@ -148,12 +153,115 @@ //婕旂ず妯″紡-鍥涘悜搴撳嚭搴� private synchronized void demoShuttleOut() { + LocMast locMast = locMastService.selectByLocNo("0900601"); + if(locMast == null) { + return; + } + if (!locMast.getLocSts().equals("O")) { + return; + } + + ArrayList<Integer> disableLevList = new ArrayList<>(); + + //query in task + List<TaskWrk> taskWrks = taskWrkService.selectList(new EntityWrapper<TaskWrk>() + .eq("io_type", 1)); + for (TaskWrk taskWrk : taskWrks) { + int lev = Utils.getLev(taskWrk.getTargetPoint()); + if(!disableLevList.contains(lev)) { + disableLevList.add(lev); + } + } + + List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() + .notIn("lev1", disableLevList) + .eq("loc_sts", "F") + ); + + if(locMasts.isEmpty()) { + return; + } + + LocMast locMast1 = locMasts.get(0); + + Date now = new Date(); + TaskWrk taskWrk = new TaskWrk(); + int workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type);//鑾峰彇鍏ュ簱宸ヤ綔鍙� + taskWrk.setTaskNo(String.valueOf(workNo1));//浠诲姟鍙� + taskWrk.setWrkNo(workNo1); + taskWrk.setStatus(TaskStatusType.RECEIVE.id);//浠诲姟鐘舵�侊細鎺ユ敹 + taskWrk.setCreateTime(now); + taskWrk.setIoType(2);//鍑哄簱 + taskWrk.setIoPri(100);//浼樺厛绾� + taskWrk.setStartPoint(locMast1.getLocNo()); + taskWrk.setTargetPoint("101");//缁堢偣 + boolean result = taskWrkService.insert(taskWrk); + + locMast1.setLocSts("R"); + locMast1.setModiTime(now); + locMastService.updateById(locMast1); + + locMast.setLocSts("S"); + locMast.setModiTime(now); + locMastService.updateById(locMast); } //婕旂ず妯″紡-鍥涘悜搴撳叆搴� private synchronized void demoShuttleIn() { + LocMast locMast = locMastService.selectByLocNo("1100601"); + if(locMast == null) { + return; + } + if (!locMast.getLocSts().equals("F")) { + return; + } + + ArrayList<Integer> disableLevList = new ArrayList<>(); + + //query out task + List<TaskWrk> taskWrks = taskWrkService.selectList(new EntityWrapper<TaskWrk>() + .eq("io_type", 2)); + for (TaskWrk taskWrk : taskWrks) { + int lev = Utils.getLev(taskWrk.getTargetPoint()); + if(!disableLevList.contains(lev)) { + disableLevList.add(lev); + } + } + + List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() + .notIn("lev1", disableLevList) + .eq("loc_sts", "O") + ); + + if(locMasts.isEmpty()) { + return; + } + + LocMast locMast1 = locMasts.get(0); + + Date now = new Date(); + TaskWrk taskWrk = new TaskWrk(); + int workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);//鑾峰彇鍏ュ簱宸ヤ綔鍙� + taskWrk.setTaskNo(String.valueOf(workNo1));//浠诲姟鍙� + taskWrk.setWrkNo(workNo1); + taskWrk.setStatus(TaskStatusType.RECEIVE.id);//浠诲姟鐘舵�侊細鎺ユ敹 + taskWrk.setCreateTime(now); + taskWrk.setIoType(1);//鍏ュ簱 + taskWrk.setIoPri(100);//浼樺厛绾� + taskWrk.setOriginTargetPoint("1"); + taskWrk.setOriginTargetPoint(String.valueOf(Utils.getLev(locMast1.getLocNo()))); + taskWrk.setTargetPoint(locMast1.getLocNo());//缁堢偣 + boolean result = taskWrkService.insert(taskWrk); + + locMast1.setLocSts("S"); + locMast1.setModiTime(now); + locMastService.updateById(locMast1); + + locMast.setLocSts("R"); + locMast.setModiTime(now); + locMastService.updateById(locMast); } /** -- Gitblit v1.9.1