From 8a9b1bc2a82166cfa563bc32057503a0274c561d Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期四, 22 二月 2024 15:37:19 +0800
Subject: [PATCH] 海诺尔 物料打印码 pda移库增加
---
src/main/java/com/zy/asrs/utils/PlaExcelListener.java | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
index c968f3a..83bc4ef 100644
--- a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -14,6 +14,7 @@
import com.zy.asrs.service.PlaService;
import com.zy.common.entity.MatExcel;
import com.zy.common.entity.PlaExcel;
+import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -26,12 +27,14 @@
* Created by vincent on 2019-11-25
*/
@Slf4j
+@Data
public class PlaExcelListener extends AnalysisEventListener<PlaExcel> {
private static final String OWNER_HZ = "娴锋鐢熺墿";
private static final String OWNER_HNE = "娴疯灏�";
private int total = 0;
+ private int index = 1;
private Long userId;
public PlaExcelListener() {
@@ -60,6 +63,7 @@
*/
@Override
public void invoke(PlaExcel excel, AnalysisContext ctx) {
+ index ++;
PlaService plaService = SpringUtils.getBean(PlaService.class);
NodeService nodeService = SpringUtils.getBean(NodeService.class);
MatService matService = SpringUtils.getBean(MatService.class);
@@ -89,7 +93,7 @@
setPla(pla);
}catch (Exception e){
log.info(e.getMessage() + "Pla: " + pla.getBatch());
- throw new CoolException(e.getMessage());
+ throw new CoolException(e.getMessage() + "锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo());
}
if(!Cools.isEmpty(pla.getLocNo())){
@@ -103,9 +107,15 @@
pla.setStatus(GlobleParameter.PLA_STATUS_1);
pla.setPakinTime(new Date());
}
- if (!plaService.insert(pla)) {
- throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
+ try {
+ plaService.insert(pla);
+ }catch (Exception e){
+ log.error("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+ throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
}
+// if (!plaService.insert(pla)) {
+// throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
+// }
total++;
}else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_00)){
excel.setId(pla.getId());
@@ -114,7 +124,12 @@
excel.setStep(2);
excel.setStatus(GlobleParameter.PLA_STATUS_00);
BeanUtils.copyProperties(excel,pla);
- plaService.updateById(pla);
+ try {
+ plaService.updateById(pla);
+ }catch (Exception e){
+ log.error("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+ throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+ }
total++;
}
}
--
Gitblit v1.9.1