From 4725ab4c1f4d0560097ae3469a42de23eb459056 Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期四, 16 十月 2025 09:57:41 +0800 Subject: [PATCH] wms功能完善 --- src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java | 94 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 89 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java b/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java index d90a3a3..673e9a6 100644 --- a/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java +++ b/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java @@ -2,16 +2,24 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; -import com.zy.asrs.entity.*; +import com.core.exception.CoolException; +import com.zy.asrs.entity.BasCrnp; +import com.zy.asrs.entity.LocMast; +import com.zy.asrs.entity.Order; +import com.zy.asrs.entity.WrkMast; import com.zy.asrs.service.*; import com.zy.asrs.task.handler.AutoLocMoveHandler; +import com.zy.common.model.enums.WorkNoType; import com.zy.common.properties.SlaveWmsParameterProperties; +import com.zy.common.service.CommonService; import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; @Slf4j @Component @@ -36,9 +44,85 @@ private OrderDetlService orderDetlService; @Autowired private AutoMoveService autoMoveService; + + @Resource + private CommonService commonService; + + @Resource + private LocMastService locMastService; + + // 绔嬩綋搴撹窇搴撶▼搴忥紝鐢熶骇鍕跨敤 ,涓�涓贩閬撴斁涓�涓墭鐩� +// @Scheduled(cron = "0/5 * * * * ? ") + public synchronized void autoMoveLoc() { + for(int i = 1; i <= 2; i++ ){ + // 婧愬簱浣� + LocMast sourceLocMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "D").eq("crn_no", i)); + if(sourceLocMast != null) { + // 鑾峰彇涓�涓Щ鍔ㄧ殑鐩爣搴撲綅 + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("crn_no", i).eq("loc_type3", "0") + .eq("loc_sts","O").orderBy("lev1").orderBy("bay1").orderBy("row1")); + + if (locMast != null) { + if (!locMast.getLocSts().equals("O") || (!sourceLocMast.getLocSts().equals("F") && !sourceLocMast.getLocSts().equals("D"))){ + log.error("{}搴撲綅鐘舵�佸凡鏀瑰彉",sourceLocMast.getLocNo()); + continue; + } + String sourceLoc = sourceLocMast.getLocNo(); // 婧愬簱浣� + String locNo = locMast.getLocNo(); // 鐩爣搴撲綅 + + // 鍒涘缓绉诲簱浠诲姟 + Date now = new Date(); + // 鑾峰彇宸ヤ綔鍙� + int workNo = commonService.getWorkNo(WorkNoType.PICK.type); + // 淇濆瓨宸ヤ綔妗� + WrkMast wrkMast = new WrkMast(); + wrkMast.setWrkNo(workNo); + wrkMast.setIoTime(now); + wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID + wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇 + wrkMast.setIoPri(10D); + wrkMast.setCrnNo(locMast.getCrnNo()); + wrkMast.setSourceLocNo(sourceLoc); // 婧愬簱浣� + wrkMast.setLocNo(locNo); // 鐩爣搴撲綅 + wrkMast.setFullPlt("N"); // 婊℃澘锛歒 + wrkMast.setPicking("N"); // 鎷f枡 + wrkMast.setExitMk("N"); // 閫�鍑� + wrkMast.setEmptyMk("Y"); // 绌烘澘 + wrkMast.setBarcode(locMast.getBarcode()); // 鎵樼洏鐮� + wrkMast.setLinkMis("N"); + wrkMast.setAppeTime(now); + wrkMast.setModiTime(now); + wrkMastService.insert(wrkMast); + + // 淇敼婧愬簱浣嶇姸鎬� + if (sourceLocMast.getLocSts().equals("D") || sourceLocMast.getLocSts().equals("F")) { + sourceLocMast.setLocSts("R"); // R.鍑哄簱棰勭害 + sourceLocMast.setModiTime(now); + sourceLocMast.setLocType3((short)1); + if (!locMastService.updateById(sourceLocMast)){ + throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�"); + } + } else { + throw new CoolException("婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLocMast.getLocSts$()); + } + // 淇敼鐩爣搴撲綅鐘舵�� + if (locMast.getLocSts().equals("O")) { + locMast.setLocSts("S"); // S.鍏ュ簱棰勭害 + locMast.setModiTime(now); + if (!locMastService.updateById(locMast)) { + throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�"); + } + } else { + throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+locMast.getLocSts$()); + } + log.info("绉诲簱浠诲姟涓嬪彂鎴愬姛锛屾簮搴撲綅锛歿}锛岀洰鏍囧簱浣嶏細{}",sourceLoc,locNo); + } + } + } + } //瀹氭椂鍑哄簱 缁忓吀鍙屼几 - @Scheduled(cron = "0/3 * * * * ? ") +// @Scheduled(cron = "0/3 * * * * ? ") public void locToLocAutoLocMove(){ if (slaveWmsParameterProperties.isAutoLocMoveBoolean()){ Config config = configService.selectConfigByCode("AutoLocMove"); @@ -60,7 +144,7 @@ } //瀹氭椂鍑哄簱 - @Scheduled(cron = "0/3 * * * * ? ") +// @Scheduled(cron = "0/3 * * * * ? ") public void locToLoc11(){ if (slaveWmsParameterProperties.isAutoLocMoveUnilateralBoolean()){ Config config = configService.selectConfigByCode("AutoLocMoveUnilateral"); @@ -79,7 +163,7 @@ } //瀹氭椂鍏ュ簱 - @Scheduled(cron = "0/3 * * * * ? ") +// @Scheduled(cron = "0/3 * * * * ? ") public void locToLoc111() { if (slaveWmsParameterProperties.isAutoLocMoveUnilateralBoolean()){ Config config = configService.selectConfigByCode("AutoLocMoveUnilateral"); -- Gitblit v1.9.1