north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue
@@ -438,7 +438,8 @@ return true } defineExpose({ validate validate, ongetproject }) const save = () => { @@ -552,7 +553,6 @@ data8.value=round(maxY-minY-lowerRight[1]*big,0) } } </script> north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialAddition.vue
New file @@ -0,0 +1,421 @@ <!-- 领出记录 --> <script setup> import {onMounted, reactive, ref} from "vue"; import {useRoute, 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 footSum from "@/hook/footSum"; import {changeFilterEvent, filterChanged} from "@/hook"; import {divideAuto, multiply} from "@/utils/decimal"; //语言获取 const { t } = useI18n() const router = useRouter() const route = useRoute() const userStore = useUserInfoStore() const username = userStore.user.userName const userid = userStore.user.userId let BasicData = ref([]) let produceLists = ref([]) let isDisabled = ref(false) let arrs = [ { type: 'radio',fixed:"left", title: t('basicData.check'), width: '80' }, { type: 'seq',fixed:'left', title: t('basicData.Number'), width: '80' }, {field: 'id', width: '150',title: t('ingredients.materialCode'), sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged} ] const value = ref('') const options = [ { value: t('ingredients.originalFilm'), label: t('ingredients.originalFilm') }, { value: t('ingredients.accessories'), label: t('ingredients.accessories'), } ] 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: 30},//鼠标移动或选择高亮 id: 'SelectIngredientsStocks', 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= async() =>{ request.get(`/BasicWarehouse/BasicWarehouseTypes/`+t('ingredientsStock.inventoryOrganization')).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 = () => { value.value=t('ingredients.originalFilm') 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) } if(value.value==t('ingredients.accessories')){ titleUploadData.value.inventoryOrganization=titleSelectJson.value.inventoryOrganization[1].operateTypeName }else{ titleUploadData.value.inventoryOrganization=titleSelectJson.value.inventoryOrganization[0].operateTypeName } getStoreWorks() }else{ ElMessage.warning(res.msg) } }) } //数据绑定 const getStoreWorks = () => { request.post(`/materialStore/getSelectMaterialStore`,filterDatas.value).then((res) => { if(res.code==200){ 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': { if(props.type==1){ const selectRecords = $grid.getRadioRecord() 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(t('ingredientsStock.pleaseSelectInventoryOrganization')) return } const materialRequisitionPersonnel = titleUploadData.value.inventoryQuantity if(materialRequisitionPersonnel === null || materialRequisitionPersonnel === undefined || materialRequisitionPersonnel === ''){ ElMessage.error(t('ingredientsStock.pleaseEnterTheQuantity')) return } const dateOfManufacture= titleUploadData.value.dateOfManufacture if(dateOfManufacture === null || dateOfManufacture === undefined || dateOfManufacture === ''){ titleUploadData.value.dateOfManufacture=null } /*const inventoryArea = titleUploadData.value.inventoryArea if(inventoryArea === null || inventoryArea === undefined || inventoryArea === ''){ ElMessage.error("请输入库存区域") return }*/ let flowData if(selectRecords.height===undefined){ flowData = ref({ title: titleUploadData.value, materialCode: selectRecords.id, userName:userStore.user.userName, userId:userStore.user.userId }) }else{ flowData = ref({ totalArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2))*titleUploadData.value.inventoryQuantity, singlePieceArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2)), title: titleUploadData.value, materialCode: selectRecords.id, userName:userStore.user.userName, userId:userStore.user.userId }) } request.post("/materialInventory/saveMaterialInventory", flowData.value).then((res) => { if(res.code==200 && res.data==="true"){ ElMessage.success(t('basicData.msg.saveSuccess')) router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}}) }else { ElMessage.warning(t('basicData.msg.ServerConnectionError')) } }) }else{ let flowData = ref({ title: titleUploadData.value, materialInventoryId: props.data.id, userName:userStore.user.userName, userId:userStore.user.userId }) request.post("/materialInventory/updateMaterialInventory", flowData.value).then((res) => { if(res.code==200 && res.data==="true"){ ElMessage.success(t('basicData.msg.saveSuccess')) router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}}) }else if(res.data==="false1") { ElMessage.warning("库存存在多条") }else { ElMessage.warning(t('basicData.msg.ServerConnectionError')) } }) } break } } } } } let props = defineProps({ type:0, data:null }) onMounted(async ()=>{ await select() if(props.data!=null){ titleUploadData.value.dateOfManufacture=props.data.dateOfManufacture titleUploadData.value.qualityGuaranteePeriod=props.data.qualityGuaranteePeriod titleUploadData.value.producer=props.data.producer titleUploadData.value.inventoryArea=props.data.inventoryArea titleUploadData.value.inventoryQuantity=props.data.inventoryQuantity titleUploadData.value.remarks=props.data.remarks isDisabled=true }else{ isDisabled=false getStoreWork() } }) </script> <template> <div style="width: 100%;height: 100%"> <div class="order-primary" > <el-row> <el-col :span="2"><el-text>{{$t('ingredientsStock.dateOfManufacture')}}:</el-text></el-col> <el-col :span="4"> <el-date-picker :disabled="isDisabled" v-model="titleUploadData.dateOfManufacture" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :placeholder="$t('ingredientsStock.pleaseDateOfManufacture')"/> </el-col> <el-col :span="2"><el-text>{{$t('ingredientsStock.qualityGuaranteePeriod')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.qualityGuaranteePeriod" /></el-col> <el-col :span="1"><el-text>{{$t('ingredientsStock.producer')}}:</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>{{$t('ingredientsStock.inventoryOrganization')}}:</el-text></el-col> <el-col :span="4"> <el-select :disabled="isDisabled" v-model="titleUploadData.inventoryOrganization" clearable :placeholder="$t('processCard.pleaseSelect')" > <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>{{$t('productStock.inventoryArea')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.inventoryArea" /></el-col> <el-col :span="1"><el-text>{{$t('order.quantity')}}:</el-text></el-col> <el-col :span="3"><el-input :disabled="isDisabled" v-model="titleUploadData.inventoryQuantity" /></el-col> <el-col :span="1"><el-text>{{$t('basicData.remarks')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.remarks" /></el-col> </el-row> </div> <div> <el-row v-if="props.type===1"> <el-select v-model="value" style="width: 200px" :placeholder="$t('ingredientsStock.pleaseSelectACategory')" @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" style="height: 350px"> <vxe-grid height="100%" 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" @keyup.enter.native="$panel.confirmFilter()" @input="changeFilterEvent($event, option, $panel)"/> </div> </div> </template> <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> </vxe-grid> </div> </div> </template> <style scoped> .head{ width: 100%; height: 35px; } .main-table{ width: 100%; height: calc(100% - 35px); } .order-primary{ width: 100%; } .el-col{ margin-left: 15px; margin-bottom: 5px; } </style> north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue
@@ -13,6 +13,8 @@ import {divideAuto, multiply} from "@/utils/decimal"; import companyInfo from "@/stores/sd/companyInfo"; import footSum from "@/hook/footSum"; import MaterialAddition from "@/views/mm/ingredientStock/MaterialAddition.vue" import SelectAlienEditor from "@/components/sd/order/SelectAlienEditor.vue"; //语言获取 const { t } = useI18n() @@ -20,8 +22,11 @@ const company = companyInfo() const router = useRouter() let produceList = ref([]) let produceLists = ref([]) let sheetIndex = ref(-1) let rowIndexData = ref(null) let dialogTableVisible = ref(false) let refMaterialAddition=ref() const getTableRow = (row,type) =>{ switch (type) { case 'edit' :{ @@ -311,6 +316,7 @@ {'code': 'out', 'name': t('ingredientsStock.materialOutbound'),status: 'primary'}, {'code': 'add', 'name': t('ingredients.materialAddition'),status: 'primary'}, {'code': 'delete', 'name': t('basicData.delete'),status: 'primary'}, {'code': 'update', 'name': t('修改'),status: 'primary'}, ], /*import: false, export: true, @@ -383,31 +389,26 @@ } case 'add': { dialogTableVisible.value=true select() //第一次加载默认 value.value=t('ingredients.originalFilm') filterData.value.type=t('ingredients.originalFilm') request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => { if(res.code==200){ gridOption.columns.splice(0,gridOption.columns.length) 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) } }) rowIndexData.value=null sheetIndex.value=1 break } case 'update': { $grid.clearFilter() const selectRecords = $grid.getCheckboxRecords() if (selectRecords.length === 1) { dialogTableVisible.value=true rowIndexData.value=selectRecords[0] sheetIndex.value=2 }else{ ElMessage.warning(t('productStock.unselectedData')) return } break } case 'delete': { @@ -446,7 +447,6 @@ } } } console.log(selectRecords) let flowData = ref({ materialInventory: selectRecords, ids: id, @@ -472,243 +472,6 @@ } } let arrs = [ { type: 'radio',fixed:"left", title: t('basicData.check'), width: '80' }, { type: 'seq',fixed:'left', title: t('basicData.Number'), width: '80' }, {field: 'id', width: '150',title: t('ingredients.materialCode'), sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged} ] const value = ref('') const options = [ { value: t('ingredients.originalFilm'), label: t('ingredients.originalFilm') }, { value: t('ingredients.accessories'), label: t('ingredients.accessories'), } ] 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: 30},//鼠标移动或选择高亮 id: 'SelectIngredientsStocks', 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/`+t('ingredientsStock.inventoryOrganization')).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) } if(value.value==t('ingredients.accessories')){ titleUploadData.value.inventoryOrganization=titleSelectJson.value.inventoryOrganization[1].operateTypeName }else{ titleUploadData.value.inventoryOrganization=titleSelectJson.value.inventoryOrganization[0].operateTypeName } getStoreWorks() }else{ ElMessage.warning(res.msg) } }) } //数据绑定 const getStoreWorks = () => { request.post(`/materialStore/getSelectMaterialStore`,filterDatas.value).then((res) => { if(res.code==200){ 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() 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(t('ingredientsStock.pleaseSelectInventoryOrganization')) return } const materialRequisitionPersonnel = titleUploadData.value.inventoryQuantity if(materialRequisitionPersonnel === null || materialRequisitionPersonnel === undefined || materialRequisitionPersonnel === ''){ ElMessage.error(t('ingredientsStock.pleaseEnterTheQuantity')) return } const dateOfManufacture= titleUploadData.value.dateOfManufacture if(dateOfManufacture === null || dateOfManufacture === undefined || dateOfManufacture === ''){ titleUploadData.value.dateOfManufacture=null } /*const inventoryArea = titleUploadData.value.inventoryArea if(inventoryArea === null || inventoryArea === undefined || inventoryArea === ''){ ElMessage.error("请输入库存区域") return }*/ let flowData if(selectRecords.height===undefined){ flowData = ref({ title: titleUploadData.value, materialCode: selectRecords.id, userName:userStore.user.userName, userId:userStore.user.userId }) }else{ flowData = ref({ totalArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2))*titleUploadData.value.inventoryQuantity, singlePieceArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2)), title: titleUploadData.value, materialCode: selectRecords.id, userName:userStore.user.userName, userId:userStore.user.userId }) } console.log(flowData.value) request.post("/materialInventory/saveMaterialInventory", flowData.value).then((res) => { console.log(res) if(res.code==200 && res.data==="true"){ ElMessage.success(t('basicData.msg.saveSuccess')) router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}}) }else if(res.data==="false1") { ElMessage.warning("库存存在多条") }else { ElMessage.warning(t('basicData.msg.ServerConnectionError')) } }) break } } } } } const rowStyle = ({ row,rowIndex }) => { @@ -739,6 +502,7 @@ } } </script> @@ -825,75 +589,16 @@ </div> <el-dialog v-model="dialogTableVisible" :title="$t('ingredients.materialAddition')" style="width: 70%;height:75% "> <div class="order-primary" > <el-row> <el-col :span="2"><el-text>{{$t('ingredientsStock.dateOfManufacture')}}:</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="$t('ingredientsStock.pleaseDateOfManufacture')"/> </el-col> <el-col :span="2"><el-text>{{$t('ingredientsStock.qualityGuaranteePeriod')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.qualityGuaranteePeriod" /></el-col> <el-col :span="1"><el-text>{{$t('ingredientsStock.producer')}}:</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>{{$t('ingredientsStock.inventoryOrganization')}}:</el-text></el-col> <el-col :span="4"> <el-select v-model="titleUploadData.inventoryOrganization" clearable :placeholder="$t('processCard.pleaseSelect')" > <el-option v-for="item in titleSelectJson['inventoryOrganization']" :key="item.id" :label="item.operateTypeName" :value="item.operateTypeName" <material-addition v-if="sheetIndex===1" ref="refMaterialAddition" style="width: 100%;height: 100%" :data=rowIndexData :type=1 :close-on-click-modal="false" :close-on-press-escape="false" /> </el-select> </el-col> <el-col :span="2"><el-text>{{$t('productStock.inventoryArea')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.inventoryArea" /></el-col> <el-col :span="1"><el-text>{{$t('order.quantity')}}:</el-text></el-col> <el-col :span="3"><el-input v-model="titleUploadData.inventoryQuantity" /></el-col> <el-col :span="1"><el-text>{{$t('basicData.remarks')}}:</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" style="width: 200px" :placeholder="$t('ingredientsStock.pleaseSelectACategory')" @change="getStoreWork"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" <material-addition v-if="sheetIndex===2" ref="refMaterialAddition" style="width: 100%;height: 100%" :data=rowIndexData :type=2 :close-on-click-modal="false" :close-on-press-escape="false" /> </el-select> </el-row> </div> <div class="main-div-customers" style="height: 350px"> <vxe-grid height="100%" 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" @keyup.enter.native="$panel.confirmFilter()" @input="changeFilterEvent($event, option, $panel)"/> </div> </div> </template> </vxe-grid> </div> </el-dialog> </div> </template> north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -45,6 +45,7 @@ return Result.seccess(materialInventoryService.saveMaterialInventory(object)); } @ApiOperation("物料库存加时间查询接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/getSelectMaterialInventoryDate/{pageNum}/{pageSize}/{selectDate}") @@ -216,5 +217,12 @@ } @ApiOperation("物料库存修改接口") @SaCheckPermission("selectIngredientsStock.add") @PostMapping("/updateMaterialInventory") public Result updateMaterialInventory( @RequestBody Map<String,Object> object){ return Result.seccess(materialInventoryService.updateMaterialInventory(object)); } } north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -271,4 +271,6 @@ Map<String,Integer> getOptimizeOutboundReportTotal(Integer offset, Integer pageSize, String startDate, String endDate, MaterialLog materialLog, String type); List<Map<String,Object>> getSelectMaterialInventoryMes(); Boolean updateMaterialInventoryAll(@Param("materialInventoryId") Long materialInventoryId,@Param("materialInventory") MaterialInventory materialInventory); } north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -1244,4 +1244,39 @@ } public String updateMaterialInventory(Map<String,Object> object) { String saveState = "true"; //设置回滚点 Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); try { long materialInventoryId = 0L; if (object.get("materialInventoryId") != null) { materialInventoryId = Long.parseLong(object.get("materialInventoryId").toString()); } Log log = new Log(); log.setOperatorId(object.get("userId").toString()); log.setOperator(object.get("userName").toString()); log.setContent(object.toString()); log.setFunction("updateMaterialInventory物料库存修改"); MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class); materialInventoryMapper.updateMaterialInventoryAll(materialInventoryId,materialInventory); logService.saveLog(log); } catch (Exception e) { TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); //将异常传入数据库 SysError sysError = new SysError(); sysError.setError(e+Arrays.toString(e.getStackTrace())); sysError.setFunc("saveMaterialInventory"); sysErrorService.insert(sysError); saveState = "false"; } return saveState; } } north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -1309,4 +1309,14 @@ order by mi.id desc </select> <update id="updateMaterialInventoryAll" > update mm.material_inventory set date_of_manufacture=#{materialInventory.dateOfManufacture}, producer=#{materialInventory.producer}, quality_guarantee_period=#{materialInventory.qualityGuaranteePeriod}, inventory_area=#{materialInventory.inventoryArea}, remarks=#{materialInventory.remarks}, inventory_organization=#{materialInventory.inventoryOrganization} where id=#{materialInventoryId} </update> </mapper>