From 93b80ffb7f7ffc02bc414271b8ebeac82be6bcb9 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期一, 11 十一月 2024 16:29:00 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/northglass-erp/src/lang/en.js                                                |    3 
 north-glass-erp/northglass-erp/src/stores/sd/companySet/金华天成.js                              |    2 
 north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java |   14 +-
 north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue       |   16 ++-
 north-glass-erp/northglass-erp/src/lang/zh.js                                                |    4 
 north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java                  |    2 
 north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java                        |    3 
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml                                    |    4 
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue             |   29 +++++
 north-glass-erp/northglass-erp/src/lang/ru.js                                                |    3 
 north-glass-erp/northglass-erp/src/views/mm/ingredientStock/ReturnToStorage.vue              |   26 +++++
 north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialOutbound.vue             |    6 +
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java       |   65 +++++++++++-
 north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue                        |   60 ++++++------
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml                           |   23 +++-
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java         |    8 +
 north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue              |    2 
 north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java                |    2 
 18 files changed, 207 insertions(+), 65 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/lang/en.js b/north-glass-erp/northglass-erp/src/lang/en.js
index fe1a68e..dc71d0d 100644
--- a/north-glass-erp/northglass-erp/src/lang/en.js
+++ b/north-glass-erp/northglass-erp/src/lang/en.js
@@ -463,6 +463,8 @@
 
         mergeState:'Merge State',
         merge:'Merge',
