From 1ed4d384f6d52a5f689915d9f9ebfc9b8545bc09 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期五, 08 十二月 2023 08:16:44 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 251 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 226 insertions(+), 25 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 3d88baa..2d9de8d 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
+import com.core.common.R;
import com.core.common.SnowflakeIdWorker;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -13,6 +14,8 @@
import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatUtils;
import com.zy.common.model.DetlDto;
+import com.zy.common.model.enums.WorkNoType;
+import com.zy.common.service.CommonService;
import com.zy.common.utils.NodeUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +59,10 @@
private WrkDetlService wrkDetlService;
@Autowired
private WaitPakinService waitPakinService;
+ @Autowired
+ private CommonService commonService;
+ @Autowired
+ private LocDetlRullUpDetailService locDetlRullUpDetailService;
@Override
@Transactional
@@ -588,21 +595,28 @@
LabellerMatParam labellerMatParam = new LabellerMatParam();
labellerMatParam.setDevNo(param.getDevNo());
labellerMatParam.setLabNo(param.getLabNo());
- ArrayList<LabellerMatParam.CombMat> combMats = new ArrayList<>();
- String orderNo = "";
+ labellerMatParam.setWrkNo(basDevp.getWrkNo().toString());
+// ArrayList<LabellerMatParam.CombMat> combMats = new ArrayList<>();
+ ArrayList<LabellerMatParam.BoxNo> boxNos = new ArrayList<>();
+// String orderNo = "";
for (WrkDetl wrkDetl:wrkDetls){
- LabellerMatParam.CombMat combMat = new LabellerMatParam.CombMat(wrkDetl);
- orderNo=wrkDetl.getOrderNo();
- combMat.setTemp1("1");
- combMats.add(combMat);
+ LabellerMatParam.BoxNo boxNo = new LabellerMatParam.BoxNo();
+ boxNo.setBoxNo(wrkDetl.getBatch());
+ boxNos.add(boxNo);
}
+ labellerMatParam.setBoxNos(boxNos);
+// for (WrkDetl wrkDetl:wrkDetls){
+// LabellerMatParam.CombMat combMat = new LabellerMatParam.CombMat(wrkDetl);
+// orderNo=wrkDetl.getOrderNo();
+// combMat.setTemp1("1");
+// combMats.add(combMat);
+// }
- labellerMatParam.setCombMats(combMats);
- labellerMatParam.setLabellingTime(DateUtils.convert(new Date()));
- labellerMatParam.setWrkNo(basDevp.getWrkNo().toString());
- labellerMatParam.setLabTemplate("1");
- labellerMatParam.setOrderNo(orderNo);
+// labellerMatParam.setCombMats(combMats);
+// labellerMatParam.setLabellingTime(DateUtils.convert(new Date()));
+// labellerMatParam.setLabTemplate("1");
+// labellerMatParam.setOrderNo(orderNo);
wrkMast.setWrkSts(53L);
if (!wrkMastService.updateById(wrkMast)){
throw new CoolException("寮傚父锛岃閲嶆柊鐢宠");
@@ -643,11 +657,12 @@
if (param.getLabResult().equals("OK")){
wrkMast.setWrkSts(54L);
+ wrkMast.setStaNo(144);
if (!wrkMastService.updateById(wrkMast)){
throw new CoolException("寮傚父锛岃閲嶆柊鐢宠");
}
}else if (param.getLabResult().equals("NG")){
- wrkMast.setWrkSts(52L);
+ wrkMast.setWrkSts(52L);//閲嶆柊璐存爣
if (!wrkMastService.updateById(wrkMast)){
throw new CoolException("寮傚父锛岃閲嶆柊鐢宠");
}
@@ -669,9 +684,14 @@
throw new CoolException("鍙傛暟锛氭墭鐩樼爜 barcode涓虹┖");
}else if (Cools.isEmpty(param.getPalletizingNo())){
throw new CoolException("鍙傛暟锛氱爜鍨涗綅缂栧彿 palletizingNo涓虹┖");
+ }else if (Cools.isEmpty(param.getBoxType())){
+ throw new CoolException("鍙傛暟锛氭湪绠辩被鍨� boxType涓虹┖");
}else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){
throw new CoolException("鍙傛暟锛氱墿鏂欐槑缁� matLists涓虹┖");
}
+
+ ArrayList<String> positions = new ArrayList<>(); //鏈ㄧ浣嶇疆鏌ラ噸 (orgin)
+ ArrayList<String> boxNos = new ArrayList<>(); //鏈ㄧ鍞竴缂栫爜鏌ラ噸 锛坆atch锛�
//鍒ゆ柇matLists鍙傛暟
for (PalletizingCompleteParam.MatList matList:param.getMatLists()){
if (Cools.isEmpty(matList.getMatnr())){
@@ -684,6 +704,18 @@
throw new CoolException("鐗╂枡缂栫爜锛�"+matList.getMatnr()+"銆佸弬鏁帮細鏈ㄧ涓摐绠旀暟閲� anfme涓虹┖");
}else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){
throw new CoolException("鐗╂枡缂栫爜锛�"+matList.getMatnr()+"銆佸弬鏁帮細閲嶉噺 weight涓虹┖");
+ }
+
+ if (!positions.contains(matList.getPosition())){
+ positions.add(matList.getPosition());
+ }else {
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBoxNo()+",鏈ㄧ浣嶇疆瀛樺湪閲嶅锛�"+matList.getPosition());
+ }
+
+ if (!boxNos.contains(matList.getBoxNo())){
+ boxNos.add(matList.getBoxNo());
+ }else {
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBoxNo()+",鏈ㄧ缂栫爜瀛樺湪閲嶅");
}
}
@@ -702,14 +734,6 @@
// }
- WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type",201).eq("barcode", param.getBarcode()).eq("sta_no",param.getDevNo$()));
- if (Cools.isEmpty(wrkMast) || !wrkMast.getWrkSts().equals(42L)){
- throw new CoolException("鏌ヨ鎵樼洏澶辫触");
- }else {
- wrkMast.setWrkSts(wrkMast.getWrkSts()+1);
- }
-
-
if (locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()))!=0
|| wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()))!=0
|| waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()))!=0){
@@ -718,6 +742,7 @@
Date now = new Date();
+ long rollUp = now.getTime();
for (PalletizingCompleteParam.MatList matList:param.getMatLists()){
Mat mat = matService.selectByMatnr(matList.getMatnr());
if (Cools.isEmpty(mat)) {
@@ -725,9 +750,10 @@
}
WaitPakin waitPakin = new WaitPakin();
waitPakin.sync(mat);
- waitPakin.setBatch(matList.getBatch()); //鎵规
+ waitPakin.setModel(matList.getBatch()); //鎵规
waitPakin.setSpecs(matList.getSpecs()); //瑙勬牸
- waitPakin.setSku(matList.getBoxNo()); //鏈ㄧ缂栫爜
+ waitPakin.setBatch(matList.getBoxNo()); //鏈ㄧ缂栫爜
+ waitPakin.setBrand(param.getBoxType()); //鏈ㄧ绫诲瀷
waitPakin.setZpallet(param.getBarcode()); //鎵樼洏鐮�
waitPakin.setOrigin(matList.getPosition()); //鏈ㄧ鍦ㄦ墭鐩樹笂鐨勪綅缃�
waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
@@ -737,14 +763,38 @@
waitPakin.setAppeTime(now);
waitPakin.setModiUser(userId);
waitPakin.setModiTime(now);
+ waitPakin.setRollUp(rollUp);
+ if (!Cools.isEmpty(matList.getMatDetlList())){
+ for (PalletizingCompleteParam.MatDetlList matDetlList:matList.getMatDetlList()){
+ LocDetlRullUpDetail locDetlRullUpDetail = new LocDetlRullUpDetail();
+ locDetlRullUpDetail.setUuid(rollUp);
+ locDetlRullUpDetail.setRollNo(matDetlList.getBoxNoDetl());
+ locDetlRullUpDetail.setRollWeight(matDetlList.getWeightDetl().toString());
+ }
+ }
if (!waitPakinService.insert(waitPakin)) {
throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
}
}
- if (!wrkMastService.updateById(wrkMast)){
- throw new CoolException("寮傚父锛岃閲嶆柊鐢宠");
- }
+ }
+
+
+ /*
+ *涓帶锛氬嚭搴撳畬鎴愭湀鍙扮浉鍏�
+ * */
+ @Override
+ @Transactional
+ public void balconyComplete(LabellerMatParam param) {
+ if (Cools.isEmpty(param.getWrkNo())){
+ throw new CoolException("宸ヤ綔鍙蜂负绌猴紒");
+ }
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getWrkNo()));
+ if (Cools.isEmpty(wrkMast)){
+ throw new CoolException("宸ヤ綔鍙蜂负绌猴紒");
+ }
+ wrkMast.setWrkSts(57L);
+ wrkMastService.updateById(wrkMast);
}
/*
@@ -753,6 +803,75 @@
@Override
@Transactional
public void singleUnstackingComplete(SingleUnstackingCompleteParam param) {
+ Long userId = 8888L;//妗佹灦涓婁綅杞欢
+ //鍒ゆ柇param鍙傛暟
+ if (Cools.isEmpty(param.getBarcode())){
+ throw new CoolException("鍙傛暟锛氭墭鐩樼爜 barcode涓虹┖");
+ }else if (Cools.isEmpty(param.getPalletizingNo())){
+ throw new CoolException("鍙傛暟锛氱爜鍨涗綅缂栧彿 palletizingNo涓虹┖");
+ }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){
+ throw new CoolException("鍙傛暟锛氱墿鏂欐槑缁� matLists涓虹┖");
+ }
+ WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode());
+ if (Cools.isEmpty(wrkMastMatrix)){
+ throw new CoolException("鍙傛暟锛氭墭鐩樼爜鏌ヨ宸ヤ綔妗eけ璐ワ細"+param.getBarcode());
+ }
+
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo());
+ ArrayList<WrkDetl> wrkDetlsNew = new ArrayList<>();
+ //鍒ゆ柇matLists鍙傛暟
+ for (SingleUnstackingCompleteParam.MatList matList:param.getMatLists()){
+ if (Cools.isEmpty(matList.getPosition())){
+ throw new CoolException("鍙傛暟锛氱爜鍨涗綅缃� position涓虹┖");
+ }else if (Cools.isEmpty(matList.getBoxNo())){
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo涓虹┖");
+ }
+ boolean sign=true;
+ for (WrkDetl wrkDetl:wrkDetls){
+ if (wrkDetl.getBatch().equals(matList.getBoxNo())){//鏈ㄧ缂栫爜
+ wrkDetl.setInspect(1);
+ wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()));
+ wrkDetlsNew.add(wrkDetl);
+ sign=false;
+ break;
+ }
+ }
+ if (sign){
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo鏈煡璇㈠埌瀵瑰簲鐨勫伐浣滄槑缁嗭紒");
+ }
+ }
+
+ // 鐢熸垚宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(202));
+ Date now = new Date();
+
+ // 鐢熸垚宸ヤ綔妗�
+ WrkMast wrkMast = new WrkMast();
+ wrkMast.setWrkNo(workNo);
+ wrkMast.setIoTime(now);
+ wrkMast.setWrkSts(51L); // 宸ヤ綔鐘舵�侊細鐢熸垚鍏ュ簱ID
+ wrkMast.setIoType(202); // 鍏ュ嚭搴撶姸鎬侊細202.鎷嗗灈鍚庡嚭搴�
+ wrkMast.setIoPri(99D); // 浼樺厛绾�
+ wrkMast.setSourceStaNo(param.getDevNo$());
+ wrkMast.setStaNo(140); //璐存爣绔欑偣
+ // 鎿嶄綔浜哄憳鏁版嵁
+ wrkMast.setAppeUser(userId);
+ wrkMast.setAppeTime(now);
+ wrkMast.setModiUser(userId);
+ wrkMast.setModiTime(now);
+ if (!wrkMastService.insert(wrkMast)) {
+ throw new CoolException("鐢熸垚宸ヤ綔妗eけ璐�==銆嬫鏋朵笂浣嶈蒋浠讹細鍗曟鎷嗗灈瀹屾垚閫氱煡");
+ }
+
+ for (WrkDetl wrkDetl : wrkDetlsNew){
+ wrkDetl.setWrkNo(wrkMast.getWrkNo());
+ wrkDetl.setIoTime(wrkMast.getIoTime());
+ wrkDetl.setAppeTime(now);
+ wrkDetl.setModiTime(now);
+ if (!wrkDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触==銆嬫鏋朵笂浣嶈蒋浠讹細鍗曟鎷嗗灈瀹屾垚閫氱煡");
+ }
+ }
}
@@ -762,6 +881,88 @@
@Override
@Transactional
public void singleMountUnstackingComplete(SingleMountUnstackingCompleteParam param) {
+ Long userId = 8888L;//妗佹灦涓婁綅杞欢
+ //鍒ゆ柇param鍙傛暟
+ if (Cools.isEmpty(param.getBarcode())){
+ throw new CoolException("鍙傛暟锛氭墭鐩樼爜 barcode涓虹┖");
+ }else if (Cools.isEmpty(param.getPalletizingNo())){
+ throw new CoolException("鍙傛暟锛氱爜鍨涗綅缂栧彿 palletizingNo涓虹┖");
+ }
+ WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode());
+ if (Cools.isEmpty(wrkMastMatrix)){
+ throw new CoolException("鍙傛暟锛氭墭鐩樼爜鏌ヨ宸ヤ綔妗eけ璐ワ細"+param.getBarcode());
+ }else {
+ if (!wrkMastMatrix.getIoType().equals(101)){
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo());
+ if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0 || param.getMatLists().size()!=wrkDetls.size()){
+ throw new CoolException("杩斿洖鐗╂枡鏄庣粏鏁颁负"+param.getMatLists().size()+",鎵樼洏鐮侊細"+param.getBarcode()+"搴斿墿浣欑墿鏂欐暟锛�"+wrkDetls.size());
+ }
+
+ ArrayList<String> orgin = new ArrayList<>();
+ //鍒ゆ柇matLists鍙傛暟
+ for (SingleMountUnstackingCompleteParam.MatList matList : param.getMatLists()){
+ if (Cools.isEmpty(matList.getPosition())){
+ throw new CoolException("鍙傛暟锛氱爜鍨涗綅缃� position涓虹┖");
+ }else if (Cools.isEmpty(matList.getBoxNo())){
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo涓虹┖");
+ }
+ if (!orgin.contains(matList.getPosition())){
+ orgin.add(matList.getPosition());
+ }else {
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBoxNo()+",鏈ㄧ浣嶇疆瀛樺湪閲嶅");
+ }
+ boolean sign=true;
+ for (WrkDetl wrkDetl:wrkDetls){
+ if (wrkDetl.getBatch().equals(matList.getBoxNo())){//鏈ㄧ缂栫爜
+ wrkDetl.setOrigin(matList.getPosition());
+ wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()));
+ sign=false;
+ break;
+ }
+ }
+ if (sign){
+ throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBoxNo()+"鏈煡璇㈠埌瀵瑰簲鐨勫伐浣滄槑缁嗭紒");
+ }
+ }
+ }
+ }
+
+ wrkMastMatrix.setSheetNo("1");
+ if (!wrkMastService.updateById(wrkMastMatrix)){
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�==銆嬫鏋朵笂浣嶈蒋浠讹細鍗曟墭鎷嗗灈瀹屾垚閫氱煡");
+ }
+ }
+
+ /*
+ *
+ * */
+ @Override
+ @Transactional
+ public void cs1(String barcode) {
+ BasDevp basDevp = basDevpService.selectById(216);
+ basDevp.setWrkNo(9992);
+ basDevp.setBarcode(barcode);
+ basDevpService.updateById(basDevp);
+ }
+
+ /*
+ *
+ * */
+ @Override
+ @Transactional
+ public void cs2() {
+ BasDevp basDevp = basDevpService.selectById(216);
+ basDevp.setWrkNo(0);
+ basDevp.setBarcode("");
+ basDevpService.updateById(basDevp);
+ }
+
+ /*
+ *
+ * */
+ @Override
+ @Transactional
+ public void cs3() {
}
--
Gitblit v1.9.1