From 403f92738e1e17268bc84b1d5daeb75d3ba7af5b Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期一, 03 十一月 2025 12:54:22 +0800
Subject: [PATCH] 出库不用选站点
---
src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java | 100 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 92 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java b/src/main/java/com/zy/asrs/task/AutoLocMoveScheduler.java
index 1f11b63..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,12 +44,88 @@
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.selectById("AutoLocMove");
+ Config config = configService.selectConfigByCode("AutoLocMove");
if (Cools.isEmpty(config) || config.getValue().equals("false")) {
return;
}
@@ -60,10 +144,10 @@
}
//瀹氭椂鍑哄簱
- @Scheduled(cron = "0/3 * * * * ? ")
+// @Scheduled(cron = "0/3 * * * * ? ")
public void locToLoc11(){
if (slaveWmsParameterProperties.isAutoLocMoveUnilateralBoolean()){
- Config config = configService.selectById("AutoLocMoveUnilateral");
+ Config config = configService.selectConfigByCode("AutoLocMoveUnilateral");
if (Cools.isEmpty(config) || config.getValue().equals("false")) {
return;
}
@@ -79,10 +163,10 @@
}
//瀹氭椂鍏ュ簱
- @Scheduled(cron = "0/3 * * * * ? ")
+// @Scheduled(cron = "0/3 * * * * ? ")
public void locToLoc111() {
if (slaveWmsParameterProperties.isAutoLocMoveUnilateralBoolean()){
- Config config = configService.selectById("AutoLocMoveUnilateral");
+ Config config = configService.selectConfigByCode("AutoLocMoveUnilateral");
if (Cools.isEmpty(config) || config.getValue().equals("false")) {
return;
}
--
Gitblit v1.9.1