From 638a684258fb4bc6adf76a1964bdf0d7f99e404f Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期一, 31 三月 2025 02:18:54 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSClient/src/extension/stock/materielnfoStatistics.js | 59 +++ 代码管理/WMS/WIDESEA_WMSClient/src/router/viewGird.js | 5 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IMaterielnfoStatisticsService.cs | 17 + 代码管理/WMS/WIDESEA_WMSClient/src/views/basic/materielInfo.vue | 155 ++++++-- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielSourceTypeEnum.cs | 10 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/MaterielnfoStatisticsDTO.cs | 66 +++ 代码管理/WMS/WIDESEA_WMSClient/src/views/stock/materielnfoStatistics.vue | 189 +++++++++++ 代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/materielInfo.js | 116 +++--- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/MaterielnfoStatisticsController.cs | 55 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielTypeEnum.cs | 13 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MaterielnfoStatisticsService.cs | 308 ++++++++++++++++++ 12 files changed, 891 insertions(+), 104 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielInfo.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielInfo.js" index 24e1d94..7e986ec 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielInfo.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielInfo.js" @@ -2,57 +2,71 @@ //姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 let extension = { - components: { - //鏌ヨ鐣岄潰鎵╁睍缁勪欢 - gridHeader: '', - gridBody: '', - gridFooter: '', - //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 - modelHeader: '', - modelBody: '', - modelFooter: '' + components: { + //鏌ヨ鐣岄潰鎵╁睍缁勪欢 + gridHeader: '', + gridBody: '', + gridFooter: '', + //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) + buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� + methods: { + //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� + onInit() { }, - tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) - buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� - methods: { - //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� - onInit() { - }, - onInited() { - //妗嗘灦鍒濆鍖栭厤缃悗 - //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 - //this.detailOptions.columns.forEach(column=>{ }); - }, - searchBefore(param) { - //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 - //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ - return true; - }, - searchAfter(result) { - //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊� - return true; - }, - addBefore(formData) { - //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� - return true; - }, - updateBefore(formData) { - //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d - return true; - }, - rowClick({ row, column, event }) { - //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� - this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; - }, - modelOpenAfter(row) { - //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 - //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; - //(2)缁欏脊鍑烘璁剧疆榛樿鍊� - //(3)this.editFormFields.瀛楁='xxx'; - //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� - //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + onInited() { + //妗嗘灦鍒濆鍖栭厤缃悗 + //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 + //this.detailOptions.columns.forEach(column=>{ }); + }, + searchBefore(param) { + //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 + //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ + return true; + }, + searchAfter(result) { + //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊� + // if (Array.isArray(result)) { + // result.forEach(item => { + // if (item.hasOwnProperty('isCheck')) { + // item.isCheck = item.isCheck === 'True' ? '鏄�' : '鍚�'; + // } + // if (item.hasOwnProperty('materielState')) { + // item.materielState = item.materielState === 'Enable' ? '鍚敤' : '绂佺敤' + // } + // }); + // } + return result; + + }, + addBefore(formData) { + //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� + return true; + }, + updateBefore(formData) { + //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d + return true; + }, + rowClick({ row, column, event }) { + //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� + this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; + }, + modelOpenAfter(row) { + //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 + //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; + //(2)缁欏脊鍑烘璁剧疆榛樿鍊� + //(3)this.editFormFields.瀛楁='xxx'; + //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� + //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + let isAdd = this.currentAction == 'Add' + if (isAdd) { + this.editFormFields.materielInvOrgId = '娣畨鐗瑰垱浜屽巶' } } - }; - export default extension; - \ No newline at end of file + } +}; +export default extension; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/materielnfoStatistics.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/materielnfoStatistics.js" new file mode 100644 index 0000000..6292426 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/materielnfoStatistics.js" @@ -0,0 +1,59 @@ + +//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 + +let extension = { + components: { + //鏌ヨ鐣岄潰鎵╁睍缁勪欢 + gridHeader: '', + gridBody: '', + gridFooter: '', + //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 + modelHeader: '', + modelBody: '', + modelFooter: '' + }, + tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓) + buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽� + methods: { + //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄� + onInit() { + + }, + onInited() { + //妗嗘灦鍒濆鍖栭厤缃悗 + //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔 + //this.detailOptions.columns.forEach(column=>{ }); + }, + searchBefore(param) { + //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟 + //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ + return true; + }, + searchAfter(result) { + //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊� + return true; + }, + addBefore(formData) { + //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫�� + return true; + }, + updateBefore(formData) { + //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d + return true; + }, + rowClick({ row, column, event }) { + //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠� + this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�; + }, + modelOpenAfter(row) { + //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁 + //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add'; + //(2)缁欏脊鍑烘璁剧疆榛樿鍊� + //(3)this.editFormFields.瀛楁='xxx'; + //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊� + //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions) + } + } + }; + export default extension; + \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/router/viewGird.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/router/viewGird.js" index 490795d..4c8f700 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/router/viewGird.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/router/viewGird.js" @@ -78,6 +78,11 @@ path: '/outStockLockInfo', name: 'outStockLockInfo', component: () => import('@/views/outbound/outStockLockInfo.vue') + }, + { + path: '/materielnfoStatistics', + name: 'materielnfoStatistics', + component: () => import('@/views/stock/materielnfoStatistics.vue') },{ path: '/stockInfo', name: 'stockInfo', diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/basic/materielInfo.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/basic/materielInfo.vue" index aaacaa0..97ab61e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/basic/materielInfo.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/basic/materielInfo.vue" @@ -38,9 +38,11 @@ [ { title: "浠撳簱", - required: true, field: "warehouseId", - type: "string", + type: "select", + dataKey: "warehouses", + data: [], + required: true, }, { title: "鐗╂枡缂栧彿", @@ -48,27 +50,74 @@ field: "materielCode", type: "string", }, - { + ], + [ + { title: "鐗╂枡鍚嶇О", required: true, field: "materielName", type: "string", }, { - title: "璁¢噺鍗曚綅", + title: "鐗╂枡瑙勬牸", required: true, - field: "unit", + field: "materielSpec", type: "string", }, ], [ - - { - title: "鐗╂枡鎻忚堪", - field: "materielDes", - type: "textarea", + { + title: "鐗╂枡鍩烘湰鍒嗙被", + required: true, + field: "materielType", + type: "select", + dataKey:"materielTypeEnum", + data:[] + }, + { + field: "materielSourceType", + title: "鐗╂枡灞炴�у垎绫�", + required: true, + type: "select", + dataKey:"materielSourceTypeEnum", + data:[] + }, ], + [ + { + title: "鍩烘湰鍗曚綅", + required: true, + field: "materielUnit", + type: "string", + }, + { + title: "鐗╂枡鐘舵��", + required: true, + field: "materielState", + type: "select", + dataKey:"enableEnum", + data:[] + }, + + ], + [ + { + title: "搴撳瓨缁勭粐", + required: true, + field: "materielInvOrgId", + type: "string", + }, + { + title: "鏄惁闇�瑕佽川妫�", + required: true, + field: "isCheck", + type: "select", + dataKey:"yesno", + data:[] + }, + ] + ]); const searchFormFields = ref({ materielCode: "", @@ -78,6 +127,7 @@ [ { title: "鐗╂枡缂栧彿", field: "materielCode", type: "like" }, { title: "鐗╂枡鍚嶇О", field: "materielName", type: "like" }, + {title: "鎵�灞炰粨搴�", field:"warehouseId",type:"select",dataKey:"warehouses",data:[]} ], ]); const columns = ref([ @@ -114,57 +164,78 @@ align: "left", }, { - field: "materielDes", - title: "鐗╂枡鎻忚堪", - type: "decimal", - width: 90, - align: "left", - }, - { - field: "cotainerType", - title: "瀹瑰櫒绫诲瀷", + field: "materielSpec", + title: "鐗╂枡瑙勬牸", type: "string", - width: 90, + width: 240, align: "left", - hidden:true }, { - field: "packspes", - title: "鍖呰瑙勬牸", - type: "int", + field: "materielSourceType", + title: "鐗╂枡灞炴�у垎绫�", + type: "string", width: 120, align: "left", - hidden:true + bind: { key: "materielSourceTypeEnum", data: [] }, }, { - field: "attribute", - title: "鐗╂枡灞炴��", + field: "materielType", + title: "鐗╂枡鍩烘湰鍒嗙被", type: "string", - width: 200, + width: 120, align: "left", - hidden:true + }, { - field: "unit", - title: "璁¢噺鍗曚綅", + field: "materielUnit", + title: "鍩烘湰鍗曚綅", type: "string", + width: 120, + align: "left", + }, + { + field: "materielSize", + title: "鐗╂枡灏哄", + type: "float", width: 180, align: "left", }, { - field: "validity", - title: "鏈夋晥鏈�", - type: "string", + field: "materielLength", + title: "鐗╂枡闀垮害", + type: "float", width: 120, align: "left", }, { - field: "safetyStock", - title: "瀹夊叏搴撳瓨", - type: "string", + field: "materielThickness", + title: "鐗╂枡鍘氬害", + type: "float", width: 120, align: "left", - hidden:true + }, + { + field: "materielState", + title: "鐗╂枡鐘舵��", + type: "select", + width: 100, + bind:{key:"",data: [{key:'Enable',value:'鍚敤'},{key:'Disable',value:'绂佺敤'}] }, + align: "left", + }, + { + field: "materielInvOrgId", + title: "搴撳瓨缁勭粐", + type: "string", + width: 100, + align: "left", + }, + { + field: "isCheck", + title: "鏄惁闇�瑕佽川妫�", + type: "int", + bind:{key:"",data: [{key:'False',value:'鍚�'},{key:'True',value:'鏄�'}] }, + width: 100, + align: "left", }, { field: "creater", @@ -196,13 +267,7 @@ align: "left", hidden:true }, - { - field: "remark", - title: "澶囨敞", - type: "string", - width: 100, - align: "left", - }, + ]); const detail = ref({ cnName: "#detailCnName", diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/stock/materielnfoStatistics.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/stock/materielnfoStatistics.vue" new file mode 100644 index 0000000..c50070b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/stock/materielnfoStatistics.vue" @@ -0,0 +1,189 @@ +<template> + <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" + :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions" + :table="table" :extend="extend"> + </view-grid> +</template> +<script> +import extend from "@/extension/stock/materielnfoStatistics.js"; +import { ref, defineComponent } from "vue"; +export default defineComponent({ + setup() { + const table = ref({ + key: "stockId", + footer: "Foots", + cnName: "鐗╂枡鍒嗙被缁熻", + name: "materielnfoStatistics", + url: "/materielnfoStatistics/", + sortName: "stockId", + }); + const editFormFields = ref({ + deviceCode: "", + deviceName: "", + deviceType: "", + deviceStatus: "", + deviceIp: "", + devicePort: "", + devicePlcType: "", + deviceRemark: "", + }); + const editFormOptions = ref([ + [ + { + title: "鐗╂枡缂栧彿", + required: true, + field: "materielCode", + type: "string", + }, + { + title: "鍗曟嵁缂栧彿", + required: true, + field: "materielName", + type: "string", + }, + { + title: "鎵规鍙�", + required: true, + field: "orderNo", + type: "string", + }, + { + title: "搴忓垪鍙�", + required: true, + field: "serialNumber", + type: "string", + }, + ], + + ]); + const searchFormFields = ref({ + materielCode: "", + materielName: "", + orderNo: "", + }); + const searchFormOptions = ref([ + [ + { title: "鐗╂枡缂栧彿", field: "materielCode", type:"like"}, + { title: "鐗╂枡鍚嶇О", field: "materielName" ,type:"like"}, + { title: "鎵�灞炰粨搴�", field: "warehouseId",type: "select",dataKey: "warehouses",data: []}, + {title: "搴撳瓨鐘舵��",field: "stockStatus",type: "select",dataKey:"stockStatusEmun", data: []} + ], + ]); + const columns = ref([ + { + field: "stockId", + title: "Id", + type: "int", + width: 90, + hidden: true, + readonly: true, + require: true, + align: "left", + }, + { + field: "warehouseId", + title: "浠撳簱", + type: "select", + width: 100, + align: "left", + bind: { key: "warehouses", data: [] }, + }, + { + field: "materielCode", + title: "鐗╂枡缂栧彿", + type: "string", + width: 150, + align: "left", + }, + { + field: "materielName", + title: "鐗╂枡鍚嶇О", + type: "string", + width: 150, + align: "left", + }, + { + field: "stockQuantity", + title: "搴撳瓨鏁伴噺", + type: "string", + width: 120, + align: "left", + }, + { + field: "outboundQuantity", + title: "鍑哄簱鏁伴噺", + type: "string", + width: 120, + align: "left", + }, + { + field:"unit", + title:"鍗曚綅", + type:"string", + width:60, + align:"left" + }, + { + field: "stockStatus", + title: "搴撳瓨鐘舵��", + type: "string", + width: 120, + align: "left", + bind: { key: "stockStatusEmun", data: [] }, + }, + { + field: "remark", + title: "澶囨敞", + type: "string", + width: 100, + align: "left", + }, + { + field: "creater", + title: "鍒涘缓浜�", + type: "string", + width: 90, + align: "left", + }, + { + field: "createDate", + title: "鍒涘缓鏃堕棿", + type: "datetime", + width: 160, + align: "left", + }, + { + field: "modifier", + title: "淇敼浜�", + type: "string", + width: 100, + align: "left", + }, + { + field: "modifyDate", + title: "淇敼鏃堕棿", + type: "datetime", + width: 160, + align: "left", + }, + + ]); + const detail = ref({ + cnName: "#detailCnName", + table: "", + columns: [], + sortName: "", + }); + return { + table, + extend, + editFormFields, + editFormOptions, + searchFormFields, + searchFormOptions, + columns, + detail, + }; + }, +}); +</script> \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielSourceTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielSourceTypeEnum.cs" index 7cfbe87..157b741 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielSourceTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielSourceTypeEnum.cs" @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -11,16 +12,19 @@ /// <summary> /// 閲囪喘浠� /// </summary> - PurchasePart = 1, + [Description("閲囪喘浠�")] + 閲囪喘浠� = 1, /// <summary> /// 鑷埗浠� /// </summary> - SelfMadePart = 2, + [Description("鑷埗浠�")] + 鑷埗浠� = 2, /// <summary> /// 閲囪喘&鑷埗浠� /// </summary> - PurchaseAndSelf = 3 + [Description("閲囪喘鍜岃嚜鍒朵欢")] + 閲囪喘鍜岃嚜鍒朵欢 = 3 } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielTypeEnum.cs" index 6878539..b08053b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/MaterielEnum/MaterielTypeEnum.cs" @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -14,21 +15,25 @@ /// <summary> /// 鎴愬搧 /// </summary> - FinishProduct = 1, + [Description("鎴愬搧")] + 鎴愬搧 = 1, /// <summary> /// 鍗婃垚鍝� /// </summary> - HalfProduct = 2, + [Description("鍗婃垚鍝�")] + 鍗婃垚鍝� = 2, /// <summary> /// 鍘熸潗鏂� /// </summary> - RawMateriel = 3, + [Description("鍘熸潗鏂�")] + 鍘熸潗鏂� = 3, /// <summary> /// 澶囦欢 /// </summary> - SpareParts = 4 + [Description("澶囦欢")] + 澶囦欢 = 4 } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/MaterielnfoStatisticsDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/MaterielnfoStatisticsDTO.cs" new file mode 100644 index 0000000..cc5b348 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/MaterielnfoStatisticsDTO.cs" @@ -0,0 +1,66 @@ +锘縰sing Magicodes.ExporterAndImporter.Core; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Model.Models; + +namespace WIDESEA_DTO.Stock +{ + public class MaterielnfoStatisticsDTO + { + /// <summary> + /// 浠撳簱ID + /// </summary> + [ExporterHeader(DisplayName = "浠撳簱ID")] + public int WarehouseId { get; set; } + + /// <summary> + /// 鐗╂枡缂栧彿 + /// </summary> + [ExporterHeader(DisplayName = "鐗╂枡缂栧彿")] + public string MaterielCode { get; set; } + + /// <summary> + /// 鐗╂枡鍚嶇О + /// </summary> + [ExporterHeader(DisplayName = "鐗╂枡鍚嶇О")] + public string MaterielName { get; set; } + + /// <summary> + /// 搴撳瓨鏁伴噺 + /// </summary> + [ExporterHeader(DisplayName = "搴撳瓨鏁伴噺")] + public float StockQuantity { get; set; } + + /// <summary> + /// 鍑哄簱鏁伴噺 + /// </summary> + [ExporterHeader(DisplayName = "鍑哄簱鏁伴噺")] + public float OutboundQuantity { get; set; } + + /// <summary> + /// 搴撳瓨鐘舵�� + /// </summary> + [ExporterHeader(IsIgnore = true)] + public int StockStatus { get; set; } + + + /// <summary> + /// 鍗曚綅 + /// </summary> + [ExporterHeader(DisplayName = "鍗曚綅")] + public string Unit { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [ExporterHeader(DisplayName = "澶囨敞")] + public string Remark { get; set; } + + + + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IMaterielnfoStatisticsService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IMaterielnfoStatisticsService.cs" new file mode 100644 index 0000000..93d8901 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IMaterielnfoStatisticsService.cs" @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Core; +using WIDESEA_DTO.Stock; + +namespace WIDESEA_IStockService +{ + public interface IMaterielnfoStatisticsService : IDependency + { + PageGridData<MaterielnfoStatisticsDTO> GetPageGridData(PageDataOptions options); + + WebResponseContent Export(PageDataOptions options); + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" index 682c4fe..768a873 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" @@ -68,7 +68,7 @@ /// <summary> /// 鐗堟湰鍚嶇О /// </summary> - [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐗堟湰鍚嶇О")] + [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐗堟湰鍚嶇О")] public string MaterielVersion { get; set; } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MaterielnfoStatisticsService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MaterielnfoStatisticsService.cs" new file mode 100644 index 0000000..d8d262c --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/MaterielnfoStatisticsService.cs" @@ -0,0 +1,308 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Core; +using WIDESEA_Core.BaseRepository; +using WIDESEA_Core.DB.Models; +using WIDESEA_Core.Helper; +using WIDESEA_Core.HostedService; +using WIDESEA_DTO.Stock; +using WIDESEA_IStockService; +using WIDESEA_Model.Models; +using System.Linq; +using WIDESEA_Common.WareHouseEnum; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using WIDESEA_Common.LocationEnum; +using WIDESEA_Core.Utilities; + +namespace WIDESEA_StockService +{ + public partial class MaterielnfoStatisticsService : IMaterielnfoStatisticsService + { + public readonly IUnitOfWorkManage _unitOfWorkManage; + public readonly SqlSugarClient _dbBase; + + public MaterielnfoStatisticsService(IUnitOfWorkManage unitOfWorkManage) { + _unitOfWorkManage = unitOfWorkManage; + _dbBase = unitOfWorkManage.GetDbClient(); + } + + public virtual PageGridData<MaterielnfoStatisticsDTO> GetPageGridData(PageDataOptions options) + { + try + { + + List<MaterielnfoStatisticsDTO> materielnfoStatistics = new List<MaterielnfoStatisticsDTO>(); + ISugarQueryable<Dt_StockInfoDetail> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfoDetail>(); + + string whereStoDe = GetDataRole(typeof(Dt_StockInfoDetail)); + sugarQueryable1 = sugarQueryable1.Where(whereStoDe); + + + string whereSto = GetDataRole(typeof(Dt_StockInfo)); + ISugarQueryable<Dt_StockInfo> sugarQueryable = _dbBase.Queryable<Dt_StockInfo>().Where(whereSto); + if (!string.IsNullOrEmpty(options.Wheres)) + { + try + { + List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); + if (searchParametersList.Count > 0) + { + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielCode).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielCode.Contains(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.WarehouseId).FirstLetterToLower()); + if (searchParameters != null) { + sugarQueryable = sugarQueryable.Where(x => x.WarehouseId.Equals(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.StockStatus).FirstLetterToLower()); + if(searchParameters!= null) + { + sugarQueryable = sugarQueryable.Where(x => x.StockStatus.Equals(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielName).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielName.Contains(searchParameters.Value)); + } + } + + } + + } + catch(Exception ex) + { + + } + } + + + ISugarQueryable<MaterielnfoStatisticsDTO> sugarQueryable2 = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => b.StockId == a.Id).Where((b,a)=>a.LocationCode!="" && a.LocationCode!=null).Select((b, a) + => new MaterielnfoStatisticsDTO + { + WarehouseId = a.WarehouseId, + MaterielCode = b.MaterielCode, + MaterielName = b.MaterielName, + StockQuantity = b.StockQuantity, + OutboundQuantity = b.OutboundQuantity, + StockStatus = a.StockStatus, + Unit = b.Unit, + Remark = a.Remark, + + }); + // 鑾峰彇鎵�鏈夋暟鎹� + var allData = sugarQueryable2.ToList(); + + // 浣跨敤瀛楀吀杩涜鍒嗙粍姹囨�� + var groupedData = new Dictionary<string, MaterielnfoStatisticsDTO>(); + foreach (var item in allData) + { + if (groupedData.ContainsKey(item.MaterielCode)) + { + groupedData[item.MaterielCode].StockQuantity += item.StockQuantity; + groupedData[item.MaterielCode].OutboundQuantity += item.OutboundQuantity; + } + else + { + groupedData[item.MaterielCode] = new MaterielnfoStatisticsDTO + { + WarehouseId = item.WarehouseId, + MaterielCode = item.MaterielCode, + MaterielName = item.MaterielName, + StockQuantity = item.StockQuantity, + OutboundQuantity = item.OutboundQuantity, + StockStatus = item.StockStatus, + Unit = item.Unit, + Remark = item.Remark + }; + } + } + + // 杞崲涓哄垪琛� + materielnfoStatistics = groupedData.Values.ToList(); + + // 鍒嗛〉澶勭悊 + int startIndex = (options.Page - 1) * options.Rows; + int endIndex = Math.Min(startIndex + options.Rows, materielnfoStatistics.Count); + materielnfoStatistics = materielnfoStatistics.GetRange(startIndex, endIndex - startIndex); + + int count = groupedData.Count; + + return new PageGridData<MaterielnfoStatisticsDTO>(count, materielnfoStatistics); + + } + catch(Exception ex) + { + + } + return new PageGridData<MaterielnfoStatisticsDTO>(); + } + + public virtual WebResponseContent Export(PageDataOptions options) + { + WebResponseContent content = new WebResponseContent(); + try + { + Type t = typeof(MaterielnfoStatisticsDTO); + + string savePath = AppDomain.CurrentDomain.BaseDirectory + $"ExcelExport"; + IExporter exporter = new ExcelExporter(); + options.Page = 1; + options.Rows = 30; + options.Order = "desc"; + options.Sort = "MaterielCode"; + List<MaterielnfoStatisticsDTO> materielnfoStatistics = new List<MaterielnfoStatisticsDTO>(); + ISugarQueryable<Dt_StockInfoDetail> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfoDetail>(); + + string whereStoDe = GetDataRole(typeof(Dt_StockInfoDetail)); + sugarQueryable1 = sugarQueryable1.Where(whereStoDe); + + + string whereSto = GetDataRole(typeof(Dt_StockInfo)); + ISugarQueryable<Dt_StockInfo> sugarQueryable = _dbBase.Queryable<Dt_StockInfo>().Where(whereSto); + if (!string.IsNullOrEmpty(options.Wheres)) + { + try + { + List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); + if (searchParametersList.Count > 0) + { + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielCode).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielCode.Contains(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.WarehouseId).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable = sugarQueryable.Where(x => x.WarehouseId.Equals(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.StockStatus).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable = sugarQueryable.Where(x => x.StockStatus.Equals(searchParameters.Value)); + } + } + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielName).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielName.Contains(searchParameters.Value)); + } + } + + } + + } + catch (Exception ex) + { + + } + } + + + ISugarQueryable<MaterielnfoStatisticsDTO> sugarQueryable2 = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => b.StockId == a.Id).Where((b, a) => a.LocationCode != "" && a.LocationCode != null).Select((b, a) + => new MaterielnfoStatisticsDTO + { + WarehouseId = a.WarehouseId, + MaterielCode = b.MaterielCode, + MaterielName = b.MaterielName, + StockQuantity = b.StockQuantity, + OutboundQuantity = b.OutboundQuantity, + StockStatus = a.StockStatus, + Unit = b.Unit, + Remark = a.Remark, + + }); + // 鑾峰彇鎵�鏈夋暟鎹� + var allData = sugarQueryable2.ToList(); + + // 浣跨敤瀛楀吀杩涜鍒嗙粍姹囨�� + var groupedData = new Dictionary<string, MaterielnfoStatisticsDTO>(); + foreach (var item in allData) + { + if (groupedData.ContainsKey(item.MaterielCode)) + { + groupedData[item.MaterielCode].StockQuantity += item.StockQuantity; + groupedData[item.MaterielCode].OutboundQuantity += item.OutboundQuantity; + } + else + { + groupedData[item.MaterielCode] = new MaterielnfoStatisticsDTO + { + WarehouseId = item.WarehouseId, + MaterielCode = item.MaterielCode, + MaterielName = item.MaterielName, + StockQuantity = item.StockQuantity, + OutboundQuantity = item.OutboundQuantity, + StockStatus = item.StockStatus, + Unit = item.Unit, + Remark = item.Remark + }; + } + } + + // 杞崲涓哄垪琛� + materielnfoStatistics = groupedData.Values.ToList(); + + byte[] data = exporter.ExportAsByteArray(materielnfoStatistics).Result; + + string fileName = "鐗╂枡鍒嗙被缁熻.xlsx"; + + FileHelper.WriteFile(savePath, fileName, data); + + content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName); + } + catch (Exception ex) + { + content = WebResponseContent.Instance.Error(ex.Message); + } + return content; + } + private string GetDataRole(Type type) + { + try + { + UserRole? userRole = PermissionDataHostService.UserRoles.FirstOrDefault(x => x.UserId == App.User.UserId); + if (userRole == null) + throw new Exception($"鏃犳潈闄�"); + + if (type.IsAssignableFrom(typeof(BaseWarehouseEntity)) || type.GetProperty(nameof(BaseWarehouseEntity.WarehouseId)) != null) + { + if (userRole.WarehouseIds.Count > 0) + { + return $"{nameof(BaseWarehouseEntity.WarehouseId)} in ({userRole.WarehouseIds.Serialize().Replace("[", "").Replace("]", "")})"; + } + + else + return $"1 != 1"; + } + else + { + return "1 = 1"; + } + } + catch (Exception ex) + { + throw new Exception($"鏃犳潈闄愶紝{ex.Message}"); + } + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/MaterielnfoStatisticsController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/MaterielnfoStatisticsController.cs" new file mode 100644 index 0000000..fb32e85 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/MaterielnfoStatisticsController.cs" @@ -0,0 +1,55 @@ +锘縰sing Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Reflection; +using WIDESEA_Core; +using WIDESEA_IStockService; +using WIDESEA_StockService; + +namespace WIDESEA_WMSServer.Controllers.Stock +{ + [Route("api/MaterielnfoStatistics")] + [Authorize,ApiController] + public class MaterielnfoStatisticsController : Controller + { + private readonly IMaterielnfoStatisticsService _materielnfoStatisticsService; + + public MaterielnfoStatisticsController (IMaterielnfoStatisticsService materielnfoStatisticsService) + { + _materielnfoStatisticsService = materielnfoStatisticsService; + } + [HttpPost,Route("GetPageData")] + public object GetPageData([FromBody] PageDataOptions options) + { + return _materielnfoStatisticsService.GetPageGridData(options); + } + + /// <summary> + /// 瀵煎嚭鏁版嵁 + /// </summary> + /// <param name="loadData"></param> + /// <returns></returns> + [HttpPost, Route("Export")] + public virtual ActionResult Export([FromBody] PageDataOptions loadData) + { + WebResponseContent result = InvokeService("Export", new object[] { loadData }) as WebResponseContent; + if (result.Status) + return File( + System.IO.File.ReadAllBytes(result.Data.ToString()), + System.Net.Mime.MediaTypeNames.Application.Octet, + Path.GetFileName(result.Data.ToString()) + ); + return Json(result); + } + private object InvokeService(string methodName, object[] parameters) + { + Type t = _materielnfoStatisticsService.GetType(); + List<Type> types = new List<Type>(); + foreach (var param in parameters) + { + types.Add(param.GetType()); + } + MethodInfo method = t.GetMethod(methodName, types.ToArray()); + return method.Invoke(_materielnfoStatisticsService, parameters); + } + } +} -- Gitblit v1.9.3