From d3475019350136c3946afcb3a831a5444e97bc17 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 29 三月 2024 09:59:02 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue         |   81 ++
 north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java |   43 +
 north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue                      |    2 
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue          |  332 +++++---
 north-glass-erp/target/classes/mapper/mm/MaterialStore.xml                                   |    4 
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java             |    2 
 north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java              |   28 
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue   |   14 
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue           |    3 
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue    |  567 ++++++++++++++--
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java       |  227 ++++++
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml                           |  312 ++++++++
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java         |   75 ++
 north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml                               |    4 
 north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml                               |  312 ++++++++
 north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java        |   31 
 16 files changed, 1,742 insertions(+), 295 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue
index abe457d..1076662 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue
@@ -76,7 +76,6 @@
 let filterData = ref({
 
 
-
 })
 
 let BasicData = ref([])
@@ -486,7 +485,7 @@
       <el-col  :span="2"><el-text>閿�鍞崟鍙�:</el-text></el-col>
       <el-col  :span="3"><el-input v-model="titleUploadData.orderId" /></el-col>
       <el-col  :span="2"><el-text>浠撶鍛�:</el-text></el-col>
-      <el-col  :span="3"><el-input v-model="titleUploadData.warehouseManager" /></el-col>
+      <el-col  :span="3"><el-input v-model="titleUploadData.warehouseManager" :readonly="true" /></el-col>
 
     </el-row>
   </div>
diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
index 7a62057..5fb42f1 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
@@ -92,6 +92,77 @@
 })
 
 
