north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheet1.vue
@@ -474,7 +474,7 @@ <style scoped> @media print { @page { margin: 8mm 16mm 8mm 16mm !important; margin: 8mm 16mm 20mm 16mm !important; } .pages { page-break-after: always; north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheet2.vue
@@ -253,7 +253,7 @@ <style scoped> @media print { @page { margin: 8mm 16mm 8mm 16mm !important; margin: 8mm 16mm 20mm 16mm !important; } .pages { page-break-after: always; north-glass-erp/northglass-erp/src/router/index.js
@@ -1049,6 +1049,12 @@ name:'returnToStorageCreate', component:()=>import('../views/mm/ingredientStock/ReturnToStorageCreate.vue') }, //物料新增 { path:'materialAdditionRecord', name:'materialAdditionRecord', component:()=>import('../views/mm/ingredientStock/MaterialAdditionRecord.vue') }, { path: '', redirect:'/main/ingredientsStock/selectIngredientsStock' north-glass-erp/northglass-erp/src/views/mm/ingredientStock/IngredientsStock.vue
@@ -32,6 +32,7 @@ <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('ingredientsStock.returnToStorage')}}</el-breadcrumb-item> <el-breadcrumb-item @click="changeRouter(6)" :class="indexFlag===6?'indexTag':''" :to="{ path: '/main/ingredientsStock/selectSurplusMaterials' }">{{$t('ingredientsStock.surplusMaterialManagement')}}</el-breadcrumb-item> <el-breadcrumb-item @click="changeRouter(7)" :class="indexFlag===7?'indexTag':''" :to="{ path: '/main/ingredientsStock/materialAdditionRecord' }">{{$t('物料新增')}}</el-breadcrumb-item> <el-breadcrumb-item v-show="false" :to="{ path: '/main/order/orderReport' }">{{$t('ingredientsStock.returnToStorage')}}</el-breadcrumb-item> </el-breadcrumb> north-glass-erp/northglass-erp/src/views/mm/ingredientStock/MaterialAdditionRecord.vue
New file @@ -0,0 +1,480 @@ <!-- 领出记录 --> <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"; //语言获取 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([]) const getTableRow = (row,type) =>{ switch (type) { case 'add' :{ alert('我接收到子组件传送的编辑信息') 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 selectDate = ref(["",""]) let type = ref("") //筛选条件,有外键需要先定义明细里面的数据 let filterData = ref({ }) let pageNum=ref(1) let total = reactive({ pageTotal : 0, dataTotal : 0, pageSize : 100 }) onMounted(()=> { //第一次调用 request.post(`/materialInventory/getMaterialLogReport/物料新增/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 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") } }) }) let pageState = null /*使用筛选,后端获取数据*/ const changeFilterEvent = (event, option, $panel,) => { // 手动触发筛选 $panel.changeOption(event, !!option.data, option) } function filterChanged(column) { gridOptions.loading = true //筛选条件发生变化条件发生变化 let value = column.datas[0] != undefined ? column.datas[0] : '' value = value.trim() //判断是否存在外键 if (column.property.indexOf('.') > -1) { const columnArr = column.property.split('.') filterData.value[columnArr[0]] = { [columnArr[1]]: value } } else { filterData.value[column.property] = value } request.post(`/materialInventory/getMaterialLogReport/物料新增/1/${total.pageSize}/${selectDate.value}`, filterData.value).then((res) => { if (res.code == 200) { total.dataTotal = res.data.total.total * 1 total.pageTotal = res.data.total.pageTotal selectDate.value = res.data.selectDate pageNum.value = 1 produceList = deepClone(res.data.data) xGrid.value.loadData(produceList) gridOptions.loading = false } else { ElMessage.warning(res.msg) router.push("/login") } }) } const selectOrderList = () => { request.post(`/materialInventory/getMaterialLogReport/物料新增/${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 } produceList = deepClone(res.data.data) xGrid.value.loadData(produceList) gridOptions.loading = false } else { ElMessage.warning(res.msg) router.push("/login") } }) } const changeDate = () => { selectOrderList() } //页脚跳转 const handlePageChange = ({currentPage, pageSize}) => { total.pageTotal = pageSize pageNum.value = currentPage selectOrderList() } //子组件接收参数 const xGrid = ref(); const gridOptions = reactive({ border: "full",//表格加边框 keepSource: true,//保持源数据 align: 'center',//文字居中 stripe: true,//斑马纹 rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 id: 'StorageRecord', 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: 'operationOrderNumber', width: '150', title: t('productStock.operationOrderNumber'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'operationNumber', width: '100', title: t('order.OrderNum'), showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'operateType', width: '120', title: t('warehouseBasicData.type'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'quantity', width: '140', title: t('order.quantity'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'inventoryId', width: '100', title: t('ingredientsStock.id'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'materialCode', width: '140', title: t('ingredients.materialCode'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'materialName', width: '140', title: t('ingredientsStock.materialName'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, {field: 'width', width: '100', title: t('order.width'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, {field: 'height', width: '100', title: t('order.height'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, { field: 'thickness', width: '150', title: t('order.totalThickness'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'producer', width: '100', title: t('ingredientsStock.producer'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'unit', width: '140', title: t('ingredients.unit'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'singlePieceArea', width: '140', title: t('productStock.singlePieceArea'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'inventoryArea', width: '140', title: t('productStock.inventoryArea'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'operator', width: '100', title: t('productStock.creator'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'operateTime', width: '140', title: t('productStock.productionDate'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, { field: 'remarks', width: '140', title: t('productStock.remarks'), filters: [{data: ''}], slots: {filter: 'num1_filter'} }, ],//表头按钮 toolbarConfig: { buttons: [ { 'name': t('productStock.returnToWarehouse'), status: 'primary', 'code': 'cancel' }], /*import: false, export: true, print: true,*/ zoom: true, custom: true }, footerMethod({columns, data}) {//页脚函数 let footList = ['quantity'] return [ columns.map((column, columnIndex) => { if (columnIndex === 0) { return t('basicData.total') } if (footList.includes(column.field)) { return footSum(data, column.field) } return '' }) ] } }) const gridEvents = { toolbarButtonClick({code}) { const $grid = xGrid.value if ($grid) { switch (code) { case 'cancel': { const $table = xGrid.value //gridOptions.columns.unshift(a) if ($table) { const selectRecords = $table.getCheckboxRecords() if (selectRecords.length <= 0) { ElMessage.warning(t('productStock.unselectedData')) return } let flowData = ref({ userId: userid, userName: username, materialAdd: selectRecords }) request.post("/materialInventory/cancelMaterialAdditionRecord", flowData.value).then((res) => { if (res.code == 200 && res.data === "true") { ElMessage.success(t('product.msg.operateSuccess')) router.push({ path: '/main/ingredientsStock/materialAdditionRecord', query: {random: Math.random(), storageType: type.value} }) }else if(res.data === "false1"){ ElMessage.warning(t('数量不对请检查')) }else if(res.data === "false2"){ ElMessage.warning(t('库存不存在或者存在多条')) }else { ElMessage.warning(t('productStock.cancellationFailed')) } }).catch((err) => { ElMessage.error(t('basicData.msg.ServerConnectionError')) router.push("/login") }) } return; } } } } } </script> <template> <div style="width: 100%;height: 100%"> <div class="head"> <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> </div> <div class="main-table"> <vxe-grid height="100%" @filter-change="filterChanged" class="mytable-scrollbar" ref="xGrid" v-bind="gridOptions" v-on="gridEvents" :checkbox-config="checkBoxConfig" > <!-- <template #state="{ row,column}"> <!– <p>{{row[column.field]}}</p>–> <!– <el-checkbox v-model="row['isState']" :disabled="row[column.field]==='已审核'||row[column.field]==='未通过'"/>–> <vxe-checkbox v-model="row['isState']" :disabled="row[column.field]==='已审核'||row[column.field]==='未通过'"></vxe-checkbox> </template>--> <!-- @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" @keyup.enter.native="$panel.confirmFilter()" @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> </div> </div> </template> <style scoped> .head{ width: 100%; height: 35px; } .main-table{ width: 100%; height: calc(100% - 35px); } </style> north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -188,6 +188,12 @@ return Result.seccess(materialInventoryService.mesMaterialOutbound(reportingWork)); } @ApiOperation("物料新增返回接口") @PostMapping("/cancelMaterialAdditionRecord") public Result cancelMaterialAdditionRecord( @RequestBody Map<String,Object> object){ return Result.seccess(materialInventoryService.cancelMaterialAdditionRecord(object)); } north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -60,6 +60,8 @@ Boolean deleteMaterialLog(@Param("materialOutboundId") String materialOutboundId); Boolean deleteMaterialLogById(@Param("id") Long id); Integer getMaximum(@Param("type") String type); Integer getMaximums(@Param("type") String type); @@ -68,9 +70,9 @@ Integer getReturningWarehouseCount(@Param("returningId") String returningId); Integer getMaterialInventoryCount(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture); List<MaterialInventory> getMaterialInventoryCount(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture); Integer getMaterialInventoryCountNull(@Param("materialCode") Long materialCode); List<MaterialInventory> getMaterialInventoryCountNull(@Param("materialCode") Long materialCode); List<MaterialInventory> getMaterialInventoryCountId(@Param("materialCode") Long materialCode,@Param("dateOfManufacture") LocalDate dateOfManufacture); @@ -190,6 +192,11 @@ @Param("totalArea") Double totalArea, @Param("materialInventory") MaterialInventory materialInventory); Boolean updateMaterialInventoryOut(@Param("materialCode") Long materialCode,@Param("quantity") Integer quantity, @Param("dateOfManufacture") String dateOfManufacture); Boolean updateMaterialInventoryNullOut(@Param("materialCode") Long materialCode,@Param("quantity") Integer quantity); 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/MaterialInventoryService.java
@@ -201,21 +201,22 @@ //查询物料是否存在 Integer MaterialInventoryCount=0; List<MaterialInventory> MaterialInventoryCount; if (materialInventory.getDateOfManufacture()!=null){ MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); }else{ MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode); } if(MaterialInventoryCount==1){ if(MaterialInventoryCount.size()==1){ materialInventory.setId(MaterialInventoryCount.get(0).getId()); if (materialInventory.getDateOfManufacture()!=null){ materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); }else{ materialInventoryMapper.updateMaterialInventoryNull(materialCode,singlePieceArea,totalArea,materialInventory); } log.setFunction("saveMaterialInventory修改"); }else if(MaterialInventoryCount==0) { }else if(MaterialInventoryCount.isEmpty()) { materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); log.setFunction("saveMaterialInventory新增"); }else { @@ -226,6 +227,9 @@ MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(materialCode); json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); MaterialLog materialLog=new MaterialLog(); if(materialInventory.getDateOfManufacture()!=null){ materialLog.setOperationOrderNumber(materialInventory.getDateOfManufacture().toString()); } materialLog.setOperateType("物料新增"); materialLog.setMaterialCode(materialCode); materialLog.setMaterialName(convertString(json,"\"name\"")); @@ -598,7 +602,7 @@ //查询物料是否存在 Integer MaterialInventoryCount=0; List<MaterialInventory> MaterialInventoryCount; if (returningWarehouseDetail.getDateOfManufacture()!=null){ MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture()); }else{ @@ -606,7 +610,7 @@ } if(MaterialInventoryCount>0){ if(!MaterialInventoryCount.isEmpty()){ if (returningWarehouseDetail.getDateOfManufacture()!=null){ materialInventoryMapper.updateMaterialInventoryReturning(returningWarehouseDetail.getId(),singlePieceArea,totalArea,returningWarehouseDetail); }else{ @@ -1018,6 +1022,65 @@ } public String cancelMaterialAdditionRecord(Map<String,Object> object) { String saveState = "true"; //设置回滚点 Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); try { Log log = new Log(); log.setOperatorId(object.get("userId").toString()); log.setOperator(object.get("userName").toString()); log.setContent(object.toString()); //获取对象集合循环进行新增修改 List<MaterialLog> materialLoglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("materialAdd")), MaterialLog.class); if (!materialLoglist.isEmpty()){ for (MaterialLog materialLog : materialLoglist) { //查询物料是否存在 List<MaterialInventory> MaterialInventoryList; if (materialLog.getOperationOrderNumber()!=null){ MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCount(materialLog.getMaterialCode(), LocalDate.parse(materialLog.getOperationOrderNumber())); }else{ MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCountNull(materialLog.getMaterialCode()); } if(MaterialInventoryList.size()==1){ if(MaterialInventoryList.get(0).getAvailableQuantity()>=materialLog.getQuantity()){ if (materialLog.getOperationOrderNumber()!=null){ materialInventoryMapper.updateMaterialInventoryOut(materialLog.getMaterialCode(),materialLog.getQuantity(),materialLog.getOperationOrderNumber()); }else{ materialInventoryMapper.updateMaterialInventoryNullOut(materialLog.getMaterialCode(),materialLog.getQuantity()); } materialInventoryMapper.deleteMaterialLogById(materialLog.getId()); }else{ return "false1"; } }else{ return "false2"; } } } logService.saveLog(log); } catch (Exception e) { TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); //将异常传入数据库 SysError sysError = new SysError(); sysError.setError(e+Arrays.toString(e.getStackTrace())); sysError.setFunc("cancelFinishedGoodsInventoryStorage"); sysErrorService.insert(sysError); saveState = "false"; } return saveState; } north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -538,6 +538,10 @@ delete from mm.material_log where operation_order_number=#{materialOutboundId} </delete> <delete id="deleteMaterialLogById" > delete from mm.material_log where id=#{id} </delete> <delete id="deleteReturningWarehouseDetail" > delete from mm.returning_warehouse_detail where returning_id=#{returningId} </delete> @@ -583,11 +587,11 @@ </select> <select id="getMaterialInventoryCount" > select count(*) from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} select * from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} </select> <select id="getMaterialInventoryCountNull" > select count(*) from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture is null select * from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture is null </select> <select id="getMaterialInventoryCountId" > @@ -779,7 +783,21 @@ update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity}, available_quantity=available_quantity+#{materialInventory.inventoryQuantity}, total_area=single_piece_area*inventory_quantity where material_code=#{materialCode} where material_code=#{materialCode} and date_of_manufacture is null </update> <update id="updateMaterialInventoryOut" > update mm.material_inventory set inventory_quantity=inventory_quantity-#{quantity}, available_quantity=available_quantity-#{quantity}, total_area=single_piece_area*inventory_quantity where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} </update> <update id="updateMaterialInventoryNullOut" > update mm.material_inventory set inventory_quantity=inventory_quantity-#{quantity}, available_quantity=available_quantity-#{quantity}, total_area=single_piece_area*inventory_quantity where material_code=#{materialCode} and date_of_manufacture is null </update> <update id="updateMaterialInventoryReturning" >