From cf074430480e44eba1e6ddce09ccce9f28067120 Mon Sep 17 00:00:00 2001
From: yxFwq <1>
Date: 星期三, 17 九月 2025 08:56:24 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 225 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 186 insertions(+), 39 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 8d470ee..64997b7 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -11,6 +11,7 @@
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.OpenOrderCompeteResult;
import com.zy.asrs.entity.result.StockVo;
+import com.zy.asrs.entity.vo.JarMastTableVo;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.core.ReturnT;
@@ -18,6 +19,7 @@
import com.zy.asrs.utils.CodeDetectionUtil;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.PostMesDataUtils;
+import com.zy.asrs.utils.Utils;
import com.zy.common.model.DetlDto;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
@@ -30,6 +32,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Date;
@@ -86,6 +89,10 @@
private WorkService workService;
@Autowired
private BareBoardHandler bareBoardHandler;
+ @Autowired
+ private BasJarMastService basJarMastService;
+ @Autowired
+ private BasCrnpService basCrnpService;
@Override
@Transactional
@@ -420,7 +427,7 @@
null // 澶囨敞
);
if (tagMapper.insert(priTag) == 0) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("涓�绾у垎绫诲垱寤哄紓甯革紝璇疯仈绯荤鐞嗗憳");
}
}
// 浜岀骇鍒嗙被
@@ -450,7 +457,7 @@
null // 澶囨敞
);
if (tagMapper.insert(secTag) == 0) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("浜岀骇鍒嗙被鍒涘缓寮傚父锛岃鑱旂郴绠$悊鍛�");
}
}
tagId = secTag.getId();
@@ -466,7 +473,7 @@
mat.setCreateTime(now);
mat.setUpdateTime(now);
if (!matService.insert(mat)) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("鐗╂枡淇℃伅鏂板寮傚父锛岃鑱旂郴绠$悊鍛�");
} else {
log.info("鎵撳寘涓婄嚎娣诲姞鏂扮墿鏂橻鍟嗗搧缂栧彿锛歿}]", mat.getMatnr());
}
@@ -520,7 +527,7 @@
null // 澶囨敞
);
if (tagMapper.insert(priTag) == 0) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("涓�绾у垎绫诲垱寤哄紓甯革紝璇疯仈绯荤鐞嗗憳");
}
}
// 浜岀骇鍒嗙被
@@ -550,7 +557,7 @@
null // 澶囨敞
);
if (tagMapper.insert(secTag) == 0) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("浜岀骇鍒嗙被鍒涘缓寮傚父锛岃鑱旂郴绠$悊鍛�");
}
}
tagId = secTag.getId();
@@ -568,7 +575,7 @@
mat.setCreateTime(now);
mat.setUpdateTime(now);
if (!matService.insert(mat)) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ throw new CoolException("鏂板鐗╂枡淇℃伅寮傚父锛岃鑱旂郴绠$悊鍛�");
} else {
log.info("鍚屾鏂扮墿鏂橻鍟嗗搧缂栧彿锛歿}]", mat.getMatnr());
}
@@ -807,7 +814,7 @@
}
WaitPakin waitPakin = new WaitPakin();
waitPakin.sync(mat);
- waitPakin.setBatch(matList.getBatch()); //鏈ㄧ缂栫爜 //鎵规 鍞竴鍊� 绠卞彿
+ waitPakin.setBatch(matList.getBatch()); //鏈ㄧ缂栫爜 //鎵规 鍞竴鍊� 鎵规
waitPakin.setModel(matList.getModel()); //鍗峰彿 鍞竴鍊�
waitPakin.setBrand(param.getBoxType()); //鏈ㄧ绫诲瀷
waitPakin.setZpallet(param.getBarcode()); //鎵樼洏鐮�
@@ -815,7 +822,7 @@
waitPakin.setWeight(matList.getWeight()); //鍑�閲�
waitPakin.setVolume(matList.getRoughWeight()); //姣涢噸
waitPakin.setPrice(matList.getRollExtent()); //闀垮害
- waitPakin.setSpecs(String.valueOf(matList.getJoint())); //鎺ュご
+ waitPakin.setSpecs(String.valueOf(matList.getJoint())); //鎺ュご MES璁㈠崟鍙�
waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
waitPakin.setAnfme(matList.getAnfme()); // 鏁伴噺
waitPakin.setStatus("Y"); // 鐘舵��
@@ -1072,9 +1079,10 @@
smallContainersJar(param);
} else if (param.getType()==3){//鐩翠緵浜х嚎
smallContainersSta(param);
- } else if (param.getType()==99){//搴撳唴渚涗骇绾� //鍑哄簱 娴嬭瘯
- smallContainersBig99(param);
}
+// else if (param.getType()==99){//搴撳唴渚涗骇绾� //鍑哄簱 娴嬭瘯
+// smallContainersBig99(param);
+// }
} catch (Exception e){
throw new CoolException("澶辫触锛侊紒锛佸師鍥狅細"+e.getMessage());
}
@@ -1126,8 +1134,20 @@
if (Cools.isEmpty(basDevp.getCanining()) || !basDevp.getCanining().equals("Y")){
throw new CoolException("鐮佸灈浣嶇紪鍙� palletizingNo="+param.getStaNo()+" 鎵�澶勭珯鐐逛笉鏄兘鍏ョ姸鎬�");
}
- if (Cools.isEmpty(basDevp.getBarcode())){
+ if (Cools.isEmpty(basDevp.getBarcode()) || basDevp.getBarcode().equals("00000000")){
throw new CoolException("鐮佸灈浣嶇紪鍙� palletizingNo="+param.getStaNo()+" 鎵�澶勭珯鐐规枡绠辩爜寮傚父鐘舵�侊紱鏂欑鐮�==銆嬩负绌�"+basDevp.getBarcode());
+ }
+ if (!basDevp.getInEnable().equals("Y")){
+ try{
+ Thread.sleep(500);
+ } catch (Exception e){
+
+ }
+ BasDevp basDevp1111 = basDevpService.selectById(param.getStaNo());
+ if (!basDevp1111.getInEnable().equals("Y")){
+ throw new CoolException("鐮佸灈浣嶇紪鍙� palletizingNo="+param.getStaNo()+" 鎵�澶勭珯鐐癸紝璇风瓑寰呯炕杞畬鎴愶紱鏂欑鐮�==銆�"+basDevp.getBarcode());
+ }
+
}
if (!CodeDetectionUtil.barcodeDetection(basDevp.getBarcode(),8)){
throw new CoolException("鐮佸灈浣嶇紪鍙� palletizingNo="+param.getStaNo()+" 鎵�澶勭珯鐐规枡绠辩爜寮傚父鐘舵�侊紱鏂欑鐮侊細"+basDevp.getBarcode());
@@ -1146,14 +1166,14 @@
WaitPakin waitPakin = new WaitPakin();
waitPakin.sync(mat);
waitPakin.setBatch(param.getBatch()); //鏈ㄧ缂栫爜 //鎵规 鍞竴鍊� 绠卞彿
- waitPakin.setModel(param.getTaskNo()); //鍗峰彿 鍞竴鍊�
+ waitPakin.setModel(param.getTaskNo()); //鍗峰彿 鍞竴鍊� 宸ヤ綔鍙�
// waitPakin.setBrand(param.getBoxType()); //鏈ㄧ绫诲瀷
waitPakin.setZpallet(basDevp.getBarcode()); //鎵樼洏鐮�
// waitPakin.setOrigin(matList.getPosition()); //鏈ㄧ鍦ㄦ墭鐩樹笂鐨勪綅缃�
waitPakin.setWeight(param.getWeight()); //鍑�閲�
// waitPakin.setVolume(matList.getRoughWeight()); //姣涢噸
// waitPakin.setPrice(matList.getRollExtent()); //闀垮害
- waitPakin.setSpecs(param.getOrderNo()); //鍗曞彿 鍊熺敤
+ waitPakin.setSpecs(param.getOrderNo()); //MES璁㈠崟鍙� 鍊熺敤瑙勬牸
// waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
// waitPakin.setAnfme(matList.getAnfme()); // 鏁伴噺
waitPakin.setColor(param.getColor()); // 棰滆壊
@@ -1192,15 +1212,48 @@
throw new CoolException("鍝佸彿 matnr,璇峰厛涓嬪彂鍩虹妗f锛侊紒锛�");
}
if (Cools.isEmpty(mat.getUnits())){
- throw new CoolException("鍝佸彿 matnr,閲嶉噺鑼冨洿鍋忕Щ鍊间负绌猴紒锛侊紒,璇峰厛涓嬪彂鍩虹妗f锛侊紒锛�");
+ throw new CoolException("鍝佸彿 matnr,閲嶉噺鑼冨洿鍋忕Щ鍊间负绌猴紒锛侊紒,璇峰厛缁存姢鍩虹妗f锛侊紒锛�");
}
+ ArrayList<Integer> crns =new ArrayList<>();
+ ArrayList<Integer> crnList =new ArrayList<>();
+
+ crns.add(1);crns.add(2);crns.add(3);crns.add(4);crns.add(5);crns.add(6);crns.add(7);
+
+ for (Integer crnNo : crns){
+ // 妫�娴嬭矾寰�
+ Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+ .eq("type_no", 101)
+ .eq("stn_no", param.getDevNo())
+ .eq("crn_no", crnNo);
+ StaDesc staDesc = staDescService.selectOne(wrapper);
+ if (Cools.isEmpty(staDesc)){
+ continue;
+ }
+ BasCrnp basCrnp = basCrnpService.selectById(crnNo);
+ if (basCrnp.getCrnSts()!=3 || !basCrnp.getOutEnable().equals("Y")){
+ continue;
+ }
+ if (!basCrnpService.checkSiteError(crnNo, false)){
+ continue;
+ }
+ crnList.add(crnNo);
+ }
+
+ if (crnList.isEmpty()){
+ throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
+ }
ArrayList<LocDetl> locDetlArrayList = new ArrayList<>();
- Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight());
- if (param.getDevNo() == 536) {
+ Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>()
+ .eq("matnr", param.getMatnr())
+ .eq("weight", param.getWeight());
+ if (param.getDevNo() == 536){
wrapper.eq("model", param.getModel())
- .eq("specs", param.getOrderNo());
+ .eq("specs", param.getOrderNo())
+ .orderBy("appe_time", true);
+ } else {
+ wrapper.orderBy("batch", true);
}
List<LocDetl> locDetls = locDetlService.selectList(wrapper);
@@ -1210,14 +1263,12 @@
for (LocDetl locDetl:locDetls){
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
if (locMast.getLocSts().equals("F")){
- if (locDetlArrayList.size()<param.getBatchNum()) {//涓�
- locDetlArrayList.add(locDetl);
+ if (crnList.contains(locMast.getCrnNo())){
+ if (locDetlArrayList.size()<param.getBatchNum()) {//涓�
+ locDetlArrayList.add(locDetl);
+ }
}
}
- }
-
- if (locDetlArrayList.isEmpty()){
- throw new CoolException("鏈壘鍒扮鍚堟潯浠剁殑鐗╂枡鏄庣粏锛氬搧鍙�==銆媘atnr:"+param.getMatnr()+"锛涢噸閲�==銆媤right:"+param.getWeight());
}
Integer batchNum = param.getBatchNum();
@@ -1225,11 +1276,16 @@
Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr())
.lt("weight", param.getWeight() + mat.getUnits())
.and()
- .gt("weight", param.getWeight())
- .orderBy("weight", true);
+ .gt("weight", param.getWeight());
if (param.getDevNo() == 536){
locDetlWrapper.eq("model", param.getModel())
- .eq("specs", param.getOrderNo());
+ .eq("specs", param.getOrderNo())
+ .orderBy("appe_time", true)
+ .orderBy("weight", true);
+ } else {
+ locDetlWrapper
+ .orderBy("batch", true)
+ .orderBy("weight", true);
}
locDetls = locDetlService.selectList(locDetlWrapper);
if (locDetls.isEmpty()){
@@ -1238,8 +1294,10 @@
for (LocDetl locDetl:locDetls){
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
if (locMast.getLocSts().equals("F")){
- if (locDetlArrayList.size()<batchNum) {//涓�
- locDetlArrayList.add(locDetl);
+ if (crnList.contains(locMast.getCrnNo())){
+ if (locDetlArrayList.size()<batchNum) {//涓�
+ locDetlArrayList.add(locDetl);
+ }
}
}
}
@@ -1248,11 +1306,16 @@
Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr())
.gt("weight", param.getWeight() - mat.getUnits())
.and()
- .lt("weight", param.getWeight())
- .orderBy("weight", false);
+ .lt("weight", param.getWeight());
if (param.getDevNo() == 536){
locDetlWrapper.eq("model", param.getModel())
- .eq("specs", param.getOrderNo());
+ .eq("specs", param.getOrderNo())
+ .orderBy("appe_time", true)
+ .orderBy("weight", false);
+ } else {
+ locDetlWrapper
+ .orderBy("batch", true)
+ .orderBy("weight", false);
}
locDetls = locDetlService.selectList(locDetlWrapper);
@@ -1262,24 +1325,74 @@
for (LocDetl locDetl:locDetls){
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
if (locMast.getLocSts().equals("F")){
- if (locDetlArrayList.size()<batchNum) {//涓�
- locDetlArrayList.add(locDetl);
+ if (crnList.contains(locMast.getCrnNo())){
+ if (locDetlArrayList.size()<batchNum) {//涓�
+ locDetlArrayList.add(locDetl);
+ }
+ }
+ }
+ }
+ }
+ if (locDetlArrayList.isEmpty()){
+ throw new CoolException("鏈壘鍒扮鍚堟潯浠剁殑鐗╂枡鏄庣粏锛氬搧鍙�==銆媘atnr:"+param.getMatnr()+"锛涢噸閲�==銆媤right:"+param.getWeight());
+ }
+ if (locDetlArrayList.size()<batchNum){
+ throw new CoolException("搴撳瓨鏁伴噺:"+locDetlArrayList.size()+"锛涘皬浜庨渶姹傛暟閲�:"+param.getBatchNum());
+ }
+ ArrayList<String> locS = new ArrayList<>();
+
+ ArrayList<LocDetl> locDetlArrayAnd = new ArrayList<>();
+ for (LocDetl locDetl : locDetlArrayList){
+ if (!locS.contains(locDetl.getLocNo())){
+ locDetlArrayAnd.add(locDetl);
+ locS.add(locDetl.getLocNo());
+ if (crnList.contains(1) || crnList.contains(2)){
+ String singleLoc = Utils.singleLoc(locDetl.getLocNo());
+ if (Cools.isEmpty(singleLoc)){
+ log.error("寮傚父搴撲綅鍙凤細"+singleLoc+"锛涜緭鍏ュ簱浣嶅彿锛�"+locDetl.getLocNo());
+ continue;
+ }
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", singleLoc));
+ if (locMast.getLocSts().equals("F")){
+ LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", singleLoc));
+ if (Cools.isEmpty(locDetl1)){
+ throw new CoolException("搴撲綅"+locMast.getLocNo()+"寮傚父锛屽湪搴撲絾鏄棤搴撳瓨锛侊紒锛�");
+ }
+ if (!locS.contains(locDetl1.getLocNo())){
+ if (locDetl1.getMatnr().equals(locDetl.getMatnr())){
+ locDetlArrayAnd.add(locDetl1);
+ locS.add(locDetl1.getLocNo());
+ }
+ }
}
}
}
}
- if (locDetlArrayList.size()<batchNum){
- throw new CoolException("搴撳瓨鏁伴噺:"+locDetlArrayList.size()+"锛涘皬浜庨渶姹傛暟閲�:"+param.getBatchNum());
+ if (locDetlArrayAnd.isEmpty()){
+ throw new CoolException("鏈壘鍒扮鍚堟潯浠剁殑鐗╂枡鏄庣粏锛氬搧鍙�==銆媘atnr:"+param.getMatnr()+"锛涢噸閲�==銆媤right:"+param.getWeight());
}
- for (LocDetl locDetl : locDetlArrayList){
+ if (locDetlArrayAnd.size()<batchNum){
+ throw new CoolException("搴撳瓨鏁伴噺:"+locDetlArrayAnd.size()+"锛涘皬浜庨渶姹傛暟閲�:"+param.getBatchNum());
+ }
+
+ ArrayList<LocDetl> locDetlArraySou = new ArrayList<>();
+
+ for (LocDetl locDetl : locDetlArrayAnd){
if (batchNum <= 0){
- return;
+ break;
}
- StockOutParam stockOutParam = new StockOutParam(param,locDetl);
- workService.startupFullTakeStore(stockOutParam, userId);
+ locDetlArraySou.add(locDetl);
batchNum --;
}
+ try{
+ StockOutParam stockOutParam = new StockOutParam(param,locDetlArraySou);
+ workService.startupFullTakeStore(stockOutParam, userId);
+ } catch (Exception e){
+// throw new CoolException("鐢熸垚鍑哄簱浠诲姟澶辫触:鍑哄簱鏁伴噺锛�"+locDetlArraySou.size());
+ throw new CoolException("鐢熸垚鍑哄簱浠诲姟澶辫触:"+e.getMessage());
+ }
+
}
public void smallContainersJar(SmallCompleteParam param) {
@@ -1494,5 +1607,39 @@
}
}
+ /*
+ * 鑾峰彇纭寲缃愪换鍔′俊鎭� //
+ * */
+ @Override
+ @Transactional
+ public List<JarMastTableVo> getJatIdList(Integer id) {
+ List<BasJarMast> jarMasts = basJarMastService.selectList(new EntityWrapper<BasJarMast>().eq("jar_id", id));
+ if (Cools.isEmpty(jarMasts)){
+ return new ArrayList<JarMastTableVo>();
+ }
+ ArrayList<JarMastTableVo> jarMastTableVos = new ArrayList<>();
+ for (BasJarMast jarMast : jarMasts) {
+ JarMastTableVo jarMastTableVo = new JarMastTableVo();
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", jarMast.getWrkNo()));
+ List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", jarMast.getWrkNo()));
+ if (wrkDetls.isEmpty()){
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetls.add(wrkDetl);
+ }
+ if (Cools.isEmpty(wrkMast) || Cools.isEmpty(wrkDetls)){
+ continue;
+ }
+ jarMastTableVo.setJarId(jarMast.getJarId());
+ jarMastTableVo.setJarWrkNo(jarMast.getWrkNo().toString());
+ jarMastTableVo.setStatus(jarMast.getStatus());
+ jarMastTableVo.setStatus$(jarMast.getStatus$());
+ jarMastTableVo.setMatnr(wrkDetls.get(0).getMatnr());
+ jarMastTableVo.setMaktx(wrkDetls.get(0).getMaktx());
+ jarMastTableVo.setWeight(wrkDetls.get(0).getWeight());
+ jarMastTableVos.add(jarMastTableVo);
+ }
+ return jarMastTableVos;
+ }
+
/*...........................浜冲窞鐓滄槦..............浠ヤ笂.............浜冲窞鐓滄槦...........................*/
}
--
Gitblit v1.9.1