guoyuji
2024-03-29 d3475019350136c3946afcb3a831a5444e97bc17
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
14个文件已修改
2个文件已添加
2037 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorage.vue 332 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/ReturnToStorageCreate.vue 567 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialStoreMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java 227 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml 312 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml 312 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/mm/MaterialStore.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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},
  ],//表头按钮
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=/\./ // 定义正则表达式,查找小数点
  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>
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=/\./ // 定义正则表达式,查找小数点
  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>
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
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
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));
    }
north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouse.java
New file
@@ -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;
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/ReturningWarehouseDetail.java
New file
@@ -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;
}
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);
}
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);
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;
    }
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>
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',
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>
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',