+        printQuantity:'Print Quantity',
+        printWarn1:'The print quantity cannot be greater than the order quantity'
     },
     reportingWorks:{
         page:{
@@ -569,6 +571,7 @@
         pleaseNumber7:'The quantity cannot be greater than the quantity of the previous process',
         pleaseNumber8:'Please enter serial number',
         pleaseNumber9:'Correct number of completions or breakdowns',
+        pleaseNumber10:'The number of completions cannot be greater than the number of process cards',
 
     },
     productStock:{
diff --git a/north-glass-erp/northglass-erp/src/lang/ru.js b/north-glass-erp/northglass-erp/src/lang/ru.js
index e9c738d..219b04b 100644
--- a/north-glass-erp/northglass-erp/src/lang/ru.js
+++ b/north-glass-erp/northglass-erp/src/lang/ru.js
@@ -462,6 +462,8 @@
         pleaseSelectProject:'璇烽�夋嫨宸ョ▼',
         mergeState:'鍚堝苟鐘舵��',
         merge:'鍚堝苟',
+        printQuantity:'鎵撳嵃鏁�',
+        printWarn1:'鎵撳嵃鏁伴噺涓嶈兘澶т簬璁㈠崟鏁伴噺'
     },
     reportingWorks:{
         page:{
@@ -568,6 +570,7 @@
         pleaseNumber7:'*泻芯谢懈褔械褋褌胁芯 薪械 屑芯卸械褌 锌褉械胁褘褕邪褌褜 泻芯谢懈褔械褋褌胁芯 锌褉芯褑械褋褋芯胁.',
         pleaseNumber8:'袙胁械写懈褌械 褋械褉懈泄薪褘泄 薪芯屑械褉.',
         pleaseNumber9:'袩褉邪胁懈谢褜薪芯械 蟹邪胁械褉褕械薪懈械 懈 泻芯谢懈褔械褋褌胁芯 锌芯胁褉械卸写械薪薪褘褏',
+        pleaseNumber10:'瀹屽伐鏁颁笉鑳藉ぇ浜庢祦绋嬪崱鏁伴噺',
     },
     productStock:{
         page:{
diff --git a/north-glass-erp/northglass-erp/src/lang/zh.js b/north-glass-erp/northglass-erp/src/lang/zh.js
index 7c894d7..5f5fab5 100644
--- a/north-glass-erp/northglass-erp/src/lang/zh.js
+++ b/north-glass-erp/northglass-erp/src/lang/zh.js
@@ -462,7 +462,8 @@
         pleaseSelectProject:'璇烽�夋嫨宸ョ▼',
         mergeState:'鍚堝苟鐘舵��',
         merge:'鍚堝苟',
-
+        printQuantity:'鎵撳嵃鏁�',
+        printWarn1:'鎵撳嵃鏁伴噺涓嶈兘澶т簬璁㈠崟鏁伴噺'
 
     },
     reportingWorks:{
@@ -571,6 +572,7 @@
         pleaseNumber7:'鐨勬暟閲忎笉鑳藉ぇ浜庝笂宸ュ簭鏁伴噺',
         pleaseNumber8:'璇疯緭鍏ュ簭鍙�',
         pleaseNumber9:'姝g‘鐨勫畬宸ユ垨娆$牬鏁伴噺',
+        pleaseNumber10:'瀹屽伐鏁颁笉鑳藉ぇ浜庢祦绋嬪崱鏁伴噺',
     },
     productStock:{
         page:{
diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\344\271\220\345\212\250.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
similarity index 98%
rename from "north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\344\271\220\345\212\250.js"
rename to "north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
index 4591e4d..32b5e15 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\344\271\220\345\212\250.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
@@ -3,7 +3,7 @@
 export default defineStore('companyInfo', {
 
     state: () => ({
-        companyName: '閲戝崕甯備箰鍔ㄦ櫤鑳界鎶�鏈夐檺鍏徃',
+        companyName: '閲戝崕绂忓枩澶╂垚鐜荤拑鏈夐檺鍏徃',
         address:'娴欐睙鐪侀噾鍗庡競閲戜笢鍖烘浌瀹呴晣宸ヤ笟鍔熻兘鍖洪工宀╄28鍙�2鍙�',
         telephone:'189 3119 1362 璧栧巶闀�',
         fax:'',
diff --git a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialOutbound.vue b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialOutbound.vue
index c2b2298..f3c348d 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialOutbound.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialOutbound.vue
@@ -332,7 +332,11 @@
         <el-button @click="getTableRow(row,'edit')"
                    v-if="userStore.user.permissions.indexOf('materialOutbound.edit') > -1"
                    link type="primary" size="small">{{$t('basicData.edit')}}</el-button>
-<!--        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>-->
+        <el-popconfirm @confirm="getTableRow(row,'delete')"  :title="$t('searchOrder.deleteConfirm')">
+          <template #reference>
+            <el-button :disabled="row.reviewedState===1" link type="primary" size="small">{{ $t('basicData.delete') }}</el-button>
+          </template>
+        </el-popconfirm>
       </template>
 
       <template #num1_filter="{ column, $panel }">
diff --git a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/ReturnToStorage.vue b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/ReturnToStorage.vue
index 6254ed8..6254603 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/ReturnToStorage.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/ReturnToStorage.vue
@@ -24,6 +24,26 @@
       router.push({path: '/main/ingredientsStock/ReturnToStorageCreate', query: { returningId: row.returningId }})
       break
     }
+    case 'delete':{
+      let flowData = ref({
+        returningId:row.returningId,
+        userName:userStore.user.userName,
+        userId:userStore.user.userId
+      })
+      request.post("/materialInventory/deleteReturnToStorage",flowData.value).then((res) => {
+        if(res.code==200 && res.data===true){
+          ElMessage.success(t('searchOrder.msgDeleteSuccess'))
+          router.push({path:'/main/ingredientsStock/ReturnToStorage', query:{random:Math.random()}})
+        }else{
+          ElMessage.warning(t('basicData.msg.deleteSuccess'))
+        }
+      }).catch((err)=>{
+        ElMessage.error(t('basicData.msg.ServerConnectionError'))
+        router.push("/login")
+      })
+
+      return
+    }
 
   }
 }
@@ -283,7 +303,11 @@
         <el-button @click="getTableRow(row,'edit')"
                    v-if="userStore.user.permissions.indexOf('returnToStorage.edit') > -1"
                    link type="primary" size="small">{{$t('basicData.edit')}}</el-button>
-<!--        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>-->
+        <el-popconfirm @confirm="getTableRow(row,'delete')"  :title="$t('searchOrder.deleteConfirm')">
+          <template #reference>
+            <el-button :disabled="row.reviewedState===1" link type="primary" size="small">{{ $t('basicData.delete') }}</el-button>
+          </template>
+        </el-popconfirm>
       </template>
 
       <template #num1_filter="{ column, $panel }">
diff --git a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue
index c281202..8448545 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue
@@ -10,6 +10,7 @@
 import { useI18n } from 'vue-i18n'
 import {toolbarButtonClickEvent} from "@/hook/mouseMove";
 import {changeFilterEvent,filterChanged} from "@/hook"
+import {divideAuto, multiply} from "@/utils/decimal";
 
 //璇█鑾峰彇
 const { t } = useI18n()
@@ -585,22 +586,25 @@
 
 
           let  flowData = ref({
-            totalArea: selectRecords.height*selectRecords.width/100000*titleUploadData.value.inventoryQuantity,
-            singlePieceArea: selectRecords.height*selectRecords.width/100000,
+            totalArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2))*titleUploadData.value.inventoryQuantity,
+            singlePieceArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2)),
             title: titleUploadData.value,
             materialCode: selectRecords.id,
             userName:userStore.user.userName,
             userId:userStore.user.userId
 
           })
+          console.log(flowData.value)
 
           request.post("/materialInventory/saveMaterialInventory", flowData.value).then((res) => {
-            if(res.code==200){
+            console.log(res)
+            if(res.code==200 && res.data==="true"){
               ElMessage.success(t('basicData.msg.saveSuccess'))
               router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}})
-            }else{
-              ElMessage.warning(res.msg)
-              router.push("/login")
+            }else if(res.data==="false1") {
+              ElMessage.warning("搴撳瓨瀛樺湪澶氭潯")
+            }else {
+              ElMessage.warning(t('basicData.msg.ServerConnectionError'))
             }
           })
           break
diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
index 13dcfa7..ab4941e 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
@@ -308,6 +308,9 @@
       filterMethod: filterChanged, width: 100
     },
     {field: 'quantity', title: t('order.quantity'), width: 90},
+    {field: 'printQuantity', title: t('processCard.printQuantity'), width: 90,
+      editRender: {name: 'input', attrs: {placeholder: ''}},
+    },
     {field: 'total_area', title: t('order.area'), width: 90},
     {
       field: 'product_name', title: t('order.product'), width: 120,
@@ -338,7 +341,24 @@
       filterMethod: filterChanged, width: 120
     },
   ],//琛ㄥご鎸夐挳
-
+//琛ㄥ崟楠岃瘉
+  editRules: {
+    printQuantity: [
+      {
+        validator ({ row }) {
+          const regex = /^[0-9]\d*$/
+          const printQuantity =
+              (row.printQuantity === undefined || row.printQuantity===null || row.printQuantity==='') ? 0 : row.printQuantity
+           if(!regex.test(printQuantity)){
+             return new Error(t('reportingWorks.enterIntegerGreaterThanEqualTo'))
+          }
+          else if(row.quantity<printQuantity){
+            return new Error(t('processCard.printWarn1'))
+          }
+        }
+      }
+    ]
+  },
   toolbarConfig: {
     buttons: [
       {code: 'print', name: t('processCard.print'), status: 'primary'},
@@ -377,7 +397,7 @@
 })
 
 const gridEvents = {
-  toolbarButtonClick({code}) {
+  async toolbarButtonClick({code}) {
     const $grid = xGrid.value
     selectRecords = $grid.getCheckboxRecords()
     // selectRecords.forEach(obj => {
@@ -584,6 +604,11 @@
           break
         }
         case 'printTest': {
+          const errMap = await $grid.validate(true)
+          if (errMap) {
+            ElMessage.error(t('basicData.msg.checkoutLose'))
+            return
+          }
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
             return
diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue b/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
index 163f213..67dcab1 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
@@ -20,7 +20,7 @@
 })
 
 //宸ュ簭
-const value = ref(t('machine.edgeGrinding'))
+const value = ref()
 
 //鏍规嵁浠ヤ笅瀛楁姹囨�绘煡璇�
 const stateValue = ref('')
@@ -157,7 +157,7 @@
       total.dataTotal = res.data.total.total * 1
       total.pageTotal = res.data.total.pageTotal
       pageTotal.value = res.data.total
-      xGrid.value.loadData(res.data.data)
+      xGrid.value.reloadData(res.data.data)
       gridOptions.loading = false
     } else {
       ElMessage.warning(res.msg)
@@ -181,41 +181,41 @@
 }
 
 function filterChanged(column){
-  //gridOptions.loading=true
+  gridOptions.loading = true
   //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖�
-  let value = column.datas[0]!=undefined?column.datas[0]:''
+  let value = column.datas[0] != undefined ? column.datas[0] : ''
   value = value.trim()
   //鍒ゆ柇鏄惁瀛樺湪澶栭敭
-  if (column.property.indexOf('.')>-1){
-    const  columnArr = column.property.split('.')
+  if (column.property.indexOf('.') > -1) {
+    const columnArr = column.property.split('.')
     filterData.value[columnArr[0]] = {
-      [columnArr[1]]:value
+      [columnArr[1]]: value
     }
-  }else{
+  } else {
     filterData.value[column.property] = value
   }
-  gridOptions.loading = true
 
-  let startTime = form.date1[0]
-  let endTime = form.date1[1]
-  let optionVal=stateValue.value
-  if (optionVal == '') {
-    optionVal = null
-  }
-  request.post(`/report/workInProgress/1/${total.pageSize}/${inputVal}/${inputProject}/${selectProcesses}/${optionVal}`, filterData.value).then((res) => {
-
-    if (res.code == 200) {
-      total.dataTotal = res.data.total.total*1
-      total.pageTotal=parseInt(res.data.total)
-      pageNum.value=1
-      produceList = deepClone(res.data.data)
-      xGrid.value.reloadData(produceList)
-      gridOptions.loading=false
-    } else {
-      ElMessage.warning(res.msg)
-    }
-    //handleUpdateData(produceList)
-  })
+  getWorkOrder()
+  // let selectProcesses = value.value
+  // let optionVal=stateValue.value
+  // if (optionVal == '') {
+  //   optionVal = null
+  // }
+  // request.post(`/report/workInProgress/1/${total.pageSize}/${inputVal}/${inputProject}/${selectProcesses}/${optionVal}`, filterData.value).then((res) => {
+  //
+  //   if (res.code == 200) {
+  //     total.dataTotal = res.data.total.total*1
+  //     total.pageTotal=parseInt(res.data.total)
+  //     pageNum.value=1
+  //     produceList = deepClone(res.data.data)
+  //     console.log(res.data.data)
+  //     xGrid.value.reloadData(produceList)
+  //     gridOptions.loading=false
+  //   } else {
+  //     ElMessage.warning(res.msg)
+  //   }
+  //   //handleUpdateData(produceList)
+  // })
 
 }
 
@@ -436,7 +436,7 @@
           />
         </el-select>
         &nbsp;
-        <el-select v-model="value" clearable default-value="default_city" style="width: 120px">
+        <el-select v-model="value" clearable :placeholder="$t('reportingWorks.selectProcess')" default-value="default_city" style="width: 120px">
           <el-option
               v-for="item in titleSelectJson['processType']"
               :key="item.id"
diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
index 2e7d05b..9caaeb7 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -356,7 +356,7 @@
           }else if((row.completedQuantity*1+brokenNum*1)>row.quantity*1){
             return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`))
           }else  if(row.quantity_card<row.completedQuantity){
-            return new Error("瀹屽伐鏁颁笉鑳藉ぇ浜庢祦绋嬪崱鏁伴噺")
+            return new Error(t('reportingWorks.pleaseNumber10'))
           }
           const completedNum =
               (row.completedQuantity === undefined || row.completedQuantity===null || row.completedQuantity==='') ? 0 : row.completedQuantity
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java b/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
index 21a9f8f..c8d8951 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -42,12 +42,7 @@
     @SaCheckPermission("selectIngredientsStock.add")
     @PostMapping("/saveMaterialInventory")
     public Result saveMaterialInventory( @RequestBody Map<String,Object>  object){
-        if(materialInventoryService.saveMaterialInventory(object)){
-            return Result.seccess();
-        }else {
-            throw new ServiceException(Constants.Code_500,"淇濆瓨澶辫触");
-
-        }
+        return Result.seccess(materialInventoryService.saveMaterialInventory(object));
     }
 
     @ApiOperation("鐗╂枡搴撳瓨鍔犳椂闂存煡璇㈡帴鍙�")
@@ -121,6 +116,13 @@
         return Result.seccess(materialInventoryService.getSelectReturningWarehouse(pageNum,pageSize,returningWarehouseDetail));
     }
 
+    @ApiOperation("鐗╂枡杩斿簱鍒犻櫎鎺ュ彛")
+    @SaCheckPermission("returnToStorageCreate.delete")
+    @PostMapping("/deleteReturnToStorage")
+    public Result deleteReturnToStorage( @RequestBody Map<String,Object>  object){
+        return Result.seccess(materialInventoryService.deleteReturnToStorage(object));
+    }
+
     @ApiOperation("鐗╂枡杩斿簱瀹℃牳鎺ュ彛")
     @SaCheckPermission("returnToStorageCreate.review")
     @PostMapping("/updateReturningWarehouseToExamine")
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java b/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
index 681a449..a8ab5bc 100644
--- a/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/pp/FlowCard.java
@@ -66,6 +66,9 @@
     private LocalDate updateTime;
 
     //鏌ヨ鐢�
+    //鏍囩鎵撳嵃鏁伴噺
+    @TableField(select = false,exist = false)
+    private Integer printQuantity;
     //鎶ュ伐缂栧彿
     @TableField(select = false,exist = false)
     private String reportingWorkId;
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 fccaa51..9c41b32 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
@@ -56,6 +56,8 @@
 
     Boolean deleteMaterialOutbound(@Param("materialOutboundId") String materialOutboundId);
 
+    Boolean deleteMaterialLog(@Param("materialOutboundId") String materialOutboundId);
+
     Integer getMaximum(@Param("type") String type);
 
     Integer getMaximums(@Param("type") String type);
@@ -119,6 +121,8 @@
 
     Boolean deleteReturningWarehouseDetail(@Param("returningId") String returningId);
 
+    Boolean deleteReturningWarehouse(@Param("returningId") String returningId);
+
     List<MaterialOutbound> getSelectMaterialOutboundDate(@Param("offset") Integer offset,
                                                            @Param("pageSize") Integer pageSize,String startDate, String endDate,
                                                            @Param("materialOutbound") MaterialOutbound materialOutbound);
@@ -172,6 +176,10 @@
                                     @Param("totalArea") Double totalArea,
                                     @Param("materialInventory") MaterialInventory materialInventory);
 
+    Boolean updateMaterialInventoryNull(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
+                                    @Param("totalArea") Double totalArea,
+                                    @Param("materialInventory") MaterialInventory materialInventory);
+
     Boolean insertMaterialInventory(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
                                     @Param("totalArea") Double totalArea,
                                     @Param("materialInventory") MaterialInventory materialInventory);
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
index ef65afa..8aec501 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -163,7 +163,7 @@
 
     List<Map<String, String>> selectPrintDetailsMp1(String orderId);
 
-    List<Map<String, Object>> getPrintCustomDataDetails(String processId, Integer orderNumber);
+    List<Map<String, Object>> getPrintCustomDataDetails(String processId, Integer orderNumber, Integer printQuantity);
 
     List<Map<String, Object>> getPrintCustomDataProjectNo(String projectNo);
 
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 a003617..41cb646 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
@@ -164,8 +164,8 @@
 
     }
 
-    public Boolean saveMaterialInventory(Map<String,Object> object) {
-        boolean saveState = true;
+    public String saveMaterialInventory(Map<String,Object> object) {
+        String saveState = "true";
         //璁剧疆鍥炴粴鐐�
         Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
         try {
@@ -188,15 +188,27 @@
 
             MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class);
 
-            //鏌ヨ鐗╂枡鏄惁瀛樺湪
-            Integer MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture());
 
-            if(MaterialInventoryCount>0){
-                materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
+            //鏌ヨ鐗╂枡鏄惁瀛樺湪
+            Integer MaterialInventoryCount=0;
+            if (materialInventory.getDateOfManufacture()!=null){
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture());
+            }else{
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode);
+            }
+
+            if(MaterialInventoryCount==1){
+                if (materialInventory.getDateOfManufacture()!=null){
+                    materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
+                }else{
+                    materialInventoryMapper.updateMaterialInventoryNull(materialCode,singlePieceArea,totalArea,materialInventory);
+                }
                 log.setFunction("saveMaterialInventory淇敼");
-            }else {
+            }else if(MaterialInventoryCount==0) {
                 materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
                 log.setFunction("saveMaterialInventory鏂板");
+            }else {
+                return "false1";
             }
 
             String json="";
@@ -227,7 +239,7 @@
             sysError.setError(e+Arrays.toString(e.getStackTrace()));
             sysError.setFunc("saveMaterialInventory");
             sysErrorService.insert(sysError);
-            saveState = false;
+            saveState = "false";
 
         }
         return saveState;
@@ -317,6 +329,7 @@
             if(materialOutboundId!=null){
                 materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                 materialInventoryMapper.deleteMaterialOutbound(materialOutboundId);
+                materialInventoryMapper.deleteMaterialLog(materialOutboundId);
             }
             Log log = new Log();
             log.setContent(object.toString());
@@ -340,6 +353,42 @@
 
     }
 
+    public Boolean deleteReturnToStorage(Map<String,Object> object) {
+        boolean saveState = true;
+        //璁剧疆鍥炴粴鐐�
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        try {
+            String returningId = "";
+            if (object.get("returningId") != null) {
+                returningId = object.get("returningId").toString();
+            }
+            if(returningId!=null){
+                materialInventoryMapper.deleteReturningWarehouseDetail(returningId);
+                materialInventoryMapper.deleteReturningWarehouse(returningId);
+                materialInventoryMapper.deleteMaterialLog(returningId);
+            }
+            Log log = new Log();
+            log.setContent(object.toString());
+            log.setOperatorId(object.get("userId").toString());
+            log.setOperator(object.get("userName").toString());
+            log.setFunction("deleteReturnToStorage:"+returningId);
+            logService.saveLog(log);
+
+
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+            //灏嗗紓甯镐紶鍏ユ暟鎹簱
+            SysError sysError = new SysError();
+            sysError.setError(e+Arrays.toString(e.getStackTrace()));
+            sysError.setFunc("deleteMaterialOutbound");
+            sysErrorService.insert(sysError);
+            saveState = false;
+
+        }
+        return saveState;
+
+    }
+
     public Map<String, Object> getSelectMaterialOutboundDate(Integer pageNum, Integer pageSize, List<String> selectDate, MaterialOutbound materialOutbound) {
         Integer offset = (pageNum - 1) * pageSize;
         String endDate = LocalDate.now().toString();
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
index 740eb49..22dcb73 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -667,7 +667,7 @@
                         continue;
                     }
                     Map<String, Object> itemmap = new HashMap<>();
-                    itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(),flowCard.getOrderNumber()));
+                    itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getPrintQuantity()));
                     list.add(itemmap);
 
                     // 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
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 675f6c9..1eef82d 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -549,8 +549,16 @@
         delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
     </delete>
 
+    <delete id="deleteMaterialLog" >
+        delete from mm.material_log where operation_order_number=#{materialOutboundId}
+    </delete>
+
     <delete id="deleteReturningWarehouseDetail" >
         delete from mm.returning_warehouse_detail where returning_id=#{returningId}
+    </delete>
+
+    <delete id="deleteReturningWarehouse" >
+        delete from mm.returning_warehouse where returning_id=#{returningId}
     </delete>
 
     <select id="getMaximum" >
@@ -747,13 +755,19 @@
     <update id="updateMaterialInventory" >
         update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                          available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
-                                         total_area=total_area+#{totalArea}
+                                         total_area=single_piece_area*inventory_quantity
                                      where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
     </update>
 
+    <update id="updateMaterialInventoryNull" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
+                                         available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
+                                         total_area=single_piece_area*inventory_quantity
+        where  material_code=#{materialCode}
+    </update>
+
     <update id="updateMaterialInventoryReturning" >
-        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
-                                         total_area=total_area+#{totalArea}
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
        where  material_code=#{materialCode} and
                 date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
 
@@ -761,8 +775,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturningNull" >
-        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
-                                         total_area=total_area+#{totalArea}
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
         where  material_code=#{materialCode} and
             date_of_manufacture is null
 
diff --git a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
index 1a6aba7..b413693 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -2018,6 +2018,7 @@
                /*ogd.technology_number,*/
                ogd.glass_address,
                (fc.quantity)                                                          as quantity,
+               (fc.quantity)                                                          as printQuantity,
                round((ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
                od.product_name,
                ogd.glass_child,
@@ -2048,6 +2049,7 @@
                ogd.technology_number,
                ogd.glass_address,
                (fc.quantity)                                                          as quantity,
+               (fc.quantity)                                                          as printQuantity,
                round((ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
                od.product_name,
                ogd.glass_child,
@@ -2089,7 +2091,7 @@
                od.processing_note                                    as processingNote,
                width,
                height,
-               fc.quantity,
+               #{printQuantity}                                      as quantity,
                od.order_number                                       as orderNumber,
                fc.technology_number                                  as technologyNumber,
                od.building_number                                    as buildingNumber,

--
Gitblit v1.8.0