From 2aad6e3010f685359e45c216afcbce984d659604 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 16 四月 2024 10:55:31 +0800
Subject: [PATCH] 物料资料编辑面积修改

---
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 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..e6d1fc7 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
@@ -19,6 +21,8 @@
 public class MaterialStoreService {
     @Autowired
     MaterialStoreMapper materialStoreMapper;
+    @Autowired
+    MaterialInventoryMapper materialInventoryMapper;
     @Autowired
     BasicWarehouseTypeMapper basicWarehouseTypeMapper;
     @Autowired
@@ -29,6 +33,9 @@
             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,8 +45,19 @@
             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);
             }

--
Gitblit v1.8.0