廖井涛
2024-08-06 31b9b4cb19fab4f478ff8762ce5742fa1736b1cb
新增余料管理
12个文件已修改
3个文件已添加
718 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/lang/zh.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/router/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/IngredientsStock.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectSurplusMaterials.vue 442 ●●●●● 补丁 | 查看 | 原始文档 | 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/MaterialInventoryController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/SurplusMaterials.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/SurplusMaterialsLog.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/DeliveryService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/zh.js
@@ -931,6 +931,10 @@
        returnQuantity :'返库数量',
        materialReturnType :'材料返库类型',
        createTime :'返库日期',
        surplusMaterialManagement :'余料管理',
        additionOfSurplusMaterials :'余料新增',
        excessMaterialOutflow :'余料出库',
    },
    mainBasicData:{
        BasicData :'基础数据',
north-glass-erp/northglass-erp/src/router/index.js
@@ -888,7 +888,11 @@
              name: 'selectIngredientsStock',
              component:()=>import('../views/mm/mainIngredientStock/SelectIngredientsStock.vue')
            },
            {
              path: 'selectSurplusMaterials',
              name: 'selectSurplusMaterials',
              component:()=>import('../views/mm/mainIngredientStock/SelectSurplusMaterials.vue')
            },
            {
              path: 'accessoriesMonthlySettlement',
              name: 'accessoriesMonthlySettlement',
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/IngredientsStock.vue
@@ -31,6 +31,7 @@
<!--        <el-breadcrumb-item @click="changeRouter(3)" :class="indexFlag===3?'indexTag':''" :to="{ path: '/main/ingredientsStock/OriginalMonthlySettlement' }">原片月结</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(4)" :class="indexFlag===4?'indexTag':''" :to="{ path: '/main/ingredientsStock/AccessoriesMonthlySettlement' }">辅料月结</el-breadcrumb-item>-->
        <el-breadcrumb-item @click="changeRouter(5)" :class="indexFlag===5?'indexTag':''" :to="{ path: '/main/ingredientsStock/ReturnToStorage' }">{{$t('mainIngredientStock.returnToStorage')}}</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(6)" :class="indexFlag===6?'indexTag':''" :to="{ path: '/main/ingredientsStock/selectSurplusMaterials' }">{{$t('mainIngredientStock.surplusMaterialManagement')}}</el-breadcrumb-item>
        <el-breadcrumb-item v-show="false" :to="{ path: '/main/order/orderReport' }">{{$t('mainIngredientStock.returnToStorage')}}</el-breadcrumb-item>
      </el-breadcrumb>
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/SelectSurplusMaterials.vue
New file
@@ -0,0 +1,442 @@
<script setup>
import {reactive, ref} from "vue";
import {useRouter} from  'vue-router'
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 userStore = useUserInfoStore()
const router = useRouter()
let produceList = ref([])
let produceLists = ref([])
let dialogTableVisible = ref(false)
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/trader/CreateTrader', query: { id: row.id }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
}
const hasDecimal=(value)=>{
  const regex=/\./ // 定义正则表达式,查找小数点
  return regex.test(value) //返回true/false
}
const hasDecimalhtml=(item,row)=>{
  let aa=item.split('.').length
  if (aa===2){
    return row[item.split('.')[0]][item.split('.')[1]]
  }else if(aa===3){
    return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]]
  }
}
let pageNum=ref(1)
let total = reactive({
  pageTotal : 0,
  dataTotal : 0,
  pageSize : 100
})
let filterData = ref({
})
const values = ref('')
let selectDate = ref(["",""])
request.post(`/MaterialInventory/getSelectSurplusMaterialsDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
  if(res.code==200){
    total.dataTotal = res.data.total.total*1
    total.pageTotal= res.data.total.pageTotal
    selectDate.value = res.data.selectDate
    pageNum.value=1
    produceList = deepClone(res.data.data)
    xGrid.value.loadData(produceList)
    gridOptions.loading=false
  }else{
    ElMessage.warning(res.msg)
  }
})
const selectOrderList = ()=>{
  request.post(`/MaterialInventory/getSelectSurplusMaterialsDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
    if(res.code==200){
      selectDate.value = res.data.selectDate
      if (res.data.total!=null){
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
      }
      produceList = deepClone(res.data.data)
      xGrid.value.loadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
    }
  })
}
const changeDate =  ()=>{
  selectOrderList()
}
//页脚跳转
const handlePageChange = ({ currentPage, pageSize }) => {
  selectOrderList()
  total.pageTotal = pageSize
  pageNum.value=currentPage
}
//子组件接收参数
const xGrid = ref()
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  id: 'SelectIngredientsStock',
  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:[
    { type: 'checkbox',fixed:"left", title: t('basicData.check'), width: '80' },
    { type: 'seq',fixed:"left", title: t('basicData.Number'), width: '80' },
    {field: 'width', width:'150', title: t('order.width'), sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged },
    {field: 'height', width: '150',title: t('order.height'), sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
    {field: 'thickness', width: '100',title: t('product.msg.allThickness'), sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
    {field: 'colour',width: '150', title: t('mainIngredient.films'), sortable: true,showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
    {field: 'quantity',width: '150', title: t('order.quantity'),editRender: { name: 'input' }, sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
    {field: 'createTime',width: '150', title: t('productStock.storageTime'), sortable: true},
    {field: 'remarks',width: '150', title: t('basicData.remarks'), sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  ],//表头按钮
  toolbarConfig: {
    buttons: [
      {'code': 'out', 'name': t('mainIngredientStock.excessMaterialOutflow'),status: 'primary'},
      {'code': 'add', 'name': t('mainIngredientStock.additionOfSurplusMaterials'),status: 'primary'},
    ],
    /*import: false,
    export: true,
    print: true,*/
    zoom: true,
    custom: true
  },
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return t('basicData.total')
        }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
        // }
        return ''
      })
    ]
  }
})
const validRules = ref({
  "quantity": [{
    validator (e) {
      const regex = /^[1-9]\d*$/g
      if ( !regex.test(e.row.quantity) ) {
        return new Error(t('productStock.pleaseEnterAPositiveInteger'))
      }
      console.log(e.row.quantity1)
      if (e.row.quantity > e.row.quantity1) {
        return new Error(t('delivery.theShipmentQuantityCannotBeGreaterThanTheInventoryQuantity'))
      }
    }
  }]
})
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
          }
          const errMap = await $grid.validate(selectRecords)
          if (errMap) {
            ElMessage.warning(t('productStock.dataVerificationFailed'))
            return
          }
          let flowData = ref({
            creator:userStore.user.userName,
            type:t('productStock.outbound'),
            surplusMaterials: selectRecords,
            state:2
          })
          console.log(flowData.value)
          request.post("/MaterialInventory/addSelectSurplusMaterialsDate",flowData.value).then((res) => {
            if(res.code==200 && res.data===true){
              ElMessage.success(t('basicData.msg.saveSuccess'))
              router.push({path:'/main/ingredientsStock/selectSurplusMaterials',query:{random:Math.random()}})
            }else{
              ElMessage.warning(t('basicData.msg.saveFail'))
            }
          }).catch((err)=>{
            ElMessage.error(t('basicData.msg.ServerConnectionError'))
            router.push("/login")
          })
          break
        }
        case 'add': {
          dialogTableVisible.value=true
          request.get(`/basicData/BasicDataByType/product/stuffColor`).then((res) => {
            if(res.code==200){
              titleSelectJson.value=deepClone(res.data)
            }else{
              ElMessage.warning(res.msg)
            }
          })
          break
        }
      }
    }
  }
}
const titleSelectJson = ref({
})
let filterData1 = ref({
  width:'',
  height:'',
  thickness:'',
  quantity:'',
  colour:''
})
const resetForm = () => {
  filterData1.value.width=''
  filterData1.value.height=''
  filterData1.value.thickness=''
  filterData1.value.quantity=''
  filterData1.value.colour=''
}
const submitForm = () => {
  let flowData = ref({
    surplusMaterials:filterData1.value,
    creator:userStore.user.userName,
    type:t('searchOrder.storage'),
    state:1
  })
  request.post("/MaterialInventory/addSelectSurplusMaterialsDate",flowData.value).then((res) => {
    if(res.code==200 && res.data===true){
      ElMessage.success(t('basicData.msg.saveSuccess'))
      router.push({path:'/main/ingredientsStock/selectSurplusMaterials',query:{random:Math.random()}})
    }else{
      ElMessage.warning(t('basicData.msg.saveFail'))
    }
  }).catch((err)=>{
    ElMessage.error(t('basicData.msg.ServerConnectionError'))
    router.push("/login")
  })
}
</script>
<template>
  <div class="main-div-customer">
    <el-date-picker
        v-model="selectDate"
        type="daterange"
        :start-placeholder="$t('basicData.startDate')"
        :end-placeholder="$t('basicData.endDate')"
        format="YYYY-MM-DD"
        value-format="YYYY-MM-DD"
    />
    <el-button @click="changeDate" style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">{{$t('basicData.search')}}</el-button>
    <vxe-grid
        max-height="100%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
        :edit-rules="validRules"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
      <!--      下拉显示所有信息插槽-->
      <template #content="{ row }">
        <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 v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span>
            <span v-else>{{ row[item.field] }}</span>
          </li>
        </ul>
      </template>
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')"
                   link type="primary" size="small">{{$t('basicData.edit')}}</el-button>
        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">{{$t('basicData.delete')}}</el-button>
      </template>
      <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>
      <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="$t('mainIngredientStock.additionOfSurplusMaterials')" style="width: 70%;height:75% ">
      <div class="order-primary" >
        <el-row gutter="5">
          <el-col :span="4.5" >
            {{$t('order.width')}}:<el-input v-model="filterData1.width" :placeholder="$t('mainIngredient.pleaseEnterData')" style="width: 150px; height: 30px;" />
          </el-col>
          <el-divider ></el-divider>
          <el-col :span="4.5" >
            {{$t('order.height')}}:<el-input v-model="filterData1.height" :placeholder="$t('mainIngredient.pleaseEnterData')" style="width: 150px; height: 30px;" />
          </el-col>
          <el-divider ></el-divider>
          <el-col :span="4.5" >
            {{$t('product.msg.allThickness')}}:<el-input v-model="filterData1.thickness" :placeholder="$t('mainIngredient.pleaseEnterData')" style="width: 150px; height: 30px;" />
          </el-col>
          <el-divider ></el-divider>
          <el-col :span="4.5" >
            {{$t('mainIngredient.films')}}:
            <el-select filterable v-model="filterData1.colour"  :placeholder="$t('mainIngredient.pleaseEnterData')" style="width: 150px; height: 30px;" >
              <el-option
                  v-for="item in titleSelectJson"
                  :key="item.id"
                  :label="item.basicName"
                  :value="item.basicName"
              />
            </el-select>
          </el-col>
          <el-divider ></el-divider>
          <el-col :span="4.5" >
            {{$t('order.quantity')}}:<el-input v-model="filterData1.quantity" :placeholder="$t('mainIngredient.pleaseEnterData')" style="width: 150px; height: 30px;" />
          </el-col>
          <el-divider ></el-divider>
        </el-row>
        <el-row  gutter="10" justify="center" >
          <el-col span="4">
            <el-button id="searchButton" type="primary" @click="resetForm" >{{$t('basicData.empty')}}</el-button>
          </el-col>
          <el-col span="4">
            <el-button id="searchButton" type="primary" @click="submitForm" >{{$t('basicData.save')}}</el-button>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
  </div>
