From f6a83b4928dc830661b6662c32853e949b881fbc Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期一, 01 十二月 2025 09:03:06 +0800
Subject: [PATCH] 空托盘出库增加托盘码筛选
---
src/main/java/com/zy/asrs/utils/MatExcelListener.java | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/MatExcelListener.java b/src/main/java/com/zy/asrs/utils/MatExcelListener.java
index c4eec8f..cf5fd80 100644
--- a/src/main/java/com/zy/asrs/utils/MatExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/MatExcelListener.java
@@ -2,19 +2,20 @@
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.InOut;
import com.zy.asrs.entity.Mat;
+import com.zy.asrs.entity.MatBarcode;
import com.zy.asrs.entity.Tag;
import com.zy.asrs.mapper.TagMapper;
-import com.zy.asrs.service.InOutService;
-import com.zy.asrs.service.MatService;
-import com.zy.asrs.service.TagService;
+import com.zy.asrs.service.*;
import com.zy.common.entity.MatExcel;
import com.zy.common.utils.NodeUtils;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
@@ -60,6 +61,10 @@
TagMapper tagMapper = SpringUtils.getBean(TagMapper.class);
MatService matService = SpringUtils.getBean(MatService.class);
InOutService inOutService = SpringUtils.getBean(InOutService.class);
+ MatBarcodeService matBarcodeService = SpringUtils.getBean(MatBarcodeService.class);
+ WrkDetlService wrkDetlService = SpringUtils.getBean(WrkDetlService.class);
+ LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
+ WaitPakinService waitPakinService = SpringUtils.getBean(WaitPakinService.class);
Date now = new Date();
Long tagId;
// 鍒嗙被
@@ -130,7 +135,7 @@
tagId = tagService.getTop().getId();
}
// 鍟嗗搧
- Mat mat = matService.selectByMatnr(excel.getMatnr());
+ Mat mat = matService.selectByMatnr(excel.getMatnr() + "__" + excel.getName());
if (mat == null) {
InOut inOut=new InOut();
mat = excel;
@@ -148,6 +153,25 @@
throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
}
total++;
+ } else {
+ if (excel.getColor().equals("鎶ュ簾")){
+ //妯″叿鐘舵�佹洿鏂颁负鎶ュ簾 妯″叿涓庢墭鐩樿В缁�
+ List<MatBarcode> list = new ArrayList<>();
+ MatBarcode matBarcode = matBarcodeService.selectbyMatnr(excel.getMatnr() + "__" + excel.getName());
+ if (matBarcode != null){
+ list.add(matBarcode);
+ matBarcodeService.deleteMatBarcode(list);
+ }
+
+ }
+ //妯″叿淇℃伅鏇存柊
+ matService.delete(new EntityWrapper<Mat>().eq("matnr",mat.getMatnr()));
+ mat = excel;
+ mat.setTagId(tagId);
+ mat.setMatnr(excel.getMatnr() + "__" + excel.getName());
+ if (!matService.insert(mat)) {
+ throw new CoolException("淇濆瓨鍟嗗搧妗f澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
+ }
}
}
--
Gitblit v1.9.1