guoyuji
2024-03-27 baeae530bc5dfdd23359f34b047f449c1541359f
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
30个文件已修改
2 文件已重命名
8个文件已添加
2928 ■■■■ 已修改文件
north-glass-erp/.idea/dataSources.local.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/Ingredients.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue 535 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/IngredientsStock.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue 250 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue 699 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedGoodsIssue.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedProductOut.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedProductRework.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/OrderAllocation.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/ProductStockList.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/ReworkRecord.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/StorageRecord.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/TakeOutRecord.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/TransferRecord.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/Replenish/SelectReplenish.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/rework/SelectRework.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectOrderList.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/BasicWarehouseTypeController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialStoreController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialInventory.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialOutbound.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialOutboundDetail.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/BasicWarehouseTypeMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/BasicWarehouseTypeService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java 304 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml 317 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml 317 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/mm/MaterialStore.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/.idea/dataSources.local.xml
@@ -23,6 +23,7 @@
      <database-info product="MySQL" version="8.0.19" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.19" exact-driver-version="8.0">
        <extra-name-characters>#@</extra-name-characters>
        <identifier-quote-string>`</identifier-quote-string>
        <jdbc-catalog-is-schema>true</jdbc-catalog-is-schema>
      </database-info>
      <case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
      <secret-storage>master_key</secret-storage>
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/CreateIngredients.vue
@@ -91,7 +91,7 @@
  }
  console.log(materialStore)
  if(isBool){
    request.post("/Material/saveMaterialStore", materialStore).then((res) => {
    request.post("/MaterialStore/saveMaterialStore", materialStore).then((res) => {
      if(res.code==200){
        resetForm()
        ElMessage.success('保存成功')
@@ -104,14 +104,14 @@
}
onMounted(()=>{
  //获取传过来的数据进行判断
  const str = route.query.id
  if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){
    ruleForm.value.id = Number(str)
    request.post(`/Material/getSelectMaterialStore/1/100`,ruleForm.value).then((res) => {
    request.post(`/MaterialStore/getSelectMaterialStore/1/100`,ruleForm.value).then((res) => {
      if(res.code==200){
        ruleForm.value=deepClone(res.data.data[0])
        value.value=ruleForm.value.type
@@ -127,8 +127,6 @@
    })
  }
})
</script>
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/Ingredients.vue
@@ -7,11 +7,15 @@
import request from "@/utils/request";
import deepClone from "@/utils/deepClone";
import {ElMessage} from "element-plus";
import {useRouter} from "vue-router";
import  GlassType from '@/components/basic/product/GlassType.vue'
import {useRouter,useRoute,onBeforeRouteUpdate} from "vue-router";
import { useI18n } from 'vue-i18n'
//语言获取
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
let indexFlag=$ref(1)
function changeRouter(index){
  indexFlag=index
@@ -30,7 +34,7 @@
    </div>
    <div id="main-body">
      <router-view  />
      <router-view  :key="route.fullPath" />
    </div>
  </div>
</template>
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue
@@ -20,7 +20,7 @@
      let flowData = ref({
        id: row.id
      })
      request.post("/Material/deleteMaterialStore",flowData.value).then((res) => {
      request.post("/MaterialStore/deleteMaterialStore",flowData.value).then((res) => {
        if(res.code==200){
          ElMessage.success("删除成功")
          router.push({path:'/main/ingredients/SelectIngredients',query:{random:Math.random()}})
@@ -66,7 +66,7 @@
let total = reactive({
  pageTotal : 0,
  dataTotal : 0,
  pageSize : 2
  pageSize : 10
})
let filterData = ref({
@@ -78,13 +78,13 @@
let materialStore= ref([])
let arr = [
  {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: 'seq',fixed:'left', title: '自序', width: '80' },
  {field: 'id', width: '150',title: '物料编码', sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
]
/*//第一次加载默认
//第一次加载默认
value.value='原片'
filterData.value.type='原片'
request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
@@ -93,11 +93,10 @@
    console.log(res.data)
    BasicData.value = res.data
    //添加列
    gridOptions.columns=arr
    gridOptions.columns=arr.slice()
    for (let i=0;i<BasicData.value.length;i++){
      let aa={field: BasicData.value[i].OperateType, width: '150',title: BasicData.value[i].OperateTypeName, sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
      console.log(gridOptions.columns)
      gridOptions.columns.push(aa)
    }
@@ -106,7 +105,7 @@
  }else{
    ElMessage.warning(res.msg)
  }
})*/
})
//列查询
@@ -142,16 +141,15 @@
//数据绑定
const getWorks = () => {
  console.log(filterData.value)
  request.post(`/Material/getSelectMaterialStore/1/${total.pageSize}`,filterData.value).then((res) => {
  request.post(`/MaterialStore/getSelectMaterialStore/1/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      console.log(res.data.data)
      console.log(res.data)
      materialStore.value=[]
      for (let i=0;i<res.data.data.length;i++){
        materialStore.value[i]= JSON.parse(res.data.data[i].json)
        materialStore.value[i].id= res.data.data[i].id
      }
      console.log(materialStore)
      total.dataTotal = res.data.total.total*1
      total.pageTotal= res.data.total.pageTotal
