增强功能与修复错误,更新缓存服务
更新多个文件以增强功能和修复错误,包括添加新的缓存服务、更新任务处理逻辑、改进日志记录、以及调整路由和组件配置。新增了对 Redis 缓存的支持,并更新了相关的配置和连接字符串。修复了表格显示逻辑,增强了用户界面的交互性,添加了新的 API 路由和节流过滤器。更新了 `.gitignore` 文件以排除特定的临时文件和数据库文件。
| | |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db-shm |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db-wal |
| | | /Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/bef6627e/sessions/4a99214b-9f9f-4ab7-8ce9-83d07cd22a77 |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/CodeChunks.db |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/CodeChunks.db-shm |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/CodeChunks.db-wal |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db-shm |
| | | /Code Management/.vs/Code Management/CopilotIndices/17.13.433.20974/SemanticSymbols.db-wal |
| | | /3F/Code Management/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.metadata.v7.bin |
| | | /3F/Code Management/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.projects.v7.bin |
| | | /3F/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let buttons = [{ |
| | | name: "æ¥ è¯¢", |
| | | value: 'Search', |
| | | icon: 'el-icon-search', |
| | | class: '', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.search(); |
| | | } |
| | | }, |
| | | { |
| | | name: "æ° å»º", |
| | | icon: 'el-icon-plus', |
| | | value: 'Add', |
| | | class: '', |
| | | // plain:true, |
| | | type: 'success', |
| | | // plain:true, |
| | | onClick: function () { |
| | | this.add(); |
| | | } |
| | | }, |
| | | { |
| | | name: "ç¼ è¾", |
| | | icon: 'el-icon-edit', |
| | | value: 'Update', |
| | | // plain:true, |
| | | class: '', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.edit(); |
| | | } |
| | | }, |
| | | { |
| | | name: "ä»»å¡å®æ", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskCompleted', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "ä»»å¡åæ¶", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskCancel', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "任塿¢å¤", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskRecovery', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "æ¥ç宿´è·¯ç±", |
| | | icon: '', |
| | | class: '', |
| | | value: 'ViewAllRouter', |
| | | type: 'info', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "è·¯ç±é
ç½®", |
| | | icon: '', |
| | | class: '', |
| | | value: 'AddRouters', |
| | | type: 'success', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "åæ»å°ä¸ä¸æ¥", |
| | | icon: '', |
| | | class: '', |
| | | value: 'Previous', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "跳转å°ä¸ä¸æ¥", |
| | | icon: '', |
| | | class: '', |
| | | value: 'Next', |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | icon: 'el-icon-delete', |
| | | class: '', |
| | | value: 'Delete', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | this.del(); |
| | | } |
| | | }, |
| | | { |
| | | name: "审 æ ¸", |
| | | icon: 'el-icon-check', |
| | | class: '', |
| | | value: 'Audit', |
| | | plain: true, |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.audit(); |
| | | } |
| | | }, |
| | | { |
| | | name: "导 å
¥", |
| | | icon: 'el-icon-top', |
| | | class: '', |
| | | type: 'success', |
| | | plain: true, |
| | | value: 'Import', |
| | | onClick: function () { |
| | | this.import(); |
| | | } |
| | | }, |
| | | { |
| | | name: "导 åº", |
| | | icon: 'el-icon-bottom', |
| | | type: 'success', |
| | | plain: true, |
| | | value: 'Export', |
| | | onClick: function () { |
| | | this.export(); |
| | | } |
| | | } |
| | | |
| | | ] |
| | | |
| | | export default buttons |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html lang=""> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
| | | <meta name="keywords" content=".netccore,dotnet core,vue,element,element plus,vue3" /> |
| | | <meta name="description" content="" /> |
| | | <link rel="icon" href="<%= BASE_URL %>wcslogo.png"> |
| | | <title><%= htmlWebpackPlugin.options.title %></title> |
| | | </head> |
| | | |
| | | <body> |
| | | <noscript> |
| | | <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. |
| | | Please enable it to continue.</strong> |
| | | </noscript> |
| | | <div id="app"></div> |
| | | <!-- built files will be auto injected --> |
| | | </body> |
| | | |
| | | </html> |
| | | <style> |
| | | html, |
| | | body { |
| | | margin: 0; |
| | | padding: 0; |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .el-loading { |
| | | z-index: 999999; |
| | | } |
| | | |
| | | .el-table th { |
| | | display: table-cell !important; |
| | | } |
| | | |
| | | .el-loading .el-loading-spinner { |
| | | padding: 7px; |
| | | background: #ececec; |
| | | width: 200px; |
| | | color: red; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0 auto; |
| | | border-radius: 5px; |
| | | border: 1px solid #a0a0a0; |
| | | |
| | | } |
| | | |
| | | h1, |
| | | h2, |
| | | h3, |
| | | h4 { |
| | | margin: 0; |
| | | } |
| | | |
| | | .v-dialog { |
| | | border-radius: 5px; |
| | | top: 50%; |
| | | /* margin-top: -220px !important; */ |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header { |
| | | border-top-left-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | padding: 0px 13px; |
| | | line-height: 53px; |
| | | border-bottom: 1px solid #e2e2e2; |
| | | height: 50px; |
| | | color: white; |
| | | font-weight: bold; |
| | | font-size: 14px; |
| | | background-image: linear-gradient(135deg, #0cd7bd 10%, #50c3f7); |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header .el-dialog__headerbtn { |
| | | top: 3px; |
| | | right: 0px; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header .el-dialog__headerbtn .el-dialog__close { |
| | | font-size: 19px; |
| | | color: white; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__body { |
| | | padding: 0; |
| | | } |
| | | |
| | | .el-message { |
| | | z-index: 3500 !important; |
| | | } |
| | | |
| | | .v-date-range .el-input__inner { |
| | | padding: 0 15px 0 8px |
| | | } |
| | | |
| | | .v-date-range .el-input__suffix .el-input__icon { |
| | | display: table-caption; |
| | | background: white; |
| | | margin: 1px; |
| | | height: auto; |
| | | margin-right: -4px; |
| | | height: 33px; |
| | | width: 19px; |
| | | font-size: 13px; |
| | | border-top-right-radius: 3px; |
| | | border-bottom-right-radius: 3px; |
| | | } |
| | | |
| | | .v-date-range .el-icon-circle-check { |
| | | display: none !important; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header { |
| | | margin-right: 0; |
| | | } |
| | | |
| | | .el-button { |
| | | font-size: 12px !important; |
| | | } |
| | | |
| | | .el-button--small { |
| | | padding: 0px 15px !important; |
| | | height: 32px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import detailMethods from './detailMethods.js'; |
| | | //ä¸å¡å¤çæ¹æ³,å
¨é¨å¯ä»¥ç±å¼åè¦ç |
| | | import serviceFilter from './serviceFilter.js'; |
| | | let methods = { |
| | | //彿·»å æ©å±ç»ä»¶gridHeader/gridBody/gridFooteråæç»modelHeader/modelBody/modelFooteræ¶ï¼ |
| | | //妿è¦è·åç¶çº§Vue对象,è¯·ä½¿ç¨æ¤æ¹æ³è¿è¡åè° |
| | | parentCall(fun) { |
| | | if (typeof fun != 'function') { |
| | | return console.log('æ©å±ç»ä»¶éè¦ä¼ å
¥ä¸ä¸ªåè°æ¹æ³æè½è·åç¶çº§Vue对象'); |
| | | } |
| | | fun(this); |
| | | }, |
| | | getCurrentAction() { |
| | | if (this.currentReadonly) { |
| | | return ''; |
| | | } |
| | | return '--' + (this.currentAction == this.const.ADD ? 'æ°å¢' : 'ç¼è¾'); |
| | | }, |
| | | quickSearchKeyPress($event) { |
| | | //æ¥è¯¢å段为inputæ¶ï¼æå车æ¥è¯¢ |
| | | if ($event.keyCode == 13) { |
| | | if (this.searchFormFields[this.singleSearch.field] != '') { |
| | | this.search(); |
| | | } |
| | | } |
| | | }, |
| | | getButtons() { |
| | | //çæViewGridçé¢çæä½æé®åæ´å¤é项 |
| | | let searchIndex = this.buttons.findIndex((x) => { |
| | | return x.value == 'Search'; |
| | | }); |
| | | //æ·»å é«çº§æ¥è¯¢ |
| | | let hasOneFormItem = |
| | | this.searchFormOptions.length == 1 && |
| | | this.searchFormOptions[0].length == 1; |
| | | if (searchIndex != -1 && !hasOneFormItem) { |
| | | this.buttons.splice(searchIndex + 1, 0, { |
| | | icon: this.fiexdSearchForm ? 'el-icon-refresh-left' : 'el-icon-search', |
| | | name: this.fiexdSearchForm ? 'éç½®' : 'é«çº§æ¥è¯¢', |
| | | plain: true, |
| | | type: this.buttons[searchIndex].type, |
| | | onClick: () => { |
| | | if (this.fiexdSearchForm) { |
| | | return this.resetSearch(); |
| | | } |
| | | this.searchBoxShow = !this.searchBoxShow; |
| | | } |
| | | }); |
| | | } |
| | | if (hasOneFormItem) { |
| | | this.fiexdSearchForm = false; |
| | | } |
| | | this.maxBtnLength += searchIndex == -1 ? 0 : 1; |
| | | // if (this.buttons.length <= this.maxBtnLength) { |
| | | // return this.buttons; |
| | | // } |
| | | // let btns = this.buttons.slice(0, this.maxBtnLength); |
| | | // btns[this.maxBtnLength - 1].last = true; |
| | | // return btns; |
| | | }, |
| | | extendBtn(btns, source) { |
| | | //btnsæéæé®ï¼source为æ©å±æé® |
| | | if (!btns || !(source && source instanceof Array)) { |
| | | return; |
| | | } |
| | | //sourceéè¿å¨è¡¨çæ©å±jsæä»¶ä¸buttonså¯¹åºæé®ç屿§indexå³å®æé®ææ¾ä½ç½® |
| | | source.forEach((x) => { |
| | | //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | btns.splice(x.index == undefined ? btns.length : x.index, 0, x); |
| | | }); |
| | | // if (this.extend.buttons.view) { |
| | | // this.extend.buttons.view.forEach((x) => { |
| | | // //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | // this.buttons.splice(x.index == undefined ? this.buttons.length : x.index, 0, x); |
| | | // }) |
| | | // } |
| | | }, |
| | | initBoxButtons() { |
| | | //åå§åViewGirdä¸å¼¹åºæ¡/æç»è¡¨æé® |
| | | let path = this.$route.path; |
| | | //éè¿èåè·åç¨æ·æå¯¹åºèåéè¦æ¾ç¤ºçæé® |
| | | let permissionButtons = this.permission.getButtons( |
| | | path, |
| | | null, |
| | | this.extend.tableAction, |
| | | this.table.name |
| | | ); |
| | | if (permissionButtons) { |
| | | //2020.03.31æ·»å æ·±æ·è´æé®ç» |
| | | permissionButtons.forEach((p) => { |
| | | let _obj = {}; |
| | | for (const key in p) { |
| | | _obj[key] = p[key]; |
| | | } |
| | | this.buttons.push(_obj); |
| | | }); |
| | | // this.buttons.push(...permissionButtons); |
| | | } |
| | | if (!this.extend) { |
| | | this.extend = {}; |
| | | } |
| | | if (!this.extend.buttons) { |
| | | this.extend.buttons = {}; |
| | | } |
| | | //æ¥è¯¢ç颿©å±æé®(æ©å±æé®å¯èªè¡éè¿è®¾ç½®æé®çIndex屿§æ¾ç¤ºå°å
·ä½ä½ç½®) |
| | | if (this.extend.buttons.view) { |
| | | this.extendBtn(this.buttons, this.extend.buttons.view); |
| | | } |
| | | |
| | | //å¼¹åºæ¡æé® |
| | | let boxButtons = []; |
| | | |
| | | let saveBtn = this.buttons.some((x) => { |
| | | if ( |
| | | x.value && |
| | | (x.value.toLowerCase() == this.const.ADD.toLowerCase() || |
| | | x.value.toLowerCase() == this.const.EDIT.toLowerCase()) |
| | | ) |
| | | return true; |
| | | }); |
| | | this.currentReadonly = !saveBtn; |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | let detailGridButtons = { |
| | | name: 'å·æ°', |
| | | type: 'info', |
| | | icon: 'el-icon-refresh', |
| | | onClick() { |
| | | //妿æç»è¡¨å½åçç¶æä¸ºæ°å»ºæ¶ï¼ç¦æ¢å·æ° |
| | | if (this.currentAction == this.const.ADD) { |
| | | return; |
| | | } |
| | | this.refreshRow(); |
| | | } |
| | | }; |
| | | |
| | | let importExcel = this.buttons.some((x) => { |
| | | if (x.value == this.const.IMPORT) return true; |
| | | }); |
| | | //妿æå¯¼å
¥æé,åéè¦åå§å导å
¥ç»ä»¶ |
| | | if (importExcel) { |
| | | this.upload.url = this.getUrl(this.const.IMPORT); |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.table.cnName; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çUrlè·¯å¾ |
| | | this.upload.template.url = |
| | | this.http.ipAddress + this.getUrl(this.const.DOWNLOADTEMPLATE, true); |
| | | } |
| | | |
| | | // disabled |
| | | //妿å½åè§è²æ²¡æç¼è¾ææ°å»ºåè½ï¼æ¥çæç»æ¶å段设置å
¨é¨åªè¯» |
| | | //åªææç»è¡¨ï¼å°æç»è¡¨ä¹è®¾ç½®ä¸ºä¸å¯è½ç¼è¾ï¼å¹¶ä¸ä¸æ¾ç¤ºæ·»å è¡ãå é¤è¡ |
| | | if (!saveBtn) { |
| | | this.editFormOptions.forEach((row) => { |
| | | row.forEach((x) => { |
| | | x.disabled = true; |
| | | }); |
| | | }); |
| | | //æ²¡ææ°å¢ç¼è¾æéçï¼å¼¹åºæ¡é½è®¾ç½®ä¸ºåªè¯» |
| | | this.detail.columns.forEach((column) => { |
| | | if (column.hasOwnProperty('edit')) { |
| | | column.readonly = true; |
| | | // row['edit'] = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | //å¼¹åºå¼¹æ¡æé®(2020.04.21),没æç¼è¾ææ°å»ºæéæ¶ï¼ä¹å¯ä»¥éè¿buttons屿§æ·»å èªå®ä¹å¼¹åºæ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (!button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | return boxButtons; |
| | | } |
| | | |
| | | this.detailOptions.edit = true; |
| | | boxButtons.push( |
| | | ...[ |
| | | { |
| | | name: 'ä¿ å', |
| | | icon: 'el-icon-check', |
| | | type: 'danger', |
| | | disabled: false, |
| | | value: 'save', |
| | | onClick() { |
| | | this.save(); |
| | | } |
| | | } |
| | | // { |
| | | // name: 'é ç½®', |
| | | // icon: 'el-icon-refresh-right', |
| | | // type: 'primary', |
| | | // disabled: false, |
| | | // onClick() { |
| | | // this.resetEdit(); |
| | | // } |
| | | // } |
| | | ] |
| | | ); |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | this.detailOptions.buttons.push( |
| | | ...[ |
| | | { |
| | | name: 'æ·»å è¡', |
| | | icon: 'el-icon-plus', |
| | | type: 'primary', |
| | | hidden: false, |
| | | plain: true, |
| | | onClick() { |
| | | this.addRow(); |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: 'å é¤è¡', |
| | | hidden: false, |
| | | icon: 'el-icon-delete', |
| | | onClick() { |
| | | this.delRow(); |
| | | } |
| | | }, |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥å¯¼åºåè½ |
| | | //注æéè¦éååå°æç»è¡¨æ¥å£ç导å
¥ä¸ä¸è½½æ¨¡æ¿ã导åºçæé,Sys_DictionaryListController.cs/SellOrderListController.cs |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导å
¥', |
| | | value: 'import', |
| | | hidden: false, |
| | | icon: 'el-icon-upload2', |
| | | onClick() { |
| | | this.upload.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.IMPORT}?table=1`; |
| | | this.upload.template.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.DOWNLOADTEMPLATE}`; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.detail.cnName; |
| | | this.upload.excel = true; |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导åº', |
| | | value: 'export', |
| | | icon: 'el-icon-download', |
| | | hidden: false, |
| | | onClick() { |
| | | this.export(true); |
| | | } |
| | | } |
| | | ] |
| | | ); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | //å¼¹åºå¼¹æ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | }, |
| | | onClick(click) { |
| | | click.apply(this); |
| | | }, |
| | | changeDropdown(btnName, v1) { |
| | | let button = this.buttons.filter((x) => { |
| | | return x.name == btnName; |
| | | }); |
| | | if (button && button.length > 0) { |
| | | button[0].onClick.apply(this); |
| | | } |
| | | }, |
| | | emptyValue(value) { |
| | | if (typeof value == 'string' && value.trim() === '') { |
| | | return true; |
| | | } |
| | | if (value instanceof Array && !value.length) { |
| | | return true; |
| | | } |
| | | return value === null || value === undefined || value === ''; |
| | | }, |
| | | getSearchParameters() { |
| | | //è·åæ¥è¯¢åæ° |
| | | // 2020.09.11å¢å åºå®æ¥è¯¢è¡¨å,å¦æè®¾ç½®åºå®äºæ¥è¯¢è¡¨åï¼ç¹å»æ¥è¯¢æ¶ï¼ä¸åå
³é |
| | | if (!this.fiexdSearchForm) { |
| | | this.searchBoxShow = false; |
| | | } |
| | | |
| | | let query = { wheres: [] }; |
| | | for (const key in this.searchFormFields) { |
| | | let value = this.searchFormFields[key]; |
| | | if (this.emptyValue(value)) continue; |
| | | |
| | | if (typeof value == 'number') { |
| | | value = value + ''; |
| | | } |
| | | let displayType = this.getSearchItem(key); |
| | | |
| | | //è级åªä¿çéä¸èç¹çæåä¸ä¸ªå¼ |
| | | if (displayType == 'cascader') { |
| | | //æ¥è¯¢ä¸é¢ææçåèç¹ï¼å¦ï¼éä¸çæ¯ç¶èç¹ï¼åºè¯¥æ¥è¯¢ä¸é¢ææçèç¹æ°æ®--å¾
å® |
| | | value = value.length ? value[value.length - 1] + '' : ''; |
| | | } |
| | | //2021.05.02å¢å åºé´æ¥è¯¢ |
| | | if ( |
| | | typeof value == 'string' || |
| | | ['date', 'datetime', 'range'].indexOf(displayType) == -1 |
| | | ) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: |
| | | typeof value == 'string' ? (value + '').trim() : value.join(','), |
| | | displayType: displayType |
| | | }); |
| | | continue; |
| | | } |
| | | for (let index = 0; index < value.length; index++) { |
| | | if (!this.emptyValue(value[index])) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: (value[index] + '').trim(), |
| | | displayType: (() => { |
| | | if (['date', 'datetime', 'range'].indexOf(displayType) != -1) { |
| | | return index ? 'lessorequal' : 'thanorequal'; |
| | | } |
| | | return displayType; |
| | | })() |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return query; |
| | | }, |
| | | search() { |
| | | //æ¥è¯¢ |
| | | // let query = this.getSearchParameters(); |
| | | // this.$refs.table.load(query, true); |
| | | this.$refs.table.load(null, true); |
| | | }, |
| | | loadTableBefore(param, callBack) { |
| | | //æ¥è¯¢å设置æ¥è¯¢æ¡ä»¶ååé¡µä¿¡æ¯ |
| | | let query = this.getSearchParameters(); |
| | | if (query) { |
| | | param = Object.assign(param, query); |
| | | } |
| | | |
| | | if (this.$route.query.viewflow && this.$route.query.id) { |
| | | param.wheres.push({ |
| | | name: this.table.key, |
| | | value: this.$route.query.id |
| | | }); |
| | | } |
| | | // if (this.isViewFlow() && data && data.length) { |
| | | // let query = JSON.parse(JSON.stringify(this.$route.query)); |
| | | // query.viewflow = 0; |
| | | // this.$router.replace({ path: this.$route.path, query: query }); |
| | | // this.$nextTick(() => { |
| | | // this.getWorkFlowSteps(data[0]); |
| | | // }); |
| | | // } |
| | | let status = this.searchBefore(param); |
| | | callBack(status); |
| | | }, |
| | | |
| | | loadTableAfter(data, callBack, result) { |
| | | //æ¥è¯¢å |
| | | //2020.10.30å¢å æ¥è¯¢åè¿åææçæ¥è¯¢ä¿¡æ¯ |
| | | let status = this.searchAfter(data, result); |
| | | callBack(status); |
| | | //èªå¨å¼¹åºæ¡å®¡æ¹è¯¦æ
|
| | | }, |
| | | loadDetailTableBefore(param, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | //æ°å»ºæ¶ç¦æ¢å è½½æç» |
| | | if (this.currentAction == this.const.ADD) { |
| | | callBack(false); |
| | | return false; |
| | | } |
| | | let status = this.searchDetailBefore(param); |
| | | callBack(status); |
| | | }, |
| | | loadDetailTableAfter(data, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | let status = this.searchDetailAfter(data); |
| | | callBack(status); |
| | | }, |
| | | getSearchItem(field) { |
| | | //è·åæ¥è¯¢çåæ° |
| | | let data; |
| | | for (let index = 0; index < this.searchFormOptions.length; index++) { |
| | | if (data) return data.type; |
| | | const item = this.searchFormOptions[index]; |
| | | data = item.find((x) => { |
| | | return x.field == field; |
| | | }); |
| | | } |
| | | |
| | | return (data || {}).type; |
| | | }, |
| | | resetSearch() { |
| | | //éç½®æ¥è¯¢å¯¹è±¡ |
| | | this.resetSearchForm(); |
| | | //2020.10.17å¢å éç½®åæ¹æ³ |
| | | this.resetSearchFormAfter && this.resetSearchFormAfter(); |
| | | }, |
| | | resetEdit() { |
| | | //éç½®ç¼è¾çæ°æ® |
| | | let isEdit = this.currentAction != this.const.ADD; |
| | | //éç½®ä¹å |
| | | if (!this[isEdit ? 'resetUpdateFormBefore' : 'resetAddFormBefore']()) { |
| | | return; |
| | | } |
| | | let objKey = {}; |
| | | //ç¼è¾ç¶æä¸,ä¸éè¦é置主é®,å建æ¶é´å建人 |
| | | if (isEdit) { |
| | | objKey[this.table.key] = this.editFormFields[this.table.key]; |
| | | } |
| | | this.resetEditForm(objKey); |
| | | //éç½®ä¹å |
| | | |
| | | if (!this[isEdit ? 'resetUpdateFormAfter' : 'resetAddFormAfter']()) { |
| | | return; |
| | | } |
| | | }, |
| | | resetSearchForm(sourceObj) { |
| | | //éç½®æ¥è¯¢è¡¨ |
| | | this.resetForm('searchForm', sourceObj); |
| | | }, |
| | | resetEditForm(sourceObj) { |
| | | if (this.hasDetail && this.$refs.detail) { |
| | | // this.$refs.detail.rowData.splice(0); |
| | | this.$refs.detail.reset(); |
| | | } |
| | | this.resetForm('form', sourceObj); |
| | | if (this.$refs.form && this.$refs.form.$refs.volform) { |
| | | setTimeout(() => { |
| | | this.$refs.form.$refs.volform.clearValidate(); |
| | | }, 100); |
| | | } |
| | | }, |
| | | getKeyValueType(formData, isEditForm) { |
| | | try { |
| | | let keyLeft = (isEditForm ? 'e' : 's') + '_b_'; |
| | | formData.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (this.keyValueType.hasOwnProperty(keyLeft + x.field)) { |
| | | return true; |
| | | } |
| | | let data; |
| | | if (x.type == 'switch') { |
| | | this.keyValueType[x.field] = 1; |
| | | } else if (x.bind && x.bind.data) { |
| | | data = x.bind.data; |
| | | } else if (x.data) { |
| | | if (x.data instanceof Array) { |
| | | data = x.data; |
| | | } else if (x.data.data && x.data.data instanceof Array) { |
| | | data = x.data.data; |
| | | } |
| | | } |
| | | if ( |
| | | data && |
| | | data.length > 0 && |
| | | !this.keyValueType.hasOwnProperty(x.field) |
| | | ) { |
| | | this.keyValueType[x.field] = data[0].key; |
| | | this.keyValueType[keyLeft + x.field] = x.type; |
| | | } |
| | | }); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error.message); |
| | | } |
| | | }, |
| | | resetForm(formName, sourceObj) { |
| | | // return; |
| | | //éç½®è¡¨åæ°æ® |
| | | if (this.$refs[formName]) { |
| | | this.$refs[formName].reset(); |
| | | } |
| | | |
| | | if (!sourceObj) return; |
| | | let form, keyLeft; |
| | | if (formName == 'searchForm') { |
| | | form = this.searchFormFields; |
| | | keyLeft = 's' + '_b_'; |
| | | } else { |
| | | form = this.editFormFields; |
| | | keyLeft = 'e' + '_b_'; |
| | | } |
| | | //è·åæ°æ®æºçdataç±»åï¼å¦åå¦ææ°æ®æºdataçkeyæ¯æ°åï¼éç½®ç弿¯åç¬¦ä¸²å°±æ æ³ç»å®å¼ |
| | | if (!this.keyValueType._dinit) { |
| | | this.getKeyValueType(this.editFormOptions, true); |
| | | this.getKeyValueType(this.searchFormOptions, false); |
| | | this.keyValueType._dinit = true; |
| | | } |
| | | var _cascaderParentTree; |
| | | for (const key in form) { |
| | | if (sourceObj.hasOwnProperty(key)) { |
| | | let newVal = sourceObj[key]; |
| | | let kv_type = this.keyValueType[keyLeft + key]; |
| | | |
| | | if ( |
| | | kv_type == 'selectList' || |
| | | kv_type == 'checkbox' || |
| | | kv_type == 'cascader' || |
| | | kv_type == 'treeSelect' |
| | | ) { |
| | | // 2020.05.31å¢å iviewç»ä»¶Cascader |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascader表åéç½®æ¶æ¥è¯¢ææçç¶èç¹ |
| | | if (kv_type == 'cascader' || kv_type == 'treeSelect') { |
| | | var treeDic = this.dicKeys.find((dic) => { |
| | | return dic.fileds && dic.fileds.indexOf(key) != -1; |
| | | }); |
| | | |
| | | if (treeDic && treeDic.orginData && treeDic.orginData.length) { |
| | | let keyIsNum = typeof treeDic.orginData[0].id == 'number'; |
| | | |
| | | if (kv_type == 'cascader') { |
| | | newVal = keyIsNum ? newVal * 1 || 0 : newVal + ''; |
| | | if (kv_type == 'cascader') { |
| | | _cascaderParentTree = this.base.getTreeAllParent( |
| | | newVal, |
| | | treeDic.orginData |
| | | ); |
| | | if (_cascaderParentTree) { |
| | | newVal = _cascaderParentTree.map((x) => { |
| | | return x.id; |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | if (newVal === null || newVal === undefined) { |
| | | newVal = []; |
| | | } else if (typeof newVal == 'string') { |
| | | newVal = newVal.split(','); |
| | | } |
| | | if (keyIsNum) { |
| | | if (Array.isArray(newVal)) { |
| | | newVal = newVal.map((x) => { |
| | | return x * 1 || 0; |
| | | }); |
| | | } |
| | | } else if (typeof newVal == 'number') { |
| | | newVal = [newVal + '']; |
| | | } |
| | | } |
| | | } else { |
| | | newVal = [newVal]; |
| | | } |
| | | } else if ( |
| | | newVal != '' && |
| | | newVal != undefined && |
| | | typeof newVal == 'string' |
| | | ) { |
| | | newVal = newVal.split(','); |
| | | } else if (kv_type == 'checkbox') { |
| | | newVal = []; |
| | | } |
| | | } else if ( |
| | | this.keyValueType.hasOwnProperty(key) && |
| | | typeof this.keyValueType[key] == 'number' && |
| | | newVal * 1 == newVal |
| | | ) { |
| | | newVal = newVal * 1; |
| | | } else { |
| | | if (newVal == null || newVal == undefined) { |
| | | newVal = ''; |
| | | } else if (this.numberFields.indexOf(key) != -1) { |
| | | newVal = newVal * 1 || 0; |
| | | } else { |
| | | newVal += ''; |
| | | } |
| | | } |
| | | if (newVal instanceof Array) { |
| | | if (form[key]) { |
| | | form[key] = []; |
| | | } |
| | | form[key] = newVal; |
| | | } else { |
| | | form[key] = newVal; |
| | | } |
| | | } else { |
| | | form[key] = form[key] instanceof Array ? [] : ''; |
| | | } |
| | | } |
| | | }, |
| | | onBtnClick(param) { |
| | | this[param.method](param.data); |
| | | }, |
| | | refresh() { |
| | | //å·æ° |
| | | this.search(); |
| | | // this.$refs.table.load(); |
| | | }, |
| | | saveBefore(formData) { |
| | | return true; |
| | | }, |
| | | saveAfter(formData, result) { |
| | | return true; |
| | | }, |
| | | save() { |
| | | //æ°å¢æç¼è¾æ¶ä¿å |
| | | // if (!this.$refs.form.validate()) return; |
| | | this.$refs.form.validate((result) => { |
| | | if (result) { |
| | | this.saveExecute(); |
| | | } |
| | | }); |
| | | }, |
| | | async saveExecute() { |
| | | let editFormFields = {}; |
| | | //ä¸ä¼ æä»¶ä»¥éå·éå¼ |
| | | for (const key in this.editFormFields) { |
| | | if ( |
| | | this.uploadfiled && |
| | | this.uploadfiled.length > 0 && |
| | | this.uploadfiled.indexOf(key) != -1 && |
| | | this.editFormFields[key] instanceof Array |
| | | ) { |
| | | let allPath = this.editFormFields[key].map((x) => { |
| | | return x.path; |
| | | }); |
| | | editFormFields[key] = allPath.join(','); |
| | | } else if (typeof this.editFormFields[key] == 'function') { |
| | | try { |
| | | editFormFields[key] = this.editFormFields[key](); |
| | | } catch (error) { } |
| | | } else { |
| | | //2021.05.30ä¿®å¤ä¸ææ¡æ¸
餿°æ®ååå°ä¸è½ä¿åçé®é¢ |
| | | if ( |
| | | this.editFormFields[key] === undefined && |
| | | this.dicKeys.some((x) => { |
| | | return x.fileds && x.fileds.indexOf(key) != -1; |
| | | }) |
| | | ) { |
| | | editFormFields[key] = null; |
| | | } else { |
| | | editFormFields[key] = this.editFormFields[key]; |
| | | } |
| | | } |
| | | } |
| | | //å°æ°ç»è½¬æ¢æstring |
| | | //2020.11.01å¢å 级èå¤ç |
| | | for (const key in editFormFields) { |
| | | if (editFormFields[key] instanceof Array) { |
| | | var iscascader = this.dicKeys.some((x) => { |
| | | return ( |
| | | x.type == 'cascader' && x.fileds && x.fileds.indexOf(key) != -1 |
| | | ); |
| | | }); |
| | | if (iscascader && editFormFields[key].length) { |
| | | editFormFields[key] = |
| | | editFormFields[key][editFormFields[key].length - 1]; |
| | | } else { |
| | | editFormFields[key] = editFormFields[key].join(','); |
| | | } |
| | | } |
| | | } |
| | | |
| | | let formData = { |
| | | mainData: editFormFields, |
| | | detailData: null, |
| | | delKeys: null |
| | | }; |
| | | |
| | | //è·åæç»æ°æ®(åå°æ°æ®æç»æªåæ ¡éªï¼å¾
å®.åå°å·²ç»æ ¡éª) |
| | | if (this.hasDetail) { |
| | | formData.detailData = this.$refs.detail.rowData; |
| | | let _fields = this.detail.columns |
| | | .filter((c) => { |
| | | return ( |
| | | c.type == 'selectList' || (c.edit && c.edit.type == 'selectList') |
| | | ); |
| | | }) |
| | | .map((c) => { |
| | | return c.field; |
| | | }); |
| | | //2022.06.20å¢å ä¿åæ¶å¯¹æç»è¡¨ä¸ææ¡å¤éç夿 |
| | | if (_fields.length) { |
| | | formData.detailData = JSON.parse(JSON.stringify(formData.detailData)); |
| | | formData.detailData.forEach((row) => { |
| | | for (let index = 0; index < _fields.length; index++) { |
| | | const _field = _fields[index]; |
| | | if (Array.isArray(row[_field])) { |
| | | row[_field] = row[_field].join(','); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | if (this.detailOptions.delKeys.length > 0) { |
| | | formData.delKeys = this.detailOptions.delKeys; |
| | | } |
| | | //ä¿ååæ¦æª |
| | | let _currentIsAdd = this.currentAction == this.const.ADD; |
| | | if (_currentIsAdd) { |
| | | //2020.12.06å¢å æ°å»ºå弿¥å¤çæ¹æ³ |
| | | //2021.08.16ä¿®å¤å¼æ¥è¯æ³åéçé®é¢ |
| | | if (!this.addBefore(formData) || !(await this.addBeforeAsync(formData))) |
| | | return; |
| | | } else { |
| | | //2020.12.06å¢å ä¿®æ¹å弿¥å¤çæ¹æ³ |
| | | if ( |
| | | !this.updateBefore(formData) || |
| | | !(await this.updateBeforeAsync(formData)) |
| | | ) |
| | | return; |
| | | } |
| | | let url = this.getUrl(this.currentAction); |
| | | this.http.post(url, formData, true).then((x) => { |
| | | //ä¿åå |
| | | if (_currentIsAdd) { |
| | | if (!this.addAfter(x)) return; |
| | | //è¿ç»æ·»å |
| | | if (this.continueAdd && x.status) { |
| | | this.$success(x.message); |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | this.resetAdd(); |
| | | this.refresh(); |
| | | return; |
| | | } |
| | | } else { |
| | | if (!this.updateAfter(x)) return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success(x.message || 'æä½æå'); |
| | | //妿ä¿åæååéè¦å
³éç¼è¾æ¡ï¼ç´æ¥è¿åä¸å¤çåé¢ |
| | | if (this.boxOptions.saveClose) { |
| | | this.boxModel = false; |
| | | //2020.12.27妿æ¯ç¼è¾ä¿ååä¸éç½®å页页æ°ï¼å·æ°é¡µé¢æ¶è¿æ¯æ¾ç¤ºå½åé¡µçæ°æ® |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | //this.refresh(); |
| | | return; |
| | | } |
| | | let resultRow; |
| | | if (typeof x.data == 'string' && x.data != '') { |
| | | resultRow = JSON.parse(x.data); |
| | | } else { |
| | | resultRow = x.data; |
| | | } |
| | | |
| | | if (this.currentAction == this.const.ADD) { |
| | | // this.currentRow=x.data; |
| | | this.editFormFields[this.table.key] = ''; |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = resultRow.data; |
| | | } |
| | | this.resetEditForm(resultRow.data); |
| | | // console.log(resultRow); |
| | | if (this.hasDetail) { |
| | | this.detailOptions.delKeys = []; |
| | | if (resultRow.list) { |
| | | this.$refs.detail.rowData.push(...resultRow.list); |
| | | } |
| | | } |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | // this.refresh(); |
| | | }); |
| | | }, |
| | | del(rows) { |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | //å 餿°æ® |
| | | |
| | | if (!rows || rows.length == 0) return this.$error('è¯·éæ©è¦å é¤çè¡!'); |
| | | let delKeys = rows.map((x) => { |
| | | return x[this.table.key]; |
| | | }); |
| | | if (!delKeys || delKeys.length == 0) |
| | | return this.$error('没æè·åè¦å é¤çè¡æ°æ®!'); |
| | | //å é¤å |
| | | if (!this.delBefore(delKeys, rows)) { |
| | | return; |
| | | } |
| | | let tigger = false; |
| | | this.$confirm('确认è¦å é¤éæ©çæ°æ®å?', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | if (tigger) return; |
| | | tigger = true; |
| | | let url = this.getUrl(this.const.DEL); |
| | | this.http.post(url, delKeys, 'æ£å¨å 餿°æ®....').then((x) => { |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success("å 餿å"); |
| | | //å é¤å |
| | | if (!this.delAfter(x)) { |
| | | return; |
| | | } |
| | | this.refresh(); |
| | | }); |
| | | }); |
| | | }, |
| | | async modelOpenBeforeAsync(row) { |
| | | return true; |
| | | }, |
| | | async initBox() { |
| | | //2022.01.08å¢å æ°å»ºæ¶éèæç»è¡¨å¯¼åºåè½ |
| | | this.detailOptions.buttons.forEach((x) => { |
| | | if (x.value == 'export') { |
| | | x.hidden = this.currentAction == 'Add'; |
| | | } |
| | | }); |
| | | //åå§åæ°å»ºãç¼è¾çå¼¹åºæ¡ |
| | | if (!(await this.modelOpenBeforeAsync(this.currentRow))) return false; |
| | | this.modelOpenBefore(this.currentRow); |
| | | if (!this.boxInit) { |
| | | this.boxInit = true; |
| | | this.boxModel = true; |
| | | // this.detailUrl = this.url; |
| | | } |
| | | return true; |
| | | }, |
| | | setEditForm(row) { |
| | | // if (this.remoteColumns.length == 0 || !rows || rows.length == 0) return; |
| | | let remoteColumns = this.$refs.table.remoteColumns; |
| | | remoteColumns.forEach((column) => { |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((x) => { |
| | | if (x.field == column.field) { |
| | | x.data.data = Object.assign([], x.data, column.bind.data); |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | this.editFormFields; |
| | | //éç½®ç¼è¾è¡¨åæ°æ® |
| | | this.editFormFields[this.table.key] = row[this.table.key]; |
| | | |
| | | this.resetEditForm(row); |
| | | this.currentAction = this.const.EDIT; |
| | | this.boxModel = true; |
| | | }, |
| | | async linkData(row, column) { |
| | | this.boxOptions.title = this.table.cnName + '(ç¼è¾)'; |
| | | //ç¹å»tableåå
æ ¼å¿«æ·é¾æ¥æ¾ç¤ºç¼è¾æ°æ® |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = row; |
| | | if (!(await this.initBox())) return; |
| | | this.resetDetailTable(row); |
| | | this.setEditForm(row); |
| | | this.setContinueAdd(false); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(row); |
| | | }, |
| | | setContinueAdd(isAdd) { |
| | | if (!this.continueAdd) return; |
| | | var _button = this.boxButtons.find((x) => { |
| | | return x.value == 'save'; |
| | | }); |
| | | if (_button) { |
| | | _button.name = isAdd ? this.continueAddName : 'ä¿ å'; |
| | | } |
| | | }, |
| | | resetAdd() { |
| | | if (this.hasDetail) { |
| | | this.$refs.detail && |
| | | // this.$refs.detail.rowData && |
| | | this.$refs.detail.reset(); |
| | | } |
| | | let obj = {}; |
| | | //妿æswitchæ ç¾ï¼é»è®¤é½è®¾ç½®ä¸ºå¦ |
| | | this.editFormOptions.forEach((x) => { |
| | | x.forEach((item) => { |
| | | if (item.type == 'switch') { |
| | | obj[item.field] = 0; |
| | | } |
| | | }); |
| | | }); |
| | | this.resetEditForm(obj); |
| | | }, |
| | | async add() { |
| | | this.boxOptions.title = this.table.cnName + '(æ°å»º)'; |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | if (!(await this.initBox())) return; |
| | | |
| | | this.resetAdd(); |
| | | this.setContinueAdd(true); |
| | | // this.resetEditForm(); |
| | | this.boxModel = true; |
| | | //ç¹å»æ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(); |
| | | // this.modelOpenAfter(); |
| | | }, |
| | | async edit(rows) { |
| | | this.boxOptions.title = 'ç¼è¾'; |
| | | //ç¼è¾ |
| | | this.currentAction = this.const.EDIT; |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | if (rows.length == 0) { |
| | | return this.$error('è¯·éæ©è¦ç¼è¾çè¡!'); |
| | | } |
| | | if (rows.length != 1) { |
| | | return this.$error('åªè½éæ©ä¸è¡æ°æ®è¿è¡ç¼è¾!'); |
| | | } |
| | | //è®°å½å½åç¼è¾çè¡ |
| | | this.currentRow = rows[0]; |
| | | //åå§åå¼¹åºæ¡ |
| | | if (!(await this.initBox())) return; |
| | | this.setContinueAdd(false); |
| | | //é置表å |
| | | this.resetDetailTable(); |
| | | |
| | | //设置å½åçæ°æ®å°è¡¨åä¸ |
| | | this.setEditForm(rows[0]); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(rows[0]); |
| | | // this.modelOpenAfter(rows[0]); |
| | | }, |
| | | getRemoteFormDefaultKeyValue() { |
| | | //设置表åè¿ç¨æ°æ®æºçé»è®¤key.value |
| | | if (this.currentAction != this.const.EDIT || this.remoteKeys.length == 0) |
| | | return; |
| | | this.editFormOptions.forEach((x, xIndex) => { |
| | | x.forEach((item, yIndex) => { |
| | | if (item.remote) { |
| | | let column = this.columns.find((x) => { |
| | | return x.bind && x.bind.key == item.dataKey; |
| | | }); |
| | | if (!column) return; |
| | | let key = this.currentRow[item.field]; |
| | | let obj = column.bind.data.find((x) => { |
| | | return x.key == key; |
| | | }); |
| | | // obj ? obj.value : keyå¦ææ²¡ææ¥å°æ°æ®æºï¼ç´æ¥ä½¿ç¨åæ°æ® |
| | | item.data = [{ key: key, value: obj ? obj.value : key }]; |
| | | this.editFormOptions[xIndex].splice(yIndex, 1, item); |
| | | // this.$set(item, 'data', [{ key: key + '', value: obj.value }]) |
| | | // item.data = [{ key: key + '', value: obj.value }]; |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | modelOpenProcess(row) { |
| | | this.$nextTick(() => { |
| | | this.modelOpenAfter(row); |
| | | }); |
| | | return; |
| | | // if (!this.$refs.form) { |
| | | // let timeOut = setTimeout(x => { |
| | | // this.modelOpenAfter(row); |
| | | // }, 500) |
| | | // return; |
| | | // } |
| | | // this.modelOpenAfter(row); |
| | | }, |
| | | import() { |
| | | //导å
¥(ä¸ä¼ excel),å¼¹åºå¯¼å
¥ç»ä»¶UploadExcel.vue |
| | | this.upload.excel = true; |
| | | this.$refs.upload_excel && this.$refs.upload_excel.reset(); |
| | | }, |
| | | download(url, fileName) { |
| | | //ä¸è½½å¯¼åºçæä»¶ |
| | | let xmlResquest = new XMLHttpRequest(); |
| | | xmlResquest.open('GET', url, true); |
| | | xmlResquest.setRequestHeader('Content-type', 'application/json'); |
| | | xmlResquest.setRequestHeader( |
| | | 'Authorization', |
| | | this.$store.getters.getToken() |
| | | ); |
| | | let elink = this.$refs.export; |
| | | xmlResquest.responseType = 'blob'; |
| | | xmlResquest.onload = function (oEvent) { |
| | | if (xmlResquest.status != 200) { |
| | | this.$error('ä¸è½½æä»¶åºéäº..'); |
| | | return; |
| | | } |
| | | let content = xmlResquest.response; |
| | | // let elink = this.$refs.export;//document.createElement("a"); |
| | | elink.download = fileName; //+".xlsx"; |
| | | // elink.style.display = "none"; |
| | | let blob = new Blob([content]); |
| | | elink.href = URL.createObjectURL(blob); |
| | | // document.body.appendChild(elink); |
| | | elink.click(); |
| | | // document.body.removeChild(elink); |
| | | }; |
| | | xmlResquest.send(); |
| | | }, |
| | | getFileName(isDetail) { |
| | | //2021.01.08å¢å 导åºexcelæ¶èªå®ä¹æä»¶å |
| | | if (isDetail) { |
| | | return this.detail.cnName + '.xlsx'; |
| | | } |
| | | return this.table.cnName + '.xlsx'; |
| | | }, |
| | | export(isDetail) { |
| | | //å¯¼åº |
| | | let url, query, param; |
| | | if (isDetail) { |
| | | //æç»è¡¨å¯¼åºæ¶å¦ææ¯æ°å»ºç¶æï¼ç¦æ¢å¯¼åº |
| | | if (this.currentAction == 'Add') { |
| | | return; |
| | | } |
| | | url = `api/${this.detail.table}/${this.const.EXPORT}`; |
| | | param = { |
| | | wheres: [ |
| | | { name: this.table.key, value: this.editFormFields[this.table.key] } |
| | | ] |
| | | }; |
| | | } else { |
| | | //ä¸»è¡¨å¯¼åº |
| | | url = this.getUrl(this.const.EXPORT); |
| | | query = this.getSearchParameters(); |
| | | param = { order: this.pagination.order, wheres: query.wheres || [] }; |
| | | } |
| | | //2020.06.25å¢å 导åºåå¤ç |
| | | if (!isDetail && !this.exportBefore(param)) { |
| | | return; |
| | | } |
| | | |
| | | if (param.wheres && typeof param.wheres == 'object') { |
| | | param.wheres = JSON.stringify(param.wheres); |
| | | } |
| | | let $http = this.http; |
| | | //2022.09.26å¢å èªå®ä¹å¯¼åºæä»¶å |
| | | let fileName = this.downloadFileName || this.getFileName(isDetail); |
| | | //2021.01.08ä¼å导åºåè½ |
| | | $http |
| | | .post(url, param, 'æ£å¨å¯¼åºæ°æ®....', { responseType: 'blob' }) |
| | | .then((content) => { |
| | | const blob = new Blob([content]); |
| | | if ('download' in document.createElement('a')) { |
| | | // éIEä¸è½½ |
| | | const elink = document.createElement('a'); |
| | | elink.download = fileName; |
| | | elink.style.display = 'none'; |
| | | elink.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(elink); |
| | | elink.click(); |
| | | URL.revokeObjectURL(elink.href); |
| | | document.body.removeChild(elink); |
| | | } else { |
| | | // IE10+ä¸è½½ |
| | | navigator.msSaveBlob(blob, fileName); |
| | | } |
| | | }); |
| | | //.then(result => { |
| | | // if (!result.status) { |
| | | // return this.$error(result.message); |
| | | // } |
| | | // let path = this.getUrl(this.const.DOWNLOAD); |
| | | // path = path[0] == "/" ? path.substring(1) : path; |
| | | // this.download( |
| | | // $http.ipAddress + path + "?path=" + result.data, |
| | | // this.table.cnName + ".xlsx" // filePath |
| | | // ); |
| | | /// window.open($http.ipAddress + path + "?fileName=" + filePath, "_self"); |
| | | // }); |
| | | }, |
| | | getSelectRows() { |
| | | //è·åéä¸çè¡ |
| | | return this.$refs.table.getSelected(); |
| | | }, |
| | | getDetailSelectRows() { |
| | | //æè·åæç»éä¸çè¡ |
| | | if (!this.$refs.detail) { |
| | | return []; |
| | | } |
| | | return this.$refs.detail.getSelected(); |
| | | }, |
| | | audit() { |
| | | //å®¡æ ¸å¼¹åºæ¡ |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error('è¯·éæ©è¦å®¡æ ¸çè¡!'); |
| | | let auditStatus = Object.keys(rows[0]).find(x => { return x.toLowerCase() === 'auditstatus' }); |
| | | if (!auditStatus) { |
| | | return this.$message.error(`表å¿
é¡»å
æ¬å®¡æ ¸å段ãAuditStatusã,并䏿¯intç±»å`) |
| | | } |
| | | // let checkStatus = rows.every((x) => { |
| | | // return this.$global.audit.status.some(c => { return c === x[auditStatus] || !x[auditStatus] }) |
| | | // }); |
| | | // if (!checkStatus) return this.$error('åªè½éæ©å¾
å®¡æ¹æå®¡æ ¸ä¸çæ°æ®!'); |
| | | this.$refs.audit.open(rows); |
| | | }, |
| | | saveAudit(params, rows, callback) { |
| | | |
| | | //ä¿åå®¡æ ¸ |
| | | let keys = rows.map(x => { return x[this.table.key] }); |
| | | if (!this.auditBefore(keys, rows)) { |
| | | return; |
| | | } |
| | | let url = `${this.getUrl(this.const.AUDIT)}?auditReason=${params.reason}&auditStatus=${params.value}` |
| | | this.http.post(url, keys, 'å®¡æ ¸ä¸....').then((x) => { |
| | | if (!this.auditAfter(x, keys)) { |
| | | return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | |
| | | callback && callback(x); |
| | | this.$success(x.message); |
| | | this.refresh(); |
| | | }); |
| | | }, |
| | | viewModelCancel() { |
| | | //æ¥çè¡¨ç»æ |
| | | this.viewModel = false; |
| | | }, |
| | | initFormOptions(formOptions, keys, formFields, isEdit) { |
| | | //åå§åæ¥è¯¢ãç¼è¾å¯¹è±¡çä¸ææ¡æ°æ®æºãå¾çä¸ä¼ 龿¥å°å |
| | | //let defaultOption = { key: "", value: "è¯·éæ©" }; |
| | | //æä¸ä¼ çåæ®µ |
| | | //2020.05.03æ°å¢ |
| | | //ç¼è¾æ°æ®æºçç±»å |
| | | formOptions.forEach((item) => { |
| | | item.forEach((d) => { |
| | | if (d.type == 'number') { |
| | | //2022.08.22ä¼å表åç±»å为numberæ¶çé»è®¤å¼ |
| | | if (formFields[d.field] === '') { |
| | | formFields[d.field] = undefined; |
| | | } |
| | | this.numberFields.push(d.field); |
| | | } |
| | | if ( |
| | | d.type == 'img' || |
| | | d.type == 'excel' || |
| | | d.type == 'file' || |
| | | d.columnType == 'img' |
| | | ) { |
| | | d.url = this.http.ipAddress + 'api' + this.table.url + 'Upload'; |
| | | this.uploadfiled.push(d.field); |
| | | } |
| | | if (!d.dataKey) return true; |
| | | //2022.02.20强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | if (d.type == 'cascader' && !d.hasOwnProperty('changeOnSelect')) { |
| | | //强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | d.changeOnSelect = true; |
| | | } |
| | | //å¼å¯è¿ç¨æç´¢ |
| | | if (d.remote) { |
| | | this.remoteKeys.push(d.dataKey); |
| | | d.data = []; //{ dicNo: d.dataKey, data: [] }; |
| | | return true; |
| | | } |
| | | //2020.05.03å¢å ç¼è¾è¡¨å对checkboxçæ¯æ |
| | | if (d.type == 'checkbox' && !(formFields[d.field] instanceof Array)) { |
| | | formFields[d.field] = []; |
| | | } |
| | | if (keys.indexOf(d.dataKey) == -1) { |
| | | //2020.05.03å¢å è®°å½ç¼è¾åæ®µçæ°æ®æºç±»å |
| | | |
| | | keys.push(d.dataKey); |
| | | //2020.05.03ä¿®å¤æ¥è¯¢è¡¨åä¸ç¼è¾è¡¨åtypeç±»ååæå¼ºä¸è´æ§çé®é¢ |
| | | //this.dicKeys.push({ dicNo: d.dataKey, data: [], type: d.type }); |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascaderæ°æ®æºåå¨ |
| | | let _dic = { |
| | | dicNo: d.dataKey, |
| | | data: [], |
| | | fileds: [d.field], |
| | | orginData: [] |
| | | }; |
| | | if (d.type == 'cascader') { |
| | | _dic.type = 'cascader'; |
| | | } |
| | | if (isEdit) { |
| | | _dic['e_type'] = d.type; |
| | | } |
| | | this.dicKeys.push(_dic); |
| | | } else if (d.type == 'cascader') { |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo == d.dataKey) { |
| | | x.type = 'cascader'; |
| | | x.fileds.push(d.field); |
| | | } |
| | | }); |
| | | } |
| | | if (d.type != 'cascader') { |
| | | //2020.01.30ç§»é¤å
é¨è¡¨åformOptionsæ°æ®æºé
ç½®æ ¼å¼data.dataï¼ææåæ°æ¹ä¸ºä¸ç»ä»¶apiæ ¼å¼ç¸å |
| | | Object.assign( |
| | | d, |
| | | this.dicKeys.filter((f) => { |
| | | return f.dicNo == d.dataKey; |
| | | })[0], |
| | | { type: d.type } |
| | | ); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | //åå§table䏿ç»è¡¨çæ°æ®æºæådicKeys对象ï¼åå»åå°å è½½æ°æ®æº |
| | | initColumns(scoure, dicKeys, keys) { |
| | | if (!scoure || !(scoure instanceof Array)) return; |
| | | scoure.forEach((item) => { |
| | | if (!item.bind || (item.bind.data && item.bind.data.length > 0)) |
| | | return true; |
| | | let key = item.bind.key || item.bind.dicNo; |
| | | if (this.remoteKeys.indexOf(key) != -1) { |
| | | item.bind.remote = true; |
| | | return true; |
| | | } |
| | | if (this.hasKeyField.indexOf(item.field) == -1) { |
| | | this.hasKeyField.push(item.field); |
| | | } |
| | | var dic = dicKeys.filter((x) => { |
| | | return x.dicNo == key; |
| | | }); |
| | | if (!dic || dic.length == 0) { |
| | | dicKeys.push({ dicNo: key, data: [] }); |
| | | dic = [dicKeys[dicKeys.length - 1]]; |
| | | keys.push(key); |
| | | } |
| | | //2020.11.01å¢å 级èå¤ç |
| | | if (dic[0].type == 'cascader' || dic[0].type == 'treeSelect') { |
| | | item.bind = { data: dic[0].orginData, type: 'select', key: key }; |
| | | } else { |
| | | item.bind = dic[0]; |
| | | } |
| | | //2020.05.03ä¼åtableæ°æ®æºcheckboxä¸selectç±»åä»ç¼è¾åä¸éå |
| | | item.bind.type = item.bind.e_type || 'string'; |
| | | }); |
| | | }, |
| | | bindOptions(dic) { |
| | | //ç»å®ä¸ææ¡çæ°æ®æº |
| | | //ç»å®åå°çåå
¸æ°æ® |
| | | dic.forEach((d) => { |
| | | if (d.data.length >= (this.select2Count || 500)) { |
| | | if ( |
| | | !this.dicKeys.some((x) => { |
| | | return ( |
| | | x.dicNo == d.dicNo && |
| | | (x.type == 'cascader' || x.type == 'treeSelect') |
| | | ); |
| | | }) |
| | | ) { |
| | | d.data.forEach((item) => { |
| | | item.label = item.value; |
| | | item.value = item.key; |
| | | }); |
| | | } |
| | | } |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo != d.dicNo) return true; |
| | | //2020.10.26å¢å çº§èæ°æ®æºç»å®å¤ç |
| | | if (x.type == 'cascader' || x.type == 'treeSelect') { |
| | | // x.data=d.data; |
| | | //çætreeç»æ |
| | | let _data = JSON.parse(JSON.stringify(d.data)); |
| | | //2022.04.04å¢å 级èåå
¸æ°æ®æºå·æ°åtable没æååçé®é¢ |
| | | this.columns.forEach((column) => { |
| | | if (column.bind && column.bind.key == d.dicNo) { |
| | | column.bind.data = d.data; |
| | | } |
| | | }); |
| | | let arr = this.base.convertTree(_data, (node, data, isRoot) => { |
| | | if (!node.inited) { |
| | | node.inited = true; |
| | | node.label = node.value; |
| | | node.value = node.key; |
| | | } |
| | | }); |
| | | x.data.push(...arr); |
| | | x.orginData.push(...d.data); |
| | | //2021.10.17ä¿®å¤æ¥è¯¢çº§èä¸è½ç»å®æ°æ®æºçé®é¢ |
| | | this.searchFormOptions.forEach((searhcOption) => { |
| | | searhcOption.forEach((_option) => { |
| | | if (_option.type == 'cascader' && _option.dataKey == x.dicNo) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | //2021.10.17ä¿®å¤çº§èä¸è½äºçº§å·æ°çé®é¢ |
| | | this.editFormOptions.forEach((editOption) => { |
| | | editOption.forEach((_option) => { |
| | | if ( |
| | | (_option.type == 'cascader' || _option.type == 'treeSelect') && |
| | | _option.dataKey == x.dicNo |
| | | ) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | } else if (d.data.length > 0 && !d.data[0].hasOwnProperty('key')) { |
| | | let source = d.data, |
| | | newSource = new Array(source.length); |
| | | for (let index = 0; index < source.length; index++) { |
| | | newSource[index] = { |
| | | //é»è®¤ä»åå
¸æ°æ®è¯»åºæ¥çkey齿¯stringç±»å,ä½å¦ææ°æ®ä»sql䏿¥è¯¢çå¯è½ä¸ºéstring,妿¯async-validatoréè¦éç½®è®¾ç½®æ ¼å¼ |
| | | key: source['key'] + '', //source[index][x.config.valueField] + "", |
| | | value: source['value'] //source[index][x.config.textField] |
| | | }; |
| | | } |
| | | |
| | | x.data.push(...newSource); |
| | | } else { |
| | | //2020.06.06ï¼å¦ææ¯selectListæ°æ®æºä½¿ç¨çèªå®ä¹sqlå¹¶ä¸keyæ¯æ°åï¼å¼ºå¶è½¬æ¢æå符串 |
| | | if ( |
| | | x.e_type == 'selectList' && |
| | | d.data.length > 0 && |
| | | typeof d.data[0].key == 'number' |
| | | ) { |
| | | d.data.forEach((c) => { |
| | | c.key = c.key + ''; |
| | | }); |
| | | } |
| | | x.data.push(...d.data); |
| | | } |
| | | if ( |
| | | this.singleSearch && |
| | | this.singleSearch.dataKey && |
| | | this.singleSearch.dataKey == x.dicNo |
| | | ) { |
| | | this.singleSearch.data.splice(0, 1, ...x.data); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getUrl(action, ingorPrefix) { |
| | | //æ¯å¦å¿½ç¥åç¼/ è·åæä½çurl |
| | | return (!ingorPrefix ? '/' : '') + 'api' + this.table.url + action; |
| | | }, |
| | | |
| | | initDicKeys() { |
| | | //åå§ååå
¸æ°æ® |
| | | let keys = []; |
| | | //2022.04.17ä¼åéæ°å è½½æ°æ®æº |
| | | this.dicKeys.forEach((item) => { |
| | | item.data.splice(0); |
| | | item.orginData && item.orginData.splice(0); |
| | | }); |
| | | //this.dicKeys.splice(0); |
| | | //åå§åç¼è¾æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»ï¼å¦æè¦æ±å¿
填设置type=number/decimalçæå°å¼ |
| | | this.initFormOptions(this.editFormOptions, keys, this.editFormFields, true); |
| | | //åå§åæ¥è¯¢æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç» |
| | | this.initFormOptions( |
| | | this.searchFormOptions, |
| | | keys, |
| | | this.searchFormFields, |
| | | false |
| | | ); |
| | | //æ¥è¯¢æ¥æè®¾ç½®ä¸ºå¯éå¼å§ä¸ç»ææ¥æ |
| | | this.searchFormOptions.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (x.type == 'date' || x.type == 'datetime') x.range = true; |
| | | }); |
| | | }); |
| | | //åå§ådatatableè¡¨æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»,dicKeys为ç颿æçæ°æ®åå
¸ç¼å· |
| | | this.initColumns(this.columns, this.dicKeys, keys); |
| | | //2021.05.23é»è®¤å¼å¯æ¥è¯¢é¡µé¢ææå段æåº,妿ä¸éè¦æåºï¼å¨onInitedéåcolumns设置sort=false |
| | | //2021.09.25ç§»é¤å¼ºå¶æåºåè½ |
| | | // this.columns.forEach(x => { |
| | | // x.sort = x.render ? false : true; |
| | | // }) |
| | | if (this.detailOptions && this.detailOptions.columns) { |
| | | this.initColumns(this.detailOptions.columns, this.dicKeys, keys); |
| | | } |
| | | //åå§åå¿«éæ¥è¯¢åæ®µ,é»è®¤ä½¿ç¨ä»£ç çæå¨é
ç½®ç第ä¸ä¸ªæ¥è¯¢å段 |
| | | if (this.searchFormOptions.length > 0) { |
| | | this.singleSearch = { |
| | | dataKey: this.searchFormOptions[0][0].dataKey, |
| | | dicNo: this.searchFormOptions[0][0].dicNo, |
| | | field: this.searchFormOptions[0][0].field, |
| | | title: this.searchFormOptions[0][0].title, |
| | | type: this.searchFormOptions[0][0].type, |
| | | data: [] |
| | | }; |
| | | // this.singleSearch = this.searchFormOptions[0][0]; |
| | | } |
| | | if (keys.length == 0) return; |
| | | let $this = this; |
| | | this.http.post('/api/Sys_Dictionary/GetVueDictionary', keys).then((dic) => { |
| | | |
| | | $this.bindOptions(dic); |
| | | //2022.04.04å¢å åå
¸å è½½å®ææ¹æ³ |
| | | $this.dicInited && $this.dicInited(dic); |
| | | }); |
| | | }, |
| | | setFiexdColumn(columns, containerWidth) { |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | //2021.09.21ç§»é¤å¼ºå¶åºå®ç¬¬ä¸å |
| | | // let columnsWidth = 0; |
| | | // columns.forEach(x => { |
| | | // if (!x.hidden && x.width) { |
| | | // columnsWidth += x.width; |
| | | // } |
| | | // }); |
| | | // //å¯ç¨ç¬¬ä¸å为åºå®å |
| | | // if (columnsWidth > containerWidth) { |
| | | // let firstColumn = columns.find(x => !x.hidden); |
| | | // if (firstColumn) { |
| | | // firstColumn.fixed = true; |
| | | // } |
| | | // } |
| | | }, |
| | | initBoxHeightWidth() { |
| | | //åå§åå¼¹åºæ¡çé«åº¦ä¸å®½åº¦ |
| | | let clientHeight = document.documentElement.clientHeight; |
| | | //å¼¹åºæ¡é«åº¦è³å°250px |
| | | clientHeight = clientHeight < 250 ? 250 : clientHeight; |
| | | let clientWidth = document.documentElement.clientWidth; |
| | | if ( |
| | | this.editFormOptions.some((x) => { |
| | | return x.some((item) => { |
| | | return item.type == 'editor'; |
| | | }); |
| | | }) |
| | | ) { |
| | | this.editor.uploadImgUrl = this.getUrl('upload'); |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } else { |
| | | if (this.boxOptions.height) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.height > clientHeight * 0.8) { |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | } |
| | | } |
| | | if (this.boxOptions.width) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.width > clientWidth * 0.8) { |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } |
| | | } |
| | | } |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | let maxTableWidth = clientWidth - 270; |
| | | this.setFiexdColumn(this.columns, maxTableWidth); |
| | | |
| | | this.height = this.tableHeight || clientHeight - 206; |
| | | this.url = this.getUrl(this.const.PAGE); |
| | | //计ç®å¼¹åºæ¡çé«ä¸å®½åº¦ |
| | | //妿ææç»è¡¨ï¼é«åº¦ä¸å®½å¸¦è®¾ç½®ä¸º0.9/0.82 |
| | | if (this.detail.columns && this.detail.columns.length > 0) { |
| | | this.hasDetail = true; |
| | | clientWidth = clientWidth * 0.8; |
| | | clientHeight = clientHeight * 0.85; |
| | | if (!this.detailOptions.height) { |
| | | this.detailOptions.height = |
| | | clientHeight - this.editFormOptions.length * 36 - 234; |
| | | this.detailOptions.height = |
| | | this.detailOptions.height < 240 ? 240 : this.detailOptions.height; |
| | | } |
| | | |
| | | this.detailOptions.columns = this.detail.columns; |
| | | this.detailOptions.pagination.sortName = this.detail.sortName; |
| | | this.detailOptions.cnName = this.detail.cnName; |
| | | this.detailOptions.key = this.detail.key; |
| | | this.detailOptions.url = this.getUrl('getDetailPage'); |
| | | //计ç®å¼¹åºæ¡æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | this.setFiexdColumn(this.detail.columns, clientWidth); |
| | | } else { |
| | | let maxColumns = 1; //æå¤§åæ°ï¼æ ¹æ®å计ç®å¼¹æ¡ç宽度 |
| | | this.editFormOptions.forEach((x) => { |
| | | if (x.length > maxColumns) maxColumns = x.length; |
| | | }); |
| | | let maxHeightRate = 0.7, |
| | | maxWidthRate = 0.5; |
| | | maxWidthRate = maxColumns / 10 + 0.3; |
| | | maxHeightRate = (this.editFormOptions.length || 1) * 0.1 + 0.03; |
| | | maxHeightRate = maxHeightRate > 0.9 ? 0.9 : maxHeightRate; |
| | | clientWidth = clientWidth * maxWidthRate; |
| | | clientHeight = clientHeight * maxHeightRate; |
| | | // this.boxOptions.width = clientWidth * maxWidthRate; |
| | | // this.boxOptions.height = clientHeight * maxHeightRate; |
| | | } |
| | | if (!this.boxOptions.height) { |
| | | this.boxOptions.height = clientHeight + 10; |
| | | } |
| | | if (!this.boxOptions.width) { |
| | | this.boxOptions.width = clientWidth + 30; |
| | | } |
| | | }, |
| | | rowOnChange(row) { |
| | | this.rowChange(row); |
| | | }, |
| | | rowChange(row) { |
| | | //éä¸è¡checkboxè¡äºä»¶ |
| | | }, |
| | | rowOnClick({ row, column, event }) { |
| | | this.rowClick({ row, column, event }); |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | // ç¹å»è¡äºä»¶(2020.11.07) |
| | | }, |
| | | rowOnDbClick({ row, column, event }) { |
| | | this.rowDbClick({ row, column, event }); |
| | | }, |
| | | rowDbClick({ row, column, event }) { |
| | | // åå»å»è¡äºä»¶(2021.05.23) |
| | | }, |
| | | $error(message) { |
| | | this.$message.error(message); |
| | | // this.$message({ |
| | | // type: 'error', |
| | | // content: message, |
| | | // duration: 5 |
| | | // }); |
| | | }, |
| | | $success(message) { |
| | | this.$message.success(message); |
| | | }, |
| | | setFiexdSearchForm(visiable) { |
| | | //2020.09.011å¢å åºå®æ¥è¯¢è¡¨ååè½,visiable=trueé»è®¤å°æ¥è¯¢è¡¨åå±å¼ |
| | | this.fiexdSearchForm = true; |
| | | let refreshBtn = this.buttons.find((x) => x.name == 'å· æ°'); |
| | | if (visiable) { |
| | | this.searchBoxShow = true; |
| | | } |
| | | if (refreshBtn) { |
| | | refreshBtn.name = 'é ç½®'; |
| | | refreshBtn.onClick = function () { |
| | | this.resetSearch(); |
| | | }; |
| | | } |
| | | }, |
| | | tableBeginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return this.beginEdit(row, column, index); |
| | | }, |
| | | beginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | tableEndEditBefore(row, column, index) { |
| | | return this.endEditBefore(row, column, index); |
| | | }, |
| | | endEditBefore(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | filterPermission(tableName, permission) { |
| | | //2021.03.19夿æ¯å¦ææä¸ªè¡¨çæé®æé |
| | | //:["Search","Add","Delete","Update","Import","Export","Upload","Audit"] |
| | | const _result = (this.$store.state.permission || []).find((x) => { |
| | | return x.url == '/' + tableName; |
| | | }); |
| | | return _result && _result.permission.some((x) => x == permission); |
| | | }, |
| | | destroyed() { |
| | | //2021.04.11å¢å vue页é¢éæ¯æ¹æ³,è·¯ç±å¿
须设置keepLive:falseï¼è®¾ç½®æ¹æ³è§ï¼å端å¼åææ¡£-ã[ç¦ç¨é¡µé¢ç¼åkeepAlive] |
| | | }, |
| | | loadTreeTableChildren(tree, treeNode, resolve) { |
| | | this.loadTreeChildren.call(this, tree, treeNode, resolve); |
| | | }, |
| | | loadTreeChildren(tree, treeNode, resolve) { |
| | | //æ å½¢ç»æå è½½åèç¹(2021.05.02),å¨onInitä¸è®¾ç½®äºrowKey主é®å段åæä¼çæ |
| | | return resolve([]); |
| | | }, |
| | | importDetailAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | }, |
| | | importExcelAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åæ¹æ³å¤æ |
| | | |
| | | if (!data.status) { |
| | | return; // this.$message.error(data.message); |
| | | } |
| | | //æç»è¡¨å¯¼å
¥ |
| | | if (this.boxModel) { |
| | | if (data.data) { |
| | | data.data = JSON.parse(data.data); |
| | | } else { |
| | | data.data = []; |
| | | } |
| | | data.data.forEach((x) => { |
| | | x[this.detail.key] = undefined; |
| | | x[this.table.key] = undefined; |
| | | }); |
| | | this.importDetailAfter(data); //å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | this.$refs.detail.rowData.unshift(...data.data); |
| | | this.upload.excel = false; |
| | | return; |
| | | } |
| | | this.importAfter(data); |
| | | }, |
| | | onGridModelClose(iconClick) { |
| | | if (this.isBoxAudit) { |
| | | this.initFormOptionType(false); |
| | | } |
| | | this.isBoxAudit = false; |
| | | this.onModelClose(iconClick); |
| | | }, |
| | | initAuditColumn() { |
| | | |
| | | }, |
| | | getWorkFlowSteps(row) { |
| | | let table = this.table.url.replaceAll('/', ''); |
| | | let url = `api/Sys_WorkFlow/getSteps?tableName=${table}&id=${row[this.table.key] |
| | | }`; |
| | | this.http.get(url, {}, true).then((result) => { |
| | | this.workFlowSteps.splice(0); |
| | | //æå¯è½æ²¡æé
ç½®å®¡æ¹æµç¨ |
| | | if (!result.list || !result.list.length) { |
| | | result.list = []; |
| | | this.auditParam.showAction = true; |
| | | this.auditParam.height = 240; |
| | | this.auditParam.showViewButton = row.AuditStatus == 0; |
| | | } else { |
| | | this.auditParam.showAction = result.list.some((c) => { |
| | | return c.isCurrentUser; |
| | | }); |
| | | this.auditParam.height = 511; |
| | | this.auditParam.showViewButton = true; |
| | | } |
| | | this.auditParam.reason = ''; |
| | | this.auditParam.status = -1; |
| | | this.auditParam.value = -1; |
| | | if (result.his) { |
| | | result.his.forEach((item) => { |
| | | item.auditStatus = this.getAuditStatus(item.auditStatus); |
| | | }); |
| | | } |
| | | |
| | | this.auditParam.auditHis = result.his; |
| | | this.workFlowSteps.push(...result.list); |
| | | this.isBoxAudit = true; |
| | | this.initFormOptionType(true); |
| | | this.edit(row); |
| | | this.boxOptions.title = 'å®¡æ ¸'; |
| | | }); |
| | | }, |
| | | initFormOptionType(isReadonly) { |
| | | this.editFormOptions.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (isReadonly) { |
| | | if (!option.readonly) { |
| | | this.formFieldsType.push(option.field); |
| | | option.readonly = true; |
| | | } |
| | | } else { |
| | | if (this.formFieldsType.indexOf(option.field) != -1) { |
| | | option.readonly = false; |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getAuditStatus(status) { |
| | | let data = this.auditParam.data.find((x) => { |
| | | return x.value == status; |
| | | }); |
| | | if (!data) { |
| | | return '-'; |
| | | // return `å®¡æ ¸å¼ä¸æ£ç¡®:${status}` |
| | | } |
| | | return data.text; |
| | | }, |
| | | initFlowQuery() { |
| | | if (this.$route.query.viewflow) { |
| | | this.$refs.table && this.search(); |
| | | } |
| | | }, |
| | | fullscreen(full) { //å¼¹åºæ¡å
¨å±æ¹æ³ |
| | | |
| | | } |
| | | }; |
| | | import customColumns from './ViewGridCustomColumn.js'; |
| | | //åå¹¶æ©å±æ¹æ³ |
| | | methods = Object.assign(methods, detailMethods, serviceFilter, customColumns); |
| | | export default methods; |
| | |
| | | <!-- 2020.10.10ç§»é¤table第ä¸è¡å¼ºå¶æåº --> |
| | | <el-table-column v-for="(column, cindex) in filterColumns" :prop="column.field" :label="column.title" |
| | | :min-width="column.width" :formatter="formatter" :fixed="column.fixed" :key="column.field + cindex" |
| | | :align="column.align" :sortable="column.sort ? 'custom' : false" |
| | | :show-overflow-tooltip="column.showOverflowTooltip"> |
| | | :align="column.align" :sortable="column.sort ? 'custom' : false" :show-overflow-tooltip=true> |
| | | <template #header> |
| | | <span v-if="(column.require || column.required) && column.edit" class="column-required">*</span>{{ |
| | | column.title }} |
| | |
| | | column.onChange && |
| | | column.onChange(scope.row, column, val); |
| | | } |
| | | " :type="column.edit.type" :placeholder="column.placeholder || column.title" |
| | | " :type="column.edit.type" :placeholder="column.placeholder || column.title" |
| | | :disabledDate="(val) => getDateOptions(val, column)" :value-format="getDateFormat(column)" |
| | | :disabled="initColumnDisabled(scope.row, column)"> |
| | | </el-date-picker> |
| | |
| | | column.onChange && |
| | | column.onChange(scope.row, column, val); |
| | | } |
| | | " :placeholder="column.placeholder || column.title" :value-format="column.format || 'HH:mm:ss'" |
| | | " :placeholder="column.placeholder || column.title" :value-format="column.format || 'HH:mm:ss'" |
| | | :disabled="initColumnDisabled(scope.row, column)"> |
| | | </el-time-picker> |
| | | <el-switch v-else-if="column.edit.type == 'switch'" v-model="scope.row[column.field]" |
| | |
| | | inline-prompt @change="(val) => { |
| | | switchChange(val, scope.row, column); |
| | | } |
| | | " :active-value="typeof scope.row[column.field] == 'boolean' |
| | | " :active-value="typeof scope.row[column.field] == 'boolean' |
| | | ? true |
| | | : typeof scope.row[column.field] == 'string' |
| | | ? '1' |
| | | : 1 |
| | | " :inactive-value="typeof scope.row[column.field] == 'boolean' |
| | | ? false |
| | | : typeof scope.row[column.field] == 'string' |
| | | ? '0' |
| | | : 0 |
| | | " :disabled="initColumnDisabled(scope.row, column)"> |
| | | ? false |
| | | : typeof scope.row[column.field] == 'string' |
| | | ? '0' |
| | | : 0 |
| | | " :disabled="initColumnDisabled(scope.row, column)"> |
| | | </el-switch> |
| | | <template v-else-if=" |
| | | ['select', 'selectList'].indexOf(column.edit.type) != -1 |
| | |
| | | <div @click="() => { |
| | | column.click && formatterClick(scope.row, column); |
| | | } |
| | | " v-else-if="column.bind"> |
| | | " v-else-if="column.bind"> |
| | | <el-tag v-if="useTag" class="cell-tag" :class="[isEmptyTag(scope.row, column)]" |
| | | :type="getColor(scope.row, column)" :effect="column.effect">{{ formatter(scope.row, column, true) |
| | | }}</el-tag> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/routerview.vue'; |
| | | import gridHeader from './extend/addrouters.vue'; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | var viewButton = this.buttons.find((x) => x.value == "ViewAllRouter"); |
| | | if (viewButton) { |
| | | viewButton.onClick = ()=>{ |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | |
| | | var addRoutersButton = this.buttons.find((x) => x.value == "AddRouters"); |
| | | if (addRoutersButton) { |
| | | addRoutersButton.onClick = ()=>{ |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import gridBody from "./extend/importDevicePro.vue"; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: "", |
| | | gridBody: gridBody, |
| | | gridFooter: "", |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: "", |
| | | modelBody: "", |
| | | modelFooter: "", |
| | | }, |
| | | tableAction: "", //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | // console.log(this.detailOptions.buttons); |
| | | // console.log(this.$refs.detail) |
| | | var detailImport = this.detailOptions.buttons.find( |
| | | (item) => item.value == "import" |
| | | ); |
| | | if (detailImport) { |
| | | detailImport.onClick = function () { |
| | | this.$refs.gridBody.open(); |
| | | }; |
| | | } |
| | | this.buttons.unshift({ |
| | | //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | name: "å¼å¯æå¡", //æé®åç§° |
| | | icon: "el-icon-document", //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | type: "primary", //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | onClick: function () { |
| | | this.$Message.success("å¼å¯æå¡"); |
| | | }, |
| | | }); |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | // this.detailOptions.columns.forEach(column=>{ }); |
| | | // console.log(this) |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | }, |
| | | updated() { |
| | | //console.log(this.$refs) |
| | | this.$nextTick(() => { |
| | | if (this.$refs.upload_excel) { |
| | | alert("ç¹å»äºä¸ä¼ æé®"); |
| | | this.$refs.upload_excel.upload = function () { |
| | | console.log("ç¹å»äºä¸ä¼ æé®"); |
| | | }; |
| | | } |
| | | // alert(1) |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: { //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | //æ©å±ç»ä»¶å¼å
¥æ¹å¼ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { //äºä»¶æ©å± |
| | | onInit() { |
| | | //ç¹å»åå
æ ¼ç¼è¾ä¸ç»æç¼è¾(é»è®¤æ¯ç¹å»åå
æ ¼ç¼è¾ï¼é¼ æ 离å¼ç»æç¼è¾) |
| | | this.detailOptions.clickEdit = true; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.min = 0; |
| | | } |
| | | if (item.field == "DbSql") { |
| | | item.placeholder = "妿仿°æ®åºå è½½æ°æ®æºï¼è¯·ææ¤æ ¼å¼é
ç½®sqlè¯å¥ï¼select orderType as key,orderName as value from order 妿éè¦æ ¹æ®ç¨æ·ä¿¡æ¯å è½½æ°æ®æºï¼è¯·é
置好æ¤sql,åä¿®æ¹åå°DictionaryHandler.GetCustomDBSqlæ¹æ³"; |
| | | } |
| | | }) |
| | | }) |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == 'OrderNo') { |
| | | x.summary = true; |
| | | } |
| | | }) |
| | | //ä¿ååä¸å
³éç¼è¾æ¡ |
| | | this.boxOptions.saveClose = false; |
| | | }, |
| | | onInited() { |
| | | this.boxOptions.height = document.body.clientHeight * 0.87 |
| | | this.height = this.height - 45; |
| | | }, |
| | | addBefore(formData) { |
| | | return this.saveBefore(formData); |
| | | }, |
| | | updateBefore(formData) { |
| | | return this.saveBefore(formData); |
| | | }, |
| | | saveBefore(formData) { |
| | | if (this.editFormFields.DbSql && |
| | | (this.editFormFields.DbSql.indexOf('value') == -1 || |
| | | this.editFormFields.DbSql.indexOf('key') == -1) |
| | | ) { |
| | | this.$message.error("sqlè¯å¥å¿
é¡»å
æ¬key/valueåæ®µ,å¦:select orderType as key,orderName as value from order"); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | searchBefore(param) { |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader:'', |
| | | gridbody:'', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | methods: {//äºä»¶æ©å± |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: { |
| | | //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: "", //{ template: "<div>æ©å±ç»xxä»¶</div>" }, |
| | | gridBody: '', |
| | | gridFooter: "", |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: "", |
| | | modelBody: "", |
| | | modelFooter: "" |
| | | }, |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { |
| | | //äºä»¶æ©å± |
| | | onInit() { |
| | | console.log("sys_log") |
| | | this.setFiexdSearchForm(true); |
| | | }, |
| | | onInited() { |
| | | this.height = this.height - 170; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | tableAction:"Sys_Role", |
| | | methods: {//äºä»¶æ©å± |
| | | onInited () { |
| | | this.height = this.height - 80; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.title = "ä¸çº§è§è²"; |
| | | //设置任æèç¹é½è½éä¸(é»è®¤åªè½é䏿åä¸ä¸ªèç¹) |
| | | item.changeOnSelect = true; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onInit() { |
| | | //设置treetableçå¯ä¸å¼å段(è¿ä¸ªå段çå¼å¨è¡¨éé¢å¿
é¡»æ¯å¯ä¸ç) |
| | | this.rowKey="Role_Id"; |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url=`api/role/getTreeTableChildrenData?roleId=${tree.Role_Id}`; |
| | | this.http.post(url,{}).then(result=>{ |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params){//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value=1; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: { |
| | | render () { |
| | | return [ |
| | | h(resolveComponent('el-alert'), { |
| | | style: { 'margin-bottom': '12px' }, |
| | | 'show-icon': true, type: 'error', |
| | | closable: false, title: 'å
³äºTreeTable使ç¨' |
| | | }, ' treetableåæ ·å
¨é¨ä»£ç èªå¨çæï¼é¡µé¢çæå设置this.rowKe="xxx" tree主é®å段,å³å¯å®ææ å½¢tableé
ç½®,å
·ä½è¯´æè§Sys_Role1.js'), |
| | | ] |
| | | } |
| | | }, |
| | | |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | tableAction:"Sys_Role", |
| | | methods: {//äºä»¶æ©å± |
| | | onInited () { |
| | | this.height = this.height - 80; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.title = "ä¸çº§è§è²"; |
| | | //设置任æèç¹é½è½éä¸(é»è®¤åªè½é䏿åä¸ä¸ªèç¹) |
| | | item.changeOnSelect = true; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onInit() { |
| | | //设置treetableçå¯ä¸å¼å段(è¿ä¸ªå段çå¼å¨è¡¨éé¢å¿
é¡»æ¯å¯ä¸ç) |
| | | this.rowKey="Role_Id"; |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url=`api/role/getTreeTableChildrenData?roleId=${tree.Role_Id}`; |
| | | this.http.post(url,{}).then(result=>{ |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params){//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value=1; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { defineAsyncComponent } from "vue"; |
| | | let extension = { |
| | | components: { //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: defineAsyncComponent(() => |
| | | import("./Sys_User/Sys_UserGridHeader.vue")), |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | text: "åªè½çå°å½åè§è²ä¸çææå¸å·", |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { //äºä»¶æ©å± |
| | | onInit() { |
| | | this.boxOptions.height = 530; |
| | | this.columns.push({ |
| | | title: 'æä½', |
| | | hidden: false, |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: 120, |
| | | render: (h, { row, column, index }) => { |
| | | return h( |
| | | "div", { style: { 'font-size': '13px', 'cursor': 'pointer', 'color': '#409eff' } }, [ |
| | | h( |
| | | "a", { |
| | | style: { 'margin-right': '15px' }, |
| | | onClick: (e) => { |
| | | e.stopPropagation() |
| | | this.$refs.gridHeader.open(row); |
| | | } |
| | | }, "ä¿®æ¹å¯ç " |
| | | ), |
| | | h( |
| | | "a", { |
| | | style: {}, |
| | | onClick: (e) => { |
| | | e.stopPropagation() |
| | | this.edit(row); |
| | | } |
| | | }, |
| | | "ç¼è¾" |
| | | ), |
| | | ]) |
| | | } |
| | | }) |
| | | }, |
| | | onInited() { }, |
| | | addAfter(result) { //ç¨æ·æ°å»ºåï¼æ¾ç¤ºéæºçæçå¯ç |
| | | if (!result.status) { |
| | | return true; |
| | | } |
| | | //æ¾ç¤ºæ°å»ºç¨æ·çå¯ç |
| | | //2020.08.28ä¼åæ°å»ºæåæç¤ºæ¹å¼ |
| | | this.$confirm(result.message, 'æ°å»ºç¨æ·æå', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | type: 'success', |
| | | center: true |
| | | }).then(() => { }) |
| | | |
| | | this.boxModel = false; |
| | | this.refresh(); |
| | | return false; |
| | | }, |
| | | modelOpenAfter() { |
| | | //ç¹å»å¼¹åºæ¡åï¼å¦ææ¯ç¼è¾ç¶æï¼ç¦æ¢ç¼è¾ç¨æ·åï¼å¦ææ°å»ºç¶æï¼å°ç¨æ·ååæ®µè®¾ç½®ä¸ºå¯ç¼è¾ |
| | | let isEDIT = this.currentAction == this.const.EDIT; |
| | | this.editFormOptions.forEach(item => { |
| | | item.forEach(x => { |
| | | if (x.field == "UserName") { |
| | | x.disabled=isEDIT; |
| | | } |
| | | }) |
| | | //䏿¯æ°å»ºï¼æ§å«é»è®¤å¼è®¾ç½®ä¸ºç· |
| | | if (!isEDIT) { |
| | | this.editFormFields.Gender = "0"; |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/taskExecuteDetail.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | // this.$Notice.success({ title: this.detailOptions.cnName + ',æ¥è¯¢ç»æ', desc: 'è¿åç对象ï¼' + JSON.stringify(data) }); |
| | | |
| | | var previousButton = this.buttons.find((x) => x.value == "Previous"); |
| | | if (previousButton) previousButton.hidden = true; |
| | | var nextButton = this.buttons.find((x) => x.value == "Next"); |
| | | if (nextButton) nextButton.hidden = true; |
| | | var recoveryButton = this.buttons.find((x) => x.value == "TaskRecovery"); |
| | | if (recoveryButton) recoveryButton.hidden = true; |
| | | |
| | | //æ©å±é¡µé¢åå§åæä½ |
| | | this.columns.push({ |
| | | field: 'æä½', |
| | | title: 'æä½', |
| | | width: 70, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | return ( |
| | | '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">æ¥ç</i>' |
| | | ); |
| | | }, |
| | | click: (row) => { |
| | | this.$refs.gridBody.open(row); |
| | | } |
| | | }); |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /***************************************************************************************** |
| | | ** Author:jxx 2022 |
| | | ** QQ:283591387 |
| | | **宿´ææ¡£è§ï¼http://v2.volcore.xyz/document/api ã代ç çæé¡µé¢ViewGridã |
| | | **常ç¨ç¤ºä¾è§ï¼http://v2.volcore.xyz/document/vueDev |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | | // this.buttons.unshift({ //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | // name: 'æé®', //æé®åç§° |
| | | // icon: 'el-icon-document', //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | // type: 'primary', //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | // onClick: function () { |
| | | // this.$Message.success('ç¹å»äºæé®'); |
| | | // } |
| | | // }); |
| | | |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | | this.boxOptions.labelWidth = 150; |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
| | |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //设置æ¥è¯¢çé¢å¼¹åºæ¡çlabel宽度 |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | | // this.buttons.unshift({ //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | // name: 'æé®', //æé®åç§° |
| | | // icon: 'el-icon-document', //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | // type: 'primary', //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | // onClick: function () { |
| | | // this.$Message.success('ç¹å»äºæé®'); |
| | | // } |
| | | // }); |
| | | |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | | this.boxOptions.labelWidth = 150; |
| | | }, |
| | | onInited() { |
| | |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | //this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | |
| | | name: 'UserInfo', |
| | | component: () => import('@/views/system/UserInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'sysMenu', |
| | | component: () => import('@/views/system/Sys_Menu.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'signalR', |
| | | component: () => import('@/views/signalR/Index.vue'), |
| | | meta:{ |
| | | keepAlive:false |
| | | } |
| | | }, |
| | | ] |
| | |
| | | path: '/Dt_AreaInfo', |
| | | name: 'Dt_AreaInfo', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_AreaInfo.vue'), |
| | | // meta: { |
| | | // keepAlive: true |
| | | // } |
| | | meta: { |
| | | |
| | | } |
| | | }, |
| | | { |
| | | path: '/Dt_BillGroupStock', |
| | | name: 'Dt_BillGroupStock', |
| | | component: () => import('@/views/widesea_wms/stock/Dt_BillGroupStock.vue'), |
| | | // meta: { |
| | | // keepAlive: true |
| | | // } |
| | | }, |
| | | // { |
| | | // path: '/Dt_BillGroupStockDetail', |
| | | // name: 'Dt_BillGroupStockDetail', |
| | | // component: () => import('@/views/widesea_wms/stock/Dt_BillGroupStockDetail.vue'), |
| | | // meta: { |
| | | // keepAlive: true |
| | | // |
| | | // } |
| | | // }, |
| | | { |
| | |
| | | name: 'Dt_InboundOrder', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_InboundOrder.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_InboundOrderDetail', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_InboundOrderDetail.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_LocationInfo', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_LocationInfo.vue'), |
| | | meta: { |
| | | keepAlive: true |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_MaterielAttribute', |
| | | component: () => import('@/views/widesea_wms/material/Dt_MaterielAttribute.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_MaterielInfo', |
| | | component: () => import('@/views/widesea_wms/material/Dt_MaterielInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrder', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrder.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderAndStock', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderAndStock.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderDetail', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderDetail.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderProduction', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderProduction.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderProductionDetail', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderProductionDetail.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderTransfer', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderTransfer.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderTransferDetail', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderTransferDetail.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_RoadWayInfo', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_RoadWayInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | | path: '/Dt_Strategy', |
| | | name: 'Dt_Strategy', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_Strategy.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | meta: { |
| | | |
| | | } |
| | | }, |
| | | { |
| | | path: '/Dt_Task', |
| | | name: 'Dt_Task', |
| | | component: () => import('@/views/widesea_wms/taskinfo/Dt_Task.vue'), |
| | | // meta: { |
| | | // keepAlive: true |
| | | // } |
| | | meta: { |
| | | |
| | | } |
| | | },{ |
| | | path: '/Dt_Task_Hty', |
| | | name: 'Dt_Task_Hty', |
| | | component: () => import('@/views/widesea_wms/taskinfo/Dt_Task_Hty.vue'), |
| | | // meta: { |
| | | // keepAlive: true |
| | | // } |
| | | meta: { |
| | | |
| | | } |
| | | }, |
| | | // { |
| | | // path: '/Dt_TaskOut', |
| | | // name: 'Dt_TaskOut', |
| | | // component: () => import('@/views/widesea_wms/taskinfo/Dt_TaskOut.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // |
| | | // } |
| | | // }, |
| | | // { |
| | |
| | | // name: 'Dt_TaskExecuteDetail', |
| | | // component: () => import('@/views/widesea_wms/taskinfo/Dt_TaskExecuteDetail.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // |
| | | // } |
| | | // }, |
| | | { |
| | |
| | | name: 'Dt_UnitInfo', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_UnitInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_WareAreaInfo', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_WareAreaInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_OutOrderSorting', |
| | | component: () => import('@/views/widesea_wms/invoices/Dt_OutOrderSorting.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | // { |
| | |
| | | name: 'PointStackerRelation', |
| | | component: () => import('@/views/widesea_wms/basicinfo/PointStackerRelation.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'LocationStatusChange', |
| | | component: () => import('@/views/widesea_wms/basicinfo/LocationStatusChange.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'DtBoxing', |
| | | component: () => import('@/views/widesea_wms/stock/DtBoxingInfo.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'momTest', |
| | | component: () => import('@/views/widesea_wms/MOM/momTest.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'ProductionModel', |
| | | component: () => import('@/views/widesea_wms/MOM/ProductionModel.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Dt_StationManager', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_StationManager.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | },{ |
| | | path: '/Dt_needBarcode', |
| | | name: 'Dt_needBarcode', |
| | | component: () => import('@/views/widesea_wms/basicinfo/Dt_needBarcode.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | },{ |
| | | path: '/Message', |
| | | name: 'Message', |
| | | component: () => import('@/views/widesea_wms/MOM/ErrorMessage/Message.vue'), |
| | | meta: { |
| | | |
| | | } |
| | | }, |
| | | ] |
| | |
| | | name: 'sys_Log', |
| | | component: () => import('@/views/system/Sys_Log.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Sys_User', |
| | | component: () => import('@/views/system/Sys_User.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'permission', |
| | | component: () => import('@/views/system/Permission.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | |
| | |
| | | name: 'Sys_Dictionary', |
| | | component: () => import('@/views/system/Sys_Dictionary.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | { |
| | |
| | | name: 'Sys_Role', |
| | | component: () => import('@/views/system/Sys_Role.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | // { |
| | | // path: '/Sys_Role1', |
| | | // name: 'Sys_Role1', |
| | | // component: () => import('@/views/system/Sys_Role1.vue') |
| | | // } |
| | | // , |
| | | { |
| | | path: '/Sys_DictionaryList', |
| | | name: 'Sys_DictionaryList', |
| | | component: () => import('@/views/system/Sys_DictionaryList.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | }, |
| | | // { |
| | | // path: '/FormDesignOptions', |
| | | // name: 'FormDesignOptions', |
| | | // component: () => import('@/views/system/form/FormDesignOptions.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | // { |
| | | // path: '/FormCollectionObject', |
| | | // name: 'FormCollectionObject', |
| | | // component: () => import('@/views/system/form/FormCollectionObject.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | // { |
| | | // path: '/Sys_WorkFlow', |
| | | // name: 'Sys_WorkFlow', |
| | | // component: () => import('@/views/system/flow/Sys_WorkFlow.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | // { |
| | | // path: '/Sys_WorkFlowTable', |
| | | // name: 'Sys_WorkFlowTable', |
| | | // component: () => import('@/views/system/flow/Sys_WorkFlowTable.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | // { |
| | | // path: '/Sys_QuartzOptions', |
| | | // name: 'Sys_QuartzOptions', |
| | | // component: () => import('@/views/system/quartz/Sys_QuartzOptions.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | // { |
| | | // path: '/Sys_QuartzLog', |
| | | // name: 'Sys_QuartzLog', |
| | | // component: () => import('@/views/system/quartz/Sys_QuartzLog.vue'), |
| | | // meta: { |
| | | // keepAlive: false |
| | | // } |
| | | // }, |
| | | { |
| | | },{ |
| | | path: '/Sys_Department', |
| | | name: 'Sys_Department', |
| | | component: () => import('@/views/system/system/Sys_Department.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | |
| | | } |
| | | } |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- |
| | | *Authorï¼jxx |
| | | *Contactï¼283591387@qq.com |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *ä¸å¡è¯·å¨@/extension/widesea_wms/basicinfo/Dt_AreaInfo.jsæ¤å¤ç¼å |
| | | --> |
| | | <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/widesea_wms/MOM/MOMMessage.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: 'id', |
| | | footer: "Foots", |
| | | cnName: 'MOMæ¶æ¯', |
| | | name: 'MOM/MOMErrorMessage', |
| | | url: "/MOMErrorMessage/", |
| | | sortName: "CreateTime" |
| | | }); |
| | | const editFormFields = ref({}); |
| | | const editFormOptions = ref([]); |
| | | const searchFormFields = ref({}); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { "title": "æçå·", "field": "palletCode", type: "text" }, |
| | | { "title": "ä»»å¡å·", "field": "taskNum", type: "text" , hidden: true}, |
| | | { "title": "å¼å¸¸æ¶æ¯", "field": "errorMessage", type: "text" }, |
| | | ], |
| | | [ |
| | | { "title": "apiåç§°", "field": "apiName", type: "text" }, |
| | | { "title": "å建æ¶é´", "field": "createTime", type: "text" }, |
| | | ] |
| | | ]); |
| | | const columns = ref([{ field: 'id', title: '主é®', type: 'int', sort: true, hidden: true, width: 110, readonly: true, require: true, align: 'left' }, |
| | | { field: 'taskNum', title: 'ä»»å¡å·', type: 'string', sort: true, width: 110, require: true, align: 'left', sort: true , hidden: true}, |
| | | { field: 'palletCode', title: 'æçå·', type: 'string', sort: true, width: 110, align: 'left' }, |
| | | { field: 'errorMessage', title: 'å¼å¸¸æ¶æ¯', type: 'string', sort: true, width: 200, align: 'left' }, |
| | | { field: 'apiName', title: 'apiåç§°', type: 'string', sort: true, width: 110, align: 'left' }, |
| | | { field: 'createTime', title: 'å建æ¶é´', type: 'string', sort: true, width: 110, align: 'left' },]); |
| | | const detail = ref({ |
| | | cnName: "#detailCnName", |
| | | table: "#detailTable", |
| | | columns: [], |
| | | sortName: "", |
| | | key: "" |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { expect } from 'chai' |
| | | import { shallowMount } from '@vue/test-utils' |
| | | import HelloWorld from '@/components/HelloWorld.vue' |
| | | |
| | | describe('HelloWorld.vue', () => { |
| | | it('renders props.msg when passed', () => { |
| | | const msg = 'new message' |
| | | const wrapper = shallowMount(HelloWorld, { |
| | | props: { msg } |
| | | }) |
| | | expect(wrapper.text()).to.include(msg) |
| | | }) |
| | | }) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // const webpack = require("webpack"); |
| | | |
| | | module.exports = { |
| | | productionSourceMap: false, |
| | | lintOnSave: false, |
| | | devServer: { |
| | | port: 8080, |
| | | overlay: { |
| | | warning: false, |
| | | errors: false |
| | | } |
| | | }, |
| | | css: { |
| | | //æ¥çCSSå±äºåªä¸ªcssæä»¶ |
| | | sourceMap: true |
| | | }, |
| | | configureWebpack: { |
| | | module: { |
| | | rules: [ |
| | | { |
| | | test: /\.mjs$/, |
| | | include: /node_modules/, |
| | | type: "javascript/auto" |
| | | }, |
| | | ] |
| | | } |
| | | }, |
| | | //https://cli.vuejs.org/zh/guide/html-and-static-assets.html#html |
| | | chainWebpack: (config) => { |
| | | // ç§»é¤ prefetch æä»¶ |
| | | config.plugins.delete('prefetch'); |
| | | //èªä¸å®ä¹title |
| | | config.plugin('html').tap((args) => { |
| | | args[0].title = 'WCS'; |
| | | return args; |
| | | }); |
| | | |
| | | // æè
|
| | | // ä¿®æ¹å®çéé¡¹ï¼ |
| | | // config.plugin('prefetch').tap(options => { |
| | | // options[0].fileBlacklist = options[0].fileBlacklist || [] |
| | | // options[0].fileBlacklist.push(/myasyncRoute(.)+?\.js$/) |
| | | // return options |
| | | // }) |
| | | } |
| | | // configureWebpack: { |
| | | // plugins: [ |
| | | // new webpack.optimize.MinChunkSizePlugin({ |
| | | // minChunkSize: 100000 // éè¿åå¹¶å°äº minChunkSize 大å°ç chunkï¼å° chunk ä½ç§¯ä¿æå¨æå®å¤§å°éå¶ä»¥ä¸ |
| | | // }) |
| | | // ] |
| | | // } |
| | | }; |
| | |
| | | public void FatalFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(provider, format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | |
| | | public void FatalFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | |
| | | public void FatalFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1, arg2)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | |
| | | public void Info(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | |
| | | public void Info(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | |
| | | public void InfoFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format("\n{0}\n{1}\n-----------------------------------------------------------\n\n", format, arg0)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | |
| | | public void Warn(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | |
| | | public void Warn(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | |
| | | public void WarnFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// Redis常é |
| | | /// </summary> |
| | | public class CacheConst |
| | | { |
| | | /// <summary> |
| | | /// Redis Keyåç¼(å¯å é¤) |
| | | /// </summary> |
| | | public const string Cache_Prefix_Web = "WIDESEA_WMSServerWeb:"; |
| | | |
| | | /// <summary> |
| | | /// Redis Keyåç¼(éè¦æä¹
åï¼ä¸éç³»ç»éå¯å é¤) |
| | | /// </summary> |
| | | public const string Cache_Prefix = "WIDESEA_WMSServer:"; |
| | | |
| | | /// <summary> |
| | | /// Redis Hashç±»å |
| | | /// </summary> |
| | | public const string Cache_Hash = "Hash"; |
| | | |
| | | /// <summary> |
| | | /// ç³»ç»é
置表ç¼åKey |
| | | /// </summary> |
| | | public const string Cache_DevConfig = Cache_Prefix_Web + "DevConfig:"; |
| | | |
| | | /// <summary> |
| | | /// ç»å½éªè¯ç ç¼åKey |
| | | /// </summary> |
| | | public const string Cache_Captcha = Cache_Prefix_Web + "Captcha:"; |
| | | |
| | | /// <summary> |
| | | /// ç¨æ·è¡¨ç¼åKey |
| | | /// </summary> |
| | | public const string Cache_SysUser = Cache_Prefix_Web + "SysUser"; |
| | | |
| | | /// <summary> |
| | | /// ç¨æ·ææºå·å
³ç³»ç¼åKey |
| | | /// </summary> |
| | | public const string Cache_SysUserPhone = Cache_Prefix_Web + "SysUserPhone"; |
| | | |
| | | /// <summary> |
| | | /// ç¨æ·Tokenç¼åKey |
| | | /// </summary> |
| | | public const string Cache_UserToken = Cache_Prefix + "UserToken"; |
| | | |
| | | /// <summary> |
| | | /// WMSåºåç¼åKey |
| | | /// </summary>Cache_AutoModel |
| | | public const string Cache_DtStockInfo = Cache_Prefix + "DtStockInfo"; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// Linqæ©å± |
| | | /// </summary> |
| | | public static class LinqExtension |
| | | { |
| | | /// <summary> |
| | | /// æ¯å¦é½å
å« |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="first">第ä¸ä¸ªå表</param> |
| | | /// <param name="secend">第äºä¸ªå表</param> |
| | | /// <returns></returns> |
| | | public static bool ContainsAll<T>(this List<T> first, List<T> secend) |
| | | { |
| | | return secend.All(s => first.Any(f => f.Equals(s))); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace WIDESEA_Cache; |
| | | /// <summary> |
| | | /// objectæå± |
| | | /// </summary> |
| | | public static class ObjectExtension |
| | | { |
| | | /// <summary> |
| | | /// jsonå符串åºåå |
| | | /// </summary> |
| | | /// <param name="json"></param> |
| | | /// <returns></returns> |
| | | public static object ToObject(this string json) |
| | | { |
| | | return string.IsNullOrEmpty(json) ? null : JsonConvert.DeserializeObject(json); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// jsonå符串åºåå |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="json"></param> |
| | | /// <returns></returns> |
| | | public static T ToObject<T>(this string json) |
| | | { |
| | | if (json != null) |
| | | { |
| | | json = json.Replace(" ", ""); |
| | | return JsonConvert.DeserializeObject<T>(json); |
| | | } |
| | | else return default; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// jsonå符串åºåå |
| | | /// </summary> |
| | | /// <param name="json"></param> |
| | | /// <returns></returns> |
| | | public static JObject ToJObject(this string json) |
| | | { |
| | | return json == null ? JObject.Parse("{}") : JObject.Parse(json.Replace(" ", "")); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | global using Masuit.Tools; |
| | | global using Microsoft.AspNetCore.Builder; |
| | | global using Microsoft.AspNetCore.Hosting; |
| | | global using Microsoft.Extensions.DependencyInjection; |
| | | global using NewLife.Caching; |
| | | global using NewLife.Serialization; |
| | | global using SimpleRedis; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// ç¼åæå¡ |
| | | /// </summary> |
| | | public partial interface ISimpleCacheService |
| | | { |
| | | /// <summary> |
| | | /// æ·»å 䏿¡æ°æ®å°HashMap |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="hashKey">hashå表éçKey</param> |
| | | /// <param name="value">å¼</param> |
| | | void HashAdd<T>(string key, string hashKey, T value); |
| | | |
| | | /// <summary> |
| | | /// æ·»å 夿¡æ°æ®å°HashMap |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="dic">é®å¼å¯¹åå
¸</param> |
| | | /// <returns></returns> |
| | | bool HashSet<T>(string key, Dictionary<string, T> dic); |
| | | |
| | | /// <summary> |
| | | /// ä»HashMapä¸å 餿°æ® |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="fields">hashé®å表</param> |
| | | /// <returns>æ§è¡ç»æ</returns> |
| | | int HashDel<T>(string key, params string[] fields); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®é®è·åhashå表ä¸çå¼ |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="fields">hashé®å表</param> |
| | | /// <returns>æ°æ®å表</returns> |
| | | List<T> HashGet<T>(string key, params string[] fields); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®é®è·åhashå表ä¸çå¼ |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="field">hashé®</param> |
| | | /// <returns></returns> |
| | | T HashGetOne<T>(string key, string field); |
| | | |
| | | /// <summary> |
| | | /// è·åææé®å¼å¯¹ |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <returns>æ°æ®åå
¸</returns> |
| | | IDictionary<string, T> HashGetAll<T>(string key); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// ç¼åæå¡ |
| | | /// </summary> |
| | | public partial interface ISimpleCacheService |
| | | { |
| | | #region åºç¡æä½ |
| | | |
| | | /// <summary>æ¯å¦å
å«ç¼å项</summary> |
| | | /// <param name="key"></param> |
| | | /// <returns></returns> |
| | | bool ContainsKey(string key); |
| | | |
| | | /// <summary>设置ç¼å项</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">å¼</param> |
| | | /// <param name="expire">è¿ææ¶é´ï¼ç§ãå°äº0æ¶éç¨é»è®¤ç¼åæ¶é´</param> |
| | | /// <returns></returns> |
| | | bool Set<T>(string key, T value, int expire = -1); |
| | | |
| | | /// <summary>设置ç¼å项</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">å¼</param> |
| | | /// <param name="expire">è¿ææ¶é´</param> |
| | | /// <returns></returns> |
| | | bool Set<T>(string key, T value, TimeSpan expire); |
| | | |
| | | /// <summary>è·åç¼å项</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | T Get<T>(string key); |
| | | |
| | | /// <summary>æ¹éç§»é¤ç¼å项</summary> |
| | | /// <param name="keys">é®éå</param> |
| | | /// <returns></returns> |
| | | int Remove(params string[] keys); |
| | | |
| | | /// <summary>æ¸
空ææç¼å项</summary> |
| | | void Clear(); |
| | | |
| | | /// <summary>设置ç¼åé¡¹æææ</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="expire">è¿ææ¶é´</param> |
| | | bool SetExpire(string key, TimeSpan expire); |
| | | |
| | | /// <summary>è·åç¼åé¡¹æææ</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | TimeSpan GetExpire(string key); |
| | | |
| | | /// <summary> |
| | | /// 模ç³å é¤ |
| | | /// </summary> |
| | | /// <param name="pattern">å¹é
å
³é®å</param> |
| | | void DelByPattern(string pattern); |
| | | |
| | | #endregion åºç¡æä½ |
| | | |
| | | #region éåæä½ |
| | | |
| | | /// <summary>æ¹éè·åç¼å项</summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | IDictionary<string, T> GetAll<T>(IEnumerable<string> keys); |
| | | |
| | | /// <summary>æ¹é设置ç¼å项</summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="values"></param> |
| | | /// <param name="expire">è¿ææ¶é´ï¼ç§ãå°äº0æ¶éç¨é»è®¤ç¼åæ¶é´</param> |
| | | void SetAll<T>(IDictionary<string, T> values, int expire = -1); |
| | | |
| | | /// <summary>è·åå表</summary> |
| | | /// <typeparam name="T">å
ç´ ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | IList<T> GetList<T>(string key); |
| | | |
| | | /// <summary>è·ååå¸</summary> |
| | | /// <typeparam name="T">å
ç´ ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | IDictionary<string, T> GetDictionary<T>(string key); |
| | | |
| | | /// <summary>è·åéå</summary> |
| | | /// <typeparam name="T">å
ç´ ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | IProducerConsumer<T> GetQueue<T>(string key); |
| | | |
| | | /// <summary>è·åæ </summary> |
| | | /// <typeparam name="T">å
ç´ ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <returns></returns> |
| | | IProducerConsumer<T> GetStack<T>(string key); |
| | | |
| | | /// <summary>è·åSet</summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="key"></param> |
| | | /// <returns></returns> |
| | | ICollection<T> GetSet<T>(string key); |
| | | |
| | | #endregion éåæä½ |
| | | |
| | | #region é«çº§æä½ |
| | | |
| | | /// <summary>æ·»å ï¼å·²å卿¶ä¸æ´æ°</summary> |
| | | /// <typeparam name="T">å¼ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">å¼</param> |
| | | /// <param name="expire">è¿ææ¶é´ï¼ç§ãå°äº0æ¶éç¨é»è®¤ç¼åæ¶é´</param> |
| | | /// <returns></returns> |
| | | bool Add<T>(string key, T value, int expire = -1); |
| | | |
| | | /// <summary>设置æ°å¼å¹¶è·åæ§å¼ï¼ååæä½</summary> |
| | | /// <remarks> |
| | | /// 常常é
åIncrement使ç¨ï¼ç¨äºç´¯å å°ä¸å®æ°åéç½®å½é¶ï¼åé¿å
å¤çº¿ç¨å²çªã |
| | | /// </remarks> |
| | | /// <typeparam name="T">å¼ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">å¼</param> |
| | | /// <returns></returns> |
| | | T Replace<T>(string key, T value); |
| | | |
| | | /// <summary>å°è¯è·åæå®é®ï¼è¿åæ¯å¦å
å«å¼ãæå¯è½ç¼å项å好æ¯é»è®¤å¼ï¼æè
åªæ¯ååºåå失败ï¼è§£å³ç¼åç©¿éé®é¢</summary> |
| | | /// <typeparam name="T">å¼ç±»å</typeparam> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">å¼ãå³ä½¿æå¼ä¹ä¸ä¸å®è½å¤è¿åï¼å¯è½ç¼å项å好æ¯é»è®¤å¼ï¼æè
åªæ¯ååºåå失败</param> |
| | | /// <returns>è¿åæ¯å¦å
å«å¼ï¼å³ä½¿ååºåå失败</returns> |
| | | bool TryGetValue<T>(string key, out T value); |
| | | |
| | | /// <summary>ç´¯å ï¼ååæä½</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">ååé</param> |
| | | /// <returns></returns> |
| | | long Increment(string key, long value); |
| | | |
| | | /// <summary>ç´¯å ï¼ååæä½</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">ååé</param> |
| | | /// <returns></returns> |
| | | double Increment(string key, double value); |
| | | |
| | | /// <summary>éåï¼ååæä½</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">ååé</param> |
| | | /// <returns></returns> |
| | | long Decrement(string key, long value); |
| | | |
| | | /// <summary>éåï¼ååæä½</summary> |
| | | /// <param name="key">é®</param> |
| | | /// <param name="value">ååé</param> |
| | | /// <returns></returns> |
| | | double Decrement(string key, double value); |
| | | |
| | | #endregion é«çº§æä½ |
| | | |
| | | #region äºå¡ |
| | | |
| | | /// <summary>æäº¤åæ´ãé¨åæä¾è
éè¦å·ç</summary> |
| | | /// <returns></returns> |
| | | int Commit(); |
| | | |
| | | /// <summary>ç³è¯·åå¸å¼é</summary> |
| | | /// <param name="key">è¦éå®çkey</param> |
| | | /// <param name="msTimeout">éçå¾
æ¶é´ï¼å使¯«ç§</param> |
| | | /// <returns></returns> |
| | | IDisposable AcquireLock(string key, int msTimeout); |
| | | |
| | | /// <summary>ç³è¯·åå¸å¼é</summary> |
| | | /// <param name="key">è¦éå®çkey</param> |
| | | /// <param name="msTimeout">éçå¾
æ¶é´ï¼ç³è¯·å 鿶妿éå°å²çªåçå¾
çæå¤§æ¶é´ï¼å使¯«ç§</param> |
| | | /// <param name="msExpire">éè¿ææ¶é´ï¼è¶
è¿è¯¥æ¶é´å¦ææ²¡æä¸»å¨éæ¾åèªå¨éæ¾éï¼å¿
é¡»æ´æ°ç§ï¼å使¯«ç§</param> |
| | | /// <param name="throwOnFailure">å¤±è´¥æ¶æ¯å¦æåºå¼å¸¸ï¼å¦æä¸æåºå¼å¸¸ï¼å¯éè¿è¿ånullå¾ç¥ç³è¯·é失败</param> |
| | | /// <returns></returns> |
| | | IDisposable AcquireLock(string key, int msTimeout, int msExpire, bool throwOnFailure); |
| | | |
| | | #endregion äºå¡ |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //using Furion.ConfigurableOptions; |
| | | using WIDESEA_Core.Core; |
| | | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// ç¼å设置 |
| | | /// </summary> |
| | | public class CacheSettingsOptions : IConfigurableOptions |
| | | { |
| | | /// <summary> |
| | | /// 使ç¨Redis |
| | | /// </summary> |
| | | public bool UseRedis { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æ¯æ¬¡å¯å¨é½æ¸
空 |
| | | /// </summary> |
| | | public RedisSettings RedisSettings { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Redis设置 |
| | | /// </summary> |
| | | public class RedisSettings |
| | | { |
| | | /// <summary> |
| | | /// è¿æ¥å°å |
| | | /// </summary> |
| | | public string Address { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¯ç |
| | | /// </summary> |
| | | public string Password { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®åº |
| | | /// </summary> |
| | | public int Db { get; set; } = 0; |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æ¯æ¬¡å¯å¨é½æ¸
空 |
| | | /// </summary> |
| | | public bool ClearRedis { get; set; } = false; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// <inheritdoc cref="ISimpleCacheService"/> |
| | | /// å
åç¼å |
| | | /// </summary> |
| | | public partial class MemoryCacheService : ISimpleCacheService |
| | | { |
| | | /// <inheritdoc/> |
| | | public void HashAdd<T>(string key, string hashKey, T value) |
| | | { |
| | | //è·ååå
¸ |
| | | var exist = _memoryCache.GetDictionary<T>(key); |
| | | if (exist.ContainsKey(hashKey))//妿å
å«Key |
| | | exist[hashKey] = value;//éæ°èµå¼ |
| | | else exist.Add(hashKey, value);//å 䏿°çå¼ |
| | | _memoryCache.Set(key, exist); |
| | | } |
| | | |
| | | //private IDictionary<string,T> GetDictionary(string key,string) |
| | | |
| | | /// <inheritdoc/> |
| | | public bool HashSet<T>(string key, Dictionary<string, T> dic) |
| | | { |
| | | //è·ååå
¸ |
| | | var exist = _memoryCache.GetDictionary<T>(key); |
| | | dic.ForEach(it => |
| | | { |
| | | if (exist.ContainsKey(it.Key))//妿å
å«Key |
| | | exist[it.Key] = it.Value;//éæ°èµå¼ |
| | | else exist.Add(it.Key, it.Value);//å 䏿°çå¼ |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public int HashDel<T>(string key, params string[] fields) |
| | | { |
| | | int result = 0; |
| | | //è·ååå
¸ |
| | | var exist = _memoryCache.GetDictionary<T>(key); |
| | | foreach (var field in fields) |
| | | { |
| | | if (field != null && exist.ContainsKey(field))//妿å
å«Key |
| | | { |
| | | exist.Remove(field);//å é¤ |
| | | result++; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public List<T> HashGet<T>(string key, params string[] fields) |
| | | { |
| | | List<T> list = new List<T>(); |
| | | //è·ååå
¸ |
| | | var exist = _memoryCache.GetDictionary<T>(key); |
| | | foreach (var field in fields) |
| | | { |
| | | if (exist.ContainsKey(field))//妿å
å«Key |
| | | { |
| | | list.Add(exist[field]); |
| | | } |
| | | else { list.Add(default); } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public T HashGetOne<T>(string key, string field) |
| | | { |
| | | //è·ååå
¸ |
| | | var exist = _memoryCache.GetDictionary<T>(key); |
| | | |
| | | exist.TryGetValue(field, out T result); |
| | | var data = result.DeepClone(); |
| | | return data; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> HashGetAll<T>(string key) |
| | | { |
| | | var data = _memoryCache.GetDictionary<T>(key); |
| | | return data; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// <inheritdoc cref="ISimpleCacheService"/> |
| | | /// å
åç¼å |
| | | /// </summary> |
| | | public partial class MemoryCacheService : ISimpleCacheService |
| | | { |
| | | public readonly MemoryCache _memoryCache; |
| | | |
| | | public MemoryCacheService() |
| | | { |
| | | _memoryCache = new MemoryCache(); |
| | | } |
| | | |
| | | #region æ®éæä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public T Get<T>(string key) |
| | | { |
| | | var data = _memoryCache.Get<string>(key); |
| | | return data.ToObject<T>(); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public int Remove(params string[] keys) |
| | | { |
| | | return _memoryCache.Remove(keys); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Set<T>(string key, T value, int expire = -1) |
| | | { |
| | | return _memoryCache.Set(key, value.ToJson(), expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Set<T>(string key, T value, TimeSpan expire) |
| | | { |
| | | return _memoryCache.Set(key, value.ToJson(), expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool SetExpire(string key, TimeSpan expire) |
| | | { |
| | | return _memoryCache.SetExpire(key, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public TimeSpan GetExpire(string key) |
| | | { |
| | | return _memoryCache.GetExpire(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool ContainsKey(string key) |
| | | { |
| | | return _memoryCache.ContainsKey(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void Clear() |
| | | { |
| | | _memoryCache.Clear(); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void DelByPattern(string pattern) |
| | | { |
| | | var keys = _memoryCache.Keys.ToList();//è·åæækey |
| | | keys.ForEach(it => |
| | | { |
| | | if (it.Contains(pattern))//妿å¹é
|
| | | _memoryCache.Remove(pattern); |
| | | }); |
| | | } |
| | | |
| | | #endregion æ®éæä½ |
| | | |
| | | #region éåæä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys) |
| | | { |
| | | IDictionary<string, T>? result = default;//å®ä¹éå |
| | | IDictionary<string, string>? data = _memoryCache.GetAll<string>(keys);//è·åæ°æ® |
| | | data.ForEach(it => |
| | | { |
| | | result.Add(it.Key, it.Value.ToObject<T>());//éåæ°æ®,æ ¼å¼åå¹¶å å°æ°çæ°æ®éå |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void SetAll<T>(IDictionary<string, T> values, int expire = -1) |
| | | { |
| | | IDictionary<string, string>? result = default;//å®ä¹éå |
| | | values.ForEach(it => |
| | | { |
| | | result.Add(it.Key, it.Value.ToJson());//éåæ°æ®,æ ¼å¼åå¹¶å å°æ°çæ°æ®éå |
| | | }); |
| | | _memoryCache.SetAll(values, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> GetDictionary<T>(string key) |
| | | { |
| | | IDictionary<string, T>? result = default;//å®ä¹éå |
| | | var data = _memoryCache.GetDictionary<string>(key); |
| | | data.ForEach(it => |
| | | { |
| | | result.Add(it.Key, it.Value.ToObject<T>());//éåæ°æ®,æ ¼å¼åå¹¶å å°æ°çæ°æ®éå |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IProducerConsumer<T> GetQueue<T>(string key) |
| | | { |
| | | return _memoryCache.GetQueue<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IProducerConsumer<T> GetStack<T>(string key) |
| | | { |
| | | return _memoryCache.GetStack<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public ICollection<T> GetSet<T>(string key) |
| | | { |
| | | return _memoryCache.GetSet<T>(key); |
| | | } |
| | | |
| | | #endregion éåæä½ |
| | | |
| | | #region é«çº§æä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Add<T>(string key, T value, int expire = -1) |
| | | { |
| | | return _memoryCache.Add(key, value.ToJson(), expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IList<T> GetList<T>(string key) |
| | | { |
| | | IList<T> result = default;//å®ä¹éå |
| | | var data = _memoryCache.GetList<string>(key); |
| | | data.ForEach(it => |
| | | { |
| | | result.Add(it.ToObject<T>());//éåæ°æ®,æ ¼å¼åå¹¶å å°æ°çæ°æ®éå |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public T Replace<T>(string key, T value) |
| | | { |
| | | return _memoryCache.Replace(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool TryGetValue<T>(string key, out T value) |
| | | { |
| | | var result = string.Empty; |
| | | _ = _memoryCache.TryGetValue<string>(key, out result); |
| | | value = result.ToObject<T>(); |
| | | return value == null; |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public long Decrement(string key, long value) |
| | | { |
| | | return _memoryCache.Decrement(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public double Decrement(string key, double value) |
| | | { |
| | | return _memoryCache.Decrement(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public long Increment(string key, long value) |
| | | { |
| | | return _memoryCache.Increment(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public double Increment(string key, double value) |
| | | { |
| | | return _memoryCache.Increment(key, value); |
| | | } |
| | | |
| | | #endregion é«çº§æä½ |
| | | |
| | | #region äºå¡ |
| | | |
| | | /// <inheritdoc/> |
| | | public int Commit() |
| | | { |
| | | return _memoryCache.Commit(); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDisposable AcquireLock(string key, int msTimeout) |
| | | { |
| | | return _memoryCache.AcquireLock(key, msTimeout); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDisposable AcquireLock(string key, int msTimeout, int msExpire, bool throwOnFailure) |
| | | { |
| | | return _memoryCache.AcquireLock(key, msTimeout, msExpire, throwOnFailure); |
| | | } |
| | | |
| | | #endregion äºå¡ |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// <inheritdoc cref="ISimpleCacheService"/> |
| | | /// Redisç¼å |
| | | /// </summary> |
| | | |
| | | public partial class RedisCacheService : ISimpleCacheService |
| | | { |
| | | /// <inheritdoc/> |
| | | public void HashAdd<T>(string key, string hashKey, T value) |
| | | { |
| | | _simpleRedis.HashAdd<T>(key, hashKey, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool HashSet<T>(string key, Dictionary<string, T> dic) |
| | | { |
| | | return _simpleRedis.HashSet<T>(key, dic); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public int HashDel<T>(string key, params string[] fields) |
| | | { |
| | | return _simpleRedis.HashDel<T>(key, fields); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public List<T> HashGet<T>(string key, params string[] fields) |
| | | { |
| | | return _simpleRedis.HashGet<T>(key, fields); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public T HashGetOne<T>(string key, string field) |
| | | { |
| | | return _simpleRedis.HashGetOne<T>(key, field); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> HashGetAll<T>(string key) |
| | | { |
| | | return _simpleRedis.HashGetAll<T>(key); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace WIDESEA_Cache; |
| | | |
| | | /// <summary> |
| | | /// <inheritdoc cref="ISimpleCacheService"/> |
| | | /// Redisç¼å |
| | | /// </summary> |
| | | public partial class RedisCacheService : ISimpleCacheService |
| | | { |
| | | private readonly ISimpleRedis _simpleRedis; |
| | | |
| | | public RedisCacheService(ISimpleRedis simpleRedis) |
| | | { |
| | | this._simpleRedis = simpleRedis; |
| | | } |
| | | |
| | | #region æ®éæä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public T Get<T>(string key) |
| | | { |
| | | return _simpleRedis.Get<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public int Remove(params string[] keys) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Remove(keys); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Set<T>(string key, T value, int expire = -1) |
| | | { |
| | | return _simpleRedis.Set(key, value, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Set<T>(string key, T value, TimeSpan expire) |
| | | { |
| | | return _simpleRedis.Set(key, value, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool SetExpire(string key, TimeSpan expire) |
| | | { |
| | | return _simpleRedis.GetFullRedis().SetExpire(key, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public TimeSpan GetExpire(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetExpire(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool ContainsKey(string key) |
| | | { |
| | | return _simpleRedis.ContainsKey(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void Clear() |
| | | { |
| | | _simpleRedis.Clear(); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void DelByPattern(string pattern) |
| | | { |
| | | _simpleRedis.DelByPattern(pattern); |
| | | } |
| | | |
| | | #endregion æ®éæä½ |
| | | |
| | | #region éåæä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetAll<T>(keys); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public void SetAll<T>(IDictionary<string, T> values, int expire = -1) |
| | | { |
| | | _simpleRedis.GetFullRedis().SetAll(values, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDictionary<string, T> GetDictionary<T>(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetDictionary<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IProducerConsumer<T> GetQueue<T>(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetQueue<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IProducerConsumer<T> GetStack<T>(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetStack<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public ICollection<T> GetSet<T>(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetSet<T>(key); |
| | | } |
| | | |
| | | #endregion éåæä½ |
| | | |
| | | #region é«çº§æä½ |
| | | |
| | | /// <inheritdoc/> |
| | | public bool Add<T>(string key, T value, int expire = -1) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Add(key, value, expire); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IList<T> GetList<T>(string key) |
| | | { |
| | | return _simpleRedis.GetFullRedis().GetList<T>(key); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public T Replace<T>(string key, T value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Replace(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public bool TryGetValue<T>(string key, out T value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().TryGetValue(key, out value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public long Decrement(string key, long value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Decrement(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public double Decrement(string key, double value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Decrement(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public long Increment(string key, long value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Increment(key, value); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public double Increment(string key, double value) |
| | | { |
| | | return _simpleRedis.GetFullRedis().Increment(key, value); |
| | | } |
| | | |
| | | #endregion é«çº§æä½ |
| | | |
| | | #region äºå¡ |
| | | |
| | | /// <inheritdoc/> |
| | | public int Commit() |
| | | { |
| | | return _simpleRedis.GetFullRedis().Commit(); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDisposable AcquireLock(string key, int msTimeout) |
| | | { |
| | | return _simpleRedis.GetFullRedis().AcquireLock(key, msTimeout); |
| | | } |
| | | |
| | | /// <inheritdoc/> |
| | | public IDisposable AcquireLock(string key, int msTimeout, int msExpire, bool throwOnFailure) |
| | | { |
| | | return _simpleRedis.GetFullRedis().AcquireLock(key, msTimeout, msExpire, throwOnFailure); |
| | | } |
| | | |
| | | #endregion äºå¡ |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | | <ImplicitUsings>enable</ImplicitUsings> |
| | | <Nullable>enable</Nullable> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="SimpleRedis" Version="1.1.9" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_Core\WIDESEA_Core.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | [ImporterHeader(Name = "å建è
")] |
| | | [ExporterHeader(DisplayName = "å建è
")] |
| | | [SugarColumn(IsNullable = false, IsOnlyIgnoreUpdate = true, ColumnDescription = "å建è
")] |
| | | public string Creater { get; set; } = "Systeam"; |
| | | public string Creater { get; set; } = "System"; |
| | | |
| | | /// <summary> |
| | | /// å建æ¶é´ |
| | |
| | | |
| | | // 设置é»è®¤å¼ |
| | | registration.RegistrationStatus = "å¾
å®¡æ ¸"; |
| | | registration.Creater = "Systeam"; |
| | | registration.Creater = "System"; |
| | | |
| | | // å建 HTML æ ¼å¼çé®ä»¶å
容 |
| | | var bodyBuilder = new BodyBuilder(); |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Cache; |
| | | using WIDESEA_IBusinessesRepository; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStorageBasicRepository; |
| | |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; |
| | | |
| | | private readonly ISimpleCacheService _simpleCacheService; |
| | | private readonly LogFactory LogFactory = new LogFactory(); |
| | | |
| | | public MCSService(ILocationInfoRepository locationRepository,IDt_TaskRepository taskRepository,IStockInfoRepository stockInfoRepository, ISys_ConfigService configService, IDt_StationManagerRepository stationManagerRepository,IDt_AreaInfoRepository dt_AreaInfoRepository) |
| | | public MCSService(ILocationInfoRepository locationRepository,IDt_TaskRepository taskRepository,IStockInfoRepository stockInfoRepository, ISys_ConfigService configService, IDt_StationManagerRepository stationManagerRepository,IDt_AreaInfoRepository dt_AreaInfoRepository, ISimpleCacheService simpleCacheService) |
| | | { |
| | | _locationRepository = locationRepository; |
| | | _taskRepository = taskRepository; |
| | |
| | | _configService = configService; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _areaInfoRepository = dt_AreaInfoRepository; |
| | | _simpleCacheService = simpleCacheService; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (respone.Status) |
| | | { |
| | | var taskId = _taskRepository.AddData(task); |
| | | location.LocationStatus = (int) LocationEnum.InStockDisable; |
| | | _locationRepository.UpdateData(location); |
| | | |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { taskDTO.PalletCode }); |
| | | } |
| | | |
| | | else |
| | |
| | | { |
| | | throw new Exception("WCSå¤ç失败"); |
| | | } |
| | | |
| | | //WMSTaskDTO taskDTO = new WMSTaskDTO |
| | | //{ |
| | | // Id = 0, |
| | |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); // Specify the namespace explicitly |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.AgingInput)?.ConfigValue; |
| | |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.AgingInput); |
| | | Console.WriteLine(err.Message.ToString()); |
| | | //MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.AgingInput); |
| | | //Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("éç½®éåå
¥åºï¼æ´æçï¼").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("éç½®éåå
¥åºï¼æ´æçï¼").Error(true, err.StackTrace); |
| | | } |
| | |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); // Specify the namespace explicitly |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.AgingOutput)?.ConfigValue; |
| | |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.AgingOutput); |
| | | Console.WriteLine(err.Message.ToString()); |
| | | //MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.AgingOutput); |
| | | //Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("éç½®éååºåºï¼æ´æçï¼").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("éç½®éååºåºï¼æ´æçï¼").Error(true, err.StackTrace); |
| | | content.Error(err.Message); |
| | |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.CellState)?.ConfigValue; |
| | |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | Console.WriteLine(err.Message.ToString()); |
| | | //Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("åçµè¯å±æ§è·å").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("åçµè¯å±æ§è·å").Error(true, $"请æ±åæ°: {JsonConvert.SerializeObject(input)}"); |
| | | LogFactory.GetLog("åçµè¯å±æ§è·å").Error(true, err.Message); |
| | |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.TrayCellsStatus)?.ConfigValue; |
| | |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.TrayCellsStatus); |
| | | //MoMErrorMsg.AddMoMErrorMsg(0, input.TrayBarcode, err.Message, SysConfigConst.TrayCellsStatus); |
| | | |
| | | Console.WriteLine(err.Message.ToString()); |
| | | //Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("æ´ççµè¯å±æ§è·å").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("æ´ççµè¯å±æ§è·å").Error(true, $"请æ±åæ°: {JsonConvert.SerializeObject(input)}"); |
| | | LogFactory.GetLog("æ´ççµè¯å±æ§è·å").Error(true, err.Message); |
| | |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ProcessApply)?.ConfigValue; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | //Console.WriteLine(ex.Message); |
| | | LogFactory.GetLog("å·¥èºè·¯çº¿ç³è¯·").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("å·¥èºè·¯çº¿ç³è¯·").Error(true, ex.StackTrace); |
| | | } |
| | |
| | | input.EquipmentCode = "24MEJQ08-1091"; |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); |
| | | LogFactory.GetLog("æçåçµè¯è§£ç»1").Info(true, JsonConvert.SerializeObject(inputJson)); |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | |
| | | input.EquipmentCode = "24MEJQ08-1091"; |
| | | input.EmployeeNo = "MITest"; |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); |
| | | Console.WriteLine(inputJson); |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; |
| | |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\LogLibrary\LogLibrary.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Cache\WIDESEA_Cache.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Common\WIDESEA_Common.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStoragIntegrationServices\WIDESEA_IStoragIntegrationServices.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Services\WIDESEA_Services.csproj" /> |
| | |
| | | RoadwayNo = locType > 1 ? $"GWSC{((line - 1) / 4) + 1}" : $"GWSC{((line - 1) / 2) + 1}", |
| | | LocationStatus = LocationEnum.Free.ObjToInt(), |
| | | AreaId = areaId, |
| | | Creater = "systeam", |
| | | Creater = "System", |
| | | EnalbeStatus = 2, |
| | | }); |
| | | } |
| | |
| | | using Masuit.Tools; |
| | | using Microsoft.Extensions.Hosting; |
| | | using Microsoft.Extensions.Logging; |
| | | using WIDESEA_Cache; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | private readonly ISimpleCacheService _simpleCacheService; |
| | | |
| | | private Timer _timer; |
| | | |
| | | public MyBackgroundService(ILogger<MyBackgroundService> logger, ILocationInfoRepository locationRepository, IStockInfoRepository stockInfoRepository, IDt_AreaInfoRepository areaInfoRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, ISys_ConfigService configService) |
| | | public MyBackgroundService(ILogger<MyBackgroundService> logger, ILocationInfoRepository locationRepository, IStockInfoRepository stockInfoRepository, IDt_AreaInfoRepository areaInfoRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, ISys_ConfigService configService, ISimpleCacheService simpleCacheService) |
| | | { |
| | | _logger = logger; |
| | | _locationRepository = locationRepository; |
| | |
| | | _taskRepository = taskRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _simpleCacheService = simpleCacheService; |
| | | } |
| | | |
| | | public Task StartAsync(CancellationToken cancellationToken) |
| | | { |
| | | _timer = new Timer(DoWork, null, 0, 10000); |
| | | _timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(5)); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | |
| | | var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == "GWSC1"); |
| | | |
| | | if (area == null) { return; } |
| | | var stockInfo = _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // é¢å è½½StockInfoDetails |
| | | .Where(x => x.AreaCode == area.AreaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // è¿æ»¤æ¡ä»¶ |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var stockInfo = stockInfoList.Where(x => x.AreaCode == area.AreaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // è¿æ»¤æ¡ä»¶ |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .ToList(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | |
| | | Creater = "System", // ä¿®æ£æ¼åé误 |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | ProductionLine= stockInfo.ProductionLine, |
| | | ProductionLine = stockInfo.ProductionLine, |
| | | ProcessCode = stockInfo.ProcessCode, |
| | | }; |
| | | } |
| | |
| | | using Autofac.Core; |
| | | using Mapster; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SqlSugar; |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEA_Cache; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | |
| | | |
| | | namespace WIDESEA_StorageTaskServices; |
| | | |
| | |
| | | private readonly IAgingInOrOutInputService _agingInOrOutInputService; //éç½®\éå |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly ISimpleCacheService _simpleCacheService; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IAgingInOrOutInputService agingInOrOutInputService, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | ISys_ConfigService configService, |
| | | ISimpleCacheService simpleCacheService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoRepository = stockInfoRepository; |
| | |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _simpleCacheService = simpleCacheService; |
| | | } |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | |
| | | { |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | #region èçæ¬ |
| | | //var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>() |
| | | // .FirstAsync(x => x.EquipmentName == task.Roadway); |
| | | //var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue); |
| | | //if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") //éå容åºåºä¸å½åå·¥åºæ¯OCVBå䏿¥MOMåºå
¥ç« |
| | | //{ |
| | | // var agingOutputDto = MapToAgingOutputDto(stock); |
| | | // content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | // //ValidateResponse(content); |
| | | // var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | // if (!result.Success || !agingOutputDto.SerialNos[0].SerialNoResult) |
| | | // { |
| | | // if (result.MessageCode == "E10001") |
| | | // { |
| | | // var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == stock.AreaCode); |
| | | // if (area == null) |
| | | // { |
| | | // throw new Exception("æªæ¾å°å¯¹åºçåºåºä¿¡æ¯"); |
| | | // } |
| | | // var trayCells = new TrayCellsStatusDto() |
| | | // { |
| | | // Software = area.Spare3, |
| | | // TrayBarcode = task.PalletCode, |
| | | // EquipmentCode = area.Spare2, |
| | | // SceneType = area.Spare4 |
| | | // }; |
| | | // content = await _cellStateService.GetTrayCellStatusAsync(trayCells); |
| | | // if (!content.Status) return content; |
| | | |
| | | // var ResultTray = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | // if (ResultTray.SerialNos.Count > 0) |
| | | // { |
| | | // var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("æ¶é´")); |
| | | // if (parameterInfo == null) throw new Exception(""); |
| | | |
| | | // var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.CreateDate : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours; |
| | | |
| | | // var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble(); |
| | | |
| | | // var defectCode = string.Empty; |
| | | // if (!isNG) defectCode = "TQCK"; |
| | | // var outputDto = new AgingOutputDto |
| | | // { |
| | | // OpFlag = 1, |
| | | // Software = area.Spare3, |
| | | // EquipmentCode = area.Spare2, |
| | | // TrayBarcode = stock.PalletCode, |
| | | // SerialNos = ResultTray.SerialNos.Select(x => new SerialNoOutDto |
| | | // { |
| | | // SlotNo = x.PositionNo, |
| | | // SerialNo = x.SerialNo, |
| | | // SerialNoResult = true, //isNG, |
| | | // ParameterInfo = new List<ParameterInfoOutput> { |
| | | // new ParameterInfoOutput() { |
| | | // Value = outHours.ToString(), |
| | | // ParameterCode =parameterInfo.ParameterCode, |
| | | // ParameterDesc = parameterInfo.Description, |
| | | // ParameterResult = "OK", //isNG.ToString(), |
| | | // TargetValue = parameterInfo.TargetValue, |
| | | // LowerLomit = parameterInfo.LowerSpecificationsLimit, |
| | | // UpperLimit = parameterInfo.UpperSpecificationsLimit, |
| | | // DefectCode = defectCode, |
| | | // UOMCode = parameterInfo.UOMCode, |
| | | // } |
| | | // } |
| | | // }).ToList() |
| | | // }; |
| | | |
| | | // content = await _agingInOrOutInputService.GetOCVOutputAsync(outputDto); |
| | | // result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | // if (!result.Success) |
| | | // task.Remark = "NG"; |
| | | // } |
| | | // } |
| | | // else |
| | | // task.Remark = "NG"; |
| | | // } |
| | | //} |
| | | #endregion èçæ¬ |
| | | |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") |
| | |
| | | ConsoleHelper.WriteErrorLine("MOM鿥ç¹è¯NG"); |
| | | return content.Error("MOM鿥ç¹è¯NG"); |
| | | } |
| | | |
| | | // æ´æ°åºåç¶æåä»»å¡ç¶æ |
| | | (var loc, var tas) = UpdateStockAndTaskStatus(stock, task); |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | |
| | | DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); |
| | | stockInfo_Hty.ModifyDate = DateTime.Now; |
| | |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | try |
| | | { |
| | | //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("å é¤ç¼å失败").Error(true, $"{stock.PalletCode}_å é¤ç¼å失败ï¼å¼å¸¸ä¿¡æ¯ï¼{ex.Message}"); |
| | | //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | //} |
| | | } |
| | | |
| | | return content.OK("ä»»å¡å®ææå", task.Remark); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto info = null) |
| | | private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto? info = null) |
| | | { |
| | | // TODO Value弿 ¹æ®MOMä¸åçéç½®æ¶é´å°å½åæ¶é´çåéæ° |
| | | var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == stock.AreaCode); |
| | |
| | | if (isResult) |
| | | { |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | |
| | | stock.StockInfoDetails = new List<DtStockInfoDetail>() { { stock.StockInfoDetails[0] } }; |
| | | stock.LocationInfo = locationInf; |
| | | //using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | try |
| | | { |
| | | _simpleCacheService.HashAdd(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, stock.PalletCode, stock); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("æ·»å ç¼å失败").Error(true, $"{stock.PalletCode}_æ·»å ç¼å失败ï¼å¼å¸¸ä¿¡æ¯ï¼{ex.Message}"); |
| | | } |
| | | |
| | | content.OK("å
¥åºä»»å¡å®ææå"); |
| | | } |
| | | else |
| | |
| | | { |
| | | isFull = respone.SpecialParameterDuration.IsNullOrEmpty(); |
| | | } |
| | | if (respone.ProductionLine == null || respone.ParameterInfos == null) |
| | | if (respone.ProductionLine == null || respone.ParameterInfos == null || respone.ParameterInfos.IsNullOrEmpty()) |
| | | { |
| | | throw new Exception("MOMæ°æ®è¿åé误"); |
| | | throw new Exception($"MOMæ°æ®è¿åé误,产线{respone.ProductionLine},ParameterInfos{respone.ParameterInfos}"); |
| | | } |
| | | stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime; |
| | | stock.SpecialParameterDuration = respone.SpecialParameterDuration; |
| | |
| | | #endregion ä»»å¡å®æ |
| | | |
| | | #region 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region |
| | | |
| | | /// <summary> |
| | | /// 请æ±ä»»å¡å··é |
| | | /// </summary> |
| | | /// <param name="input">è¯·æ±æ¨¡å</param> |
| | | /// <returns>å
å«ä»»å¡ä¿¡æ¯çååºå
容</returns> |
| | | public async Task<WebResponseContent> RequestTaskAsync2(RequestTaskDto input) |
| | | { |
| | | // å建ä¸ä¸ªWebResponseContent对象 |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | try |
| | | { |
| | | // è°ç¨BaseDal.QueryFirstAsyncæ¹æ³ï¼æ¥è¯¢ä»»å¡ |
| | | var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode); |
| | | if (task != null) |
| | | { |
| | | //if (task.TaskState == (int)TaskInStatusEnum.InNew) |
| | | { |
| | | // å建WMSä»»å¡ |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.Roadway, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | }; |
| | | return content.OK(data: taskDTO); |
| | | } |
| | | } |
| | | |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == input.PalletCode && x.IsFull); |
| | | if (stock != null) |
| | | { |
| | | // TODOè´¨æ£ååº |
| | | } |
| | | |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.Spare1.Contains(input.Position)); |
| | | if (area == null) |
| | | return content.Error("æ¹ç¹ä½ä¸å¨åºåå表ä¸åå¨"); |
| | | |
| | | // å建ä¸ä¸ªTrayCellsStatusDto对象ï¼å¹¶èµå¼ |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | | Software = area.Spare3, |
| | | TrayBarcode = input.PalletCode, |
| | | EquipmentCode = area.Spare2, |
| | | SceneType = area.Spare4, |
| | | }; |
| | | |
| | | // è°ç¨GetTrayCellStatusAsyncæ¹æ³ï¼è·åæ´ççµè¯ |
| | | content = await GetTrayCellStatusAsync(trayCells); |
| | | // å¦æç¶æä¸ºfalseï¼åè¿åcontent |
| | | if (!content.Status) return content; |
| | | |
| | | // æ·»å ç»çä¿¡æ¯ |
| | | // å°content.Data转æ¢ä¸ºResultTrayCellsStatus对象 |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | if (!result.Success) |
| | | return content.Error(result.MOMMessage); |
| | | |
| | | // è·åå¼å¸¸çµè¯ |
| | | List<SerialNoDto>? serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | // TODO å建任å¡éè³NGæåºå£ |
| | | var efg = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList(); |
| | | //List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" }; |
| | | if (efg.Count <= 0) |
| | | { |
| | | throw new Exception("æªæ¾å°NGå
¥åºç«å°é
ç½®"); |
| | | } |
| | | List<string> NGStation = efg.Select(x => x.stationNGLocation).ToList(); |
| | | if (NGStation.Count <= 0) |
| | | { |
| | | NGStation = efg.Select(x => x.stationNGChildCode).ToList(); |
| | | } |
| | | content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, NGStation, 2); |
| | | return content.Error("åå¨å¼å¸¸çµè¯"); |
| | | } |
| | | |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | // Todo 空æçå
¥åºé»è¾ |
| | | content = await RequestTrayInTaskAsync(input); |
| | | return content; |
| | | } |
| | | |
| | | var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | //Console.WriteLine(boxing.ToJsonString()); |
| | | if (boxing == null) return content.Error("ç»ç失败"); |
| | | |
| | | if (result.ProcessCode == "OCVB") |
| | | { |
| | | //TODO 夿éä¸éè¦å»å
è£
ï¼ä¸éè¦å°±å»å¸¸æ¸©ä¸ |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationPLC == "1018" && x.stationArea == "Cache"); |
| | | var station = stationManagers.Select(x => x.stationChildCode).ToList(); |
| | | |
| | | // è·åWCSipå°å |
| | | var configz = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wcsBasez = configz.Where(x => x.ConfigKey == SysConfigConst.WCSIPAddress).FirstOrDefault()?.ConfigValue; |
| | | var address = configz.Where(x => x.ConfigKey == SysConfigConst.GetStation).FirstOrDefault()?.ConfigValue; |
| | | if (wcsBasez == null || address == null) |
| | | { |
| | | throw new InvalidOperationException("WCS IP æªé
ç½®"); |
| | | } |
| | | var wcsIpAddrss = wcsBasez + address; |
| | | |
| | | var abc = HttpHelper.PostAsync(wcsIpAddrss, station.ToJsonString()).Result; |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(abc); |
| | | if (content.Data.ObjToInt() > 0) |
| | | { |
| | | // TODO éè³å
è£
|
| | | List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList(); |
| | | content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 3); |
| | | return content; |
| | | } |
| | | else |
| | | { |
| | | var config = _configService.GetByConfigKey("SYS_InStacker", "CW3InStacker"); |
| | | var strings = config.ConfigValue.Split(',').ToList(); |
| | | // TODO å
¥åº |
| | | content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings); |
| | | if (content.Status) |
| | | await _boxingInfoRepository.AddDataNavAsync(boxing); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // TODO è·åæ¬å°ææ¡å±æ§ä¸æ´ççµè¯å±æ§è·åçå¼è¿è¡å¯¹æ¯ï¼å¦æä¸è´åç»§ç»ï¼å¦åè¿åéè¯¯ä¿¡æ¯ |
| | | //var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty)); |
| | | //if (productions.Count <= 0) |
| | | // return content.Error("ææ¡å±æ§ä¸åå¨"); |
| | | |
| | | // è°ç¨CreateBoxingInfoæ¹æ³ï¼å建ç»çä¿¡æ¯ |
| | | |
| | | //var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | ////Console.WriteLine(boxing.ToJsonString()); |
| | | //if (boxing == null) return content.Error("ç»ç失败"); |
| | | |
| | | // è°ç¨GetProcessApplyAsyncæ¹æ³ï¼è·åå·¥èºè·¯çº¿ |
| | | ProcessApplyDto process = await GetProcessApplyAsync(result); |
| | | |
| | | // 妿process为nullï¼åè¿åcontent |
| | | if (process == null) return content; |
| | | |
| | | // å¹¶èµå¼ä¸ä½è½¯ä»¶åç§°å设å¤ç¼ç |
| | | process.Software = area.Spare3; |
| | | process.EquipmentCode = area.Spare2; |
| | | |
| | | // è°ç¨GetProcessApplyAsyncæ¹æ³ï¼è·åå·¥èºç³è¯· |
| | | |
| | | // è°ç¨_processApplyService.GetProcessApplyAsyncæ¹æ³ï¼è·åå·¥èºç³è¯· |
| | | content = await _processApplyService.GetProcessApplyAsync(process); |
| | | |
| | | // å¦æç¶æä¸ºfalseï¼åè¿ånull |
| | | if (!content.Status) return content.Error("å·¥èºç³è¯·å¤±è´¥"); |
| | | |
| | | var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString()); |
| | | if (!resultProcessApply.Success) return content.Error("å·¥èºç³è¯·å¤±è´¥"); |
| | | |
| | | var number = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode == boxing.ProcessCode).FirstOrDefault().Number.ToInt32(); |
| | | foreach (var item in resultProcessApply.ProcessInfo) |
| | | { |
| | | if (item.Number.ToInt32() == number + 1) |
| | | { |
| | | boxing.NextProcessCode = item.ProcessCode; |
| | | } |
| | | } |
| | | Console.WriteLine(); |
| | | Console.WriteLine($"å½åå·¥åºï¼{boxing.ProcessCode}"); |
| | | Console.WriteLine($"ä¸ä¸å·¥åºï¼{boxing.NextProcessCode}"); |
| | | |
| | | Console.WriteLine(area.AreaCode + "-----------------------"); |
| | | Console.WriteLine(input.Position + "-----------------------"); |
| | | |
| | | var areaIn = string.Empty; |
| | | switch (boxing.NextProcessCode) |
| | | { |
| | | case "CH01": |
| | | areaIn = "CH001"; |
| | | break; |
| | | |
| | | case "JZ01": |
| | | areaIn = "JZ001"; |
| | | break; |
| | | |
| | | case "GW01": |
| | | areaIn = "GWSC1"; |
| | | break; |
| | | |
| | | case "CW01": |
| | | areaIn = "CWSC1"; |
| | | break; |
| | | |
| | | case "CW02": |
| | | areaIn = "CWSC2"; |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea.Contains(areaIn)).FirstOrDefault(); |
| | | if (stationManagers == null) |
| | | { |
| | | throw new Exception("æªæ¾å°å
¥åºç«å°é
ç½®"); |
| | | } |
| | | List<string> strings = stationManagers.Roadway.Split(',').ToList(); |
| | | Console.WriteLine(strings.ToJsonString() + "b-----------------------"); |
| | | //// è°ç¨CreateNewTaskæ¹æ³ï¼å建æ°ä»»å¡ |
| | | content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings); |
| | | if (content.Status) |
| | | { |
| | | var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); |
| | | } |
| | | //} |
| | | } |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | // 妿åçå¼å¸¸ï¼åè°ç¨content.Erroræ¹æ³ï¼è®°å½é误信æ¯ï¼å¹¶è¾åºéè¯¯ä¿¡æ¯ |
| | | content.Error(err.Message); |
| | | Console.WriteLine(err.Message); |
| | | } |
| | | |
| | | // è¿åcontent |
| | | return content; |
| | | } |
| | | |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | public async Task<WebResponseContent> RequestTaskAsync(RequestTaskDto input) |
| | | { |
| | |
| | | return content.Error(result.MOMMessage); |
| | | } |
| | | |
| | | |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | var config = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.InboundIsEmpty); |
| | |
| | | { |
| | | // å建WMSä»»å¡ |
| | | WMSTaskDTO taskDTO = CreateTaskDTO(task); |
| | | //WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | //{ |
| | | // TaskNum = task.TaskNum.Value, |
| | | // Grade = 1, |
| | | // PalletCode = task.PalletCode, |
| | | // RoadWay = task.Roadway, |
| | | // SourceAddress = task.SourceAddress, |
| | | // TargetAddress = task.Roadway, |
| | | // TaskState = task.TaskState.Value, |
| | | // Id = 0, |
| | | // TaskType = task.TaskType, |
| | | //}; |
| | | return content.OK(data: task); |
| | | } |
| | | |
| | |
| | | ConsoleHelper.WriteErrorLine($"å½åæçæ 产线,èç³»MOMæ·»å 产线"); |
| | | return content.Error("å½åæçæ 产线,èç³»MOMæ·»å 产线"); |
| | | } |
| | | |
| | | |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 6 && x.stationChildCode == input.Position).FirstOrDefault(); |
| | | if (stationManagers == null) |
| | |
| | | }; |
| | | } |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | |
| | | } |
| | | |
| | | //ConsoleHelper.WriteColorLine(JsonConvert.SerializeObject(stockInfo), ConsoleColor.DarkMagenta); |
| | | |
| | | |
| | | // æ°å¢éå¤ä»»å¡æ ¡éª |
| | | var hasTask = BaseDal.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | |
| | | { |
| | | // è®°å½å¼å¸¸ä¿¡æ¯å¹¶æåº |
| | | LogFactory.GetLog("è¯·æ±æçä»»å¡").Error(true, ex); |
| | | ConsoleHelper.WriteErrorLine("请æ±ç©º/宿çä»»å¡" + ex.Message); |
| | | ConsoleHelper.WriteErrorLine("请æ±ç©º/宿çä»»å¡" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | if (area == null) |
| | | try |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"æ¥è¯¢å®çåºåä¿¡æ¯æ¶,æªæ¾å°åºå代ç 为{areaCode}çæ°æ®"); |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | if (area == null) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"æ¥è¯¢å®çåºåä¿¡æ¯æ¶,æªæ¾å°åºå代ç 为{areaCode}çæ°æ®"); |
| | | return null; |
| | | } |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == area.AreaCode) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | var result = new DtStockInfo(); |
| | | |
| | | //if (stockInfoList.IsNullOrEmpty()) |
| | | //{ |
| | | // stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | // .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync(); |
| | | //} |
| | | |
| | | result = stockInfoList.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull) |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstOrDefault(); |
| | | |
| | | if (result != null) |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | else |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsyncæ¥è¯¢å®çåºåä¿¡æ¯å¤±è´¥:æªæ¾å°ç¬¦åæ¡ä»¶çæ°æ®"); |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsyncæ¥è¯¢å®çåºåä¿¡æ¯å¤±è´¥:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string> materielCodes = null; |
| | | if (outBoundMateriel.Count != 0) |
| | | { |
| | | materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == area.AreaCode).Select(x => x.MaterielCode).ToList(); |
| | | } |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // é¢å è½½StockInfoDetails |
| | | .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .FirstAsync(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | | //var firstOrDefault = result.FirstOrDefault(x => roadways.Contains(x.LocationInfo.RoadwayNo)); // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //var firstOrDefault = result[0]; // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //return firstOrDefault; |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine) |
| | | { |
| | | var areaId = (await _areaInfoRepository.QueryDataAsync(x => areaCodes.Contains(x.AreaCode))).Select(x => x.AreaID).ToList(); |
| | | if (areaId.Count == 0) |
| | | try |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"æ¥è¯¢å¸¸æ¸©å®çåºåä¿¡æ¯æ¶,æªæ¾å°åºå代ç 为{JsonConvert.SerializeObject(areaCodes)}çæ°æ®"); |
| | | var areaId = (await _areaInfoRepository.QueryDataAsync(x => areaCodes.Contains(x.AreaCode))).Select(x => x.AreaID).ToList(); |
| | | if (areaId.Count == 0) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"æ¥è¯¢å¸¸æ¸©å®çåºåä¿¡æ¯æ¶,æªæ¾å°åºå代ç 为{JsonConvert.SerializeObject(areaCodes)}çæ°æ®"); |
| | | return null; |
| | | } |
| | | |
| | | //var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | //List<string> materielCodes = null; |
| | | //if (outBoundMateriel.Count != 0) |
| | | //{ |
| | | // materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]).Select(x => x.MaterielCode).ToList(); |
| | | //} |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | //var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = stockInfoList.Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .FirstOrDefault(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | | if (result != null) |
| | | { |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayCWAsyncæ¥è¯¢å¸¸æ¸©å®çåºåä¿¡æ¯å¤±è´¥:æªæ¾å°ç¬¦åæ¡ä»¶çæ°æ®"); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayCWAsyncæ¥è¯¢å®çåºåä¿¡æ¯å¤±è´¥:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string> materielCodes = null; |
| | | if (outBoundMateriel.Count != 0) |
| | | { |
| | | materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]).Select(x => x.MaterielCode).ToList(); |
| | | } |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) |
| | | .ToList(); |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // é¢å è½½StockInfoDetails |
| | | .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .FirstAsync(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | | //var firstOrDefault = result.FirstOrDefault(x => roadways.Contains(x.LocationInfo.RoadwayNo)); // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //var firstOrDefault = result[0]; // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //return firstOrDefault; |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, string position) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | try |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | | ConsoleHelper.WriteColorLine(position + "..." + areaCode, ConsoleColor.Magenta); |
| | | var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == position && x.stationType == 17); |
| | | ConsoleHelper.WriteColorLine(position + "..." + areaCode, ConsoleColor.Magenta); |
| | | var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == position && x.stationType == 17); |
| | | |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList(); |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | var result = stockInfoList.Where(x => x.ProductionLine == station.productLine) |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => y.MaterielCode == "空æç")) |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.CreateDate) // æåº |
| | | .FirstOrDefault(); // 转æ¢ä¸ºå表 |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // é¢å è½½StockInfoDetails |
| | | .Where(x => x.ProductionLine == station.productLine) |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "空æç")) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.CreateDate) // æåº |
| | | .FirstAsync(); // 转æ¢ä¸ºå表 |
| | | if (result != null) |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | else |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForEmptyTrayAsyncæ¥è¯¢ç©ºçåºåä¿¡æ¯å¤±è´¥:æªæ¾å°ç¬¦åæ¡ä»¶çæ°æ®"); |
| | | |
| | | //var firstOrDefault = result[0]; // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //return firstOrDefault; |
| | | return result; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForEmptyTrayAsyncæ¥è¯¢å®çåºåä¿¡æ¯å¤±è´¥:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | // content.Error(ex.Message); |
| | | //} |
| | | //return content; |
| | | #endregion |
| | | #endregion éç½®å¼å¸¸å£å
¥åº |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | private WMSTaskDTO CreateWMSTaskDTO(object source) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion éç½®å¼å¸¸å£å
¥åº |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | #region å
é¨è°ç¨æ¹æ³ |
| | | |
| | |
| | | var taskHty = _mapper.Map<Dt_Task_Hty>(task); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.TaskId = 0; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工å é¤ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工å é¤ : App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.SourceId = task.TaskId; |
| | | if (isHand) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (stock.IsFull) |
| | | { |
| | | // æ¥è¯¢ç¬¦åæ¡ä»¶çåºåä¿¡æ¯ |
| | | var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration); |
| | | #region æ´æ°åºåä¿¡æ¯ï¼ææ¶ä¸éè¦ï¼ |
| | | //if (stock.IsFull) |
| | | //{ |
| | | // // æ¥è¯¢ç¬¦åæ¡ä»¶çåºåä¿¡æ¯ |
| | | // var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration); |
| | | |
| | | // æ¥è¯¢ä»»å¡ä¿¡æ¯ |
| | | var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList(); |
| | | // // æ¥è¯¢ä»»å¡ä¿¡æ¯ |
| | | // var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList(); |
| | | |
| | | if (stocks != null && stocks.Count > 0) |
| | | { |
| | | // è¿æ»¤åºéè¦æ´æ°çåºåä¿¡æ¯ |
| | | var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList(); |
| | | foreach (var item in stocksToUpdate) |
| | | { |
| | | // æ´æ°åºåä¿¡æ¯çç¹å®åæ° |
| | | item.SpecialParameterDuration = stock.SpecialParameterDuration; |
| | | item.ParameterInfos = stock.ParameterInfos; |
| | | item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration)); |
| | | } |
| | | if (stocksToUpdate.Count > 0) |
| | | { |
| | | // 弿¥æ´æ°åºåä¿¡æ¯ |
| | | var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // if (stocks != null && stocks.Count > 0) |
| | | // { |
| | | // // è¿æ»¤åºéè¦æ´æ°çåºåä¿¡æ¯ |
| | | // var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList(); |
| | | // foreach (var item in stocksToUpdate) |
| | | // { |
| | | // // æ´æ°åºåä¿¡æ¯çç¹å®åæ° |
| | | // item.SpecialParameterDuration = stock.SpecialParameterDuration; |
| | | // item.ParameterInfos = stock.ParameterInfos; |
| | | // item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration)); |
| | | // } |
| | | // if (stocksToUpdate.Count > 0) |
| | | // { |
| | | // // 弿¥æ´æ°åºåä¿¡æ¯ |
| | | // var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate); |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | // æ·»å åå²ä»»å¡ |
| | | var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | |
| | | } |
| | | |
| | | #region ä»»å¡è¯·æ±æ¹æ³ |
| | | |
| | | |
| | | private static readonly SemaphoreSlim _semaphoreUpdate = new SemaphoreSlim(1, 1); |
| | | // æ´æ°ä»»å¡è´§ä½ |
| | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | finally { _semaphoreUpdate.Release(); } |
| | |
| | | TaskState = flag == 3 ? (int)TaskOutStatusEnum.OutNew : (int)TaskInStatusEnum.InNew, |
| | | TaskType = flag == 0 ? (int)TaskInboundTypeEnum.Inbound : flag == 1 ? (int)TaskInboundTypeEnum.InTray : flag == 2 ? (int)TaskInboundTypeEnum.InNG : (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = productionLine, |
| | | ProcessCode = processCode |
| | | }; |
| | |
| | | return content; |
| | | } |
| | | |
| | | |
| | | private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¾è´§ä½ |
| | | /// </summary> |
| | |
| | | using Masuit.Tools; |
| | | using SqlSugar; |
| | | using WIDESEA_Common.CustomModels; |
| | | |
| | | //using WIDESEA_Common.CustomModels; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | Creater = "System" |
| | | }; |
| | | return taskNG; |
| | | } |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = stationManager.stationType == 1 ? (int)TaskInboundTypeEnum.Inbound : (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | { |
| | | if (stationManager.stationType != 7) throw new Exception("é误çè°å"); |
| | | |
| | | var stockinfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) |
| | | //.Includes(x=>x.StockInfoDetails) |
| | | .Where(x => !x.IsFull && x.LocationInfo.RoadwayNo == stationManager.Roadway) |
| | | .OrderBy(x => x.CreateDate) |
| | | .FirstAsync(); |
| | | // ä»ç¼åä¸è·ååºåä¿¡æ¯ |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var stockinfo1 = stockInfoList.OrderBy(x => x.CreateDate) |
| | | .ToList(); |
| | | var stockinfo = stockinfo1.Where(x => x.LocationInfo != null && !x.IsFull && x.LocationInfo.RoadwayNo == stationManager.Roadway) |
| | | .FirstOrDefault(); |
| | | |
| | | if (stockinfo == null) return null; |
| | | |
| | |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = (int)TaskOutboundTypeEnum.OutTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = stockinfo.ProductionLine, |
| | | }; |
| | | |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { task.PalletCode }); |
| | | return task; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | |
| | | #region 常温补空æçè³å容 |
| | | |
| | | private static readonly Dictionary<string, (int Count, DateTime LastRequestTime)> requestTrackerToCW = new(); |
| | | |
| | | public async Task<WebResponseContent> GetFROutTrayToCW(RequestTaskDto taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //string requestKey = JsonConvert.SerializeObject(taskDTO); |
| | | //// æ£æ¥è¯·æ±æ¬¡æ°åæ¶é´éå¶ |
| | | //if (requestTrackerToCW.TryGetValue(requestKey, out var requestInfo)) |
| | | //{ |
| | | // if (requestInfo.Count > 5 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(2)) |
| | | // { |
| | | // // å¦æè¯·æ±æ¬¡æ°è¶
è¿éå¶ä¸æªè¶
è¿10åéï¼æåºå¼å¸¸ |
| | | // throw new InvalidOperationException("è¯·æ±æ¬¡æ°å·²è¾¾å°éå¶ï¼è¯·ç¨ååè¯ã"); |
| | | // } |
| | | //} |
| | | |
| | | //// æ´æ°è¯·æ±è·è¸ªä¿¡æ¯ |
| | | //if (requestTrackerToCW.ContainsKey(requestKey)) |
| | | //{ |
| | | // requestTrackerToCW[requestKey] = (requestInfo.Count + 1, DateTime.Now); |
| | | //} |
| | | //else |
| | | //{ |
| | | // requestTrackerToCW[requestKey] = (1, DateTime.Now); |
| | | //} |
| | | |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == taskDTO.Position && x.stationStatus == "1"); |
| | | var locations = _locationRepository.QueryData(x => x.RoadwayNo == station.Roadway && x.LocationStatus == (int)LocationEnum.Free && x.LocationType == 1); |
| | | |
| | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | // è¿åæåååº |
| | | //requestTrackerToCW.Remove(requestKey); |
| | | |
| | | return content.OK(data: wmsTask); |
| | | } |
| | | else |
| | |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList(); |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | // ä»ç¼åä¸è·ååºåä¿¡æ¯ |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // é¢å è½½StockInfoDetails |
| | | .Where(x => x.ProductionLine == productLine) |
| | | var result1 = stockInfoList.Where(x => x.ProductionLine == productLine) |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "空æç")) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => x.LocationInfo != null && deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.CreateDate) // æåº |
| | | .FirstAsync(); // 转æ¢ä¸ºå表 |
| | | .ToList(); // 转æ¢ä¸ºå表 |
| | | |
| | | //var firstOrDefault = result[0]; // æ¥æ¾ç¬¬ä¸ä¸ªå¹é
çå
ç´ |
| | | //return firstOrDefault; |
| | | var result = result1.Where(x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => y.MaterielCode == "空æç")) |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // è¿æ»¤æ¡ä»¶ |
| | | .FirstOrDefault(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | | if (result != null) |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | else |
| | | ConsoleHelper.WriteColorLine($"常温{productLine}空æçåºåä¸è¶³", ConsoleColor.Red); |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //string requestKey = JsonConvert.SerializeObject(json); |
| | | //// æ£æ¥è¯·æ±æ¬¡æ°åæ¶é´éå¶ |
| | | //if (requestTracker.TryGetValue(requestKey, out var requestInfo)) |
| | | //{ |
| | | // if (requestInfo.Count >= 9 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(5)) |
| | | // { |
| | | // // å¦æè¯·æ±æ¬¡æ°è¶
è¿éå¶ä¸æªè¶
è¿10åéï¼æåºå¼å¸¸ |
| | | // throw new InvalidOperationException("è¯·æ±æ¬¡æ°å·²è¾¾å°éå¶ï¼è¯·ç¨ååè¯ã"); |
| | | // } |
| | | //} |
| | | |
| | | //// æ´æ°è¯·æ±è·è¸ªä¿¡æ¯ |
| | | //if (requestTracker.ContainsKey(requestKey)) |
| | | //{ |
| | | // requestTracker[requestKey] = (requestInfo.Count + 1, DateTime.Now); |
| | | //} |
| | | //else |
| | | //{ |
| | | // requestTracker[requestKey] = (1, DateTime.Now); |
| | | //} |
| | | //LogFactory.GetLog("常温3åºåºè³å
è£
").Info(true, $"常温3åºåºè³å
è£
ä¼ å
¥åæ°ï¼" + JsonConvert.SerializeObject(json, Formatting.Indented)); |
| | | |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call"); |
| | | if (station == null) { throw new Exception($"æªæ¾å°å
è£
ç«å°ä¿¡æ¯ï¼è¯·æ£æ¥ä¼ å
¥åæ°{json.Position}"); } |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) // è¿æ»¤æ¡ä»¶ |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | // ä»ç¼åä¸è·ååºåä¿¡æ¯ |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | // ä¿®æ¹åçæ¥è¯¢ä»£ç |
| | | var stockInfo1 = stockInfoList |
| | | .Where(x => x.ProductionLine == station.productLine) |
| | | .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .ToList(); |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | //LogFactory.GetLog("常温3åºåºè³å
è£
").Info(true, $"常温3åºåºè³å
è£
ä¼ å
¥åæ°ï¼" + JsonConvert.SerializeObject(json, Formatting.Indented)); |
| | | var stockInfo = _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Where(x => x.ProductionLine == station.productLine) |
| | | .Includes(x => x.LocationInfo) // é¢å è½½LocationInfo |
| | | .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .First(); // è·å第ä¸ä¸ªå
ç´ |
| | | var stockInfo = stockInfo1 |
| | | // å¢å 对 LocationInfo çç©ºå¼æ£æ¥ |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) |
| | | // å¢å 对 LocationInfo çç©ºå¼æ£æ¥ |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => x.LocationInfo != null && deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .FirstOrDefault(); |
| | | |
| | | //DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine); |
| | | if (stockInfo == null) throw new Exception($"åºå
{station.productLine}æ æ»¡è¶³æ¡ä»¶çåºåå¯åºåº"); |
| | | |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode); |
| | |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = stockInfo.ProductionLine, |
| | | ProcessCode = stockInfo.ProcessCode, |
| | | }; |
| | |
| | | stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | _locationRepository.UpdateData(stockInfo.LocationInfo); |
| | | |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { taskDTO.PalletCode }); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(stockInfo.LocationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | return content.OK(data: taskDTO); |
| | |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\LogLibrary\LogLibrary.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Cache\WIDESEA_Cache.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IBusinessServices\WIDESEA_IBusinessServices.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStorageBasicService\WIDESEA_IStorageBasicServices.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStorageOutOrderService\WIDESEA_IStorageOutOrderServices.csproj" /> |
| | |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_IStoragIntegrationServices", "WIDESEA_IStoragIntegrationServices\WIDESEA_IStoragIntegrationServices.csproj", "{94D572FA-810E-4897-B673-AF988FD4019E}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_Cache", "WIDESEA_Cache\WIDESEA_Cache.csproj", "{461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | | Debug|Any CPU = Debug|Any CPU |
| | |
| | | {94D572FA-810E-4897-B673-AF988FD4019E}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {94D572FA-810E-4897-B673-AF988FD4019E}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {94D572FA-810E-4897-B673-AF988FD4019E}.Release|x86.Build.0 = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Dev|Any CPU.ActiveCfg = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Dev|Any CPU.Build.0 = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Dev|x86.ActiveCfg = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Dev|x86.Build.0 = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {461A73BF-9FC7-4BFE-9BEB-2AE686CBFEEC}.Release|x86.Build.0 = Release|Any CPU |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
| | |
| | | using WIDESEA_DTO; |
| | | using static WIDESEA_DTO.RequestTaskDto; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers; |
| | | |
| | |
| | | /// <param name="saveModel">ä»»å¡å·</param> |
| | | /// <returns>æåæå¤±è´¥</returns> |
| | | [HttpGet, Route("CompleteTaskAsync"), AllowAnonymous] |
| | | //[TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> CompleteTaskAsync(int taskNum) |
| | | { |
| | | return await _taskService.CompleteAsync(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="saveModel">ä»»å¡å·</param> |
| | | /// <returns>æåæå¤±è´¥</returns> |
| | | //[HttpGet, Route("CompleteTaskByStation"), AllowAnonymous] |
| | | //public async Task<WebResponseContent> CompleteTaskByStation(int taskNum) |
| | | //{ |
| | | // return await _taskService.CompleteTaskByStation(taskNum); |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// æ£æ¥æ¯å¦éè¦è¿è¡ç§»åº |
| | |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns>ä»»å¡</returns> |
| | | [HttpGet, Route("TransferCheckAsync"), AllowAnonymous] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> TransferCheckAsync(int taskNum) |
| | | { |
| | | return new WebResponseContent().OK(data: await _locationService.TransferCheckAsync(taskNum)); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestTaskAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestTaskAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.RequestTaskAsync(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestInTask")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestInTask([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.RequestInTask(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestLocationTaskAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> UpdateExistingTask([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.UpdateExistingTask(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestTrayInTaskAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestTrayInTaskAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.RequestTrayInTaskAsync(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æç&满çåºåºè¯·æ± |
| | | /// 空æç满çåºåºè¯·æ± |
| | | /// </summary> |
| | | /// <param name="request">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestTrayOutTaskAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestTrayOutTaskAsync([FromBody] RequestOutTaskDto request) |
| | | { |
| | | return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.AreaCdoes, request.ProductionLine); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("UpdateTaskStatus")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> UpdateTaskStatus([FromBody] UpdateStatusDto input) |
| | | { |
| | | return await Service.UpdateTaskStatus(input.TaskNum, input.TaskState); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpGet, AllowAnonymous, Route("StockCheckingAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public WebResponseContent StockCheckingAsync() |
| | | { |
| | | return Service.StockCheckingAsync(); |
| | |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <returns></returns> |
| | | [HttpGet, AllowAnonymous, Route("CreateAndSendOutboundTask")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> CreateAndSendOutboundTask(string locationCode, string palletCode) |
| | | { |
| | | return await Service.CreateAndSendOutboundTask(locationCode, palletCode); |
| | |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestInBoundTaskNG")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestInBoundTaskNG([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.CreateAndSendInboundTask(input.PalletCode, input.Position); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("GetFROutTrayToCW")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 15 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> GetFROutTrayToCW([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.GetFROutTrayToCW(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("EmergencyTask")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public WebResponseContent EmergencyTask([FromBody] object input) |
| | | { |
| | | return Service.EmergencyTask(input); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// CW3 åºåºè³å
è£
|
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestOutTaskToBZAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> RequestOutTaskToBZAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.RequestOutTaskToBZAsync(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("SetEmptyOutbyInToOutAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> SetEmptyOutbyInToOutAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.SetEmptyOutbyInToOutAsync(input); |
| | |
| | | /// <param name="input">è¯·æ±æ°æ®</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("SetEmptyOutbyInToOutOneAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5ç§èæµ |
| | | public async Task<WebResponseContent> SetEmptyOutbyInToOutOneAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.SetEmptyOutbyInToOutOneAsync(input); |
¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | using WIDESEA_Core.Middlewares; |
| | | using WIDESEA_IStorageTaskServices; |
| | | using WIDESEA_StorageOutTaskServices; |
| | | |
| | | namespace WIDESEA_WMSServer.Filter |
| | | { |
| | | public static class StockOutMiddleware |
| | | { |
| | | public static Task InvokeAsync() |
| | | { |
| | | Task.Run(() => |
| | | { |
| | | while (true) |
| | | { |
| | | var _taskService = WIDESEA_Core.App.GetService<IDt_TaskService>(); |
| | | if (_taskService != null) |
| | | { |
| | | _taskService.StockCheckingAsync(); |
| | | } |
| | | Thread.Sleep(10000); |
| | | } |
| | | }); |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc.Filters; |
| | | using System.Collections.Concurrent; |
| | | using System.Text.Json; |
| | | |
| | | public class ThrottleFilter : IAsyncActionFilter |
| | | { |
| | | private static readonly ConcurrentDictionary<string, DateTime> _lastExecutionTimes = new ConcurrentDictionary<string, DateTime>(); |
| | | private readonly int _intervalInSeconds; |
| | | |
| | | public ThrottleFilter(int intervalInSeconds) |
| | | { |
| | | _intervalInSeconds = intervalInSeconds; |
| | | } |
| | | |
| | | public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) |
| | | { |
| | | var actionName = context.ActionDescriptor.DisplayName; |
| | | |
| | | var parameterString = GenerateParameterString(context.ActionArguments); |
| | | var key = $"{actionName}_{parameterString}"; |
| | | |
| | | if (_lastExecutionTimes.TryGetValue(key, out var lastExecutionTime)) |
| | | { |
| | | var elapsedTime = DateTime.Now - lastExecutionTime; |
| | | if (elapsedTime.TotalSeconds < _intervalInSeconds) |
| | | { |
| | | context.Result = new OkObjectResult(new WebResponseContent().Error("请æ±è¿äºé¢ç¹ï¼è¯·ç¨ååè¯")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | _lastExecutionTimes[key] = DateTime.Now; |
| | | await next(); |
| | | } |
| | | |
| | | private string GenerateParameterString(IDictionary<string, object> arguments) |
| | | { |
| | | if (arguments == null || arguments.Count == 0) |
| | | { |
| | | return ""; |
| | | } |
| | | |
| | | var paramStrings = new List<string>(); |
| | | foreach (var argument in arguments) |
| | | { |
| | | var key = argument.Key; |
| | | var value = argument.Value; |
| | | string valueString; |
| | | |
| | | if (value == null) |
| | | { |
| | | valueString = "null"; |
| | | } |
| | | else if (IsSimpleType(value.GetType())) |
| | | { |
| | | valueString = value.ToString(); |
| | | } |
| | | else |
| | | { |
| | | valueString = JsonSerializer.Serialize(value); |
| | | } |
| | | |
| | | paramStrings.Add($"{key}={valueString}"); |
| | | } |
| | | |
| | | return string.Join("&", paramStrings); |
| | | } |
| | | |
| | | // å¤æç±»åæ¯å¦ä¸ºç®åç±»å |
| | | private bool IsSimpleType(Type type) |
| | | { |
| | | return type.IsPrimitive || type == typeof(string) || type == typeof(decimal); |
| | | } |
| | | } |
| | |
| | | using Swashbuckle.AspNetCore.SwaggerGen; |
| | | using Microsoft.OpenApi.Models; |
| | | using WIDESEA_StorageTaskServices; |
| | | using Autofac.Core; |
| | | using WIDESEA_Cache; |
| | | using SimpleRedis; |
| | | using WIDESEA_DTO.WMS; |
| | | using static NewLife.Remoting.ApiHttpClient; |
| | | using NewLife.Windows; |
| | | using WIDESEA_Core.Enums; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | |
| | | |
| | | builder.Services.AddHostedService<MyBackgroundService>(); |
| | | |
| | | //ç¼å设置é
置转å®ä½ |
| | | builder.Services.AddConfigurableOptions<CacheSettingsOptions>(); |
| | | //ç¦æ¢å¨ä¸»æºå¯å¨æ¶éè¿ App.GetOptions<TOptions> è·åé项ï¼å¦éè·åé
ç½®é项çåºéè¿ App.GetConfig<TOptions>("é
ç½®èç¹", true)ã |
| | | var cacheSettings = AppSettings.Configuration.GetSection("CacheSettings").Get<CacheSettingsOptions>(); |
| | | //妿æredisè¿æ¥å符串 |
| | | if (cacheSettings.UseRedis) |
| | | { |
| | | var connectionString = |
| | | $"server={cacheSettings.RedisSettings.Address};db={cacheSettings.RedisSettings.Db}"; |
| | | //注å
¥redis |
| | | builder.Services.AddSimpleRedis(connectionString); |
| | | builder.Services.AddScoped<ISimpleCacheService, RedisCacheService>(); |
| | | } |
| | | else |
| | | { |
| | | builder.Services.AddScoped<ISimpleCacheService, MemoryCacheService>(); |
| | | } |
| | | |
| | | |
| | | var app = builder.Build(); |
| | | |
| | | // éªè¯ Redis æå¡æ¯å¦æå注å |
| | | using (var scope = app.Services.CreateScope()) |
| | | { |
| | | var services = scope.ServiceProvider; |
| | | var redisService = services.GetService<ISimpleCacheService>(); |
| | | if (redisService == null) |
| | | { |
| | | WIDESEA_Core.Helper.ConsoleHelper.WriteErrorLine("Redis æå¡æªæå注å"); |
| | | } |
| | | else |
| | | { |
| | | WIDESEA_Core.Helper.ConsoleHelper.WriteSuccessLine("Redis æå¡å·²æå注å"); |
| | | } |
| | | } |
| | | |
| | | // 3ãé
ç½®ä¸é´ä»¶ |
| | | app.UseMiniProfiler();//æ§è½åæå¨ |
| | |
| | | |
| | | app.MapControllers(); |
| | | |
| | | //éè¿ App.GetOptions<TOptions> è·åé项 |
| | | var cacheSettingsb = App.GetOptions<CacheSettingsOptions>(); |
| | | //妿éè¦æ¸
é¤ç¼å |
| | | if (cacheSettingsb.UseRedis && cacheSettingsb.RedisSettings.ClearRedis) |
| | | { |
| | | var redis = app.Services.CreateScope().ServiceProvider.GetService<ISimpleCacheService>(); //è·åredisæå¡ |
| | | // å é¤redisçkey |
| | | redis.DelByPattern(CacheConst.Cache_Prefix); |
| | | |
| | | WIDESEA_Core.Helper.ConsoleHelper.WriteInfoLine("æ£å¨ç¼ååºåä¿¡æ¯"); |
| | | var stockInfoList = await SqlSugarHelper.DbWMS.Queryable<DtStockInfo>() |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync(); |
| | | // ç¼ååºåä¿¡æ¯ |
| | | foreach (var item in stockInfoList) |
| | | { |
| | | item.StockInfoDetails = new List<DtStockInfoDetail>() { { item.StockInfoDetails[0] } }; |
| | | redis.HashAdd(CacheConst.Cache_DtStockInfo, item.PalletCode, item); |
| | | } |
| | | WIDESEA_Core.Helper.ConsoleHelper.WriteInfoLine("ç¼ååºåä¿¡æ¯å®æ"); |
| | | } |
| | | |
| | | app.Run(); |
| | | |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <None Include="Controllers\Basic\MOMErrorMessageController.cs" /> |
| | | <None Include="wwwroot\WIDESEA_DB.DBSeed.Json\Sys_Tenant.tsv" /> |
| | | <None Include="wwwroot\WIDESEA_DB.DBSeed.Json\Sys_User.tsv" /> |
| | | </ItemGroup> |
| | |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_BusinessServices\WIDESEA_BusinessServices.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Cache\WIDESEA_Cache.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Services\WIDESEA_Services.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IServices\WIDESEA_IServices.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_StorageBasicServices\WIDESEA_StorageBasicServices.csproj" /> |
| | |
| | | //è¿æ¥å符串 |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionStringWCS": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionStringWCS": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionStringWCS": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F09;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //è·¨å |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //çç¥åç§° |
| | |
| | | // 注æï¼http://127.0.0.1:1818 å http://localhost:1818 æ¯ä¸ä¸æ ·ç |
| | | "IPs": "http://127.0.0.1:8080,http://localhost:8080,http://127.0.0.1:8081,http://localhost:8081" |
| | | }, |
| | | |
| | | //ç¼å设置 |
| | | "CacheSettings": { |
| | | "UseRedis": true, //å¯ç¨redis |
| | | "RedisSettings": { |
| | | "Address": "127.0.0.1:6379", //å°å |
| | | "Password": "123456", //Redisæå¡å¯ç |
| | | "Db": 9, //é»è®¤åº |
| | | "ClearRedis": true //æ¯å¦æ¯æ¬¡å¯å¨é½æ¸
é¤Redisç¼å |
| | | } |
| | | }, |
| | | |
| | | "ApiName": "WIDESEA", |
| | | "ExpMinutes": 120, |
| | | |
| | |
| | | |
| | | // å
许åºåºçç¼ç |
| | | "OutBoundMateriel": [ |
| | | { |
| | | "MaterielCode": "CC01050001348", |
| | | "ProductionLine": "ZJ-8", |
| | | "ProcessCode": "CH001" |
| | | } |
| | | //{ |
| | | // "MaterielCode": "CC01050001348", |
| | | // "ProductionLine": "ZJ-8", |
| | | // "ProcessCode": "CH001" |
| | | //} |
| | | ] |
| | | } |
| | |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_BusinessesRepository")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_BusinessServices")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_Cache")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_Core")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_DTO")] |
| | | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_IBusinessesRepository")] |