</template>
<style scoped>
.main-div-customer{
  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/sd/delivery/SelectDelivery.vue
@@ -335,7 +335,7 @@
</script>
<template>
  <div style="width: 100%;height: 100%">
  <div style="width: 100%;height: 98%">
    <el-date-picker
        v-model="orderInfo.selectDeliveryDate"
        type="daterange"
@@ -347,7 +347,7 @@
    />
    <el-button @click="changeDate" style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">{{$t('basicData.search')}}</el-button>
    <vxe-grid
        max-height="97%"
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
north-glass-erp/northglass-erp/src/views/sd/delivery/SelectOrderList.vue
@@ -305,7 +305,7 @@
</script>
<template>
  <div  style="width: 100%;height: 100%">
  <div  style="width: 100%;height: 98%">
    <el-date-picker
        v-model="orderInfo.selectOrderListDate"
        type="daterange"
@@ -317,7 +317,7 @@
    />
    <el-button @click="changeDate" style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">{{$t('basicData.search')}}</el-button>
    <vxe-grid
        max-height="97%"
        max-height="100%"
        class="mytable-scrollbar"
        @filter-change="filterChanged"
        ref="xGrid"
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -135,6 +135,21 @@
    }
    @ApiOperation("余料库存查询接口")
    @SaCheckPermission("SelectIngredientsStock.search")
    @PostMapping("/getSelectSurplusMaterialsDate/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectSurplusMaterialsDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> selectDate, @RequestBody SurplusMaterials surplusMaterials){
        return Result.seccess(materialInventoryService.getSelectSurplusMaterialsDate(pageNum,pageSize,selectDate,surplusMaterials));
    }
    @ApiOperation("余料新增接口")
    @SaCheckPermission("SelectIngredientsStock.search")
    @PostMapping("/addSelectSurplusMaterialsDate")
    public Result addSelectSurplusMaterialsDate( @RequestBody Map<String,Object> object){
        return Result.seccess(materialInventoryService.addSelectSurplusMaterialsDate(object));
    }
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/SurplusMaterials.java
New file
@@ -0,0 +1,24 @@
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 SurplusMaterials {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Double width;
    private Double height;
    private Double thickness;
    private Integer quantity;
    private String colour;
    private String remarks;
    private LocalDate createTime;
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/SurplusMaterialsLog.java
New file
@@ -0,0 +1,27 @@
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 SurplusMaterialsLog {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Double width;
    private Double height;
    private Double thickness;
    private Integer quantity;
    private String colour;
    private String type;
    private String projectNo;
    private String creator;
    private String remarks;
    private LocalDate createTime;
}
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -187,4 +187,19 @@
    Boolean updateMaterialInventoryArea(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea);
    List<SurplusMaterials> getSelectSurplusMaterialsDate(@Param("offset") Integer offset,
                                                             @Param("pageSize") Integer pageSize,String startDate, String endDate,
                                                             @Param("surplusMaterials") SurplusMaterials surplusMaterials);
    Map<String,Integer> getSelectSurplusMaterialsDatePageTotal(Integer offset, Integer pageSize,String startDate, String endDate,SurplusMaterials surplusMaterials);
    SurplusMaterials selectSurplusMaterialsCount( @Param("surplusMaterials") SurplusMaterials surplusMaterials);
    Boolean insertSurplusMaterials( @Param("surplusMaterials") SurplusMaterials surplusMaterials);
    Boolean insertSurplusMaterialsLog(@Param("surplusMaterials") SurplusMaterials surplusMaterials,String creator, String type);
    Boolean updateSurplusMaterialsOutQuantity( @Param("surplusMaterials") SurplusMaterials surplusMaterials);
    Boolean updateSurplusMaterialsIntQuantity( @Param("surplusMaterials") SurplusMaterials surplusMaterials);
}
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -5,6 +5,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.mm.*;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.OptimizeUse;
import com.example.erp.entity.sd.Delivery;
import com.example.erp.entity.sd.DeliveryDetail;
@@ -557,6 +558,81 @@
        return map;
    }
    public Map<String, Object> getSelectSurplusMaterialsDate(Integer pageNum, Integer pageSize, List<String> selectDate, SurplusMaterials surplusMaterials) {
        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.getSelectSurplusMaterialsDate(offset, pageSize,startDate, endDate, surplusMaterials));
        map.put("total", materialInventoryMapper.getSelectSurplusMaterialsDatePageTotal(offset, pageSize,startDate, endDate, surplusMaterials));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
        return map;
    }
    public Boolean addSelectSurplusMaterialsDate(Map<String,Object> object) {
        boolean saveState = true;
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
            String creator = "";
            if (object.get("creator") != null) {
                creator = object.get("creator").toString();
            }
            String type = "";
            if (object.get("type") != null) {
                type = object.get("type").toString();
            }
            int state = 0;
            if (object.get("state") != null) {
                state = Integer.parseInt(object.get("state").toString());
            }
            if(state==1){
                SurplusMaterials surplusMaterials = JSONObject.parseObject(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
                if(surplusMaterials!=null){
                    SurplusMaterials surplusMaterials1=materialInventoryMapper.selectSurplusMaterialsCount(surplusMaterials);
                    if(surplusMaterials1!=null){
                        System.out.println(surplusMaterials1);
                        materialInventoryMapper.updateSurplusMaterialsIntQuantity(surplusMaterials1);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials1,creator,type);
                    }else{
                        materialInventoryMapper.insertSurplusMaterials(surplusMaterials);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                    }
                }
            } else if (state==2) {
                List<SurplusMaterials> surplusMaterialsList = JSONArray.parseArray(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
                if(!surplusMaterialsList.isEmpty()){
                    for(SurplusMaterials surplusMaterials:surplusMaterialsList){
                        materialInventoryMapper.updateSurplusMaterialsOutQuantity(surplusMaterials);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                    }
                }
            }
        return saveState;
    }
    public String orderNumberSetting(String type) {
north-glass-erp/src/main/java/com/example/erp/service/sd/DeliveryService.java
@@ -248,15 +248,21 @@
                    }
                    double deliveryDetailMoney = 0.0;
                    if (calculateType==1){
                        deliveryDetailMoney=Double.valueOf(String.format("%.2f",Double.valueOf(
                        deliveryDetailMoney=Double.parseDouble(String.format("%.2f",Double.parseDouble(
                                String.format("%.2f", orderDetail.getComputeArea()*orderDetail.getDeliveryDetail().getQuantity())
                        )*orderDetail.getPrice()));
                    }else if (calculateType==2){
                        deliveryDetailMoney=Double.valueOf(String.format("%.2f",Double.valueOf(
                                String.format("%.2f", orderDetail.getComputeGrossArea()/orderDetail.getQuantity()*orderDetail.getDeliveryDetail().getQuantity())
                        if(Objects.equals(orderDetail.getArea(), orderDetail.getComputeArea())){
                            deliveryDetailMoney=Double.parseDouble(String.format("%.2f",Double.parseDouble(
                                    String.format("%.2f", orderDetail.getWidth()*orderDetail.getHeight()*orderDetail.getDeliveryDetail().getQuantity()/1000000)
                        )*orderDetail.getPrice()));
                        }else{
                            deliveryDetailMoney=Double.parseDouble(String.format("%.2f",Double.parseDouble(
                                    String.format("%.2f", orderDetail.getComputeArea()*orderDetail.getDeliveryDetail().getQuantity())
                            )*orderDetail.getPrice()));
                        }
                    }else if (calculateType==3){
                        deliveryDetailMoney=Double.valueOf(String.format("%.2f",orderDetail.getPrice() * orderDetail.getDeliveryDetail().getQuantity()));
                        deliveryDetailMoney=Double.parseDouble(String.format("%.2f",orderDetail.getPrice() * orderDetail.getDeliveryDetail().getQuantity()));
                    }
                    //根据订单计算方式进行金额计算
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml
@@ -54,7 +54,7 @@
        left join sd.order_detail od on fol.order_id = od.order_id and fol.operation_number = od.order_number
        left join sd.`order` o on o.order_id=fol.order_id
        <where>
            date(fol.operate_time)>=#{startDate} and date(fol.operate_time) &lt;= #{endDate} and o.delivery = 0
            date(fol.operate_time)>=#{startDate} and date(fol.operate_time) &lt;= #{endDate}
            <if test="finishedOperateLog.operationOrderNumber != null and finishedOperateLog.operationOrderNumber != ''">
                and fol.operation_order_number regexp #{finishedOperateLog.operationOrderNumber}
            </if>
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -768,4 +768,86 @@
    </update>
    <select id="getSelectSurplusMaterialsDate" >
        select *
        from mm.surplus_materials
        <where>
                and date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and quantity>0
            <if test="surplusMaterials.width != null and surplusMaterials.width != ''">
                and width regexp #{surplusMaterials.width}
            </if>
            <if test="surplusMaterials.height != null and surplusMaterials.height != ''">
                and height regexp #{surplusMaterials.height}
            </if>
            <if test="surplusMaterials.thickness != null and surplusMaterials.thickness != ''">
                and thickness regexp #{surplusMaterials.thickness}
            </if>
            <if test="surplusMaterials.quantity != null and surplusMaterials.quantity != ''">
                and quantity regexp #{surplusMaterials.quantity}
            </if>
            <if test="surplusMaterials.colour != null and surplusMaterials.colour != ''">
                and colour regexp #{surplusMaterials.colour}
            </if>
            <if test="surplusMaterials.remarks != null and surplusMaterials.remarks != ''">
                and remarks regexp #{surplusMaterials.remarks}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectSurplusMaterialsDatePageTotal" >
        select CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from mm.surplus_materials
        <where>
            and date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and quantity>0
            <if test="surplusMaterials.width != null and surplusMaterials.width != ''">
                and width regexp #{surplusMaterials.width}
            </if>
            <if test="surplusMaterials.height != null and surplusMaterials.height != ''">
                and height regexp #{surplusMaterials.height}
            </if>
            <if test="surplusMaterials.thickness != null and surplusMaterials.thickness != ''">
                and thickness regexp #{surplusMaterials.thickness}
            </if>
            <if test="surplusMaterials.quantity != null and surplusMaterials.quantity != ''">
                and quantity regexp #{surplusMaterials.quantity}
            </if>
            <if test="surplusMaterials.colour != null and surplusMaterials.colour != ''">
                and colour regexp #{surplusMaterials.colour}
            </if>
            <if test="surplusMaterials.remarks != null and surplusMaterials.remarks != ''">
                and remarks regexp #{surplusMaterials.remarks}
            </if>
        </where>
    </select>
    <select id="selectSurplusMaterialsCount" >
        select *
        from mm.surplus_materials
        where width=#{surplusMaterials.width} and height=#{surplusMaterials.height}
          and thickness=#{surplusMaterials.thickness} and colour=#{surplusMaterials.colour} limit 0,1
    </select>
    <insert id="insertSurplusMaterials">
        insert into mm.surplus_materials (width,height,thickness,quantity,colour,create_time)
        values (#{surplusMaterials.width},#{surplusMaterials.height},#{surplusMaterials.thickness},#{surplusMaterials.quantity},#{surplusMaterials.colour},now())
    </insert>
    <insert id="insertSurplusMaterialsLog">
        insert into mm.surplus_materials_log (width,height,thickness,quantity,colour,type,creator,create_time)
        values (#{surplusMaterials.width},#{surplusMaterials.height},#{surplusMaterials.thickness},
                #{surplusMaterials.quantity},#{surplusMaterials.colour},#{type},#{creator},now())
    </insert>
    <update id="updateSurplusMaterialsOutQuantity">
        update mm.surplus_materials set quantity=quantity-#{surplusMaterials.quantity} where id=#{surplusMaterials.id}
    </update>
    <update id="updateSurplusMaterialsIntQuantity">
        update mm.surplus_materials set quantity=quantity+#{surplusMaterials.quantity} where id=#{surplusMaterials.id}
    </update>
</mapper>
north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml
@@ -183,6 +183,7 @@
               od.height,
               od.shape,
               fgi.actual_signal_area,
               od.area,
               od.gross_area,
               od.compute_area,
               od.compute_gross_area,
@@ -372,6 +373,7 @@
               od.height,
               od.shape,
               fgi.actual_signal_area,
               od.area,
               od.gross_area,
               od.compute_area,
               od.compute_gross_area,