+
+/*浣跨敤绛涢�夛紝鍚庣鑾峰彇鏁版嵁*/
+const changeFilterEvent = (event, option, $panel,) => {
+  // 鎵嬪姩瑙﹀彂绛涢��
+  $panel.changeOption(event, !!option.data, option)
+}
+function filterChanged(column){
+  gridOptions.loading=true
+  //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖�
+  let value = column.datas[0]!=undefined?column.datas[0]:''
+  value = value.trim()
+  //鍒ゆ柇鏄惁瀛樺湪澶栭敭
+  if (column.property.indexOf('.')>-1){
+    const  columnArr = column.property.split('.')
+    filterData.value[columnArr[0]] = {
+      [columnArr[1]]:value
+    }
+  }else{
+    filterData.value[column.property] = value
+  }
+  request.post(`/MaterialInventory/getSelectMaterialOutboundDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+
+    if(res.code==200){
+      total.dataTotal = res.data.total.total*1
+      total.pageTotal= res.data.total.pageTotal
+
+      selectDate.value = res.data.selectDate
+      pageNum.value=1
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+
+const selectOrderList = ()=>{
+  request.post(`/MaterialInventory/getSelectMaterialOutboundDate/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+    if(res.code==200){
+      selectDate.value = res.data.selectDate
+
+      if (res.data.total!=null){
+        total.dataTotal = res.data.total.total*1
+        total.pageTotal= res.data.total.pageTotal
+      }
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+const changeDate =  ()=>{
+  selectOrderList()
+}
+
+//椤佃剼璺宠浆
+const handlePageChange = ({ currentPage, pageSize }) => {
+  total.pageTotal = pageSize
+  pageNum.value=currentPage
+
+  selectOrderList()
+}
+
+
 //瀛愮粍浠舵帴鏀跺弬鏁�
 const  xGrid = ref();
 const gridOptions = reactive({
@@ -127,14 +198,14 @@
     {title: '鎿嶄綔', width: '110', slots: { default: 'button_slot' },fixed:"left"},
     { type: 'seq',fixed:"left", title: '鑷簭', width: '80' },
     {field: 'reviewedState',title: '瀹℃牳', width: 50, slots: { default: 'state' },},
-    {field: 'materialOutboundId', width:'150', title: '鍑哄簱鍗曞彿', sortable: true},
+    {field: 'materialOutboundId', width:'150', title: '鍑哄簱鍗曞彿', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
     {field: 'materialRequisitionPersonnel', width: '150',title: '棰嗘枡鍛�', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
     {field: 'materialRequisitionTeam', width: '120',title: '棰嗘枡鐝粍', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'orderId', width:'150', title: '閿�鍞崟鍙�', sortable: true},
-    {field: 'outboundType', width: '100',title: '鍑哄簱绫诲瀷', sortable: true},
-    {field: 'warehouseManager',width: '100', title: '浠撶鍛�', sortable: true,showOverflow:"ellipsis"},
+    {field: 'orderId', width:'150', title: '閿�鍞崟鍙�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'outboundType', width: '100',title: '鍑哄簱绫诲瀷', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'warehouseManager',width: '100', title: '浠撶鍛�', sortable: true,showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
     {field: 'materialRequisitionDate', width: '80',title: '棰嗘枡鏃ユ湡', sortable: true},
-    {field: 'reviewed',width: '100', title: '瀹℃牳鍛�', sortable: true},
+    {field: 'reviewed',width: '100', title: '瀹℃牳鍛�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
     {field: 'reviewedTime', width: '100',title: '瀹℃牳鏃堕棿', sortable: true},
     {field: 'createTime',width: '100', title: '鍒涘缓鏃堕棿', sortable: true},
   ],//琛ㄥご鎸夐挳
diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue
index 3d8a6f8..cfae732 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue
@@ -5,25 +5,173 @@
 
 import {reactive, ref} from "vue";
 import {useRouter} from  'vue-router'
-let router=useRouter()
+import request from "@/utils/request";
+import deepClone from "@/utils/deepClone";
+import useUserInfoStore from "@/stores/userInfo";
+import {ElMessage} from "element-plus";
+import {Search} from "@element-plus/icons-vue";
+import { useI18n } from 'vue-i18n'
+import {toolbarButtonClickEvent} from "@/hook/mouseMove";
+
+//璇█鑾峰彇
+const { t } = useI18n()
+
+const router = useRouter()
+let produceList = ref([])
 const getTableRow = (row,type) =>{
   switch (type) {
     case 'edit' :{
-      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
-      router.push({path: '/main/ingredientsStock/CreateOutbound', query: { id: row.id }})
+      router.push({path: '/main/ingredientsStock/ReturnToStorageCreate', query: { returningId: row.returningId }})
       break
     }
-    case 'delete':{
-      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
-      break
+
+  }
+}
+
+const hasDecimal=(value)=>{
+  const regex=/\./ // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value) //杩斿洖true/false
+}
+
+const hasDecimalhtml=(item,row)=>{
+  let aa=item.split('.').length
+  if (aa===2){
+    return row[item.split('.')[0]][item.split('.')[1]]
+  }else if(aa===3){
+    return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]]
+  }
+
+
+}
+
+let pageNum=ref(1)
+let total = reactive({
+  pageTotal : 0,
+  dataTotal : 0,
+  pageSize : 4
+})
+
+let filterData = ref({
+
+})
+
+let selectDate = ref(["",""])
+
+
+request.post(`/MaterialInventory/getSelectReturningWarehouseDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+
+  if(res.code==200){
+    console.log(res.data)
+    total.dataTotal = res.data.total.total*1
+    total.pageTotal= res.data.total.pageTotal
+    pageNum.value=1
+    selectDate.value = res.data.selectDate
+    produceList = deepClone(res.data.data)
+    xGrid.value.loadData(produceList)
+    gridOptions.loading=false
+  }else{
+    ElMessage.warning(res.msg)
+    router.push("/login")
+  }
+})
+
+
+
+
+/*浣跨敤绛涢�夛紝鍚庣鑾峰彇鏁版嵁*/
+const changeFilterEvent = (event, option, $panel,) => {
+  // 鎵嬪姩瑙﹀彂绛涢��
+  $panel.changeOption(event, !!option.data, option)
+}
+function filterChanged(column){
+  gridOptions.loading=true
+  //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖�
+  let value = column.datas[0]!=undefined?column.datas[0]:''
+  value = value.trim()
+  //鍒ゆ柇鏄惁瀛樺湪澶栭敭
+  if (column.property.indexOf('.')>-1){
+    const  columnArr = column.property.split('.')
+    filterData.value[columnArr[0]] = {
+      [columnArr[1]]:value
+    }
+  }else{
+    filterData.value[column.property] = value
+  }
+  request.post(`/MaterialInventory/getSelectReturningWarehouseDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+
+    if(res.code==200){
+      total.dataTotal = res.data.total.total*1
+      total.pageTotal= res.data.total.pageTotal
+
+      selectDate.value = res.data.selectDate
+      pageNum.value=1
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+
+const selectOrderList = ()=>{
+  request.post(`/MaterialInventory/getSelectReturningWarehouseDate/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+    if(res.code==200){
+      selectDate.value = res.data.selectDate
+
+
+      if (res.data.total!=null){
+        total.dataTotal = res.data.total.total*1
+        total.pageTotal= res.data.total.pageTotal
+      }
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+const changeDate =  ()=>{
+  selectOrderList()
+}
+
+//椤佃剼璺宠浆
+const handlePageChange = ({ currentPage, pageSize }) => {
+
+  total.pageTotal = pageSize
+  pageNum.value=currentPage
+
+  selectOrderList()
+}
+
+
+const gridEvents = {
+  async toolbarButtonClick({code}) {
+    const $grid = xGrid.value
+    if ($grid) {
+      switch (code) {
+        case 'add': {
+
+          router.push({path: '/main/ingredientsStock/ReturnToStorageCreate'})
+
+          break
+        }
+
+      }
     }
   }
+
 }
 
 
 
 //瀛愮粍浠舵帴鏀跺弬鏁�
-
+const  xGrid = ref();
 const gridOptions = reactive({
   border:  "full",//琛ㄦ牸鍔犺竟妗�
   keepSource: true,//淇濇寔婧愭暟鎹�
@@ -53,105 +201,32 @@
     showStatus: true
   },//琛ㄥご鍙傛暟
   columns:[
-    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
+    {type:'expand',fixed:"left",slots: { content:'content' },width: '60'},
     {title: '鎿嶄綔', width: '110', slots: { default: 'button_slot' },fixed:"left"},
-    // { type: 'checkbox',fixed:"left", title: '閫夋嫨', width: '80' },
     { type: 'seq',fixed:"left", title: '鑷簭', width: '80' },
-
-    {title: '瀹℃牳', width: 50, slots: { default: 'state' },},
-
-    {field: 'ReturnNum', width:'150', title: '杩斿簱缂栧彿', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
-    {field: 'SalesNum', width: '150',title: '閿�鍞崟鍙�', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'ReturnType', width: '120',title: '杩斿簱绫诲瀷', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'DocumentType',width: '100', title: '鍗曟嵁绫诲瀷', sortable: true},
-    {field: 'ProjectName', width:'150', title: '椤圭洰鍚嶇О', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
-    {field: 'MaterialCode', width: '100',title: '鐗╂枡缂栫爜', sortable: true},
-    {field: 'MaterialName',width: '100', title: '鐗╂枡鍚嶇О', sortable: true,showOverflow:"ellipsis"},
-    {field: 'Width', width: '80',title: '瀹藉害', sortable: true},
-    {field: 'Height',width: '100', title: '楂樺害', sortable: true},
-    {field: 'Thickness', width: '100',title: '鍘氬害', sortable: true},
-    {field: 'OriginPlace',width: '100', title: '浜у湴', sortable: true},
-    {field: 'SaveQuantity', width: '100',title: '鑺傜害鏁伴噺', sortable: true},
-    {field: 'Type', width: '100',title: '绫诲瀷', sortable: true},
-    {field: 'Supplier',width: '140', title: '棰嗘枡鍛�/渚涘簲鍟�', sortable: true},
-    {field: 'ClassGroup',width: '100', title: '鐝粍/渚涘簲鍟�', sortable: true},
-    {field: 'WarehouseKeeper',width: '100', title: '浠撶鍛�', sortable: true},
-    {field: 'Remark',width: '100', title: '澶囨敞', sortable: true},
-    {field: 'MakingData',width: '100', title: '鍒跺崟鏃ユ湡', sortable: true},
+    {field: 'reviewedState',title: '瀹℃牳', width: 50, slots: { default: 'state' },},
+    {field: 'returningId', width:'150', title: '杩斿簱鍗曞彿', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'materialRequisitionPersonnel', width: '150',title: '棰嗘枡鍛�/渚涘簲鍟�', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'materialRequisitionTeam', width: '120',title: '棰嗘枡鐝粍/渚涘簲鍟�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'orderId', width:'150', title: '閿�鍞崟鍙�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'project', width:'150', title: '椤圭洰鍚嶇О', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'batch', width:'150', title: '鎵规', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'returningType', width: '100',title: '杩斿簱绫诲瀷', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'warehouseManager',width: '100', title: '浠撶鍛�', sortable: true,showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'reviewed',width: '100', title: '瀹℃牳鍛�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'reviewedTime', width: '100',title: '瀹℃牳鏃堕棿', sortable: true},
+    {field: 'createTime',width: '100', title: '鍒跺崟鏃ユ湡', sortable: true},
   ],//琛ㄥご鎸夐挳
   toolbarConfig: {
-    buttons: [{
-      code:'add','name': '杩斿簱鏂板',status:'primary'
-    }],
-    import: false,
+    buttons: [
+      {'code': 'add', 'name': '杩斿簱鏂板',status: 'primary'},
+    ],
+    /*import: false,
     export: true,
-    print: true,
+    print: true,*/
     zoom: true,
     custom: true
   },
-  data:  [
-    {
-      "ReturnNum": "FK24010811",
-      "SalesNum": "杩愯緭鏉愭枡鐮存崯",
-      "ReturnType": "閲囪喘鐮存崯",
-      "DocumentType": "瀹℃牳",
-      "ProjectName": "",
-      "MaterialCode": "80010128003308035401530000",
-      "MaterialName": "鐧界幓-3鍘�-鍒堕暅-浼樿川鍔犲伐绾�",
-      "Width": '3540.00',
-      "Height": "1530.00",
-      "Thickness": "3.00",
-      "OriginPlace": "骞胯タ鍗楀畞",
-      "SaveQuantity": "1.000",
-      "Type": "鐩存帴杩斿簱",
-      "Supplier": "骞胯タ鍗楀畞浼忔硶",
-      "ClassGroup": "鏇叉儬闇�",
-      "WarehouseKeeper": "鏇叉儬闇�",
-      "Remark": "2401060345",
-      "MakingData": "2024-01-08 08锛�41锛�09",
-    },
-    {
-      "ReturnNum": "FK24010811",
-      "SalesNum": "杩愯緭鏉愭枡鐮存崯",
-      "ReturnType": "閲囪喘鐮存崯",
-      "DocumentType": "瀹℃牳",
-      "ProjectName": "",
-      "MaterialCode": "80010128003308035401530000",
-      "MaterialName": "鐧界幓-3鍘�-鍒堕暅-浼樿川鍔犲伐绾�",
-      "Width": '3540.00',
-      "Height": "1530.00",
-      "Thickness": "3.00",
-      "OriginPlace": "骞胯タ鍗楀畞",
-      "SaveQuantity": "1.000",
-      "Type": "鐩存帴杩斿簱",
-      "Supplier": "骞胯タ鍗楀畞浼忔硶",
-      "ClassGroup": "鏇叉儬闇�",
-      "WarehouseKeeper": "鏇叉儬闇�",
-      "Remark": "2401060345",
-      "MakingData": "2024-01-08 08锛�41锛�09",
-    },
-    {
-      "ReturnNum": "FK24010811",
-      "SalesNum": "杩愯緭鏉愭枡鐮存崯",
-      "ReturnType": "閲囪喘鐮存崯",
-      "DocumentType": "瀹℃牳",
-      "ProjectName": "",
-      "MaterialCode": "80010128003308035401530000",
-      "MaterialName": "鐧界幓-3鍘�-鍒堕暅-浼樿川鍔犲伐绾�",
-      "Width": '3540.00',
-      "Height": "1530.00",
-      "Thickness": "3.00",
-      "OriginPlace": "骞胯タ鍗楀畞",
-      "SaveQuantity": "1.000",
-      "Type": "鐩存帴杩斿簱",
-      "Supplier": "骞胯タ鍗楀畞浼忔硶",
-      "ClassGroup": "鏇叉儬闇�",
-      "WarehouseKeeper": "鏇叉儬闇�",
-      "Remark": "2401060345",
-      "MakingData": "2024-01-08 08锛�41锛�09",
-    },
-
-  ],//table body瀹為檯鏁版嵁
   footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
     return[
       columns.map((column, columnIndex) => {
@@ -168,44 +243,23 @@
 
 })
 
-const  xGrid = ref();
-const gridEvents = {
-  toolbarButtonClick({ code }) {
-    const $grid = xGrid.value
-    if($grid){
-      switch (code){
-        case 'add':{
-          /*VXETable.modal.confirm('鐐瑰嚮浜嗗簱瀛樿皟鎷�');*/
-          router.push({path: '/main/ingredientsStock/ReturnToStorageCreate'});
-          return;
-          break
-        }
-      }
-    }
-  }
-}
 
 
 </script>
 
 <template>
   <div class="main-div-customer">
-    <el-row gutter="10" >
-      <el-col :span="2.5">
-        <div class="label-text">浼樺寲鏃ユ湡</div>
-      </el-col>
-      <el-col :span="4">
-        <el-date-picker
-            type="daterange"
-            start-placeholder="寮�濮嬫椂闂�"
-            end-placeholder="缁撴潫鏃堕棿"
-            style="width: 200px;"
-        />
-      </el-col>
-      <el-col span="4">
-        <el-button id="searchButton" type="primary" :icon="Search">鏌ヨ</el-button>
-      </el-col>
-    </el-row>
+    <el-date-picker
+        v-model="selectDate"
+        type="daterange"
+        start-placeholder="寮�濮嬫椂闂�"
+        end-placeholder="缁撴潫鏃堕棿"
+        format="YYYY-MM-DD"
+        value-format="YYYY-MM-DD"
+
+    />
+    <el-button @click="changeDate" style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">鏌ヨ</el-button>
+
     <vxe-grid
         max-height="100%"
         @filter-change="filterChanged"
@@ -239,8 +293,22 @@
         </div>
       </template>
 
-      <template #state="{ row}">
-        <el-checkbox checked/>
+      <template #state="{ row,column}">
+        <el-checkbox @click.native.prevent :checked="row[column.field]===1"/>
+      </template>
+
+
+      <template #pager>
+        <!--浣跨敤 pager 鎻掓Ы-->
+        <vxe-pager
+            @page-change="handlePageChange"
+            :layouts="[  'PrevPage', 'Jump','PageCount', 'NextPage',  'Total']"
+            v-model:current-page="pageNum"
+            v-model:page-size="total.pageSize"
+            v-model:pager-count="total.pageTotal"
+            :total="total.dataTotal"
+        >
+        </vxe-pager>
       </template>
 
     </vxe-grid>
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 006feae..08f3220 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
@@ -1,8 +1,430 @@
 <script setup>
-import {reactive, ref} from "vue"
-import {VXETable} from "vxe-table"
-import {useRouter} from "vue-router"
+import {onMounted, reactive, ref} from "vue";
+import {Search} from "@element-plus/icons-vue";
+import {useRoute, useRouter} from "vue-router"
+import request from "@/utils/request"
+import deepClone from "@/utils/deepClone"
+import VXETable from "vxe-table";
+import useUserInfoStore from "@/stores/userInfo";
+import {ElMessage} from "element-plus";
+import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
+import { useI18n } from 'vue-i18n'
+import {changeFilterEvent,filterChanged} from "@/hook"
+
+const { t } = useI18n()
 const router = useRouter()
+const route = useRoute()
+const userStore = useUserInfoStore()
+const username = userStore.user.userName
+const userid = userStore.user.userId
+let produceList = ref([])
+let cellArea = ref()
+
+
+const hasDecimal=(value)=>{
+  const regex=/\./ // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value) //杩斿洖true/false
+}
+
+const hasDecimalhtml=(item,row)=>{
+  let aa=item.split('.').length
+  if (aa===2){
+    return row[item.split('.')[0]][item.split('.')[1]]
+  }else if(aa===3){
+    return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]]
+  }
+
+
+}
+
+//瀹氫箟鎺ユ敹鍔犺浇琛ㄥご涓嬫媺鏁版嵁
+const titleSelectJson = ref({
+  returningType:"",
+  inventoryOrganization:""
+})
+
+// 瀹氫箟琛ㄥご涓婁紶鏁版嵁
+let titleUploadData = ref({
+  returningType:'',
+  returningId:'',
+  materialRequisitionPersonnel:'',
+  materialRequisitionTeam:'',
+  orderId:'',
+  batch:'',
+  project:'',
+  reviewedState:'',
+  reviewed:'',
+  createTime:'',
+  warehouseManager:userStore.user.userName
+})
+
+//绛涢�夋潯浠讹紝鏈夊閿渶瑕佸厛瀹氫箟鏄庣粏閲岄潰鐨勬暟鎹�
+let filterData = ref({
+
+
+})
+
+let BasicData = ref([])
+let materialStore= ref([])
+
+const value = ref('')
+const options = [
+  {
+    value: '鍘熺墖',
+    label: '鍘熺墖'
+  },
+  {
+    value: '杈呮枡',
+    label: '杈呮枡',
+  }
+]
+
+let arr = [
+  {field: 'select',type: 'checkbox',fixed:"left", title: '閫夋嫨', width: '80' },
+  { type: 'seq',fixed:"left", title: '鑷簭', width: '80' },
+  {field: 'returnQuantity', width:'150', title: '杩斿簱鏁伴噺', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
+  {field: 'dateOfManufacture', width:'150', title: '鐢熶骇鏃ユ湡', sortable: true,editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},},
+
+  {field: 'inventoryOrganization', width:'150', title: '搴撳瓨缁勭粐', sortable: true,folding: true,slots: { edit: 'inventoryOrganization'},editRender: { name: '$select', attrs: { placeholder: '' } }},
+  {field: 'producer', width:'150', title: '浜у湴', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
+  {field: 'qualityGuaranteePeriod', width:'150', title: '淇濊川鏈�', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
+  {field: 'inventoryArea', width:'150', title: '搴撳瓨鍖哄煙',sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
+
+  {field: 'remarks',width: '80', title: '澶囨敞', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
+  {field: 'id', width: '150',title: '鐗╂枡缂栫爜', sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
+]
+
+
+
+
+//椤甸潰绗竴娆″姞杞�
+request.get(`/BasicWarehouse/BasicWarehouseTypes/鏉愭枡杩斿簱绫诲瀷`).then((res) => {
+
+  if(res.code==200){
+    titleSelectJson.value=deepClone(res.data)
+    const today = new Date
+    today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000))
+    titleUploadData.value.createTime = today.getFullYear() +
+        '-' + ("0" + (today.getMonth() + 1)).slice(-2)
+        + '-' + ("0" + today.getDate()).slice(-2)
+
+  }else{
+    ElMessage.warning(res.msg)
+  }
+})
+
+
+
+const  number = ref();
+
+onMounted(()=>{
+  //鍚敤琛ㄦ牸鎷栧姩閫変腑
+  addListener(xGrid.value,gridOptions,cellArea.value)
+
+
+  //杩斿簱缂栬緫
+  const str = route.query.returningId
+  if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){
+    filterData.value.returningId=str
+    console.log(filterData.value)
+    //绗竴娆¤皟鐢�
+    request.post("/MaterialInventory/getSelectReturningWarehouse/1/100",filterData.value).then((res) => {
+
+      if(res.code==200){
+        titleUploadData.value=deepClone(res.data.returningWarehouse)
+        //鏍规嵁瀹℃牳鐘舵�佹樉绀哄鏍告寜閽垨鑰呮槸鍙嶅鎸夐挳
+        value.value='鍘熺墖|杈呮枡'
+        getStoreWork()
+        console.log(res.data)
+        if(titleUploadData.value.reviewedState!==0){
+          gridOptions.toolbarConfig.buttons[1].disabled = true
+          gridOptions.toolbarConfig.buttons[0].disabled = true
+
+
+        }
+        if(titleUploadData.value.reviewedState===0){
+          gridOptions.toolbarConfig.buttons[2].disabled = true
+        }
+
+        materialStore.value=[]
+        for (let i=0;i<res.data.data.length;i++){
+          materialStore.value[i]=(res.data.data[i])
+          materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
+
+        }
+        produceList = deepClone(materialStore.value)
+
+        xGrid.value.loadData(produceList)
+        //闅愯棌澶嶉�夋
+        /*xGrid.value.hideColumn("select")
+        gridOptions.loading=false*/
+        xGrid.value.showColumn("select")
+        gridOptions.loading=false
+
+
+      }else{
+        ElMessage.warning(res.msg)
+      }
+    })
+  }else{
+    //杩斿簱鏂板
+    request.post(`/MaterialStore/getSelectMaterialStore/1/100`,filterData.value).then((res) => {
+
+      if(res.code==200){
+
+        console.log(res.data.data)
+        titleUploadData.value.warehouseManager=userStore.user.userName
+        titleUploadData.value.returningType = titleSelectJson.value.returningType[0].operateTypeName
+
+        //绂佺敤鎸夐挳
+        gridOptions.toolbarConfig.buttons[1].disabled  = true
+        gridOptions.toolbarConfig.buttons[2].disabled = true
+        //鏄剧ず澶嶉�夋
+        xGrid.value.showColumn("select")
+
+        value.value='鍘熺墖'
+        getStoreWork()
+
+        getStoreWorks()
+        getInventoryOrganization()
+
+
+      }else{
+        ElMessage.warning(res.msg)
+      }
+    })
+  }
+
+
+})
+
+//搴撳瓨缁勭粐
+const getInventoryOrganization=()=>{
+  //椤甸潰绗竴娆″姞杞�
+  request.get(`/BasicWarehouse/BasicWarehouseTypes/搴撳瓨缁勭粐`).then((res) => {
+
+    if(res.code==200){
+      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);
+      // }
+
+
+    }else{
+      ElMessage.warning(res.msg)
+    }
+  })
+}
+
+
+//鍒楁煡璇�
+const getStoreWork = () => {
+  filterData.value.type=value.value
+  request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
+    if(res.code==200){
+      gridOptions.columns=[]
+      BasicData.value = res.data
+      //娣诲姞鍒�
+      gridOptions.columns=arr.slice()
+
+      for (let i=0;i<BasicData.value.length;i++){
+        let column={field: "json."+BasicData.value[i].OperateType,
+          width: '150',title: BasicData.value[i].OperateTypeName,
+          sortable: true,showOverflow:'ellipsis' ,
+          filters:[{ data: '' }],
+          slots: { filter: 'num1_filter' },
+          filterMethod:filterChanged}
+
+        gridOptions.columns.push(column)
+
+
+
+      }
+
+
+    }else{
+      ElMessage.warning(res.msg)
+    }
+  })
+}
+
+//鏁版嵁缁戝畾
+const getStoreWorks = () => {
+  console.log(filterData.value)
+  request.post(`/MaterialStore/getSelectMaterialStore/1/100`,filterData.value).then((res) => {
+
+    if(res.code==200){
+      console.log(res.data)
+      materialStore.value=[]
+      for (let i=0;i<res.data.data.length;i++){
+        materialStore.value[i]=(res.data.data[i])
+        materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
+
+      }
+      materialStore.value.forEach(item => {
+        item['inventoryOrganization'] = titleSelectJson.value["inventoryOrganization"][0].operateTypeName
+      })
+
+
+      produceList = deepClone(materialStore.value)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+
+
+const gridEvents = {
+  async toolbarButtonClick({code}) {
+    const $grid = xGrid.value
+    if ($grid) {
+      switch (code) {
+        case 'add': {
+          const selectRecords = $grid.getCheckboxRecords()
+          console.log(selectRecords)
+          if (selectRecords.length === 0) {
+            ElMessage.warning(t('productStock.unselectedData'))
+            return
+          }
+          const errMap = await $grid.validate(selectRecords)
+          if (errMap) {
+            ElMessage.warning(t('productStock.dataVerificationFailed'))
+            return
+          }
+          //琛ㄥご鏁版嵁鏍¢獙
+          const returningType = titleUploadData.value.returningType
+          if(returningType === null || returningType === undefined || returningType === ''){
+            ElMessage.error("璇烽�夋嫨杩斿簱绫诲瀷")
+            return
+          }
+          const materialRequisitionPersonnel = titleUploadData.value.materialRequisitionPersonnel
+          if(materialRequisitionPersonnel === null || materialRequisitionPersonnel === undefined || materialRequisitionPersonnel === ''){
+            ElMessage.error("璇疯緭鍏ラ鏂欏憳")
+            return
+          }
+          const materialRequisitionTeam = titleUploadData.value.materialRequisitionTeam
+          if(materialRequisitionTeam === null || materialRequisitionTeam === undefined || materialRequisitionTeam === ''){
+            ElMessage.error("璇疯緭鍏ラ鏂欑彮缁�")
+            return
+          }
+          const orderId = titleUploadData.value.orderId
+          if(orderId === null || orderId === undefined || orderId === ''){
+            ElMessage.error("璇疯緭鍏ラ攢鍞崟鍙�")
+            return
+          }
+          const project = titleUploadData.value.project
+          if(project === null || project === undefined || project === ''){
+            ElMessage.error("璇疯緭鍏ラ」鐩悕绉�")
+            return
+          }
+          const batch = titleUploadData.value.batch
+          if(batch === null || batch === undefined || batch === ''){
+            ElMessage.error("璇疯緭鍏ユ壒娆�")
+            return
+          }
+
+
+
+
+          let flowData = ref({
+            returningWarehouseDetail: selectRecords,
+            title: titleUploadData.value,
+            returningId: route.query.returningId
+
+          })
+          console.log(flowData)
+          request.post("/MaterialInventory/saveReturningWarehouse", flowData.value).then((res) => {
+            if(res.code==200){
+              ElMessage.success('淇濆瓨鎴愬姛')
+              router.push({path: '/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
+            }else{
+              ElMessage.warning(res.msg)
+              router.push("/login")
+            }
+          })
+          break
+        }
+        case 'toExamine': {
+          let flowData = ref({
+            returningId: route.query.returningId,
+            reviewed:userStore.user.userName,
+            type: 1
+
+          })
+          console.log(flowData.value)
+          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()}})
+            } else {
+              ElMessage.warning(res.msg)
+              router.push("/login")
+            }
+          })
+          break
+        }
+        case 'CounterExamination': {
+          let flowData = ref({
+            returningId: route.query.returningId,
+            type: 0
+
+          })
+          console.log(flowData.value)
+          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()}})
+            } else {
+              ElMessage.warning(res.msg)
+              router.push("/login")
+            }
+          })
+          break
+        }
+
+      }
+    }
+  },
+  menuClick ({ menu, row, column }) {
+    const $grid = xGrid.value
+    if ($grid) {
+      switch (menu.code) {
+
+        case 'copyChecked' :{
+          let result = toolbarButtonClickEvent()
+          if(result){
+            const dataList = xGrid.value.getTableData().visibleData
+            let firstVal=null;
+            if(result.cell.indexOf('.')>-1){
+              firstVal = eval("dataList["+result.start +"]."+result.cell)
+            }else {
+              firstVal=dataList[result.start][result.cell];
+            }
+            dataList.forEach((item,index) =>{
+              if(index>=result.start && index<=result.end){
+                if(result.cell.indexOf('.')>-1){
+                  const  columnArr = result.cell.split('.')
+                  item[columnArr[0]][columnArr[1]]  = firstVal
+                }else{
+                  item[result.cell]  = firstVal
+                }
+
+              }
+            })
+          }
+          break
+        }
+
+      }
+    }
+  }
+}
+
+
 
 const xGrid = ref()
 const gridOptions = reactive({
@@ -23,7 +445,7 @@
     useKey: true
   },
   filterConfig: {   //绛涢�夐厤缃」
-    remote: true
+    //remote: true
   },
   customConfig: {
     storage: true
@@ -34,32 +456,17 @@
     showStatus: true
   },//琛ㄥご鍙傛暟
   columns:[
-    {type: 'seq',fixed:"left", title: '鑷簭', width: 80 },
-    {field: 'orderID',width:120,  title: '鐗╂枡缂栫爜',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鐗╂枡鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '浜у湴',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '瀹藉害',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '楂樺害',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鍘氬害',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '搴撳瓨缂栧彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '绛夌骇',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '闈㈢Н',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鎹㈢畻鐜�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鏈鏁伴噺',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '杩斿簱鏁伴噺',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鎬绘暟閲�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '搴撳尯',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '搴撲綅',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '宸ョ▼鍗曞彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '鐢熶骇鏃ユ湡',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
-    {field: 'orderID',width:120,  title: '澶囨敞',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+
   ],//琛ㄥご鎸夐挳
   toolbarConfig: {
     buttons: [
+      {'code': 'add', 'name': t('basicData.save'),status: 'primary',icon: 'vxe-icon-save'},
+      {'code': 'toExamine', 'name': t('basicData.review'),status: 'primary'},
+      {'code': 'CounterExamination', 'name': t('basicData.cancelReview'),status: 'primary'}
     ],
-    import: false,
+    /*import: false,
     export: true,
-    print: true,
+    print: true,*/
     zoom: true,
     custom: true
   },
@@ -81,19 +488,23 @@
 
 })
 
-const gridEvents = {
-  toolbarButtonClick ({ code }) {
-    const $grid = xGrid.value
-    if ($grid) {
-      switch (code) {
-        case 'Craft': {
-          router.push({path: '/main/order/updateOrderCraft', query: { orderID: 12123 }})
-          break
-        }
+const validRules = ref({
+
+  returnQuantity: [{
+    validator (e) {
+     if (e.row.returnQuantity ==="") {
+        return new Error("杩斿簱鏁伴噺涓嶈兘涓虹┖鎴栬�呮槸绛変簬0")
       }
+      const regex = /^[1-9]\d*$/g
+      if ( !regex.test(e.row.returnQuantity) ) {
+        return new Error(t('productStock.pleaseEnterAPositiveInteger'))
+      }
+
     }
-  }
-}
+
+  }]
+
+})
 
 </script>
 
@@ -102,52 +513,60 @@
 
     <div class="order-primary" style="background-color: white">
       <el-row>
-        <el-col  :span="2"><el-text>浜よ揣鏃ユ湡锛�</el-text></el-col>
-        <el-col  :span="4">
-          <el-date-picker
-              type="week"
-              format="[Week] ww"
-              placeholder="閫夋嫨鏃ユ湡"/>
-        </el-col>
-        <el-col  :span="2"><el-text>*閫�鏂欏憳/渚涘簲鍟嗭細</el-text></el-col>
-        <el-col  :span="4"><el-input/></el-col>
-        <el-col  :span="2"><el-text>*閫�鏂欑彮缁勶細</el-text></el-col>
-        <el-col  :span="4">
-          <el-select  clearable placeholder=" " >
-            <el-option/>
-          </el-select>
-        </el-col>
-        <el-col  :span="2"><el-text>*鍒跺崟鍛橈細</el-text></el-col>
-        <el-col  :span="4">
-          <el-select  clearable placeholder=" " >
-            <el-option />
-          </el-select>
-        </el-col>
-
-        <!--      <el-col :span="2"><el-text  /></el-col>-->
+        <el-col  :span="2"><el-text>杩斿簱鏃ユ湡:</el-text></el-col>
+        <el-col  :span="3"><el-input  v-model="titleUploadData.createTime" :readonly="true" ></el-input></el-col>
+        <el-col  :span="2"><el-text>棰嗘枡鍛�/渚涘簲鍟�:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.materialRequisitionPersonnel" /></el-col>
+        <el-col  :span="2"><el-text>棰嗘枡鐝粍/渚涘簲鍟�:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.materialRequisitionTeam" /></el-col>
+        <el-col  :span="2"><el-text>浠撶鍛�:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.warehouseManager" :readonly="true" /></el-col>
       </el-row>
       <el-row>
-        <el-col  :span="2"><el-text>*鍑哄簱绫诲瀷锛�</el-text></el-col>
-        <el-col  :span="4">
-          <el-select  clearable placeholder=" " >
-            <el-option/>
+        <el-col  :span="2"><el-text>杩斿簱绫诲瀷锛�</el-text></el-col>
+        <el-col  :span="3">
+          <el-select v-model="titleUploadData.returningType"  clearable placeholder=""  >
+            <el-option
+                v-for="item in titleSelectJson['returningType']"
+                :key="item.id"
+                :label="item.operateTypeName"
+                :value="item.operateTypeName"
+            />
           </el-select>
         </el-col>
-        <el-col  :span="2"><el-text>璁㈠崟缂栧彿锛�</el-text></el-col>
-        <el-col  :span="4"><el-text /></el-col>
-        <el-col  :span="2"><el-text>椤圭洰鍚嶇О锛�</el-text></el-col>
-        <el-col  :span="4"><el-text /></el-col>
-        <el-col  :span="2"><el-text>鎵规鍙凤細</el-text></el-col>
-        <el-col  :span="4"><el-text /></el-col>
+        <el-col  :span="2"><el-text>閿�鍞崟鍙�:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.orderId" /></el-col>
+        <el-col  :span="2"><el-text>椤圭洰鍚嶇О:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.project" /></el-col>
+        <el-col  :span="2"><el-text>鎵规:</el-text></el-col>
+        <el-col  :span="3"><el-input v-model="titleUploadData.batch" /></el-col>
+
+
+      </el-row>
+
+
+      <el-row>
+        <el-select v-model="value" placeholder="璇烽�夋嫨绫诲埆" @change="getStoreWork" style="margin-top: 10px;border: #181818 1px solid;">
+          <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+          />
+        </el-select>
       </el-row>
     </div>
+
+
     <div class="order-detail">
+
       <vxe-grid
           max-height="97%"
           class="mytable-scrollbar"
           ref="xGrid"
           v-bind="gridOptions"
           v-on="gridEvents"
+          :edit-rules="validRules"
       >
         <template #num1_filter="{ column, $panel }">
           <div>
@@ -157,12 +576,14 @@
           </div>
         </template>
 
+        <template #inventoryOrganization="{ row }">
+          <vxe-select v-model="row.inventoryOrganization" transfer >
+            <vxe-option v-for="item in titleSelectJson['inventoryOrganization']"  :key="item.ID" :label="item.operateTypeName" :value="item.operateTypeName"/>
+          </vxe-select>
+        </template>
+
 
       </vxe-grid>
-      <el-row justify="center">
-          <el-button  id="searchButton" type="primary" :icon="Search" style="margin-right:20px;">娓呴櫎</el-button>
-          <el-button  id="searchButton" type="primary" :icon="save" style="margin-left:20px;">纭畾</el-button>
-      </el-row>
     </div>
   </div>
 </template>
diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue
index f442610..3ae8d0a 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue
@@ -52,7 +52,7 @@
 let total = reactive({
   pageTotal : 0,
   dataTotal : 0,
-  pageSize : 2
+  pageSize : 10
 })
 
 let filterData = ref({
@@ -503,15 +503,9 @@
             ElMessage.error("璇疯緭鍏ユ暟閲�")
             return
           }
-          const materialRequisitionTeam = titleUploadData.value.dateOfManufacture
-          if(materialRequisitionTeam === null || materialRequisitionTeam === undefined || materialRequisitionTeam === ''){
-            ElMessage.error("璇烽�変腑鐢熶骇鏃ユ湡")
-            return
-          }
-          const orderId = titleUploadData.value.qualityGuaranteePeriod
-          if(orderId === null || orderId === undefined || orderId === ''){
-            ElMessage.error("璇疯緭鍏ヤ繚璐ㄦ湡")
-            return
+          const  dateOfManufacture= titleUploadData.value.dateOfManufacture
+          if(dateOfManufacture === null || dateOfManufacture === undefined || dateOfManufacture === ''){
+            titleUploadData.value.dateOfManufacture=null
           }
 
           const inventoryArea = titleUploadData.value.inventoryArea
diff --git a/north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue b/north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue
index 0e0f7df..978cf7d 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue
@@ -555,7 +555,7 @@
         <el-col  :span="5"><el-input v-model="titleUploadData.project" :readonly="true"></el-input></el-col>
       </el-row>
       <el-row>
-        <el-col  :span="2"><el-text>{{$t('order.project')}}锛�</el-text></el-col>
+        <el-col  :span="2"><el-text>{{$t('delivery.paymentTerms')}}锛�</el-text></el-col>
         <el-col  :span="3">
           <el-select v-model="titleUploadData.paymentTerms"  clearable placeholder=""  >
             <el-option
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 7d8b272..711ffaa 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
@@ -3,10 +3,7 @@
 
 import com.example.erp.common.Constants;
 import com.example.erp.common.Result;
-import com.example.erp.entity.mm.MaterialInventory;
-import com.example.erp.entity.mm.MaterialOutbound;
-import com.example.erp.entity.mm.MaterialOutboundDetail;
-import com.example.erp.entity.mm.MaterialStore;
+import com.example.erp.entity.mm.*;
 import com.example.erp.exception.ServiceException;
 import com.example.erp.service.mm.MaterialInventoryService;
 import com.example.erp.service.mm.MaterialStoreService;
@@ -71,7 +68,7 @@
         return Result.seccess(materialInventoryService.getSelectMaterialOutbound(pageNum,pageSize,materialOutboundDetail));
     }
 
-    @ApiOperation("鏉愭枡鍑哄簱淇敼鎺ュ彛")
+    @ApiOperation("鏉愭枡鍑哄簱瀹℃牳鎺ュ彛")
     @PostMapping("/updateMaterialOutboundToExamine")
     public Result updateMaterialOutboundToExamine( @RequestBody Map<String,Object> object){
         if(materialInventoryService.updateMaterialOutboundToExamine(object)){
@@ -96,6 +93,42 @@
         }
     }
 
+    @ApiOperation("鐗╂枡杩斿簱鏂板鎺ュ彛")
+    @PostMapping("/saveReturningWarehouse")
+    public Result saveReturningWarehouse( @RequestBody Map<String,Object>  object){
+        if(materialInventoryService.saveReturningWarehouse(object)){
+            return Result.seccess();
+        }else {
+            throw new ServiceException(Constants.Code_500,"淇濆瓨澶辫触");
+
+        }
+    }
+
+    @ApiOperation("鐗╂枡杩斿簱鏂板鏌ヨ鎺ュ彛")
+    @PostMapping("/getSelectReturningWarehouse/{pageNum}/{pageSize}")
+    public Result getSelectReturningWarehouse(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody ReturningWarehouseDetail returningWarehouseDetail){
+        return Result.seccess(materialInventoryService.getSelectReturningWarehouse(pageNum,pageSize,returningWarehouseDetail));
+    }
+
+    @ApiOperation("鐗╂枡杩斿簱瀹℃牳鎺ュ彛")
+    @PostMapping("/updateReturningWarehouseToExamine")
+    public Result updateReturningWarehouseToExamine( @RequestBody Map<String,Object> object){
+        if(materialInventoryService.updateReturningWarehouseToExamine(object)){
+            return Result.seccess();
+
+        }else {
+            throw new ServiceException(Constants.Code_500,"瀹℃牳澶辫触");
+
+        }
+    }
+
+
+    @ApiOperation("鐗╂枡杩斿簱鏌ヨ鎺ュ彛")
+    @PostMapping("/getSelectReturningWarehouseDate/{pageNum}/{pageSize}/{selectDate}")
+    public Result getSelectReturningWarehouseDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> selectDate, @RequestBody ReturningWarehouse returningWarehouse){
+        return Result.seccess(materialInventoryService.getSelectReturningWarehouseDate(pageNum,pageSize,selectDate, returningWarehouse));
+    }
+
 
 
 
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java b/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java
new file mode 100644
index 0000000..4b1e877
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java
@@ -0,0 +1,28 @@
+package com.example.erp.entity.mm;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Data
+public class ReturningWarehouse {
+    @TableId(type = IdType.AUTO)
+
+    private Long id;
+    private String returningId;
+    private String returningType;
+    private String materialRequisitionPersonnel;
+    private String materialRequisitionTeam;
+    private String orderId;
+    private String project;
+    private String batch;
+    private String warehouseManager;
+    private String reviewed;
+    private LocalDate reviewedTime;
+    private Integer reviewedState;
+    private LocalDate createTime;
+
+
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java b/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java
new file mode 100644
index 0000000..cd175c6
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java
@@ -0,0 +1,31 @@
+package com.example.erp.entity.mm;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Data
+public class ReturningWarehouseDetail {
+    @TableId(type = IdType.AUTO)
+
+    private Long id;
+    private Long inventoryId;
+    private String returningId;
+    private Integer returningNumber;
+    private Long materialCode;
+    private Integer returnQuantity;
+    private LocalDate dateOfManufacture;
+    private String inventoryOrganization;
+    private String producer;
+    private Double totalArea;
+    private Double singlePieceArea;
+    private String qualityGuaranteePeriod;
+    private String inventoryArea;
+    private String remarks;
+
+
+
+
+}
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 e4ce8c2..625d8d2 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
@@ -1,9 +1,6 @@
 package com.example.erp.mapper.mm;
 
-import com.example.erp.entity.mm.MaterialInventory;
-import com.example.erp.entity.mm.MaterialOutbound;
-import com.example.erp.entity.mm.MaterialOutboundDetail;
-import com.example.erp.entity.mm.MaterialStore;
+import com.example.erp.entity.mm.*;
 import com.example.erp.entity.sd.Delivery;
 import com.example.erp.entity.sd.DeliveryDetail;
 import com.example.erp.entity.sd.OrderDetail;
@@ -40,19 +37,43 @@
 
     Boolean deleteMaterialOutbound(@Param("materialOutboundId") String materialOutboundId);
 
-    Integer getmaximum(@Param("type") String type);
+    Integer getMaximum(@Param("type") String type);
+
+    Integer getMaximums(@Param("type") String type);
 
     Integer getMaterialOutboundCount(@Param("materialOutboundId") String materialOutboundId);
 
+    Integer getReturningWarehouseCount(@Param("returningId") String returningId);
+
     Integer getMaterialInventoryCount(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture);
+
+    Integer getMaterialInventoryCountNull(@Param("materialCode") Long materialCode);
+
+
+    List<MaterialInventory> getMaterialInventoryCountId(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture);
+
+    List<MaterialInventory> getMaterialInventoryCountNullId(@Param("materialCode") Long materialCode);
 
     List<MaterialOutboundDetail> getIsNotMaterialOutboundDetail( @Param("materialOutboundId") String materialOutboundId);
 
-    Boolean insertMaterialInventoryMapper(@Param("materialOutbound") MaterialOutbound materialOutbound, @Param("number") String number);
+    List<ReturningWarehouseDetail> getIsNotReturningWarehouseDetail(@Param("returningId") String returningId);
+
+    Boolean insertMaterialOutbound(@Param("materialOutbound") MaterialOutbound materialOutbound, @Param("number") String number);
+
+    Boolean insertReturningWarehouse(@Param("returningWarehouse") ReturningWarehouse returningWarehouse, @Param("number") String number);
 
     Integer getMaterialOutboundDetailMaximum(@Param("materialOutboundId") String materialOutboundId);
 
-    Boolean insertMaterialOutboundDetail(@Param("materialOutboundDetail") MaterialOutboundDetail materialOutboundDetail, @Param("number") String number, @Param("materialOutboundNumber") Integer materialOutboundNumber);
+    Integer getReturningWarehouseDetailMaximum(@Param("returningId") String returningId);
+
+    Boolean insertMaterialOutboundDetail(@Param("materialOutboundDetail") MaterialOutboundDetail materialOutboundDetail,
+                                         @Param("number") String number, @Param("materialOutboundNumber") Integer materialOutboundNumber);
+
+    Boolean insertReturningWarehouseDetail(@Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail,
+                                         @Param("number") String number, @Param("returningWarehouseNumber") Integer returningWarehouseNumber);
+
+    Boolean updateReturningWarehouseDetail(@Param("number") String number, @Param("returningWarehouseNumber") Integer returningWarehouseNumber,
+                                           @Param("materialInventoryId") Long materialInventoryId);
 
 
     Boolean updateMaterialInventoryAvailableOut(@Param("inventoryId") Long inventoryId,
@@ -64,13 +85,27 @@
     Boolean updateMaterialInventoryInventoryInt(@Param("inventoryId") Long inventoryId,
                                        @Param("quantity") Integer quantity);
 
+    Boolean updateMaterialInventoryAvailableInventoryOut(@Param("inventoryId") Long inventoryId,
+                                                @Param("quantity") Integer quantity);
+    Boolean updateMaterialInventoryAvailableInventoryInt(@Param("inventoryId") Long inventoryId,
+                                                @Param("quantity") Integer quantity);
+
     Boolean deleteMaterialOutboundDetail(@Param("materialOutboundId") String materialOutboundId);
+
+    Boolean deleteReturningWarehouseDetail(@Param("returningId") String returningId);
 
     List<MaterialOutbound> getSelectMaterialOutboundDate(@Param("offset") Integer offset,
                                                            @Param("pageSize") Integer pageSize,String startDate, String endDate,
                                                            @Param("materialOutbound") MaterialOutbound materialOutbound);
 
     Map<String,Integer> getSelectMaterialOutboundDatePageTotal(Integer offset, Integer pageSize,String startDate, String endDate,MaterialOutbound materialOutbound);
+
+
+    List<ReturningWarehouse> getSelectReturningWarehouseDate(@Param("offset") Integer offset,
+                                                         @Param("pageSize") Integer pageSize,String startDate, String endDate,
+                                                         @Param("returningWarehouse") ReturningWarehouse returningWarehouse);
+
+    Map<String,Integer> getSelectReturningWarehouseDatePageTotal(Integer offset, Integer pageSize,String startDate, String endDate,ReturningWarehouse returningWarehouse);
 
 
     MaterialOutbound getSelectMaterialOutbound(@Param("offset") Integer offset,
@@ -83,9 +118,23 @@
 
     Map<String,Integer> getSelectMaterialOutboundDetailPageTotal(Integer offset, Integer pageSize,MaterialOutboundDetail materialOutboundDetail);
 
+    ReturningWarehouse getSelectReturningWarehouse(@Param("offset") Integer offset,
+                                               @Param("pageSize") Integer pageSize,
+                                               @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
+
+    List<Map<String,Object>> getSelectReturningWarehouseDetail(@Param("offset") Integer offset,
+                                                             @Param("pageSize") Integer pageSize,
+                                                             @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
+
+    Map<String,Integer> getSelectReturningWarehouseDetailPageTotal(Integer offset, Integer pageSize,ReturningWarehouseDetail returningWarehouseDetail);
+
     Boolean updateMaterialOutboundToExamine(@Param("materialOutboundId") String materialOutboundId,@Param("reviewedState") int reviewedState,@Param("reviewed") String reviewed);
 
     Boolean updateMaterialOutboundCounterExamination(@Param("materialOutboundId") String materialOutboundId,@Param("reviewedState") int reviewedState,@Param("reviewed") String reviewed);
+
+    Boolean updateReturningWarehouseToExamine(@Param("returningId") String returningId,@Param("reviewedState") int reviewedState,@Param("reviewed") String reviewed);
+
+    Boolean updateReturningWarehouseCounterExamination(@Param("returningId") String returningId,@Param("reviewedState") int reviewedState,@Param("reviewed") String reviewed);
 
     Boolean updateMaterialInventory(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
                                     @Param("totalArea") Double totalArea,
@@ -95,4 +144,16 @@
                                     @Param("totalArea") Double totalArea,
                                     @Param("materialInventory") MaterialInventory materialInventory);
 
+    Boolean updateMaterialInventoryReturning(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
+                                    @Param("totalArea") Double totalArea,
+                                    @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
+
+    Boolean updateMaterialInventoryReturningNull(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
+                                             @Param("totalArea") Double totalArea,
+                                             @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
+
+    Boolean insertMaterialInventoryReturning(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
+                                    @Param("totalArea") Double totalArea,
+                                    @Param("returningWarehouseDetail") ReturningWarehouseDetail returningWarehouseDetail);
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java
index 06ea450..f81acf0 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java
@@ -18,6 +18,8 @@
                                      @Param("pageSize") Integer pageSize,
                                      @Param("materialStore") MaterialStore materialStore);
 
+    MaterialStore getSelectMaterialStoreById(@Param("id") Long id);
+
 
     Map<String,Integer> getSelectMaterialStorePageTotal(Integer offset, Integer pageSize, MaterialStore materialStore);
 
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 0c16451..0383287 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
@@ -3,10 +3,7 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
-import com.example.erp.entity.mm.MaterialInventory;
-import com.example.erp.entity.mm.MaterialOutbound;
-import com.example.erp.entity.mm.MaterialOutboundDetail;
-import com.example.erp.entity.mm.MaterialStore;
+import com.example.erp.entity.mm.*;
 import com.example.erp.entity.sd.Delivery;
 import com.example.erp.entity.sd.DeliveryDetail;
 import com.example.erp.entity.sd.OrderDetail;
@@ -20,6 +17,7 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.util.*;
@@ -30,6 +28,8 @@
 public class MaterialInventoryService {
     @Autowired
     MaterialInventoryMapper materialInventoryMapper;
+    @Autowired
+    MaterialStoreMapper materialStoreMapper;
     @Autowired
     BasicWarehouseTypeMapper basicWarehouseTypeMapper;
     @Autowired
@@ -65,7 +65,7 @@
                 //鑾峰彇鍗曞彿
                 oddNumber = orderNumberSetting("鍑哄簱");
                 //鏂板鏉愭枡鍑哄簱琛ㄦ暟鎹�
-                materialInventoryMapper.insertMaterialInventoryMapper(materialOutbound, oddNumber);
+                materialInventoryMapper.insertMaterialOutbound(materialOutbound, oddNumber);
             }
 
             //鑾峰彇瀵硅薄闆嗗悎寰幆杩涜鏂板淇敼
@@ -275,15 +275,206 @@
 
     }
 
+    public Boolean saveReturningWarehouse(Map<String,Object> object) {
+        boolean saveState = true;
+        //璁剧疆鍥炴粴鐐�
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        String returningId = "";
+        String oddNumber;
+        if (object.get("returningId") != null) {
+            returningId = object.get("returningId").toString();
+        }
+            ReturningWarehouse returningWarehouse = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), ReturningWarehouse.class);
+            List<ReturningWarehouseDetail> returningWarehouseDetailList = JSONArray.parseArray(JSONObject.toJSONString(object.get("returningWarehouseDetail")), ReturningWarehouseDetail.class);
+            //鏌ヨ鍑哄簱鍗曟槸鍚﹀瓨鍦�
+            Integer ReturningWarehouseConut = materialInventoryMapper.getReturningWarehouseCount(returningId);
+            if (ReturningWarehouseConut != 0) {
+
+                List<ReturningWarehouseDetail> returningWarehouseDetailLists = materialInventoryMapper.getIsNotReturningWarehouseDetail(returningId);
+                if (!returningWarehouseDetailLists.isEmpty()) {
+                    for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailLists) {
+                        //杩樺師鐗╂枡搴撳瓨鏁�
+                        materialInventoryMapper.updateMaterialInventoryAvailableOut(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
+                    }
+                }
+                //鍒犻櫎鏉愭枡鍑哄簱鏄庣粏鐨勬暟鎹�
+                materialInventoryMapper.deleteReturningWarehouseDetail(returningId);
+                oddNumber = returningId;
+            } else {
+                //鑾峰彇鍗曞彿
+                oddNumber = orderNumberSetting("杩斿簱");
+                //鏂板鏉愭枡鍑哄簱琛ㄦ暟鎹�
+                materialInventoryMapper.insertReturningWarehouse(returningWarehouse, oddNumber);
+            }
+
+
+            //鑾峰彇瀵硅薄闆嗗悎寰幆杩涜鏂板淇敼
+            if (!returningWarehouseDetailList.isEmpty()) {
+                for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailList) {
+
+                    Integer returningWarehouseDetailMaximum = materialInventoryMapper.getReturningWarehouseDetailMaximum(oddNumber);
+                    //鏂板鏉愭枡鍑哄簱鏄庣粏鏁版嵁
+                    materialInventoryMapper.insertReturningWarehouseDetail(returningWarehouseDetail, oddNumber, returningWarehouseDetailMaximum + 1);
+
+                    double singlePieceArea=0.0;
+                    double totalArea=0.0;
+                    String json="";
+                    MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(returningWarehouseDetail.getId());
+                    json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1);
+
+
+                    double width= convert(json,"\"width\"");
+                    double height=convert(json,"\"height\"");
+                    DecimalFormat decimalFormat = new DecimalFormat("#0.00");
+                    singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000));
+                    totalArea= Double.parseDouble(decimalFormat.format(singlePieceArea * returningWarehouseDetail.getReturnQuantity()));
+
+
+                    //鏌ヨ鐗╂枡鏄惁瀛樺湪
+                    Integer MaterialInventoryCount=0;
+                    if (returningWarehouseDetail.getDateOfManufacture()!=null){
+                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture());
+                    }else{
+                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(returningWarehouseDetail.getId());
+                    }
+
+
+                    if(MaterialInventoryCount>0){
+                        if (returningWarehouseDetail.getDateOfManufacture()!=null){
+                            materialInventoryMapper.updateMaterialInventoryReturning(returningWarehouseDetail.getId(),singlePieceArea,totalArea,returningWarehouseDetail);
+                        }else{
+                            materialInventoryMapper.updateMaterialInventoryReturningNull(returningWarehouseDetail.getId(),singlePieceArea,totalArea,returningWarehouseDetail);
+                        }
+
+                    }else {
+                        materialInventoryMapper.insertMaterialInventoryReturning(returningWarehouseDetail.getId(),singlePieceArea,totalArea,returningWarehouseDetail);
+                    }
+
+                    //鑾峰彇搴撳瓨缂栧彿娣诲姞鍒拌繑搴撴槑缁嗚〃
+                    List<MaterialInventory> MaterialInventoryId;
+                    if (returningWarehouseDetail.getDateOfManufacture()!=null){
+                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountId(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture());
+                    }else{
+                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountNullId(returningWarehouseDetail.getId());
+                    }
+                    materialInventoryMapper.updateReturningWarehouseDetail(oddNumber, returningWarehouseDetailMaximum + 1,MaterialInventoryId.get(0).getId());
+
+
+
+                }
+
+            }
+
+
+        return saveState;
+
+    }
+
+
+    public Map<String, Object> getSelectReturningWarehouse(Integer pageNum, Integer pageSize, ReturningWarehouseDetail returningWarehouseDetail) {
+        Integer offset = (pageNum - 1) * pageSize;
+        Map<String, Object> map = new HashMap<>();
+        map.put("returningWarehouse", materialInventoryMapper.getSelectReturningWarehouse(offset, pageSize, returningWarehouseDetail));
+        map.put("data", materialInventoryMapper.getSelectReturningWarehouseDetail(offset, pageSize, returningWarehouseDetail));
+        map.put("total", materialInventoryMapper.getSelectReturningWarehouseDetailPageTotal(offset, pageSize, returningWarehouseDetail));
+        return map;
+    }
+
+
+    public Boolean updateReturningWarehouseToExamine(Map<String,Object> object) {
+        boolean saveState = true;
+        //璁剧疆鍥炴粴鐐�
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        try {
+            String returningId = "";
+            String reviewed = "";
+            int type =0;
+            if (object.get("returningId") != null) {
+                returningId = object.get("returningId").toString();
+            }
+
+            if (object.get("type") != null) {
+                type = Integer.parseInt(object.get("type").toString());
+            }
+            if (object.get("reviewed") != null) {
+                reviewed = object.get("reviewed").toString();
+            }
+
+            if (type==1){
+                List<ReturningWarehouseDetail> returningWarehouseDetailList = materialInventoryMapper.getIsNotReturningWarehouseDetail(returningId);
+                if (!returningWarehouseDetailList.isEmpty()) {
+                    for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailList) {
+                        //淇敼鐗╂枡搴撳瓨鏁伴噺
+                        materialInventoryMapper.updateMaterialInventoryAvailableInt(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
+                    }
+                }
+                materialInventoryMapper.updateReturningWarehouseToExamine(returningId,type,reviewed);
+            }else{
+                List<ReturningWarehouseDetail> returningWarehouseDetailList = materialInventoryMapper.getIsNotReturningWarehouseDetail(returningId);
+                if (!returningWarehouseDetailList.isEmpty()) {
+                    for (ReturningWarehouseDetail returningWarehouseDetail : returningWarehouseDetailList) {
+                        //淇敼鐗╂枡搴撳瓨鏁伴噺
+                        materialInventoryMapper.updateMaterialInventoryAvailableOut(returningWarehouseDetail.getInventoryId(), returningWarehouseDetail.getReturnQuantity());
+                    }
+                }
+                materialInventoryMapper.updateReturningWarehouseCounterExamination(returningId,type,reviewed);
+            }
+
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+            //灏嗗紓甯镐紶鍏ユ暟鎹簱
+            SysError sysError = new SysError();
+            sysError.setError(e.toString());
+            sysError.setFunc("saveOrder");
+            sysErrorService.insert(sysError);
+            saveState = false;
+
+        }
+        return saveState;
+
+
+
+    }
+
+
+    public Map<String, Object> getSelectReturningWarehouseDate(Integer pageNum, Integer pageSize, List<String> selectDate, ReturningWarehouse returningWarehouse) {
+        Integer offset = (pageNum - 1) * pageSize;
+        String endDate = LocalDate.now().toString();
+        String startDate = LocalDate.now().minusDays(15).toString();
+        if(selectDate !=null && selectDate.size()==2){
+            if(!selectDate.get(0).isEmpty()){
+                startDate = selectDate.get(0);
+            }
+            if(!selectDate.get(1).isEmpty()){
+                endDate = selectDate.get(1);
+            }
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", materialInventoryMapper.getSelectReturningWarehouseDate(offset, pageSize,startDate, endDate, returningWarehouse));
+        map.put("total", materialInventoryMapper.getSelectReturningWarehouseDatePageTotal(offset, pageSize,startDate, endDate, returningWarehouse));
+        List<String> list = new ArrayList<>();
+        list.add(startDate);
+        list.add(endDate);
+        map.put("selectDate",list);
+        return map;
+    }
+
+
 
     public String orderNumberSetting(String type) {
         //鏍规嵁绫诲瀷鑷姩鐢熸垚涓嶅悓鐨勬搷浣滃崟鍙�
         String alias="";
+        Integer maximum=0;
         if(Objects.equals(type, "鍑哄簱")){
             alias="CK";
+             maximum=materialInventoryMapper.getMaximum(type);
+        }
+        if(Objects.equals(type, "杩斿簱")){
+            alias="FK";
+             maximum=materialInventoryMapper.getMaximums(type);
         }
         //鏌ヨ褰撳ぉ鐨勬渶澶ф暟閲�
-        Integer maximum=materialInventoryMapper.getmaximum(type);
+
         //璁剧疆涓や綅涓嶅琛�0
         String formattedNumber = String.format("%02d", maximum+1);
         //鏍煎紡鍖栧綋鍓嶆棩鏈�
@@ -295,6 +486,30 @@
     }
 
 
+    public double convert(String json,String string) {
+        Map<String, Object> map = new HashMap<>();
+        String[] keyValues = json.split(",");
+        for (String keyValue : keyValues) {
+            String[] pair = keyValue.split(":");
+            if (pair.length == 2) {
+                map.put(pair[0], pair[1]);
+            }
+        }
+        double number=0.0;
+        if(map.get(string)!=null){
+            String[] widthStrings = map.get(string).toString().split("\\D+");
+            for (String numberString : widthStrings) {
+                if (!numberString.isEmpty()) {
+                    number= Double.parseDouble(numberString);
+                }
+            }
+        }
+
+
+        return number;
+    }
+
+
 
 
 
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 49a2cf3..108874f 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -3,32 +3,7 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.erp.mapper.mm.MaterialInventoryMapper">
-    <resultMap id="SelectMaterialOutbound" type="com.example.erp.entity.mm.MaterialOutboundDetail">
 
-        <result column="mid" property="id"/>
-        <result column="material_outbound_id" property="materialOutboundId"/>
-        <result column="material_outbound_number" property="materialOutboundNumber"/>
-        <result column="inventory_organization" property="inventoryOrganization"/>
-        <result column="material_code" property="materialCode"/>
-        <result column="material_name" property="materialName"/>
-        <result column="producer" property="producer"/>
-        <result column="width" property="width"/>
-        <result column="height" property="height"/>
-        <result column="unit" property="unit"/>
-        <result column="thickness" property="thickness"/>
-        <result column="outbound_quantity" property="outboundQuantity"/>
-        <result column="single_piece_area" property="singlePieceArea"/>
-        <result column="inventory_area" property="inventoryArea"/>
-        <result column="date_of_manufacture" property="dateOfManufacture"/>
-        <result column="remarks" property="remarks"/>
-
-        <result column="inventory_quantity" property="materialInventory.inventoryQuantity"/>
-        <result column="available_quantity" property="materialInventory.availableQuantity"/>
-
-        <result column="reviewed_state" property="materialOutbound.reviewedState"/>
-
-
-    </resultMap>
 
 
     <select id="getSelectMaterialInventoryDate">
@@ -123,6 +98,27 @@
         mm.material_outbound mo
         <where>
             date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
+            <if test="materialOutbound.materialOutboundId != null and materialOutbound.materialOutboundId != ''">
+                and mo.material_outbound_id regexp #{materialOutbound.materialOutboundId}
+            </if>
+            <if test="materialOutbound.materialRequisitionPersonnel != null and materialOutbound.materialRequisitionPersonnel != ''">
+                and mo.material_requisition_personnel regexp #{materialOutbound.materialRequisitionPersonnel}
+            </if>
+            <if test="materialOutbound.materialRequisitionTeam != null and materialOutbound.materialRequisitionTeam != ''">
+                and mo.material_requisition_team regexp #{materialOutbound.materialRequisitionTeam}
+            </if>
+            <if test="materialOutbound.orderId != null and materialOutbound.orderId != ''">
+                and mo.order_id regexp #{materialOutbound.orderId}
+            </if>
+            <if test="materialOutbound.outboundType != null and materialOutbound.outboundType != ''">
+                and mo.outbound_type regexp #{materialOutbound.outboundType}
+            </if>
+            <if test="materialOutbound.warehouseManager != null and materialOutbound.warehouseManager != ''">
+                and mo.warehouse_manager regexp #{materialOutbound.warehouseManager}
+            </if>
+            <if test="materialOutbound.reviewed != null and materialOutbound.reviewed != ''">
+                and mo.reviewed regexp #{materialOutbound.reviewed}
+            </if>
         </where>
         order by mo.reviewed_state desc,mo.create_time desc
         limit #{offset},#{pageSize};
@@ -136,6 +132,109 @@
         mm.material_outbound mo
         <where>
             date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
+            <if test="materialOutbound.materialOutboundId != null and materialOutbound.materialOutboundId != ''">
+                and mo.material_outbound_id regexp #{materialOutbound.materialOutboundId}
+            </if>
+            <if test="materialOutbound.materialRequisitionPersonnel != null and materialOutbound.materialRequisitionPersonnel != ''">
+                and mo.material_requisition_personnel regexp #{materialOutbound.materialRequisitionPersonnel}
+            </if>
+            <if test="materialOutbound.materialRequisitionTeam != null and materialOutbound.materialRequisitionTeam != ''">
+                and mo.material_requisition_team regexp #{materialOutbound.materialRequisitionTeam}
+            </if>
+            <if test="materialOutbound.orderId != null and materialOutbound.orderId != ''">
+                and mo.order_id regexp #{materialOutbound.orderId}
+            </if>
+            <if test="materialOutbound.outboundType != null and materialOutbound.outboundType != ''">
+                and mo.outbound_type regexp #{materialOutbound.outboundType}
+            </if>
+            <if test="materialOutbound.warehouseManager != null and materialOutbound.warehouseManager != ''">
+                and mo.warehouse_manager regexp #{materialOutbound.warehouseManager}
+            </if>
+            <if test="materialOutbound.reviewed != null and materialOutbound.reviewed != ''">
+                and mo.reviewed regexp #{materialOutbound.reviewed}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+
+    <select id="getSelectReturningWarehouseDate">
+        select
+        *
+        from
+        mm.returning_warehouse rw
+        <where>
+            date(rw.create_time)>=#{startDate} and date(rw.create_time) &lt;= #{endDate}
+            <if test="returningWarehouse.returningId != null and returningWarehouse.returningId != ''">
+                and rw.returning_id regexp #{returningWarehouse.returningId}
+            </if>
+            <if test="returningWarehouse.materialRequisitionPersonnel != null and returningWarehouse.materialRequisitionPersonnel != ''">
+                and rw.material_requisition_personnel regexp #{returningWarehouse.materialRequisitionPersonnel}
+            </if>
+            <if test="returningWarehouse.materialRequisitionTeam != null and returningWarehouse.materialRequisitionTeam != ''">
+                and rw.material_requisition_team regexp #{returningWarehouse.materialRequisitionTeam}
+            </if>
+            <if test="returningWarehouse.orderId != null and returningWarehouse.orderId != ''">
+                and rw.order_id regexp #{returningWarehouse.orderId}
+            </if>
+            <if test="returningWarehouse.returningType != null and returningWarehouse.returningType != ''">
+                and rw.returning_type regexp #{returningWarehouse.returningType}
+            </if>
+            <if test="returningWarehouse.warehouseManager != null and returningWarehouse.warehouseManager != ''">
+                and rw.warehouse_manager regexp #{returningWarehouse.warehouseManager}
+            </if>
+            <if test="returningWarehouse.reviewed != null and returningWarehouse.reviewed != ''">
+                and rw.reviewed regexp #{returningWarehouse.reviewed}
+            </if>
+            <if test="returningWarehouse.project != null and returningWarehouse.project != ''">
+                and rw.project regexp #{returningWarehouse.project}
+            </if>
+            <if test="returningWarehouse.batch != null and returningWarehouse.batch != ''">
+                and rw.batch regexp #{returningWarehouse.batch}
+            </if>
+
+
+
+        </where>
+        order by rw.reviewed_state desc,rw.create_time desc
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDatePageTotal">
+        select
+        CEILING(count(id)/#{pageSize}) as 'pageTotal',
+        count(id) as 'total'
+        from
+        mm.returning_warehouse rw
+        <where>
+            date(rw.create_time)>=#{startDate} and date(rw.create_time) &lt;= #{endDate}
+            <if test="returningWarehouse.returningId != null and returningWarehouse.returningId != ''">
+                and rw.returning_id regexp #{returningWarehouse.returningId}
+            </if>
+            <if test="returningWarehouse.materialRequisitionPersonnel != null and returningWarehouse.materialRequisitionPersonnel != ''">
+                and rw.material_requisition_personnel regexp #{returningWarehouse.materialRequisitionPersonnel}
+            </if>
+            <if test="returningWarehouse.materialRequisitionTeam != null and returningWarehouse.materialRequisitionTeam != ''">
+                and rw.material_requisition_team regexp #{returningWarehouse.materialRequisitionTeam}
+            </if>
+            <if test="returningWarehouse.orderId != null and returningWarehouse.orderId != ''">
+                and rw.order_id regexp #{returningWarehouse.orderId}
+            </if>
+            <if test="returningWarehouse.returningType != null and returningWarehouse.returningType != ''">
+                and rw.returning_type regexp #{returningWarehouse.returningType}
+            </if>
+            <if test="returningWarehouse.warehouseManager != null and returningWarehouse.warehouseManager != ''">
+                and rw.warehouse_manager regexp #{returningWarehouse.warehouseManager}
+            </if>
+            <if test="returningWarehouse.reviewed != null and returningWarehouse.reviewed != ''">
+                and rw.reviewed regexp #{returningWarehouse.reviewed}
+            </if>
+            <if test="returningWarehouse.project != null and returningWarehouse.project != ''">
+                and rw.project regexp #{returningWarehouse.project}
+            </if>
+            <if test="returningWarehouse.batch != null and returningWarehouse.batch != ''">
+                and rw.batch regexp #{returningWarehouse.batch}
+            </if>
         </where>
         limit #{offset},#{pageSize};
     </select>
@@ -198,6 +297,58 @@
     </select>
 
 
+    <select id="getSelectReturningWarehouse">
+        select
+        *
+        from
+        mm.returning_warehouse rw
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDetail" >
+        select
+        rwd.inventory_id as inventoryId,
+        mi.inventory_organization as inventoryOrganization,
+        rwd.material_code as id,
+        mi.producer,
+        rwd.return_quantity as returnQuantity,
+        date(mi.date_of_manufacture) as dateOfManufacture,
+        mi.single_piece_area as singlePieceArea,
+        mi.inventory_area as inventoryArea,
+        rwd.remarks,
+        mi.inventory_quantity as inventoryQuantity,
+        ms.json
+        from mm.returning_warehouse_detail rwd left join mm.material_inventory mi on rwd.inventory_id=mi.id
+        left join mm.returning_warehouse rw on rwd.returning_id=rw.returning_id
+        left join mm.material_store ms on rwd.material_code=ms.id
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and rwd.returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDetailPageTotal">
+        select
+        CEILING(count(id)/#{pageSize}) as 'pageTotal',
+        count(id) as 'total'
+        from
+        mm.returning_warehouse_detail rwd
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and rwd.returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+
     <insert id="insertMaterialStore"  useGeneratedKeys="true"  >
         insert into mm.material_store (type,json,create_time
         )
@@ -218,27 +369,59 @@
         delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
     </delete>
 
-    <select id="getmaximum" >
+    <delete id="deleteReturningWarehouseDetail" >
+        delete from mm.returning_warehouse_detail where returning_id=#{returningId}
+    </delete>
+
+    <select id="getMaximum" >
         select count(*) from mm.material_outbound where  date(create_time)=CURDATE()
+    </select>
+
+    <select id="getMaximums" >
+        select count(*) from mm.returning_warehouse where  date(create_time)=CURDATE()
     </select>
 
     <select id="getMaterialOutboundCount" >
         select count(*) from mm.material_outbound where  material_outbound_id=#{materialOutboundId}
     </select>
 
+    <select id="getReturningWarehouseCount" >
+        select count(*) from mm.returning_warehouse where  returning_id=#{returningId}
+    </select>
+
     <select id="getMaterialOutboundDetailMaximum" >
         select count(*) from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
+    </select>
+
+    <select id="getReturningWarehouseDetailMaximum" >
+        select count(*) from mm.returning_warehouse where  returning_id=#{returningId}
     </select>
 
     <select id="getMaterialInventoryCount" >
         select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
     </select>
 
+    <select id="getMaterialInventoryCountNull" >
+        select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null
+    </select>
+
+    <select id="getMaterialInventoryCountId" >
+        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
+    </select>
+
+    <select id="getMaterialInventoryCountNullId" >
+        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null
+    </select>
+
     <select id="getIsNotMaterialOutboundDetail" >
         select * from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
     </select>
 
-    <insert id="insertMaterialInventoryMapper"  useGeneratedKeys="true" >
+    <select id="getIsNotReturningWarehouseDetail" >
+        select * from mm.returning_warehouse_detail where  returning_id=#{returningId}
+    </select>
+
+    <insert id="insertMaterialOutbound"  useGeneratedKeys="true" >
         insert into mm.material_outbound(material_outbound_id,material_requisition_personnel,material_requisition_team,order_id,outbound_type,
                                          warehouse_manager,material_requisition_date,reviewed_state,create_time)
         values (
@@ -271,6 +454,36 @@
                )
     </insert>
 
+    <insert id="insertMaterialInventoryReturning"  useGeneratedKeys="true" >
+        insert into mm.material_inventory (inventory_organization, material_code, producer, stock_id,
+                                           inventory_quantity, available_quantity, safety_stock, total_area, single_piece_area,
+                                           date_of_manufacture, quality_guarantee_period, inventory_area, dead_stock, remarks, create_time)
+        values (
+                   #{returningWarehouseDetail.inventoryOrganization} ,#{materialCode},
+                   #{returningWarehouseDetail.producer},0,#{returningWarehouseDetail.returnQuantity},0,0,
+                   #{totalArea},#{singlePieceArea},#{returningWarehouseDetail.dateOfManufacture},#{returningWarehouseDetail.qualityGuaranteePeriod},
+                   #{returningWarehouseDetail.inventoryArea},0,#{returningWarehouseDetail.remarks},now()
+               )
+    </insert>
+
+
+    <insert id="insertReturningWarehouse"  useGeneratedKeys="true" >
+        insert into mm.returning_warehouse(returning_id, returning_type, material_requisition_personnel, material_requisition_team,
+                                           warehouse_manager, reviewed_state, order_id, batch, project, create_time)
+        values (
+                   #{number} ,#{returningWarehouse.returningType},#{returningWarehouse.materialRequisitionPersonnel},#{returningWarehouse.materialRequisitionTeam},
+                   #{returningWarehouse.warehouseManager},0,#{returningWarehouse.orderId},#{returningWarehouse.batch},#{returningWarehouse.project},now()
+               )
+    </insert>
+
+    <insert id="insertReturningWarehouseDetail"  useGeneratedKeys="true" >
+        insert into mm.returning_warehouse_detail (returning_id, returning_number, inventory_id, material_code, return_quantity,date_of_manufacture, remarks)
+        values (
+                   #{number} ,#{returningWarehouseNumber},#{returningWarehouseDetail.inventoryId},#{returningWarehouseDetail.id},
+                #{returningWarehouseDetail.returnQuantity},#{returningWarehouseDetail.dateOfManufacture},#{returningWarehouseDetail.remarks}
+               )
+    </insert>
+
     <update id="updateMaterialInventoryAvailableOut">
         update mm.material_inventory
         set available_quantity=available_quantity-#{quantity}
@@ -295,6 +508,18 @@
         where id=#{inventoryId}
     </update>
 
+    <update id="updateMaterialInventoryAvailableInventoryOut">
+        update mm.material_inventory
+        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity}
+        where id=#{inventoryId}
+    </update>
+
+    <update id="updateMaterialInventoryAvailableInventoryInt">
+        update mm.material_inventory
+        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity}
+        where id=#{inventoryId}
+    </update>
+
 
     <update id="updateMaterialOutboundToExamine">
         update mm.material_outbound set reviewed_state=#{reviewedState},reviewed=#{reviewed},reviewed_time=now()
@@ -306,6 +531,16 @@
         where material_outbound_id=#{materialOutboundId}
     </update>
 
+    <update id="updateReturningWarehouseToExamine">
+        update mm.returning_warehouse set reviewed_state=#{reviewedState},reviewed=#{reviewed},reviewed_time=now()
+        where returning_id=#{returningId}
+    </update>
+
+    <update id="updateReturningWarehouseCounterExamination">
+        update mm.returning_warehouse set reviewed_state=#{reviewedState}
+        where returning_id=#{returningId}
+    </update>
+
     <update id="updateMaterialInventory" >
         update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                          available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
@@ -313,5 +548,28 @@
                                      where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
     </update>
 
+    <update id="updateMaterialInventoryReturning" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+                                         total_area=total_area+#{totalArea}
+       where  material_code=#{materialCode} and
+                date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
+
+
+    </update>
+
+    <update id="updateMaterialInventoryReturningNull" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+                                         total_area=total_area+#{totalArea}
+        where  material_code=#{materialCode} and
+            date_of_manufacture is null
+
+
+    </update>
+
+    <update id="updateReturningWarehouseDetail" >
+        update mm.returning_warehouse_detail set inventory_id=#{materialInventoryId}
+        where  returning_id=#{number} and returning_number=#{returningWarehouseNumber}
+    </update>
+
 
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml b/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
index d23e448..1c3214b 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
@@ -20,6 +20,10 @@
         limit #{offset},#{pageSize};
     </select>
 
+    <select id="getSelectMaterialStoreById">
+        select * from mm.material_store m where id=#{id}
+    </select>
+
     <select id="getSelectMaterialStorePageTotal">
         select
         CEILING(count(id)/#{pageSize}) as 'pageTotal',
diff --git a/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml b/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
index 49a2cf3..108874f 100644
--- a/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
@@ -3,32 +3,7 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.erp.mapper.mm.MaterialInventoryMapper">
-    <resultMap id="SelectMaterialOutbound" type="com.example.erp.entity.mm.MaterialOutboundDetail">
 
-        <result column="mid" property="id"/>
-        <result column="material_outbound_id" property="materialOutboundId"/>
-        <result column="material_outbound_number" property="materialOutboundNumber"/>
-        <result column="inventory_organization" property="inventoryOrganization"/>
-        <result column="material_code" property="materialCode"/>
-        <result column="material_name" property="materialName"/>
-        <result column="producer" property="producer"/>
-        <result column="width" property="width"/>
-        <result column="height" property="height"/>
-        <result column="unit" property="unit"/>
-        <result column="thickness" property="thickness"/>
-        <result column="outbound_quantity" property="outboundQuantity"/>
-        <result column="single_piece_area" property="singlePieceArea"/>
-        <result column="inventory_area" property="inventoryArea"/>
-        <result column="date_of_manufacture" property="dateOfManufacture"/>
-        <result column="remarks" property="remarks"/>
-
-        <result column="inventory_quantity" property="materialInventory.inventoryQuantity"/>
-        <result column="available_quantity" property="materialInventory.availableQuantity"/>
-
-        <result column="reviewed_state" property="materialOutbound.reviewedState"/>
-
-
-    </resultMap>
 
 
     <select id="getSelectMaterialInventoryDate">
@@ -123,6 +98,27 @@
         mm.material_outbound mo
         <where>
             date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
+            <if test="materialOutbound.materialOutboundId != null and materialOutbound.materialOutboundId != ''">
+                and mo.material_outbound_id regexp #{materialOutbound.materialOutboundId}
+            </if>
+            <if test="materialOutbound.materialRequisitionPersonnel != null and materialOutbound.materialRequisitionPersonnel != ''">
+                and mo.material_requisition_personnel regexp #{materialOutbound.materialRequisitionPersonnel}
+            </if>
+            <if test="materialOutbound.materialRequisitionTeam != null and materialOutbound.materialRequisitionTeam != ''">
+                and mo.material_requisition_team regexp #{materialOutbound.materialRequisitionTeam}
+            </if>
+            <if test="materialOutbound.orderId != null and materialOutbound.orderId != ''">
+                and mo.order_id regexp #{materialOutbound.orderId}
+            </if>
+            <if test="materialOutbound.outboundType != null and materialOutbound.outboundType != ''">
+                and mo.outbound_type regexp #{materialOutbound.outboundType}
+            </if>
+            <if test="materialOutbound.warehouseManager != null and materialOutbound.warehouseManager != ''">
+                and mo.warehouse_manager regexp #{materialOutbound.warehouseManager}
+            </if>
+            <if test="materialOutbound.reviewed != null and materialOutbound.reviewed != ''">
+                and mo.reviewed regexp #{materialOutbound.reviewed}
+            </if>
         </where>
         order by mo.reviewed_state desc,mo.create_time desc
         limit #{offset},#{pageSize};
@@ -136,6 +132,109 @@
         mm.material_outbound mo
         <where>
             date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
+            <if test="materialOutbound.materialOutboundId != null and materialOutbound.materialOutboundId != ''">
+                and mo.material_outbound_id regexp #{materialOutbound.materialOutboundId}
+            </if>
+            <if test="materialOutbound.materialRequisitionPersonnel != null and materialOutbound.materialRequisitionPersonnel != ''">
+                and mo.material_requisition_personnel regexp #{materialOutbound.materialRequisitionPersonnel}
+            </if>
+            <if test="materialOutbound.materialRequisitionTeam != null and materialOutbound.materialRequisitionTeam != ''">
+                and mo.material_requisition_team regexp #{materialOutbound.materialRequisitionTeam}
+            </if>
+            <if test="materialOutbound.orderId != null and materialOutbound.orderId != ''">
+                and mo.order_id regexp #{materialOutbound.orderId}
+            </if>
+            <if test="materialOutbound.outboundType != null and materialOutbound.outboundType != ''">
+                and mo.outbound_type regexp #{materialOutbound.outboundType}
+            </if>
+            <if test="materialOutbound.warehouseManager != null and materialOutbound.warehouseManager != ''">
+                and mo.warehouse_manager regexp #{materialOutbound.warehouseManager}
+            </if>
+            <if test="materialOutbound.reviewed != null and materialOutbound.reviewed != ''">
+                and mo.reviewed regexp #{materialOutbound.reviewed}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+
+    <select id="getSelectReturningWarehouseDate">
+        select
+        *
+        from
+        mm.returning_warehouse rw
+        <where>
+            date(rw.create_time)>=#{startDate} and date(rw.create_time) &lt;= #{endDate}
+            <if test="returningWarehouse.returningId != null and returningWarehouse.returningId != ''">
+                and rw.returning_id regexp #{returningWarehouse.returningId}
+            </if>
+            <if test="returningWarehouse.materialRequisitionPersonnel != null and returningWarehouse.materialRequisitionPersonnel != ''">
+                and rw.material_requisition_personnel regexp #{returningWarehouse.materialRequisitionPersonnel}
+            </if>
+            <if test="returningWarehouse.materialRequisitionTeam != null and returningWarehouse.materialRequisitionTeam != ''">
+                and rw.material_requisition_team regexp #{returningWarehouse.materialRequisitionTeam}
+            </if>
+            <if test="returningWarehouse.orderId != null and returningWarehouse.orderId != ''">
+                and rw.order_id regexp #{returningWarehouse.orderId}
+            </if>
+            <if test="returningWarehouse.returningType != null and returningWarehouse.returningType != ''">
+                and rw.returning_type regexp #{returningWarehouse.returningType}
+            </if>
+            <if test="returningWarehouse.warehouseManager != null and returningWarehouse.warehouseManager != ''">
+                and rw.warehouse_manager regexp #{returningWarehouse.warehouseManager}
+            </if>
+            <if test="returningWarehouse.reviewed != null and returningWarehouse.reviewed != ''">
+                and rw.reviewed regexp #{returningWarehouse.reviewed}
+            </if>
+            <if test="returningWarehouse.project != null and returningWarehouse.project != ''">
+                and rw.project regexp #{returningWarehouse.project}
+            </if>
+            <if test="returningWarehouse.batch != null and returningWarehouse.batch != ''">
+                and rw.batch regexp #{returningWarehouse.batch}
+            </if>
+
+
+
+        </where>
+        order by rw.reviewed_state desc,rw.create_time desc
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDatePageTotal">
+        select
+        CEILING(count(id)/#{pageSize}) as 'pageTotal',
+        count(id) as 'total'
+        from
+        mm.returning_warehouse rw
+        <where>
+            date(rw.create_time)>=#{startDate} and date(rw.create_time) &lt;= #{endDate}
+            <if test="returningWarehouse.returningId != null and returningWarehouse.returningId != ''">
+                and rw.returning_id regexp #{returningWarehouse.returningId}
+            </if>
+            <if test="returningWarehouse.materialRequisitionPersonnel != null and returningWarehouse.materialRequisitionPersonnel != ''">
+                and rw.material_requisition_personnel regexp #{returningWarehouse.materialRequisitionPersonnel}
+            </if>
+            <if test="returningWarehouse.materialRequisitionTeam != null and returningWarehouse.materialRequisitionTeam != ''">
+                and rw.material_requisition_team regexp #{returningWarehouse.materialRequisitionTeam}
+            </if>
+            <if test="returningWarehouse.orderId != null and returningWarehouse.orderId != ''">
+                and rw.order_id regexp #{returningWarehouse.orderId}
+            </if>
+            <if test="returningWarehouse.returningType != null and returningWarehouse.returningType != ''">
+                and rw.returning_type regexp #{returningWarehouse.returningType}
+            </if>
+            <if test="returningWarehouse.warehouseManager != null and returningWarehouse.warehouseManager != ''">
+                and rw.warehouse_manager regexp #{returningWarehouse.warehouseManager}
+            </if>
+            <if test="returningWarehouse.reviewed != null and returningWarehouse.reviewed != ''">
+                and rw.reviewed regexp #{returningWarehouse.reviewed}
+            </if>
+            <if test="returningWarehouse.project != null and returningWarehouse.project != ''">
+                and rw.project regexp #{returningWarehouse.project}
+            </if>
+            <if test="returningWarehouse.batch != null and returningWarehouse.batch != ''">
+                and rw.batch regexp #{returningWarehouse.batch}
+            </if>
         </where>
         limit #{offset},#{pageSize};
     </select>
@@ -198,6 +297,58 @@
     </select>
 
 
+    <select id="getSelectReturningWarehouse">
+        select
+        *
+        from
+        mm.returning_warehouse rw
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDetail" >
+        select
+        rwd.inventory_id as inventoryId,
+        mi.inventory_organization as inventoryOrganization,
+        rwd.material_code as id,
+        mi.producer,
+        rwd.return_quantity as returnQuantity,
+        date(mi.date_of_manufacture) as dateOfManufacture,
+        mi.single_piece_area as singlePieceArea,
+        mi.inventory_area as inventoryArea,
+        rwd.remarks,
+        mi.inventory_quantity as inventoryQuantity,
+        ms.json
+        from mm.returning_warehouse_detail rwd left join mm.material_inventory mi on rwd.inventory_id=mi.id
+        left join mm.returning_warehouse rw on rwd.returning_id=rw.returning_id
+        left join mm.material_store ms on rwd.material_code=ms.id
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and rwd.returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getSelectReturningWarehouseDetailPageTotal">
+        select
+        CEILING(count(id)/#{pageSize}) as 'pageTotal',
+        count(id) as 'total'
+        from
+        mm.returning_warehouse_detail rwd
+        <where>
+            <if test="returningWarehouseDetail.returningId != null and returningWarehouseDetail.returningId != ''">
+                and rwd.returning_id regexp #{returningWarehouseDetail.returningId}
+            </if>
+        </where>
+        limit #{offset},#{pageSize};
+    </select>
+
+
     <insert id="insertMaterialStore"  useGeneratedKeys="true"  >
         insert into mm.material_store (type,json,create_time
         )
@@ -218,27 +369,59 @@
         delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
     </delete>
 
-    <select id="getmaximum" >
+    <delete id="deleteReturningWarehouseDetail" >
+        delete from mm.returning_warehouse_detail where returning_id=#{returningId}
+    </delete>
+
+    <select id="getMaximum" >
         select count(*) from mm.material_outbound where  date(create_time)=CURDATE()
+    </select>
+
+    <select id="getMaximums" >
+        select count(*) from mm.returning_warehouse where  date(create_time)=CURDATE()
     </select>
 
     <select id="getMaterialOutboundCount" >
         select count(*) from mm.material_outbound where  material_outbound_id=#{materialOutboundId}
     </select>
 
+    <select id="getReturningWarehouseCount" >
+        select count(*) from mm.returning_warehouse where  returning_id=#{returningId}
+    </select>
+
     <select id="getMaterialOutboundDetailMaximum" >
         select count(*) from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
+    </select>
+
+    <select id="getReturningWarehouseDetailMaximum" >
+        select count(*) from mm.returning_warehouse where  returning_id=#{returningId}
     </select>
 
     <select id="getMaterialInventoryCount" >
         select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
     </select>
 
+    <select id="getMaterialInventoryCountNull" >
+        select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null
+    </select>
+
+    <select id="getMaterialInventoryCountId" >
+        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
+    </select>
+
+    <select id="getMaterialInventoryCountNullId" >
+        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null
+    </select>
+
     <select id="getIsNotMaterialOutboundDetail" >
         select * from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
     </select>
 
-    <insert id="insertMaterialInventoryMapper"  useGeneratedKeys="true" >
+    <select id="getIsNotReturningWarehouseDetail" >
+        select * from mm.returning_warehouse_detail where  returning_id=#{returningId}
+    </select>
+
+    <insert id="insertMaterialOutbound"  useGeneratedKeys="true" >
         insert into mm.material_outbound(material_outbound_id,material_requisition_personnel,material_requisition_team,order_id,outbound_type,
                                          warehouse_manager,material_requisition_date,reviewed_state,create_time)
         values (
@@ -271,6 +454,36 @@
                )
     </insert>
 
+    <insert id="insertMaterialInventoryReturning"  useGeneratedKeys="true" >
+        insert into mm.material_inventory (inventory_organization, material_code, producer, stock_id,
+                                           inventory_quantity, available_quantity, safety_stock, total_area, single_piece_area,
+                                           date_of_manufacture, quality_guarantee_period, inventory_area, dead_stock, remarks, create_time)
+        values (
+                   #{returningWarehouseDetail.inventoryOrganization} ,#{materialCode},
+                   #{returningWarehouseDetail.producer},0,#{returningWarehouseDetail.returnQuantity},0,0,
+                   #{totalArea},#{singlePieceArea},#{returningWarehouseDetail.dateOfManufacture},#{returningWarehouseDetail.qualityGuaranteePeriod},
+                   #{returningWarehouseDetail.inventoryArea},0,#{returningWarehouseDetail.remarks},now()
+               )
+    </insert>
+
+
+    <insert id="insertReturningWarehouse"  useGeneratedKeys="true" >
+        insert into mm.returning_warehouse(returning_id, returning_type, material_requisition_personnel, material_requisition_team,
+                                           warehouse_manager, reviewed_state, order_id, batch, project, create_time)
+        values (
+                   #{number} ,#{returningWarehouse.returningType},#{returningWarehouse.materialRequisitionPersonnel},#{returningWarehouse.materialRequisitionTeam},
+                   #{returningWarehouse.warehouseManager},0,#{returningWarehouse.orderId},#{returningWarehouse.batch},#{returningWarehouse.project},now()
+               )
+    </insert>
+
+    <insert id="insertReturningWarehouseDetail"  useGeneratedKeys="true" >
+        insert into mm.returning_warehouse_detail (returning_id, returning_number, inventory_id, material_code, return_quantity,date_of_manufacture, remarks)
+        values (
+                   #{number} ,#{returningWarehouseNumber},#{returningWarehouseDetail.inventoryId},#{returningWarehouseDetail.id},
+                #{returningWarehouseDetail.returnQuantity},#{returningWarehouseDetail.dateOfManufacture},#{returningWarehouseDetail.remarks}
+               )
+    </insert>
+
     <update id="updateMaterialInventoryAvailableOut">
         update mm.material_inventory
         set available_quantity=available_quantity-#{quantity}
@@ -295,6 +508,18 @@
         where id=#{inventoryId}
     </update>
 
+    <update id="updateMaterialInventoryAvailableInventoryOut">
+        update mm.material_inventory
+        set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity}
+        where id=#{inventoryId}
+    </update>
+
+    <update id="updateMaterialInventoryAvailableInventoryInt">
+        update mm.material_inventory
+        set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity}
+        where id=#{inventoryId}
+    </update>
+
 
     <update id="updateMaterialOutboundToExamine">
         update mm.material_outbound set reviewed_state=#{reviewedState},reviewed=#{reviewed},reviewed_time=now()
@@ -306,6 +531,16 @@
         where material_outbound_id=#{materialOutboundId}
     </update>
 
+    <update id="updateReturningWarehouseToExamine">
+        update mm.returning_warehouse set reviewed_state=#{reviewedState},reviewed=#{reviewed},reviewed_time=now()
+        where returning_id=#{returningId}
+    </update>
+
+    <update id="updateReturningWarehouseCounterExamination">
+        update mm.returning_warehouse set reviewed_state=#{reviewedState}
+        where returning_id=#{returningId}
+    </update>
+
     <update id="updateMaterialInventory" >
         update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                          available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
@@ -313,5 +548,28 @@
                                      where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
     </update>
 
+    <update id="updateMaterialInventoryReturning" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+                                         total_area=total_area+#{totalArea}
+       where  material_code=#{materialCode} and
+                date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
+
+
+    </update>
+
+    <update id="updateMaterialInventoryReturningNull" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity},
+                                         total_area=total_area+#{totalArea}
+        where  material_code=#{materialCode} and
+            date_of_manufacture is null
+
+
+    </update>
+
+    <update id="updateReturningWarehouseDetail" >
+        update mm.returning_warehouse_detail set inventory_id=#{materialInventoryId}
+        where  returning_id=#{number} and returning_number=#{returningWarehouseNumber}
+    </update>
+
 
 </mapper>
\ No newline at end of file
diff --git a/north-glass-erp/target/classes/mapper/mm/MaterialStore.xml b/north-glass-erp/target/classes/mapper/mm/MaterialStore.xml
index d23e448..1c3214b 100644
--- a/north-glass-erp/target/classes/mapper/mm/MaterialStore.xml
+++ b/north-glass-erp/target/classes/mapper/mm/MaterialStore.xml
@@ -20,6 +20,10 @@
         limit #{offset},#{pageSize};
     </select>
 
+    <select id="getSelectMaterialStoreById">
+        select * from mm.material_store m where id=#{id}
+    </select>
+
     <select id="getSelectMaterialStorePageTotal">
         select
         CEILING(count(id)/#{pageSize}) as 'pageTotal',

--
Gitblit v1.8.0