From 329e41ccb0cd24d102b8d5c6db5c167ca01da857 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期二, 16 四月 2024 11:08:15 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/a1536384743/erp_-override

---
 north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue          |    5 ++
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue |   33 +++++++++++-----
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java    |   10 +++--
 north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml                       |    2 
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml                        |   18 ++++++---
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java      |    2 +
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java        |   18 +++++++++
 north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml                            |   18 ++++++---
 north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml                           |    2 
 9 files changed, 79 insertions(+), 29 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue
index 9ea316d..7152658 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue
@@ -87,8 +87,11 @@
   let materialStore={
     id:ruleForm.value.id,
     type:value.value,
-    json:productName
+    json:productName,
+    width:BasicData.value[0].Type,
+    height:BasicData.value[1].Type
   }
+  console.log(materialStore)
   if(isBool){
     request.post("/MaterialStore/saveMaterialStore", materialStore).then((res) => {
       if(res.code==200){
diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue
index 8649d29..ca904c7 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue
@@ -98,7 +98,7 @@
 
 
 //椤甸潰绗竴娆″姞杞�
-request.get(`/BasicWarehouse/BasicWarehouseTypes/鏉愭枡杩斿簱绫诲瀷`).then((res) => {
+request.get(`/BasicWarehouse/BasicWarehouseTypes/搴撳瓨缁勭粐|鏉愭枡杩斿簱绫诲瀷`).then((res) => {
 
   if(res.code==200){
     titleSelectJson.value=deepClone(res.data)
@@ -186,7 +186,7 @@
         getStoreWork()
 
         getStoreWorks()
-        getInventoryOrganization()
+        //getInventoryOrganization()
 
 
       }else{
@@ -201,9 +201,10 @@
 //搴撳瓨缁勭粐
 const getInventoryOrganization=()=>{
   //椤甸潰绗竴娆″姞杞�
-  request.get(`/BasicWarehouse/BasicWarehouseTypes/搴撳瓨缁勭粐`).then((res) => {
+  request.get(`/BasicWarehouse/BasicWarehouseTypes/搴撳瓨缁勭粐|鏉愭枡杩斿簱绫诲瀷`).then((res) => {
 
     if(res.code==200){
+      console.log(res.data)
       titleSelectJson.value=deepClone(res.data)
       // for(let i=0;i<titleSelectJson.value.inventoryOrganization.length;i++){
       //   this.$set(this.produceList[i], "inventoryOrganization", titleSelectJson.value["inventoryOrganization"][i].operateTypeName);
@@ -216,12 +217,17 @@
   })
 }
 
+const getWork = () => {
+  getStoreWork()
+  getStoreWorks()
+}
 
 //鍒楁煡璇�
 const getStoreWork = () => {
   filterData.value.type=value.value
   request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
     if(res.code==200){
+      console.log(res.data)
       gridOptions.columns=[]
       BasicData.value = res.data
       //娣诲姞鍒�
@@ -261,9 +267,16 @@
         materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
 
       }
-      materialStore.value.forEach(item => {
-        item['inventoryOrganization'] = titleSelectJson.value["inventoryOrganization"][0].operateTypeName
-      })
+      if(value.value==='鍘熺墖'){
+        materialStore.value.forEach(item => {
+          item['inventoryOrganization'] = titleSelectJson.value["inventoryOrganization"][0].operateTypeName
+        })
+      }else if(value.value==='杈呮枡'){
+        materialStore.value.forEach(item => {
+          item['inventoryOrganization'] = titleSelectJson.value["inventoryOrganization"][1].operateTypeName
+        })
+      }
+
 
 
       produceList = deepClone(materialStore.value)
@@ -340,7 +353,7 @@
           request.post("/MaterialInventory/saveReturningWarehouse", flowData.value).then((res) => {
             if(res.code==200){
               ElMessage.success('淇濆瓨鎴愬姛')
-              router.push({path: '/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
+              router.push({path: '/main/ingredientsStock/ReturnToStorage', query:{random:Math.random()}})
             }else{
               ElMessage.warning(res.msg)
               router.push("/login")
@@ -359,7 +372,7 @@
           request.post("/MaterialInventory/updateReturningWarehouseToExamine", flowData.value).then((res) => {
             if (res.code == 200) {
               ElMessage.success(t('basicData.msg.ReviewSuccess'))
-              router.push({path: '/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
+              router.push({path: '/main/ingredientsStock/ReturnToStorage', query:{random:Math.random()}})
             } else {
               ElMessage.warning(res.msg)
               router.push("/login")
@@ -377,7 +390,7 @@
           request.post("/MaterialInventory/updateReturningWarehouseToExamine", flowData.value).then((res) => {
             if (res.code == 200) {
               ElMessage.success(t('basicData.msg.cancelReviewSuccess'))
-              router.push({path: '/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
+              router.push({path: '/main/ingredientsStock/ReturnToStorage', query:{random:Math.random()}})
             } else {
               ElMessage.warning(res.msg)
               router.push("/login")
@@ -546,7 +559,7 @@
 
 
       <el-row>
-        <el-select v-model="value" placeholder="璇烽�夋嫨绫诲埆" @change="getStoreWork" style="margin-top: 10px;border: #181818 1px solid;">
+        <el-select v-model="value" placeholder="璇烽�夋嫨绫诲埆" @change="getWork" style="margin-top: 10px;border: #181818 1px solid;">
           <el-option
               v-for="item in options"
               :key="item.value"
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
index db4977a..641552a 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -185,4 +185,6 @@
                                     @Param("totalArea") Double totalArea,
                                     @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
 
+    Boolean updateMaterialInventoryArea(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea);
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
index f89574a..401705d 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -55,13 +55,15 @@
                 List<MaterialOutboundDetail> materialOutboundDetailLists = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId);
                 if (!materialOutboundDetailLists.isEmpty()) {
                     for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailLists) {
-                        if(materialOutboundDetail.getUseId()!=null){
+                        //杩樺師鐗╂枡搴撳瓨鏁�
+                        materialInventoryMapper.updateMaterialInventoryAvailableInt(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity());
+                        /*if(materialOutboundDetail.getUseId()!=null){
                             //杩樺師浼樺寲宸ョ▼搴撳瓨鏁�
                             materialInventoryMapper.updateMaterialInventoryAvailableOptInt(materialOutboundDetail.getUseId(), materialOutboundDetail.getOutboundQuantity());
                         }else{
                             //杩樺師鐗╂枡搴撳瓨鏁�
                             materialInventoryMapper.updateMaterialInventoryAvailableInt(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity());
-                        }
+                        }*/
 
                     }
                 }
@@ -465,7 +467,7 @@
                 if (!returningWarehouseDetailList.isEmpty()) {
                     for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailList) {
                         //淇敼鐗╂枡搴撳瓨鏁伴噺
-                        materialInventoryMapper.updateMaterialInventoryAvailableInt(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
+                        materialInventoryMapper.updateMaterialInventoryInventoryInt(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
                     }
                 }
                 materialInventoryMapper.updateReturningWarehouseToExamine(returningId,type,reviewed);
@@ -474,7 +476,7 @@
                 if (!returningWarehouseDetailList.isEmpty()) {
                     for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailList) {
                         //淇敼鐗╂枡搴撳瓨鏁伴噺
-                        materialInventoryMapper.updateMaterialInventoryAvailableOut(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
+                        materialInventoryMapper.updateMaterialInventoryInventoryOut(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
                     }
                 }
                 materialInventoryMapper.updateReturningWarehouseCounterExamination(returningId,type,reviewed);
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);
             }
diff --git a/north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml b/north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml
index 2d85411..de1942f 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml
@@ -17,7 +17,7 @@
     </select>
 
     <select id="getBasicWarehouse" >
-        select operate_type from mm.basic_warehouse_type where type=#{type};
+        select operate_type from mm.basic_warehouse_type where type regexp #{type};
     </select>
 
 
diff --git a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
index 611e82d..ba35622 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -678,25 +678,25 @@
 
     <update id="updateMaterialInventoryInventoryOut">
         update mm.material_inventory
-        set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0)
+        set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0),total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryInventoryInt">
         update mm.material_inventory
-        set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity}
+        set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryAvailableInventoryOut">
         update mm.material_inventory
-        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity}
+        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryAvailableInventoryInt">
         update mm.material_inventory
-        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity}
+        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
@@ -729,7 +729,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturning" >
-        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
                                          total_area=total_area+#{totalArea}
        where  material_code=#{materialCode} and
                 date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
@@ -738,7 +738,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturningNull" >
-        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
                                          total_area=total_area+#{totalArea}
         where  material_code=#{materialCode} and
             date_of_manufacture is null
@@ -751,5 +751,11 @@
         where  returning_id=#{number} and returning_number=#{returningWarehouseNumber}
     </update>
 
+    <update id="updateMaterialInventoryArea" >
+        update mm.material_inventory set single_piece_area=#{singlePieceArea},
+                                         total_area=inventory_quantity*#{singlePieceArea}
+        where  material_code=#{materialCode}
+    </update>
+
 
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml b/north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml
index 2d85411..de1942f 100644
--- a/north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml
+++ b/north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml
@@ -17,7 +17,7 @@
     </select>
 
     <select id="getBasicWarehouse" >
-        select operate_type from mm.basic_warehouse_type where type=#{type};
+        select operate_type from mm.basic_warehouse_type where type regexp #{type};
     </select>
 
 
diff --git a/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml b/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
index 611e82d..ba35622 100644
--- a/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
@@ -678,25 +678,25 @@
 
     <update id="updateMaterialInventoryInventoryOut">
         update mm.material_inventory
-        set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0)
+        set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0),total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryInventoryInt">
         update mm.material_inventory
-        set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity}
+        set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryAvailableInventoryOut">
         update mm.material_inventory
-        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity}
+        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
     <update id="updateMaterialInventoryAvailableInventoryInt">
         update mm.material_inventory
-        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity}
+        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity},total_area=inventory_quantity*single_piece_area
         where id=#{inventoryId}
     </update>
 
@@ -729,7 +729,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturning" >
-        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
                                          total_area=total_area+#{totalArea}
        where  material_code=#{materialCode} and
                 date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
@@ -738,7 +738,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturningNull" >
-        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
                                          total_area=total_area+#{totalArea}
         where  material_code=#{materialCode} and
             date_of_manufacture is null
@@ -751,5 +751,11 @@
         where  returning_id=#{number} and returning_number=#{returningWarehouseNumber}
     </update>
 
+    <update id="updateMaterialInventoryArea" >
+        update mm.material_inventory set single_piece_area=#{singlePieceArea},
+                                         total_area=inventory_quantity*#{singlePieceArea}
+        where  material_code=#{materialCode}
+    </update>
+
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0