@@ -170,7 +168,7 @@
//分页查询
const getWorkPaging = () => {
  console.log(filterData.value)
  request.post(`/Material/getSelectMaterialStore/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
  request.post(`/MaterialStore/getSelectMaterialStore/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      console.log(res.data.data)
@@ -179,6 +177,7 @@
        materialStore.value[i]= JSON.parse(res.data.data[i].json)
        materialStore.value[i].id= res.data.data[i].id
      }
      produceList = deepClone(materialStore.value)
      xGrid.value.loadData(produceList)
@@ -196,16 +195,18 @@
  request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
    if(res.code==200){
      gridOptions.columns.splice(0,gridOptions.columns.length)
      console.log(res.data)
      BasicData.value = res.data
      //添加列
      gridOptions.columns=arr
      gridOptions.columns=arr.slice()
      for (let i=0;i<BasicData.value.length;i++){
        let aa={field: BasicData.value[i].OperateType, width: '150',title: BasicData.value[i].OperateTypeName, sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
        console.log(gridOptions.columns)
        gridOptions.columns.push(aa)
      }
      if (res.data.total!=null){
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
      }
      getWorkPaging()
@@ -262,9 +263,9 @@
  ],//表头按钮
  toolbarConfig: {
    import: false,
    /*import: false,
    export: true,
    print: true,
    print: true,*/
    zoom: true,
    custom: true
  },
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue
@@ -3,9 +3,27 @@
<script setup>
import {reactive} from "vue";
import {useRouter} from  'vue-router'
let router=useRouter()
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 getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
@@ -20,10 +38,339 @@
  }
}
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({
  outboundType:""
})
// 定义表头上传数据
let titleUploadData = ref({
  outboundType:'',
  materialOutboundId:'',
  materialRequisitionPersonnel:'',
  materialRequisitionTeam:'',
  orderId:'',
  materialRequisitionDate:'',
  reviewedState:'',
  reviewed:'',
  warehouseManager:userStore.user.userName
})
//筛选条件,有外键需要先定义明细里面的数据
let filterData = ref({
})
let BasicData = ref([])
let materialStore= ref([])
let arr = [
  {type:'expand',fixed:"left",slots: { content:'content' },width: '60'},
  {field: 'select',type: 'checkbox',fixed:"left", title: '选择', width: '80' },
  { type: 'seq',fixed:"left", title: '自序', width: '80' },
  {field: 'inventoryOrganization', width:'150', title: '库存组织', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged },
  {field: 'materialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'producer', width: '100',title: '产地', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'inventoryQuantity',width: '100', title: '库存数量', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'availableQuantity', width: '100',title: '可用库存', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'outboundQuantity', width:'150', title: '出库数量', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
  {field: 'singlePieceArea', width: '100',title: '单片面积', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'dateOfManufacture',width: '100', title: '生产日期', sortable: true},
  {field: 'inventoryArea',width: '100', title: '库存区域', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'remarks',width: '80', title: '备注', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
]
//页面第一次加载
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.materialRequisitionDate = today.getFullYear() +
        '-' + ("0" + (today.getMonth() + 1)).slice(-2)
        + '-' + ("0" + today.getDate()).slice(-2)
    getWork()
  }else{
    ElMessage.warning(res.msg)
  }
})
//列查询
const getWork = () => {
  request.get(`/BasicWarehouse/BasicWarehouseType/原片|辅料`).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  number = ref();
onMounted(()=>{
  //启用表格拖动选中
  addListener(xGrid.value,gridOptions,cellArea.value)
  //出库新增
  const id = route.query.id
  if (typeof id !== 'undefined' && id !== null && id !== '' && id !== '\n' && id !== '\r'){
    filterData.value.stockId=id
    number.value=id
    console.log(filterData.value)
    //第一次调用
    request.post("/MaterialInventory/getSelectMaterialInventory/1/100",filterData.value).then((res) => {
      if(res.code==200){
        console.log(res.data.data)
        titleUploadData.value.warehouseManager=userStore.user.userName
        titleUploadData.value.outboundType = titleSelectJson.value.outboundType[0].operateTypeName
        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)
        //禁用按钮
        gridOptions.toolbarConfig.buttons[1].disabled  = true
        gridOptions.toolbarConfig.buttons[2].disabled = true
        //显示复选框
        xGrid.value.showColumn("select")
        gridOptions.loading=false
      }else{
        ElMessage.warning(res.msg)
      }
    })
  }
//出库编辑
  const str = route.query.materialOutboundId
  if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){
    filterData.value.materialOutboundId=str
    console.log(filterData.value)
    //第一次调用
    request.post("/MaterialInventory/getSelectMaterialOutbound/1/100",filterData.value).then((res) => {
      if(res.code==200){
        titleUploadData.value=deepClone(res.data.materialOutbound)
        //根据审核状态显示审核按钮或者是反审按钮
        console.log(res.data.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)
      }
    })
  }
})
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 outboundType = titleUploadData.value.outboundType
          if(outboundType === null || outboundType === undefined || outboundType === ''){
            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
          }
          let flowData = ref({
            materialOutboundDetail: selectRecords,
            title: titleUploadData.value,
            materialOutboundId: route.query.materialOutboundId
          })
          console.log(flowData)
          request.post("/MaterialInventory/saveMaterialOutbound", 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({
            materialOutboundId: route.query.materialOutboundId,
            reviewed:userStore.user.userName,
            type: 1
          })
          console.log(flowData.value)
          request.post("/MaterialInventory/updateMaterialOutboundToExamine", 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({
            materialOutboundId: route.query.materialOutboundId,
            type: 0
          })
          request.post("/MaterialInventory/updateMaterialOutboundToExamine", 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({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -42,7 +389,7 @@
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
    //remote: true
  },
  customConfig: {
    storage: true
@@ -53,36 +400,17 @@
    showStatus: true
  },//表头参数
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
    { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
    // { type: 'seq',fixed:"left", title: '自序', width: '80' },
    {title: '操作', width: '110', slots: { default: 'button_slot' },fixed:"left"},
    {field: 'MaterialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'MaterialName', width: '120',title: '物料名称', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'InventoryCount',width: '100', title: '库存数量', sortable: true},
    {field: 'OutNum', width:'150', title: '出库数量', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'Origin', width: '100',title: '产地', sortable: true},
    {field: 'Width', width: '80',title: '宽度', sortable: true},
    {field: 'Height',width: '100', title: '高度', sortable: true},
    {field: 'Thickness', width: '100',title: '厚度', sortable: true},
    {field: 'MainUnit',width: '100', title: '单位', sortable: true},
    {field: 'SafetyStock', width: '100',title: '单片面积', sortable: true},
    {field: 'AvailableInventory', width: '100',title: '换算率', sortable: true},
    {field: 'UnclaimedQuantity',width: '140', title: '未领取数量', sortable: true},
    {field: 'TotalArea',width: '100', title: '库区', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
    {field: 'ProductionDate',width: '100', title: '库位', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
    {field: 'ShelfLife',width: '100', title: '工程单号', sortable: true},
    {field: 'LocationNumber',width: '100', title: '生产日期', sortable: true},
    {field: 'remark',width: '80', title: '备注', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
  ],//表头按钮
  toolbarConfig: {
    buttons: [
        {'name': '提交',status:'primary'},
        {'name': '审核',status:'primary', 'disabled': true}
      {'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
  },
@@ -106,86 +434,73 @@
})
/*数据校验*/
const validRules = ref({
  outboundQuantity: [{
    validator (e) {
      if (e.row.outboundQuantity > e.row.availableQuantity) {
        return new Error("出库数量不能大于可用数量")
      }else if (e.row.outboundQuantity ==="") {
        return new Error("出库数量不能为空或者是等于0")
      }
      const regex = /^[1-9]\d*$/g
      if ( !regex.test(e.row.outboundQuantity) ) {
        return new Error(t('productStock.pleaseEnterAPositiveInteger'))
      }
    }
  }]
})
</script>
<template>
  <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;height: 30px"
  <div class="main-div">
  <div class="order-primary" style="background-color: white">
    <el-row>
      <el-col  :span="2"><el-text>领料日期:</el-text></el-col>
      <el-col  :span="3"><el-input  v-model="titleUploadData.materialRequisitionDate" :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-row>
    <el-row>
      <el-col  :span="2"><el-text>出库类型:</el-text></el-col>
      <el-col  :span="3">
        <el-select v-model="titleUploadData.outboundType"  clearable placeholder=""  >
          <el-option
              v-for="item in titleSelectJson['outboundType']"
              :key="item.id"
              :label="item.operateTypeName"
              :value="item.operateTypeName"
      />
        </el-select>
    </el-col>
    <el-col :span="4">
    <el-input v-model="productName" placeholder="请输入领料员名称" style="width: 200px; height: 30px;" />
    </el-col>
    <el-col :span="4">
    <el-input v-model="banzu" placeholder="请输入领料班组" style="width: 200px; height: 30px;" />
    </el-col>
    <el-col :span="7">
    仓管员<el-input v-model="banzu" placeholder="王翠兰" style="width: 200px; height: 30px;" />
    </el-col>
<!--    <el-col span="4">-->
<!--      <el-button id="searchButton" type="primary" :icon="Search">查询报表</el-button>-->
<!--    </el-col>-->
  </el-row>
      <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-row gutter="10" >
    <el-col :span="2.5">
      <div class="label-text">库存组织</div>
    </el-col>
    <el-col :span="4">
                  <el-dropdown>
                    <el-button type="primary">
                      请选择库存组织<el-icon class="el-icon--right" style="width: 66px;height: 30px"><arrow-down /></el-icon>
                    </el-button>
                    <template #dropdown>
                      <el-dropdown-menu>
                        <el-dropdown-item>人工库</el-dropdown-item>
                        <el-dropdown-item>计划库</el-dropdown-item>
                        <el-dropdown-item>自动化库</el-dropdown-item>
                      </el-dropdown-menu>
                    </template>
                  </el-dropdown>
                </el-col>
    <el-col :span="4">
      <el-dropdown>
        <el-button type="primary">
          请选择出库类型<el-icon class="el-icon--right" style="width:66px;"><arrow-down /></el-icon>
        </el-button>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>标准出库</el-dropdown-item>
            <el-dropdown-item>补单领料</el-dropdown-item>
            <el-dropdown-item>返工领料</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </el-col>
    <el-col :span="12">
      <el-input v-model="banzu" placeholder="请输入销售单号" style="width: 200px; height: 30px;" />
    </el-col>
<!--    <el-col span="4">-->
<!--      <el-button id="searchButton" type="primary" :icon="Search">提交</el-button>-->
<!--    </el-col>-->
    <!--    <el-col span="4">-->
    <!--      <el-button id="searchButton" type="primary" :icon="Search">查询报表</el-button>-->
    <!--    </el-col>-->
  </el-row>
  </div>
  <div class="main-div-customer">
    <vxe-grid
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
        :edit-rules="validRules"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
@@ -216,11 +531,35 @@
    </vxe-grid>
  </div>
  </div>
</template>
<style scoped>
.main-div-customer{
  width: 99%;
.main-div {
  width: 100%;
  height: 100%;
}
.el-col{
  border: #181818 1px solid;
}
:deep(.el-input__wrapper) {
  box-shadow: 0 0 0 0 var(--el-input-border-color, var(--el-border-color)) inset;
  cursor: default;
  border: none !important;
  background-color: transparent;
}
.order-primary{
  width: 100%;
}
.main-div-customer{
  width: 100%;
  height: 70%;
}
.vxe-grid {
  /* 禁用浏览器默认选中 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
</style>
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/IngredientsStock.vue
@@ -7,11 +7,15 @@
import request from "@/utils/request";
import deepClone from "@/utils/deepClone";
import {ElMessage} from "element-plus";
import {useRouter} from "vue-router";
import  GlassType from '@/components/basic/product/GlassType.vue'
import {useRouter,useRoute,onBeforeRouteUpdate} from "vue-router";
import { useI18n } from 'vue-i18n'
//语言获取
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
let indexFlag=$ref(1)
function changeRouter(index){
  indexFlag=index
@@ -33,7 +37,7 @@
    </div>
    <div id="main-body">
      <router-view  />
      <router-view  :key="route.fullPath" />
    </div>
  </div>
</template>
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
@@ -5,25 +5,95 @@
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/CreateOutbound', query: { materialOutboundId: row.materialOutboundId }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
      let flowData = ref({
        materialOutboundId:row.materialOutboundId
      })
      request.post("/MaterialInventory/deleteMaterialOutbound",flowData.value).then((res) => {
        if(res.code==200){
          ElMessage.success(t('searchOrder.msgDeleteSuccess'))
          router.push({path:'/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
        }else{
          ElMessage.warning(res.msg)
          router.push("/login")
        }
      })
      return
    }
  }
}
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 : 10
})
let filterData = ref({
})
let selectDate = ref(["",""])
request.post(`/MaterialInventory/getSelectMaterialOutboundDate/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  xGrid = ref();
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -53,116 +123,29 @@
    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: 'InventoryOrganization', width:'150', title: '库存组织', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'MaterialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'MaterialName', width: '120',title: '物料名称', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'InventoryCount',width: '100', title: '库存数量', sortable: true},
    {field: 'OutNum', width:'150', title: '出库数量', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'Origin', width: '100',title: '产地', sortable: true},
    {field: 'InventoryNumber',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: 'MainUnit',width: '100', title: '主单位', sortable: true},
    {field: 'SafetyStock', width: '100',title: '安全库存', sortable: true},
    {field: 'AvailableInventory', width: '100',title: '可用库存', sortable: true},
    {field: 'UnclaimedQuantity',width: '140', title: '未领取数量', sortable: true},
    {field: 'TotalArea',width: '100', title: '总面积', sortable: true},
    {field: 'ProductionDate',width: '100', title: '生产日期', sortable: true},
    {field: 'ShelfLife',width: '100', title: '保质期', sortable: true},
    {field: 'LocationNumber',width: '100', title: '库位编号', sortable: true},
    {field: 'StorageArea',width: '100', title: '存储区域', sortable: true},
    {field: 'Location',width: '100', title: '库位', sortable: true},
    {field: 'BacklogInventory',width: '100', title: '积压库存', sortable: true},
    {field: 'remark',width: '80', title: '备注', sortable: true},
    {field: 'reviewedState',title: '审核', width: 50, slots: { default: 'state' },},
    {field: 'materialOutboundId', width:'150', title: '出库单号', sortable: true},
    {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: 'materialRequisitionDate', width: '80',title: '领料日期', sortable: true},
    {field: 'reviewed',width: '100', title: '审核员', sortable: true},
    {field: 'reviewedTime', width: '100',title: '审核时间', sortable: true},
    {field: 'createTime',width: '100', title: '创建时间', sortable: true},
  ],//表头按钮
  toolbarConfig: {
    buttons: [{
      code:'add','name': '出库新增',status:'primary'
    }],
    import: false,
    /*import: false,
    export: true,
    print: true,
    print: true,*/
    zoom: true,
    custom: true
  },
  data:  [
    {
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装170",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "5",
      "InventoryCount": "20",
      "AvailableInventory": "9",
      "UnclaimedQuantity": "2",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },
    {
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装175",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "5",
      "InventoryCount": "20",
      "AvailableInventory": "9",
      "UnclaimedQuantity": "2",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },{
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装180",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "2",
      "InventoryCount": "23",
      "AvailableInventory": "4",
      "UnclaimedQuantity": "3",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },
  ],//table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
@@ -179,28 +162,27 @@
})
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/CreateOutbound'});
          return;
          break
        }
      }
    }
  }
}
</script>
<template>
  <div class="main-div-customer">
    <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"
@@ -223,7 +205,7 @@
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>
        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>
<!--        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>-->
      </template>
      <template #num1_filter="{ column, $panel }">
@@ -234,10 +216,24 @@
        </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>
  </div>
</template>
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectIngredientsStock.vue
@@ -1,8 +1,23 @@
<script setup>
import {reactive} from "vue";
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";
import {changeFilterEvent,filterChanged} from "@/hook"
//语言获取
const { t } = useI18n()
const router = useRouter()
let produceList = ref([])
let produceLists = ref([])
let dialogTableVisible = ref(false)
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
@@ -17,10 +32,173 @@
  }
}
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 : 2
})
let filterData = ref({
})
let selectDate = ref(["",""])
let BasicData = ref([])
let materialStore= ref([])
let arr = [
  {type:'expand',fixed:"left",slots: { content:'content' },width: '60'},
  { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
  { type: 'seq',fixed:"left", title: '自序', width: '80' },
  {field: 'inventoryOrganization', width:'150', title: '库存组织', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged },
  {field: 'materialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'producer', width: '100',title: '产地', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'id',width: '100', title: '库存编号', sortable: true,showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  //{field: 'safetyStock', width: '100',title: '安全库存', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'inventoryQuantity',width: '100', title: '库存数量', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'availableQuantity', width: '100',title: '可用库存', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'totalArea',width: '100', title: '总面积', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'dateOfManufacture',width: '100', title: '生产日期', sortable: true},
  {field: 'qualityGuaranteePeriod',width: '100', title: '保质期', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'inventoryArea',width: '100', title: '库存区域', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  //{field: 'deadStock',width: '100', title: '积压库存', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'createTime',width: '100', title: '入库时间', sortable: true},
  {field: 'remarks',width: '80', title: '备注', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
]
request.get(`/BasicWarehouse/BasicWarehouseType/原片|辅料`).then((res) => {
  if(res.code==200){
    gridOptions.columns.splice(0,gridOptions.columns.length)
    BasicData.value = res.data
    //添加列
    gridOptions.columns=arr.slice()
    for (let i=0;i<BasicData.value.length;i++){
      let aa={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(aa)
    }
    getInventoryWorks()
  }else{
    ElMessage.warning(res.msg)
  }
})
const getInventoryWorks = () => {
  request.post(`/MaterialInventory/getSelectMaterialInventoryDate/1/${total.pageSize}/${selectDate.value}`,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))
      }
      total.dataTotal = res.data.total.total*1
      total.pageTotal= res.data.total.pageTotal
      pageNum.value=1
      selectDate.value = res.data.selectDate
      produceList = deepClone(materialStore.value)
      xGrid.value.loadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
      router.push("/login")
    }
  })
}
const getInventoryWorkPaging = () => {
  console.log(filterData.value)
  request.post(`/MaterialInventory/getSelectMaterialInventoryDate/${pageNum.value}/${total.pageSize}/${selectDate.value}`,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))
      }
      if (res.data.total!=null){
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
      }
      produceList = deepClone(materialStore.value)
      selectDate.value = res.data.selectDate
      xGrid.value.loadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
      router.push("/login")
    }
  })
}
const selectOrderList = ()=>{
  request.get(`/BasicWarehouse/BasicWarehouseType/原片|辅料`).then((res) => {
    if(res.code==200){
      gridOptions.columns.splice(0,gridOptions.columns.length)
      BasicData.value = res.data
      //添加列
      gridOptions.columns=arr.slice()
      for (let i=0;i<BasicData.value.length;i++){
        let aa={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(aa)
      }
      getInventoryWorkPaging()
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
const changeDate =  ()=>{
  selectOrderList()
}
//页脚跳转
const handlePageChange = ({ currentPage, pageSize }) => {
  selectOrderList()
  total.pageTotal = pageSize
  pageNum.value=currentPage
}
//子组件接收参数
const xGrid = ref()
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -39,7 +217,7 @@
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
    //remote: true
  },
  customConfig: {
    storage: true
@@ -50,112 +228,19 @@
    showStatus: true
  },//表头参数
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
    // { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
    { type: 'seq',fixed:"left", title: '自序', width: '80' },
    // {title: '操作', width: '110', slots: { default: 'button_slot' },fixed:"left"},
    {field: 'InventoryOrganization', width:'150', title: '库存组织', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'MaterialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'MaterialName', width: '120',title: '物料名称', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'Origin', width: '100',title: '产地', sortable: true},
    {field: 'InventoryNumber',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: 'MainUnit',width: '100', title: '主单位', sortable: true},
    {field: 'SafetyStock', width: '100',title: '安全库存', sortable: true},
    {field: 'InventoryCount',width: '100', title: '库存数量', sortable: true},
    {field: 'AvailableInventory', width: '100',title: '可用库存', sortable: true},
    {field: 'UnclaimedQuantity',width: '140', title: '未领取数量', sortable: true},
    {field: 'TotalArea',width: '100', title: '总面积', sortable: true},
    {field: 'ProductionDate',width: '100', title: '生产日期', sortable: true},
    {field: 'ShelfLife',width: '100', title: '保质期', sortable: true},
    {field: 'LocationNumber',width: '100', title: '库位编号', sortable: true},
    {field: 'StorageArea',width: '100', title: '存储区域', sortable: true},
    {field: 'Location',width: '100', title: '库位', sortable: true},
    {field: 'BacklogInventory',width: '100', title: '积压库存', sortable: true},
    {field: 'remark',width: '80', title: '备注', sortable: true},
  ],//表头按钮
  toolbarConfig: {
    // buttons: [{
    //   'name': '新增'
    // }],
    import: false,
    buttons: [
      {'code': 'out', 'name': '物料出库',status: 'primary'},
      {'code': 'add', 'name': '物料新增',status: 'primary'},
    ],
    /*import: false,
    export: true,
    print: true,
    print: true,*/
    zoom: true,
    custom: true
  },
  data:  [
    {
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装170",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "5",
      "InventoryCount": "20",
      "AvailableInventory": "9",
      "UnclaimedQuantity": "2",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },
    {
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装175",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "5",
      "InventoryCount": "20",
      "AvailableInventory": "9",
      "UnclaimedQuantity": "2",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },{
      "InventoryOrganization": "人工库",
      "MaterialCode": "700900000000115",
      "MaterialName": "冬装180",
      "Origin": "China",
      "InventoryNumber": "KC2006891",
      "Width": '',
      "Height": "",
      "Thickness": "",
      "MainUnit": "件",
      "SafetyStock": "2",
      "InventoryCount": "23",
      "AvailableInventory": "4",
      "UnclaimedQuantity": "3",
      "TotalArea": "0",
      "ProductionDate": "2016-10-17",
      "ShelfLife": "0",
      "LocationNumber": "0",
      "StorageArea": "0",
      "Location": "0",
      "BacklogInventory": "40",
      "remark": "测试",
    },
  ],//table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
@@ -173,17 +258,322 @@
})
const gridEvents = {
  async toolbarButtonClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'out': {
          const selectRecords = $grid.getCheckboxRecords()
          if (selectRecords.length === 0) {
            ElMessage.warning(t('productStock.unselectedData'))
            return
          }
          let id = ""
          const array = [];
          for (let i = 0; i < selectRecords.length; i++) {
            array.push(selectRecords[i].id)
            if (i + 1 === selectRecords.length) {
              id += selectRecords[i].id
            } else {
              id += selectRecords[i].id + "|"
            }
          }
          router.push({path: '/main/ingredientsStock/CreateOutbound', query: {id: id}})
          break
        }
        case 'add': {
          dialogTableVisible.value=true
          select()
          //第一次加载默认
          value.value='原片'
          filterData.value.type='原片'
          request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
            if(res.code==200){
              gridOption.columns.splice(0,gridOption.columns.length)
              console.log(res.data)
              BasicData.value = res.data
              //添加列
              gridOption.columns=arr.slice()
              for (let i=0;i<BasicData.value.length;i++){
                let aa={field: BasicData.value[i].OperateType, width: '150',title: BasicData.value[i].OperateTypeName, sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
                gridOption.columns.push(aa)
              }
              getStoreWork()
            }else{
              ElMessage.warning(res.msg)
            }
          })
          break
        }
      }
    }
  }
}
let arrs = [
  { type: 'radio',fixed:"left", title: '选择', width: '80' },
  { type: 'seq',fixed:'left', title: '自序', width: '80' },
  {field: 'id', width: '150',title: '物料编码', sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
]
const value = ref('')
const options = [
  {
    value: '原片',
    label: '原片'
  },
  {
    value: '辅料',
    label: '辅料',
  }
]
let filterDatas = ref({
  type:''
})
let BasicDatas = ref([])
let materialStores= ref([])
//定义接收加载表头下拉数据
const titleSelectJson = ref({
  inventoryOrganization:""
})
// 定义表头上传数据
let titleUploadData = ref({
  producer:'',
  dateOfManufacture:'',
  qualityGuaranteePeriod:'',
  inventoryOrganization:'',
  inventoryArea:'',
  inventoryQuantity:'',
  remarks:''
})
//物料新增
const xGrids = ref()
const gridOption = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  id: 'CustomerList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    //remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },//表头参数
  columns:[
  ],//表头按钮
  toolbarConfig: {
    buttons: [
      {'code': 'add', 'name': t('basicData.save'),status: 'primary',icon: 'vxe-icon-save'},
    ],
  }
})
const select=() =>{
  request.get(`/BasicWarehouse/BasicWarehouseTypes/库存组织`).then((res) => {
    if(res.code==200){
      titleSelectJson.value=deepClone(res.data)
      titleUploadData.value.inventoryOrganization=titleSelectJson.value.inventoryOrganization[0].operateTypeName
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
//列查询
const getStoreWork = () => {
  filterDatas.value.type=value.value
  request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
    if(res.code==200){
      gridOption.columns=[]
      BasicData.value = res.data
      //添加列
      gridOption.columns=arrs.slice()
      for (let i=0;i<BasicData.value.length;i++){
        let column={field: BasicData.value[i].OperateType,
          width: '150',title: BasicData.value[i].OperateTypeName,
          sortable: true,showOverflow:'ellipsis' ,
          filters:[{ data: '' }],
          slots: { filter: 'num1_filter' },
          filterMethod:filterChanged}
        gridOption.columns.push(column)
      }
      getStoreWorks()
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
//数据绑定
const getStoreWorks = () => {
  console.log(filterDatas.value)
  request.post(`/MaterialStore/getSelectMaterialStore/1/${total.pageSize}`,filterDatas.value).then((res) => {
    if(res.code==200){
      console.log(res.data)
      materialStores.value=[]
      for (let i=0;i<res.data.data.length;i++){
        materialStores.value[i]=JSON.parse(res.data.data[i].json)
        materialStores.value[i].id=(res.data.data[i].id)
      }
      produceLists = deepClone(materialStores.value)
      xGrids.value.loadData(produceLists)
      gridOption.loading=false
    }else{
      ElMessage.warning(res.msg)
      router.push("/login")
    }
  })
}
const gridEvent = {
  async toolbarButtonClick({code}) {
    const $grid = xGrids.value
    if ($grid) {
      switch (code) {
        case 'add': {
          const selectRecords = $grid.getRadioRecord()
          console.log(selectRecords)
          if (selectRecords == null) {
            ElMessage.warning(t('productStock.unselectedData'))
            return
          }
          const errMap = await $grid.validate(selectRecords)
          if (errMap) {
            ElMessage.warning(t('productStock.dataVerificationFailed'))
            return
          }
          //表头数据校验
          const outboundType = titleUploadData.value.inventoryOrganization
          if(outboundType === null || outboundType === undefined || outboundType === ''){
            ElMessage.error("请选择库存组织")
            return
          }
          const materialRequisitionPersonnel = titleUploadData.value.inventoryQuantity
          if(materialRequisitionPersonnel === null || materialRequisitionPersonnel === undefined || materialRequisitionPersonnel === ''){
            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 inventoryArea = titleUploadData.value.inventoryArea
          if(inventoryArea === null || inventoryArea === undefined || inventoryArea === ''){
            ElMessage.error("请输入库存区域")
            return
          }
          let  flowData = ref({
            totalArea: selectRecords.height*selectRecords.width/100000*titleUploadData.value.inventoryQuantity,
            singlePieceArea: selectRecords.height*selectRecords.width/100000,
            title: titleUploadData.value,
            materialCode: selectRecords.id
          })
          console.log(flowData)
          request.post("/MaterialInventory/saveMaterialInventory", flowData.value).then((res) => {
            if(res.code==200){
              ElMessage.success('保存成功')
              router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}})
            }else{
              ElMessage.warning(res.msg)
              router.push("/login")
            }
          })
          break
        }
      }
    }
  }
}
</script>
<template>
  <div class="main-div-customer">
    <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"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
@@ -192,7 +582,8 @@
        <ul class="expand-wrapper">
          <li  v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
            <span style="font-weight: bold">{{item.title+':  '}}</span>
            <span>{{ row[item.field] }}</span>
            <span v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span>
            <span v-else>{{ row[item.field] }}</span>
          </li>
        </ul>
      </template>
@@ -211,8 +602,93 @@
        </div>
      </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>
    <el-dialog v-model="dialogTableVisible" title="物料新增" style="width: 70%;height:75% ">
      <div class="order-primary" >
        <el-row>
          <el-col  :span="2"><el-text>生产日期:</el-text></el-col>
          <el-col  :span="4">
            <el-date-picker
                v-model="titleUploadData.dateOfManufacture"
                type="date"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                placeholder="请选择生产日期"/>
          </el-col>
          <el-col  :span="2"><el-text>保质期:</el-text></el-col>
          <el-col  :span="3"><el-input v-model="titleUploadData.qualityGuaranteePeriod" /></el-col>
          <el-col  :span="1"><el-text>产地:</el-text></el-col>
          <el-col  :span="3"><el-input v-model="titleUploadData.producer" /></el-col>
        </el-row>
        <el-row>
          <el-col  :span="2"><el-text>库存组织:</el-text></el-col>
          <el-col  :span="4">
            <el-select v-model="titleUploadData.inventoryOrganization"  clearable placeholder=""  >
              <el-option
                  v-for="item in titleSelectJson['inventoryOrganization']"
                  :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="3"><el-input v-model="titleUploadData.inventoryArea" /></el-col>
          <el-col  :span="1"><el-text>数量:</el-text></el-col>
          <el-col  :span="3"><el-input v-model="titleUploadData.inventoryQuantity" /></el-col>
          <el-col  :span="1"><el-text>备注:</el-text></el-col>
          <el-col  :span="3"><el-input v-model="titleUploadData.remarks" /></el-col>
        </el-row>
      </div>
      <div>
        <el-row>
            <el-select v-model="value" placeholder="请选择类别" @change="getStoreWork">
              <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
              />
            </el-select>
        </el-row>
      </div>
      <div class="main-div-customers">
        <vxe-grid
            height="400px"
            class="mytable-scrollbar"
            ref="xGrids"
            v-bind="gridOption"
            v-on="gridEvent"
        >
          <template #num1_filter="{ column, $panel }">
            <div>
              <div v-for="(option, index) in column.filters" :key="index">
                <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
              </div>
            </div>
          </template>
        </vxe-grid>
      </div>
    </el-dialog>
  </div>
</template>
@@ -221,4 +697,15 @@
  width: 99%;
  height: 100%;
}
.main-div-customers{
  width: 99%;
  height: 100%;
}
.el-col{
  margin-left: 15px;
  margin-bottom: 5px;
}
.order-primary{
  width: 100%;
}
</style>
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedGoodsIssue.vue
@@ -225,6 +225,10 @@
  request.post(`/FinishedGoodsInventory/getSelectAllocate/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedProductOut.vue
@@ -148,6 +148,10 @@
  request.post(`/FinishedGoodsInventory/getSelectDeliveryDetail/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/FinishedProductRework.vue
@@ -224,6 +224,10 @@
  request.post(`/FinishedGoodsInventory/getSelectAllocate/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/OrderAllocation.vue
@@ -142,6 +142,10 @@
  request.post(`/FinishedGoodsInventory/getSelectAllocate/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/ProductStockList.vue
@@ -133,6 +133,10 @@
  request.post(`/FinishedGoodsInventory/getSelect/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/ReworkRecord.vue
@@ -129,8 +129,10 @@
const selectOrderList = ()=>{
  request.post(`/FinishedGoodsInventory/getSelectOperateRecord/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      if (res.data.total!=null){
      total.dataTotal = res.data.total.total*1
      total.pageTotal= res.data.total.pageTotal
      }
      selectDate.value = res.data.selectDate
      pageNum.value=1
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/StorageRecord.vue
@@ -140,7 +140,10 @@
  request.post(`/FinishedGoodsInventory/getSelectStorageRecord/${pageNum.value}/${total.pageSize}/${selectDate.value}/${type.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
      }
      pageNum.value=1
      produceList = deepClone(res.data.data)
      xGrid.value.loadData(produceList)
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/TakeOutRecord.vue
@@ -130,6 +130,10 @@
      selectDate.value = res.data.selectDate
      pageNum.value=1
      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
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/TransferRecord.vue
@@ -132,9 +132,11 @@
  request.post(`/FinishedGoodsInventory/getSelectAllocateFinishedOperateLog/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      if (res.data.total!=null){
      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)
north-glass-erp/northglass-erp/src/views/pp/Replenish/SelectReplenish.vue
@@ -221,6 +221,10 @@
const selectOrderList = ()=>{
  request.post(`/Replenish/SelectReplenish/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      if (res.data.total!=null){
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
      }
      selectDate.value = res.data.selectDate
      produceList = deepClone(res.data.data)
north-glass-erp/northglass-erp/src/views/pp/rework/SelectRework.vue
@@ -230,6 +230,10 @@
const selectOrderList = ()=>{
  request.post(`/rework/SelectRework/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      if (res.data.total!=null){
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
      }
      selectDate.value = res.data.selectDate
      produceList = deepClone(res.data.data)
north-glass-erp/northglass-erp/src/views/sd/delivery/CreateDelivery.vue
@@ -107,6 +107,7 @@
  if(res.code==200){
    titleSelectJson.value=deepClone(res.data)
    console.log(titleSelectJson.value)
    const today = new Date
    today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000))
    titleUploadData.value.deliveryDate = today.getFullYear() +
@@ -572,6 +573,8 @@
          <el-date-picker
              v-model="titleUploadData.payDate"
              type="date"
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              :placeholder="$t('delivery.selectDate')"/>
        </el-col>
@@ -604,6 +607,8 @@
          <el-date-picker
              v-model="titleUploadData.deliveryDate"
              type="date"
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              :placeholder="$t('delivery.selectDate')"/>
        </el-col>
      </el-row>
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue
@@ -135,6 +135,10 @@
  request.post(`/Delivery/getSelectShippingOrder/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectOrderList.vue
@@ -124,6 +124,10 @@
  request.post(`/Delivery/getSelectOrderInventory/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      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
north-glass-erp/src/main/java/com/example/erp/controller/mm/BasicWarehouseTypeController.java
@@ -19,4 +19,9 @@
        return Result.seccess(basicWarehouseTypeService.getBasicWarehouseType(type));
    }
    @GetMapping("/BasicWarehouseTypes/{type}")
    public Result getBasicWarehouseTypes(@PathVariable String type){
        return Result.seccess(basicWarehouseTypeService.getBasicWarehouseTypes(type));
    }
}
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
New file
@@ -0,0 +1,102 @@
package com.example.erp.controller.mm;
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.exception.ServiceException;
import com.example.erp.service.mm.MaterialInventoryService;
import com.example.erp.service.mm.MaterialStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/MaterialInventory")
@Api(value="物料库存controller",tags={"物料库存操作接口"})
public class MaterialInventoryController {
    @Autowired
    MaterialInventoryService materialInventoryService;
    @ApiOperation("物料出库新增接口")
    @PostMapping("/saveMaterialOutbound")
    public Result saveMaterialOutbound( @RequestBody Map<String,Object>  object){
        if(materialInventoryService.saveMaterialOutbound(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"保存失败");
        }
    }
    @ApiOperation("物料新增接口")
    @PostMapping("/saveMaterialInventory")
    public Result saveMaterialInventory( @RequestBody Map<String,Object>  object){
        if(materialInventoryService.saveMaterialInventory(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"保存失败");
        }
    }
    @ApiOperation("物料库存加时间查询接口")
    @PostMapping("/getSelectMaterialInventoryDate/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectMaterialInventoryDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> selectDate, @RequestBody MaterialInventory materialInventory){
        return Result.seccess(materialInventoryService.getSelectMaterialInventoryDate(pageNum,pageSize,selectDate,materialInventory));
    }
    @ApiOperation("物料库存查询接口")
    @PostMapping("/getSelectMaterialInventory/{pageNum}/{pageSize}")
    public Result getSelectMaterialInventory(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MaterialInventory materialInventory){
        return Result.seccess(materialInventoryService.getSelectMaterialInventory(pageNum,pageSize,materialInventory));
    }
    @ApiOperation("材料出库查询接口")
    @PostMapping("/getSelectMaterialOutboundDate/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectMaterialOutboundDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> selectDate, @RequestBody MaterialOutbound materialOutbound){
        return Result.seccess(materialInventoryService.getSelectMaterialOutboundDate(pageNum,pageSize,selectDate, materialOutbound));
    }
    @ApiOperation("材料出库查询接口")
    @PostMapping("/getSelectMaterialOutbound/{pageNum}/{pageSize}")
    public Result getSelectMaterialOutbound(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MaterialOutboundDetail materialOutboundDetail){
        return Result.seccess(materialInventoryService.getSelectMaterialOutbound(pageNum,pageSize,materialOutboundDetail));
    }
    @ApiOperation("材料出库修改接口")
    @PostMapping("/updateMaterialOutboundToExamine")
    public Result updateMaterialOutboundToExamine( @RequestBody Map<String,Object> object){
        if(materialInventoryService.updateMaterialOutboundToExamine(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"审核失败");
        }
    }
    @ApiOperation("物料删除接口")
    @PostMapping("/deleteMaterialOutbound")
    public Result deleteMaterialOutbound( @RequestBody Map<String,Object>  object){
        if(materialInventoryService.deleteMaterialOutbound(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"删除失败");
        }
    }
}
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialStoreController.java
File was renamed from north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialController.java
@@ -3,34 +3,27 @@
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.entity.mm.FinishedGoodsInventory;
import com.example.erp.entity.mm.FinishedOperateLog;
import com.example.erp.entity.mm.MaterialStore;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.sd.Customer;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.mm.FinishedGoodsInventoryService;
import com.example.erp.service.mm.MaterialService;
import com.example.erp.service.mm.MaterialStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/Material")
@RequestMapping("/MaterialStore")
@Api(value="物料controller",tags={"物料操作接口"})
public class MaterialController {
public class MaterialStoreController {
    @Autowired
    MaterialService faterialService;
    MaterialStoreService materialStoreService;
    @ApiOperation("物料新增接口")
    @PostMapping("/saveMaterialStore")
    public Result saveMaterialStore( @RequestBody Map<String,Object>  object){
        if(faterialService.saveMaterialStore(object)){
        if(materialStoreService.saveMaterialStore(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"保存失败");
@@ -41,13 +34,13 @@
    @ApiOperation("物料查询接口")
    @PostMapping("/getSelectMaterialStore/{pageNum}/{pageSize}")
    public Result getSelectMaterialStore(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MaterialStore materialStore){
        return Result.seccess(faterialService.getSelectMaterialStore(pageNum,pageSize,materialStore));
        return Result.seccess(materialStoreService.getSelectMaterialStore(pageNum,pageSize,materialStore));
    }
    @ApiOperation("物料删除接口")
    @PostMapping("/deleteMaterialStore")
    public Result deleteMaterialStore( @RequestBody Map<String,Object>  object){
        if(faterialService.deleteMaterialStore(object)){
        if(materialStoreService.deleteMaterialStore(object)){
            return Result.seccess();
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialInventory.java
New file
@@ -0,0 +1,37 @@
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 MaterialInventory {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String inventoryOrganization;
    private Long materialCode;
    private String materialName;
    private String producer;
    private String stockId;
    private Double width;
    private Double height;
    private Double thickness;
    private String unit;
    private Integer inventoryQuantity;
    private Integer availableQuantity;
    private Integer safetyStock;
    private Double totalArea;
    private Double singlePieceArea;
    private LocalDate dateOfManufacture;
    private String qualityGuaranteePeriod;
    private String inventoryArea;
    private Integer deadStock;
    private String remarks;
    private LocalDate createTime;
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialOutbound.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 MaterialOutbound {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String materialOutboundId;
    private String materialRequisitionPersonnel;
    private String materialRequisitionTeam;
    private String orderId;
    private String outboundType;
    private String warehouseManager;
    private LocalDate materialRequisitionDate;
    private String reviewed;
    private LocalDate reviewedTime;
    private Integer reviewedState;
    private LocalDate createTime;
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialOutboundDetail.java
New file
@@ -0,0 +1,36 @@
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 MaterialOutboundDetail {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long inventoryId;
    private String materialOutboundId;
    private Long materialOutboundNumber;
    private String inventoryOrganization;
    private String materialName;
    private String materialCode;
    private String producer;
    private Double width;
    private Double height;
    private Double thickness;
    private String unit;
    private Integer outboundQuantity;
    private Double singlePieceArea;
    private String inventoryArea;
    private LocalDate dateOfManufacture;
    private String remarks;
    private MaterialInventory materialInventory;
    private MaterialOutbound materialOutbound;
}
north-glass-erp/src/main/java/com/example/erp/mapper/mm/BasicWarehouseTypeMapper.java
@@ -17,5 +17,7 @@
    List<BasicWarehouseType> getBasicWarehouseType(String type);
    List<String> getBasicWarehouse(String type);
}
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
New file
@@ -0,0 +1,98 @@
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.sd.Delivery;
import com.example.erp.entity.sd.DeliveryDetail;
import com.example.erp.entity.sd.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.repository.CrudRepository;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@Mapper
public interface MaterialInventoryMapper extends CrudRepository<MaterialInventory,Long> {
    List<Map<String,Object>> getSelectMaterialInventoryDate(@Param("offset") Integer offset,
                                     @Param("pageSize") Integer pageSize,String startDate, String endDate,
                                     @Param("materialInventory") MaterialInventory materialInventory);
    Map<String,Integer> getSelectMaterialInventoryDatePageTotal(Integer offset, Integer pageSize,String startDate, String endDate, MaterialInventory materialInventory);
    List<Map<String,Object>> getSelectMaterialInventory(@Param("offset") Integer offset,
                                                       @Param("pageSize") Integer pageSize,
                                                       @Param("materialInventory") MaterialInventory materialInventory);
    Map<String,Integer> getSelectMaterialInventoryPageTotal(Integer offset, Integer pageSize, MaterialInventory materialInventory);
    Boolean insertMaterialStore(@Param("type") String type,
                                         @Param("json") String json);
    Boolean updateMaterialStore(@Param("type") String type,
                                @Param("json") String json, @Param("id") Long id);
    Boolean deleteMaterialOutbound(@Param("materialOutboundId") String materialOutboundId);
    Integer getmaximum(@Param("type") String type);
    Integer getMaterialOutboundCount(@Param("materialOutboundId") String materialOutboundId);
    Integer getMaterialInventoryCount(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture);
    List<MaterialOutboundDetail> getIsNotMaterialOutboundDetail( @Param("materialOutboundId") String materialOutboundId);
    Boolean insertMaterialInventoryMapper(@Param("materialOutbound") MaterialOutbound materialOutbound, @Param("number") String number);
    Integer getMaterialOutboundDetailMaximum(@Param("materialOutboundId") String materialOutboundId);
    Boolean insertMaterialOutboundDetail(@Param("materialOutboundDetail") MaterialOutboundDetail materialOutboundDetail, @Param("number") String number, @Param("materialOutboundNumber") Integer materialOutboundNumber);
    Boolean updateMaterialInventoryAvailableOut(@Param("inventoryId") Long inventoryId,
                                                @Param("quantity") Integer quantity);
    Boolean updateMaterialInventoryAvailableInt(@Param("inventoryId") Long inventoryId,
                                                @Param("quantity") Integer quantity);
    Boolean updateMaterialInventoryInventoryOut(@Param("inventoryId") Long inventoryId,
                                       @Param("quantity") Integer quantity);
    Boolean updateMaterialInventoryInventoryInt(@Param("inventoryId") Long inventoryId,
                                       @Param("quantity") Integer quantity);
    Boolean deleteMaterialOutboundDetail(@Param("materialOutboundId") String materialOutboundId);
    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);
    MaterialOutbound getSelectMaterialOutbound(@Param("offset") Integer offset,
                                                         @Param("pageSize") Integer pageSize,
                                                         @Param("materialOutboundDetail") MaterialOutboundDetail materialOutboundDetail);
    List<Map<String,Object>> getSelectMaterialOutboundDetail(@Param("offset") Integer offset,
                                                         @Param("pageSize") Integer pageSize,
                                                         @Param("materialOutboundDetail") MaterialOutboundDetail materialOutboundDetail);
    Map<String,Integer> getSelectMaterialOutboundDetailPageTotal(Integer offset, Integer pageSize,MaterialOutboundDetail materialOutboundDetail);
    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 updateMaterialInventory(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
                                    @Param("totalArea") Double totalArea,
                                    @Param("materialInventory") MaterialInventory materialInventory);
    Boolean insertMaterialInventory(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea,
                                    @Param("totalArea") Double totalArea,
                                    @Param("materialInventory") MaterialInventory materialInventory);
}
north-glass-erp/src/main/java/com/example/erp/service/mm/BasicWarehouseTypeService.java
@@ -27,7 +27,7 @@
        List<BasicWarehouseType> basicWarehouseType=basicWarehouseTypeMapper.getBasicWarehouseType(type);
        for (BasicWarehouseType item : basicWarehouseType){
            Map<String, Object> map = new HashMap<>();
            map.put("id",item.getId());
            map.put("OperateTypeId",item.getOperateTypeId());
            map.put("OperateTypeName",item.getOperateTypeName());
            map.put("OperateType",item.getOperateType());
@@ -42,5 +42,28 @@
    }
    public Map<String, List<Object>> getBasicWarehouseTypes(String type){
        //返回基础数据里的所有类型
        List<String> orderBasicDataType = basicWarehouseTypeMapper.getBasicWarehouse(type);
        //返回此类型基础数据所有数据
        List<BasicWarehouseType> orderBasicData = basicWarehouseTypeMapper.getBasicWarehouseType(type);
        Map<String, List<Object>> BasicDataMap = new HashMap<>();
        //创建List对象
        //遍历订单基本数据类型
        for(String item :orderBasicDataType){
            List<Object> orderBasicDataList = new ArrayList<>();
            //将类型和List对象放入Map中
            BasicDataMap.put(item,orderBasicDataList);
        }
        //遍历订单基本数据
        for (BasicWarehouseType item : orderBasicData){
            //将数据放入List中
            BasicDataMap.get(item.getOperateType()).add(item);
        }
        return BasicDataMap;
    }
}
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
New file
@@ -0,0 +1,304 @@
package com.example.erp.service.mm;
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.sd.Delivery;
import com.example.erp.entity.sd.DeliveryDetail;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
import com.example.erp.mapper.mm.MaterialInventoryMapper;
import com.example.erp.mapper.mm.MaterialStoreMapper;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@Service
@DS("mm")
@Transactional(rollbackFor = Exception.class)
public class MaterialInventoryService {
    @Autowired
    MaterialInventoryMapper materialInventoryMapper;
    @Autowired
    BasicWarehouseTypeMapper basicWarehouseTypeMapper;
    @Autowired
    SysErrorService sysErrorService;
    public Boolean saveMaterialOutbound(Map<String,Object> object) {
        boolean saveState = true;
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        String materialOutboundId = "";
        String oddNumber;
        if (object.get("materialOutboundId") != null) {
            materialOutboundId = object.get("materialOutboundId").toString();
        }
        try {
            MaterialOutbound materialOutbound = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialOutbound.class);
            List<MaterialOutboundDetail> materialOutboundDetailList = JSONArray.parseArray(JSONObject.toJSONString(object.get("materialOutboundDetail")), MaterialOutboundDetail.class);
            //查询出库单是否存在
            Integer MaterialOutboundConut = materialInventoryMapper.getMaterialOutboundCount(materialOutboundId);
            if (MaterialOutboundConut != 0) {
                List<MaterialOutboundDetail> materialOutboundDetailLists = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId);
                if (!materialOutboundDetailLists.isEmpty()) {
                    for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailLists) {
                        //还原物料库存数
                        materialInventoryMapper.updateMaterialInventoryAvailableInt(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity());
                    }
                }
                //删除材料出库明细的数据
                materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                oddNumber = materialOutboundId;
            } else {
                //获取单号
                oddNumber = orderNumberSetting("出库");
                //新增材料出库表数据
                materialInventoryMapper.insertMaterialInventoryMapper(materialOutbound, oddNumber);
            }
            //获取对象集合循环进行新增修改
            if (!materialOutboundDetailList.isEmpty()) {
                for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailList) {
                    Integer materialOutboundDetailMaximum = materialInventoryMapper.getMaterialOutboundDetailMaximum(oddNumber);
                    //新增材料出库明细数据
                    materialInventoryMapper.insertMaterialOutboundDetail(materialOutboundDetail, oddNumber, materialOutboundDetailMaximum + 1);
                    //修改物料库存表出库数量
                    System.out.println(materialOutboundDetail.getInventoryId());
                    materialInventoryMapper.updateMaterialInventoryAvailableOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity());
                }
            }
        } 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 Boolean saveMaterialInventory(Map<String,Object> object) {
        boolean saveState = true;
        Double singlePieceArea = 0.0;
        Double totalArea = 0.0;
        Long materialCode = 0L;
        if (object.get("singlePieceArea") != null) {
            singlePieceArea = Double.valueOf(object.get("singlePieceArea").toString());
        }
        if (object.get("totalArea") != null) {
            totalArea = Double.valueOf(object.get("totalArea").toString());
        }
        if (object.get("materialCode") != null) {
            materialCode = Long.valueOf(object.get("materialCode").toString());
        }
        MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class);
        //查询物料是否存在
        Integer MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture());
        if(MaterialInventoryCount>0){
            materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
        }else {
            materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
        }
        return saveState;
    }
    public Map<String, Object> getSelectMaterialInventoryDate(Integer pageNum, Integer pageSize, List<String> selectDate, MaterialInventory materialInventory) {
        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.getSelectMaterialInventoryDate(offset, pageSize,startDate, endDate, materialInventory));
        map.put("total", materialInventoryMapper.getSelectMaterialInventoryDatePageTotal(offset, pageSize,startDate, endDate, materialInventory));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
        return map;
    }
    public Map<String, Object> getSelectMaterialInventory(Integer pageNum, Integer pageSize, MaterialInventory materialInventory) {
        Integer offset = (pageNum - 1) * pageSize;
        Map<String, Object> map = new HashMap<>();
        map.put("data", materialInventoryMapper.getSelectMaterialInventory(offset, pageSize, materialInventory));
        map.put("total", materialInventoryMapper.getSelectMaterialInventoryPageTotal(offset, pageSize, materialInventory));
        return map;
    }
    public Boolean deleteMaterialOutbound(Map<String,Object> object) {
        boolean saveState = true;
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        try {
            String materialOutboundId = "";
            if (object.get("materialOutboundId") != null) {
                materialOutboundId = object.get("materialOutboundId").toString();
            }
            if(materialOutboundId!=null){
                materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                materialInventoryMapper.deleteMaterialOutbound(materialOutboundId);
            }
        } 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> getSelectMaterialOutboundDate(Integer pageNum, Integer pageSize, List<String> selectDate, MaterialOutbound materialOutbound) {
        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.getSelectMaterialOutboundDate(offset, pageSize,startDate, endDate, materialOutbound));
        map.put("total", materialInventoryMapper.getSelectMaterialOutboundDatePageTotal(offset, pageSize,startDate, endDate, materialOutbound));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
        return map;
    }
    public Map<String, Object> getSelectMaterialOutbound(Integer pageNum, Integer pageSize, MaterialOutboundDetail materialOutboundDetail) {
        Integer offset = (pageNum - 1) * pageSize;
        Map<String, Object> map = new HashMap<>();
        System.out.println("数据"+materialOutboundDetail);
        map.put("materialOutbound", materialInventoryMapper.getSelectMaterialOutbound(offset, pageSize, materialOutboundDetail));
        map.put("data", materialInventoryMapper.getSelectMaterialOutboundDetail(offset, pageSize, materialOutboundDetail));
        map.put("total", materialInventoryMapper.getSelectMaterialOutboundDetailPageTotal(offset, pageSize, materialOutboundDetail));
        return map;
    }
    public Boolean updateMaterialOutboundToExamine(Map<String,Object> object) {
        boolean saveState = true;
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        try {
            String materialOutboundId = "";
            String reviewed = "";
            int type =0;
            if (object.get("materialOutboundId") != null) {
                materialOutboundId = object.get("materialOutboundId").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<MaterialOutboundDetail> materialOutboundDetailList = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId);
                if (!materialOutboundDetailList.isEmpty()) {
                    for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailList) {
                        //修改物料库存数量
                        materialInventoryMapper.updateMaterialInventoryInventoryOut(materialOutboundDetail.getInventoryId(), materialOutboundDetail.getOutboundQuantity());
                    }
                }
                materialInventoryMapper.updateMaterialOutboundToExamine(materialOutboundId,type,reviewed);
            }else{
                List<MaterialOutboundDetail> materialOutboundDetailList = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId);
                if (!materialOutboundDetailList.isEmpty()) {
                    for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailList) {
                        //修改物料库存数量
                        materialInventoryMapper.updateMaterialInventoryInventoryInt(materialOutboundDetail.getInventoryId(), materialOutboundDetail.getOutboundQuantity());
                    }
                }
                materialInventoryMapper.updateMaterialOutboundCounterExamination(materialOutboundId,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 String orderNumberSetting(String type) {
        //根据类型自动生成不同的操作单号
        String alias="";
        if(Objects.equals(type, "出库")){
            alias="CK";
        }
        //查询当天的最大数量
        Integer maximum=materialInventoryMapper.getmaximum(type);
        //设置两位不够补0
        String formattedNumber = String.format("%02d", maximum+1);
        //格式化当前日期
        Date currentDate = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
        String formattedDate = dateFormat.format(currentDate);
        String oddNumbers =  alias+formattedDate+formattedNumber;
        return oddNumbers;
    }
}
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java
File was renamed from north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialService.java
@@ -1,19 +1,9 @@
package com.example.erp.service.mm;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.mm.FinishedGoodsInventory;
import com.example.erp.entity.mm.FinishedOperateLog;
import com.example.erp.entity.mm.MaterialStore;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.sd.Customer;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.sd.Product;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper;
import com.example.erp.mapper.mm.FinishedOperateLogMapper;
import com.example.erp.mapper.mm.MaterialStoreMapper;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,14 +11,12 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@Service
@DS("mm")
@Transactional(rollbackFor = Exception.class)
public class MaterialService {
public class MaterialStoreService {
    @Autowired
    MaterialStoreMapper materialStoreMapper;
    @Autowired
north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml
@@ -13,7 +13,11 @@
    </select>
    <select id="getBasicWarehouseType" >
        select * from mm.basic_warehouse_type where type=#{type};
        select * from mm.basic_warehouse_type where type regexp #{type} group by operate_type_name;
    </select>
    <select id="getBasicWarehouse" >
        select operate_type from mm.basic_warehouse_type where type=#{type};
    </select>
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
New file
@@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        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">
        select
        mi.id,
        mi.inventory_organization as inventoryOrganization,
        mi.material_code AS materialCode,
        mi.producer,
        mi.inventory_quantity AS inventoryQuantity,
        mi.available_quantity AS availableQuantity,
        mi.safety_stock AS safetyStock,
        mi.total_area AS totalArea,
        mi.single_piece_area singlePieceArea,
        date(mi.date_of_manufacture) AS dateOfManufacture,
        mi.quality_guarantee_period qualityGuaranteePeriod,
        mi.inventory_area AS inventoryArea,
        mi.dead_stock AS deadStock,
        mi.remarks,
        date(mi.create_time) AS createTime,
        ms.json
        from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id
        <where>
                date(mi.create_time)>=#{startDate} and date(mi.create_time) &lt;= #{endDate} and mi.available_quantity>0
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventoryDatePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_inventory mi
        <where>
                date(mi.create_time)>=#{startDate} and date(mi.create_time) &lt;= #{endDate} and mi.available_quantity>0
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventory">
        select
        mi.id,
        mi.inventory_organization as inventoryOrganization,
        mi.material_code AS materialCode,
        mi.producer,
        mi.inventory_quantity AS inventoryQuantity,
        mi.available_quantity AS availableQuantity,
        mi.safety_stock AS safetyStock,
        mi.total_area AS totalArea,
        mi.single_piece_area singlePieceArea,
        date(mi.date_of_manufacture) AS dateOfManufacture,
        mi.quality_guarantee_period qualityGuaranteePeriod,
        mi.inventory_area AS inventoryArea,
        mi.dead_stock AS deadStock,
        mi.remarks,
        date(mi.create_time) AS createTime,
        ms.json
        from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id
        <where>
            <if test="materialInventory.stockId != null and materialInventory.stockId != ''">
                and mi.id regexp #{materialInventory.stockId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventoryPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_inventory mi
        <where>
            <if test="materialInventory.id != null and materialInventory.id != ''">
                and mi.id regexp #{materialInventory.id}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDate">
        select
        *
        from
        mm.material_outbound mo
        <where>
            date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
        </where>
        order by mo.reviewed_state desc,mo.create_time desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDatePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_outbound mo
        <where>
            date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutbound">
        select
        *
        from
        mm.material_outbound mo
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and mo.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDetail" >
        select
        modd.inventory_id as id,
        modd.inventory_organization as inventoryOrganization,
        modd.material_code as materialCode,
        modd.material_name as materialName,
        modd.producer,
        modd.width,
        modd.height,
        modd.thickness,
        modd.unit,
        modd.outbound_quantity as outboundQuantity,
        date(modd.date_of_manufacture) as dateOfManufacture,
        modd.single_piece_area as singlePieceArea,
        modd.inventory_area as inventoryArea,
        modd.remarks,
        mi.inventory_quantity as inventoryQuantity,
        if(mo.reviewed_state!=1,modd.outbound_quantity+mi.available_quantity,mi.available_quantity) as availableQuantity,
        ms.json
        from mm.material_outbound_detail modd left join mm.material_inventory mi on modd.inventory_id=mi.id
            left join mm.material_outbound mo on modd.material_outbound_id=mo.material_outbound_id
            left join mm.material_store ms on modd.material_code=ms.id
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDetailPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_outbound_detail modd
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <insert id="insertMaterialStore"  useGeneratedKeys="true"  >
        insert into mm.material_store (type,json,create_time
        )
        values (
                   #{type},#{json},now()
               )
    </insert>
    <update id="updateMaterialStore" >
        update mm.material_store set json=#{json} where id=#{id}
    </update>
    <delete id="deleteMaterialOutbound" >
        delete from mm.material_outbound where material_outbound_id=#{materialOutboundId}
    </delete>
    <delete id="deleteMaterialOutboundDetail" >
        delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
    </delete>
    <select id="getmaximum" >
        select count(*) from mm.material_outbound where  date(create_time)=CURDATE()
    </select>
    <select id="getMaterialOutboundCount" >
        select count(*) from mm.material_outbound where  material_outbound_id=#{materialOutboundId}
    </select>
    <select id="getMaterialOutboundDetailMaximum" >
        select count(*) from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
    </select>
    <select id="getMaterialInventoryCount" >
        select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
    </select>
    <select id="getIsNotMaterialOutboundDetail" >
        select * from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
    </select>
    <insert id="insertMaterialInventoryMapper"  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 (
                  #{number} ,#{materialOutbound.materialRequisitionPersonnel},#{materialOutbound.materialRequisitionTeam},
                #{materialOutbound.orderId},#{materialOutbound.outboundType},#{materialOutbound.warehouseManager},#{materialOutbound.materialRequisitionDate},
                   0,now()
               )
    </insert>
    <insert id="insertMaterialOutboundDetail"  useGeneratedKeys="true" >
        insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,material_name,inventory_id,inventory_organization,producer,unit,width,
                                                 height,thickness,outbound_quantity,single_piece_area,inventory_area,date_of_manufacture,remarks)
        values (
                   #{number} ,#{materialOutboundNumber},#{materialOutboundDetail.materialCode},#{materialOutboundDetail.materialName},#{materialOutboundDetail.id},
                   #{materialOutboundDetail.inventoryOrganization},#{materialOutboundDetail.producer},#{materialOutboundDetail.unit},
                   #{materialOutboundDetail.width},#{materialOutboundDetail.height},#{materialOutboundDetail.thickness},#{materialOutboundDetail.outboundQuantity},
                #{materialOutboundDetail.singlePieceArea},#{materialOutboundDetail.inventoryArea},#{materialOutboundDetail.dateOfManufacture},#{materialOutboundDetail.remarks}
               )
    </insert>
    <insert id="insertMaterialInventory"  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 (
                   #{materialInventory.inventoryOrganization} ,#{materialCode},
                #{materialInventory.producer},0,#{materialInventory.inventoryQuantity},#{materialInventory.inventoryQuantity},0,
                   #{totalArea},#{singlePieceArea},#{materialInventory.dateOfManufacture},#{materialInventory.qualityGuaranteePeriod},
                   #{materialInventory.inventoryArea},0,#{materialInventory.remarks},now()
               )
    </insert>
    <update id="updateMaterialInventoryAvailableOut">
        update mm.material_inventory
        set available_quantity=available_quantity-#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryAvailableInt">
        update mm.material_inventory
        set available_quantity=available_quantity+#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryInventoryOut">
        update mm.material_inventory
        set inventory_quantity=inventory_quantity-#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryInventoryInt">
        update mm.material_inventory
        set 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()
        where material_outbound_id=#{materialOutboundId}
    </update>
    <update id="updateMaterialOutboundCounterExamination">
        update mm.material_outbound set reviewed_state=#{reviewedState}
        where material_outbound_id=#{materialOutboundId}
    </update>
    <update id="updateMaterialInventory" >
        update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                         available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
                                         total_area=total_area+#{totalArea}
                                     where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
    </update>
</mapper>
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
@@ -30,7 +30,9 @@
            <if test="materialStore.id != null and materialStore.id != ''">
                and m.id regexp #{materialStore.id}
            </if>
            <if test="materialStore.type != null and materialStore.type != ''">
                and m.type regexp #{materialStore.type}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
north-glass-erp/target/classes/mapper/mm/BasicWarehouseType.xml
@@ -13,7 +13,11 @@
    </select>
    <select id="getBasicWarehouseType" >
        select * from mm.basic_warehouse_type where type=#{type};
        select * from mm.basic_warehouse_type where type regexp #{type} group by operate_type_name;
    </select>
    <select id="getBasicWarehouse" >
        select operate_type from mm.basic_warehouse_type where type=#{type};
    </select>
north-glass-erp/target/classes/mapper/mm/MaterialInventory.xml
New file
@@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        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">
        select
        mi.id,
        mi.inventory_organization as inventoryOrganization,
        mi.material_code AS materialCode,
        mi.producer,
        mi.inventory_quantity AS inventoryQuantity,
        mi.available_quantity AS availableQuantity,
        mi.safety_stock AS safetyStock,
        mi.total_area AS totalArea,
        mi.single_piece_area singlePieceArea,
        date(mi.date_of_manufacture) AS dateOfManufacture,
        mi.quality_guarantee_period qualityGuaranteePeriod,
        mi.inventory_area AS inventoryArea,
        mi.dead_stock AS deadStock,
        mi.remarks,
        date(mi.create_time) AS createTime,
        ms.json
        from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id
        <where>
                date(mi.create_time)>=#{startDate} and date(mi.create_time) &lt;= #{endDate} and mi.available_quantity>0
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventoryDatePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_inventory mi
        <where>
                date(mi.create_time)>=#{startDate} and date(mi.create_time) &lt;= #{endDate} and mi.available_quantity>0
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventory">
        select
        mi.id,
        mi.inventory_organization as inventoryOrganization,
        mi.material_code AS materialCode,
        mi.producer,
        mi.inventory_quantity AS inventoryQuantity,
        mi.available_quantity AS availableQuantity,
        mi.safety_stock AS safetyStock,
        mi.total_area AS totalArea,
        mi.single_piece_area singlePieceArea,
        date(mi.date_of_manufacture) AS dateOfManufacture,
        mi.quality_guarantee_period qualityGuaranteePeriod,
        mi.inventory_area AS inventoryArea,
        mi.dead_stock AS deadStock,
        mi.remarks,
        date(mi.create_time) AS createTime,
        ms.json
        from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id
        <where>
            <if test="materialInventory.stockId != null and materialInventory.stockId != ''">
                and mi.id regexp #{materialInventory.stockId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialInventoryPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_inventory mi
        <where>
            <if test="materialInventory.id != null and materialInventory.id != ''">
                and mi.id regexp #{materialInventory.id}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDate">
        select
        *
        from
        mm.material_outbound mo
        <where>
            date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
        </where>
        order by mo.reviewed_state desc,mo.create_time desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDatePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_outbound mo
        <where>
            date(mo.create_time)>=#{startDate} and date(mo.create_time) &lt;= #{endDate}
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutbound">
        select
        *
        from
        mm.material_outbound mo
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and mo.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDetail" >
        select
        modd.inventory_id as id,
        modd.inventory_organization as inventoryOrganization,
        modd.material_code as materialCode,
        modd.material_name as materialName,
        modd.producer,
        modd.width,
        modd.height,
        modd.thickness,
        modd.unit,
        modd.outbound_quantity as outboundQuantity,
        date(modd.date_of_manufacture) as dateOfManufacture,
        modd.single_piece_area as singlePieceArea,
        modd.inventory_area as inventoryArea,
        modd.remarks,
        mi.inventory_quantity as inventoryQuantity,
        if(mo.reviewed_state!=1,modd.outbound_quantity+mi.available_quantity,mi.available_quantity) as availableQuantity,
        ms.json
        from mm.material_outbound_detail modd left join mm.material_inventory mi on modd.inventory_id=mi.id
            left join mm.material_outbound mo on modd.material_outbound_id=mo.material_outbound_id
            left join mm.material_store ms on modd.material_code=ms.id
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectMaterialOutboundDetailPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_outbound_detail modd
        <where>
            <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''">
                and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <insert id="insertMaterialStore"  useGeneratedKeys="true"  >
        insert into mm.material_store (type,json,create_time
        )
        values (
                   #{type},#{json},now()
               )
    </insert>
    <update id="updateMaterialStore" >
        update mm.material_store set json=#{json} where id=#{id}
    </update>
    <delete id="deleteMaterialOutbound" >
        delete from mm.material_outbound where material_outbound_id=#{materialOutboundId}
    </delete>
    <delete id="deleteMaterialOutboundDetail" >
        delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
    </delete>
    <select id="getmaximum" >
        select count(*) from mm.material_outbound where  date(create_time)=CURDATE()
    </select>
    <select id="getMaterialOutboundCount" >
        select count(*) from mm.material_outbound where  material_outbound_id=#{materialOutboundId}
    </select>
    <select id="getMaterialOutboundDetailMaximum" >
        select count(*) from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
    </select>
    <select id="getMaterialInventoryCount" >
        select count(*) from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
    </select>
    <select id="getIsNotMaterialOutboundDetail" >
        select * from mm.material_outbound_detail where  material_outbound_id=#{materialOutboundId}
    </select>
    <insert id="insertMaterialInventoryMapper"  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 (
                  #{number} ,#{materialOutbound.materialRequisitionPersonnel},#{materialOutbound.materialRequisitionTeam},
                #{materialOutbound.orderId},#{materialOutbound.outboundType},#{materialOutbound.warehouseManager},#{materialOutbound.materialRequisitionDate},
                   0,now()
               )
    </insert>
    <insert id="insertMaterialOutboundDetail"  useGeneratedKeys="true" >
        insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,material_name,inventory_id,inventory_organization,producer,unit,width,
                                                 height,thickness,outbound_quantity,single_piece_area,inventory_area,date_of_manufacture,remarks)
        values (
                   #{number} ,#{materialOutboundNumber},#{materialOutboundDetail.materialCode},#{materialOutboundDetail.materialName},#{materialOutboundDetail.id},
                   #{materialOutboundDetail.inventoryOrganization},#{materialOutboundDetail.producer},#{materialOutboundDetail.unit},
                   #{materialOutboundDetail.width},#{materialOutboundDetail.height},#{materialOutboundDetail.thickness},#{materialOutboundDetail.outboundQuantity},
                #{materialOutboundDetail.singlePieceArea},#{materialOutboundDetail.inventoryArea},#{materialOutboundDetail.dateOfManufacture},#{materialOutboundDetail.remarks}
               )
    </insert>
    <insert id="insertMaterialInventory"  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 (
                   #{materialInventory.inventoryOrganization} ,#{materialCode},
                #{materialInventory.producer},0,#{materialInventory.inventoryQuantity},#{materialInventory.inventoryQuantity},0,
                   #{totalArea},#{singlePieceArea},#{materialInventory.dateOfManufacture},#{materialInventory.qualityGuaranteePeriod},
                   #{materialInventory.inventoryArea},0,#{materialInventory.remarks},now()
               )
    </insert>
    <update id="updateMaterialInventoryAvailableOut">
        update mm.material_inventory
        set available_quantity=available_quantity-#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryAvailableInt">
        update mm.material_inventory
        set available_quantity=available_quantity+#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryInventoryOut">
        update mm.material_inventory
        set inventory_quantity=inventory_quantity-#{quantity}
        where id=#{inventoryId}
    </update>
    <update id="updateMaterialInventoryInventoryInt">
        update mm.material_inventory
        set 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()
        where material_outbound_id=#{materialOutboundId}
    </update>
    <update id="updateMaterialOutboundCounterExamination">
        update mm.material_outbound set reviewed_state=#{reviewedState}
        where material_outbound_id=#{materialOutboundId}
    </update>
    <update id="updateMaterialInventory" >
        update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                         available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
                                         total_area=total_area+#{totalArea}
                                     where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
    </update>
</mapper>
north-glass-erp/target/classes/mapper/mm/MaterialStore.xml
@@ -30,7 +30,9 @@
            <if test="materialStore.id != null and materialStore.id != ''">
                and m.id regexp #{materialStore.id}
            </if>
            <if test="materialStore.type != null and materialStore.type != ''">
                and m.type regexp #{materialStore.type}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>