From 00b8e7a256d8508043784f061a4afe5b1107d9aa Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期五, 02 二月 2024 16:10:54 +0800
Subject: [PATCH] 1.layui版本更新 2.固定表格 显示表格合计信息
---
src/main/java/com/zy/asrs/utils/PlaExcelListener.java | 66 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
index fae28c7..c968f3a 100644
--- a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -5,9 +5,11 @@
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
+import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.Node;
import com.zy.asrs.entity.Pla;
import com.zy.asrs.entity.param.GlobleParameter;
+import com.zy.asrs.service.MatService;
import com.zy.asrs.service.NodeService;
import com.zy.asrs.service.PlaService;
import com.zy.common.entity.MatExcel;
@@ -25,6 +27,9 @@
*/
@Slf4j
public class PlaExcelListener extends AnalysisEventListener<PlaExcel> {
+
+ private static final String OWNER_HZ = "娴锋鐢熺墿";
+ private static final String OWNER_HNE = "娴疯灏�";
private int total = 0;
private Long userId;
@@ -57,6 +62,7 @@
public void invoke(PlaExcel excel, AnalysisContext ctx) {
PlaService plaService = SpringUtils.getBean(PlaService.class);
NodeService nodeService = SpringUtils.getBean(NodeService.class);
+ MatService matService = SpringUtils.getBean(MatService.class);
Date now = new Date();
// 鍟嗗搧
@@ -71,10 +77,26 @@
pla.setModifyTime(new Date());
pla.setStatus(GlobleParameter.PLA_STATUS_00);
pla.setStockFreeze(1);
+ pla.setWeightAnfme(pla.getWeight());
+ Mat mat = matService.selectByMaktx(pla.getBrand());
+ if(Cools.isEmpty(mat)){
+ throw new CoolException("鏃犳硶鎵惧埌瀵瑰簲鐨勭墝鍙蜂俊鎭紝鐗屽彿=" + pla.getBrand());
+ }
+ pla.setMatnr(mat.getMatnr());
+ try {
+ pla.setType(getType(mat.getMatnr()));
+ //杞﹂棿銆佷骇绾裤�佷富浣�
+ setPla(pla);
+ }catch (Exception e){
+ log.info(e.getMessage() + "Pla: " + pla.getBatch());
+ throw new CoolException(e.getMessage());
+ }
+
if(!Cools.isEmpty(pla.getLocNo())){
Node node = nodeService.selectByUuid(pla.getLocNo());
if(Cools.isEmpty(node)){
- throw new CoolException("鏈兘鎵惧埌鐩稿簲鐨勫簱浣嶄俊鎭�");
+ throw new CoolException("鏈兘鎵惧埌鐩稿簲鐨勫簱浣嶄俊鎭紝搴撲綅缂栧彿=" +pla.getLocNo());
+ //log.info("鏈兘鎵惧埌鐩稿簲鐨勫簱浣嶄俊鎭紝搴撲綅缂栧彿={}",pla.getLocNo());
}
pla.setStash(node.getParentName());
pla.setLocNo(node.getUuid());
@@ -97,6 +119,48 @@
}
}
+ private String getType(String matnr){
+ String type = matnr.substring(0,3);
+ if(Cools.eq(type,"301")){
+ return "绾爲鑴�";
+ }
+ if (Cools.eq(type,"302")){
+ return "鏀规�ф爲鑴�";
+ }
+ if (Cools.eq(type,"303")){
+ return "鍓骇鐗�";
+ }
+ if (Cools.eq(type,"304")){
+ return "濮旀墭鍔犲伐浜у搧";
+ }
+ if (Cools.eq(type,"305")){
+ return "涓欎氦閰�";
+ }
+
+ return "";
+ }
+
+ private void setPla(Pla pla){
+ String batch = pla.getBatch();
+ String line = batch.substring(8,10);
+
+ pla.setLine(line);
+ if("绾爲鑴�".equals(pla.getType())){
+ if("01".equals(line) || "02".equals(line)){
+ pla.setOwner(OWNER_HZ);
+ pla.setWorkshop("涓�杞﹂棿");
+ }else {
+ pla.setOwner(OWNER_HNE);
+ pla.setWorkshop("涓夎溅闂�");
+ }
+ }else if ("鏀规�ф爲鑴�".equals(pla.getType())){
+ if ("01".equals(line) || "02".equals(line) || "03".equals(line) || "04".equals(line)){
+ pla.setOwner(OWNER_HNE);
+ pla.setWorkshop("浜岃溅闂�");
+ }
+ }
+ }
+
/**
* 鎵�鏈夋暟鎹В鏋愬畬鎴愪簡璋冪敤
* 閫傚悎浜嬪姟
--
Gitblit v1.9.1