From a27ce393f9924c044dfe743b220f0300f33e79d3 Mon Sep 17 00:00:00 2001
From: 你好啊 <1536384743@qq.com>
Date: 星期二, 06 八月 2024 15:47:14 +0800
Subject: [PATCH] 合并相关文件
---
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java
index eb878ef..b9b3b4e 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java
@@ -4,6 +4,7 @@
import com.example.erp.entity.mm.MaterialStore;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
+import com.example.erp.mapper.mm.MaterialInventoryMapper;
import com.example.erp.mapper.mm.MaterialStoreMapper;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +12,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import java.text.DecimalFormat;
import java.util.*;
@Service
@@ -20,15 +22,23 @@
@Autowired
MaterialStoreMapper materialStoreMapper;
@Autowired
+ MaterialInventoryMapper materialInventoryMapper;
+ @Autowired
BasicWarehouseTypeMapper basicWarehouseTypeMapper;
@Autowired
SysErrorService sysErrorService;
public Boolean saveMaterialStore(Map<String,Object> object) {
boolean saveState = true;
+ //璁剧疆鍥炴粴鐐�
+ Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+ try {
String id = "";
String type = "";
String json = "";
+ double width = 0.0;
+ double height = 0.0;
+ double singlePieceArea=0.0;
if (object.get("id") != null) {
id = object.get("id").toString();
}
@@ -38,12 +48,32 @@
if (object.get("json") != null) {
json = object.get("json").toString();
}
+ if (object.get("width") != null) {
+ width = Double.parseDouble(object.get("width").toString());
+ }
+ if (object.get("height") != null) {
+ height = Double.parseDouble(object.get("height").toString());
+ }
+ DecimalFormat decimalFormat = new DecimalFormat("#0.00");
+ singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000));
if(Long.parseLong(id)>0){
materialStoreMapper.updateMaterialStore(type,json, Long.valueOf(id));
+ if (Objects.equals(type, "鍘熺墖")){
+ materialInventoryMapper.updateMaterialInventoryArea(Long.valueOf(id),singlePieceArea);
+ }
}else{
materialStoreMapper.insertMaterialStore(type,json);
}
+ } catch (Exception e) {
+ TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+ //灏嗗紓甯镐紶鍏ユ暟鎹簱
+ SysError sysError = new SysError();
+ sysError.setError(e+Arrays.toString(e.getStackTrace()));
+ sysError.setFunc("saveMaterialStore");
+ sysErrorService.insert(sysError);
+ saveState = false;
+ }
return saveState;
}
@@ -76,8 +106,8 @@
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
//灏嗗紓甯镐紶鍏ユ暟鎹簱
SysError sysError = new SysError();
- sysError.setError(e.toString());
- sysError.setFunc("saveOrder");
+ sysError.setError(e+Arrays.toString(e.getStackTrace()));
+ sysError.setFunc("deleteMaterialStore");
sysErrorService.insert(sysError);
saveState = false;
--
Gitblit v1.8.0