From fa25b6e0bc9dfb8195759dd13ad85ec6d8a13b24 Mon Sep 17 00:00:00 2001 From: "yu.wu" Date: Sat, 20 Nov 2021 17:23:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fish=E9=A1=B5=E9=9D=A2=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/src/components/ImportTxt/index.vue | 63 +- vue/src/router/modules/fis.js | 10 + .../pg-fis/basedate/assemblyCfg/index.vue | 25 +- .../pg-fis/basedate/customerPartCfg/index.vue | 166 +- .../views/pg-fis/basedate/m100BIll/detail.vue | 347 ++++ .../views/pg-fis/basedate/m100BIll/index.vue | 118 +- .../pg-fis/basedate/m100Online/detail.vue | 354 ++++ .../pg-fis/basedate/m100Online/index.vue | 82 +- .../pg-fis/basedate/productLine/index.vue | 6 +- .../pg-fis/basedate/r100Online/detail.vue | 354 ++++ .../pg-fis/basedate/r100Online/index.vue | 106 +- .../basedate/unknownAssembly/detail.vue | 270 +++ .../pg-fis/basedate/unknownAssembly/index.vue | 1491 +++++++++++++++++ .../pg-fis/basedate/weldingAssembly/index.vue | 128 +- 14 files changed, 3329 insertions(+), 191 deletions(-) create mode 100644 vue/src/views/pg-fis/basedate/m100BIll/detail.vue create mode 100644 vue/src/views/pg-fis/basedate/m100Online/detail.vue create mode 100644 vue/src/views/pg-fis/basedate/r100Online/detail.vue create mode 100644 vue/src/views/pg-fis/basedate/unknownAssembly/detail.vue create mode 100644 vue/src/views/pg-fis/basedate/unknownAssembly/index.vue diff --git a/vue/src/components/ImportTxt/index.vue b/vue/src/components/ImportTxt/index.vue index 4eea759b..6392dce9 100644 --- a/vue/src/components/ImportTxt/index.vue +++ b/vue/src/components/ImportTxt/index.vue @@ -345,6 +345,7 @@ export default { { fis: "FIS发运数据", settleAccount: "R3数据", + AssemblyCfgERP:"总成SAP数据", }[this.crmType] || "" ); }, @@ -352,7 +353,8 @@ export default { return ( { fis: "/api/settleaccount/fis/ExcelImport", - settleAccount: "/api/settleaccount/SettleAccount/ExcelImport", + settleAccount: "/api/settleaccount/SettleAccount/ExcelImport", + AssemblyCfgERP:"/api/newjit/assembly-cfg-erp/import", }[this.crmType] || "" ); }, @@ -362,6 +364,7 @@ export default { { fis: "FIS发运数据导入模板.xlsx", settleAccount: "R3数据模板.xlsx", + AssemblyCfgERP:"BOM-批量导入模板.txt", }[this.crmType] || "" ); }, @@ -560,24 +563,48 @@ export default { .posts(webapi, fd) .then(async (res) => { console.log("导入条件:" + JSON.stringify(res)); - if (res === "Success") { - if (this.isLt2M === "1" && this.isFileType === "1") { - this.$notify({ - title: "成功", - message: "数据导入成功!", - type: "success", - duration: 2000, - }); - this.stepList[1].status = "finish"; - this.resultData.successMessage = "数据导入成功!"; - this.stepsActive = 4; + if(this.crmType !== "AssemblyCfgERP"){ + if (res === "Success") { + if (this.isLt2M === "1" && this.isFileType === "1") { + this.$notify({ + title: "成功", + message: "数据导入成功!", + type: "success", + duration: 2000, + }); + this.stepList[1].status = "finish"; + this.resultData.successMessage = "数据导入成功!"; + this.stepsActive = 4; + } + } else { + this.stepList[0].status = "wait"; + this.resultData.errTemplate = res; //指定错误模板名称,作为参数,用于错误模板下载 + this.resultData.errSize = 1; //保持大于0,用于控制错误数据下载按钮的可不可见 + this.resultData.successMessage = "数据导入失败!"; + this.stepsActive = 3; + } + } + else{ + console.log(res.status) + if (res.status === true) { + if (this.isLt2M === "1" && this.isFileType === "1") { + this.$notify({ + title: "成功", + message: "数据导入成功!", + type: "success", + duration: 2000, + }); + this.stepList[1].status = "finish"; + this.resultData.successMessage = "数据导入成功!"; + this.stepsActive = 4; + } + } else { + this.stepList[0].status = "wait"; + this.resultData.errTemplate = res; //指定错误模板名称,作为参数,用于错误模板下载 + this.resultData.errSize = 1; //保持大于0,用于控制错误数据下载按钮的可不可见 + this.resultData.successMessage = "数据导入失败!"; + this.stepsActive = 3; } - } else { - this.stepList[0].status = "wait"; - this.resultData.errTemplate = res; //指定错误模板名称,作为参数,用于错误模板下载 - this.resultData.errSize = 1; //保持大于0,用于控制错误数据下载按钮的可不可见 - this.resultData.successMessage = "数据导入失败!"; - this.stepsActive = 3; } this.$emit("status", "finish"); this.loading = false; diff --git a/vue/src/router/modules/fis.js b/vue/src/router/modules/fis.js index 4655ab23..576b0c7c 100644 --- a/vue/src/router/modules/fis.js +++ b/vue/src/router/modules/fis.js @@ -36,6 +36,16 @@ const pgfis = { icon: '发货' } }, + { + path: '/pg-unknownAssembly', + component: () => import('@/views/pg-fis/basedate/unknownAssembly'), + name: 'pg-unknownAssembly',//命名路由 + meta: { + title: '未知总成模块管理', + roles: ['SettleAccount.Reports'], + icon: '发货' + } + }, { path: '/pg-workLine', component: () => import('@/views/pg-fis/basedate/productLine'), diff --git a/vue/src/views/pg-fis/basedate/assemblyCfg/index.vue b/vue/src/views/pg-fis/basedate/assemblyCfg/index.vue index 038670b9..8f4922c6 100644 --- a/vue/src/views/pg-fis/basedate/assemblyCfg/index.vue +++ b/vue/src/views/pg-fis/basedate/assemblyCfg/index.vue @@ -174,7 +174,7 @@ align="center" > @@ -185,6 +185,7 @@ :close-on-click-modal="false" :title="formTitle" width="700px" + @close='closeDialog' > + + { }); }, + closeDialog(){ + //this.multipleSelection = [];//清空数据 + }, }, }; diff --git a/vue/src/views/pg-fis/basedate/customerPartCfg/index.vue b/vue/src/views/pg-fis/basedate/customerPartCfg/index.vue index 80ade2ac..fad25f00 100644 --- a/vue/src/views/pg-fis/basedate/customerPartCfg/index.vue +++ b/vue/src/views/pg-fis/basedate/customerPartCfg/index.vue @@ -22,7 +22,7 @@ - - + + - + - - + + @@ -274,12 +280,12 @@ export default { MaxResultCount: 15, version: "", //site: "TH", - customerCode: "", + customerCode: undefined, //userId: "00000000-0000-0000-0000-000000000000", partCode:"",//零件编码 partName:"",//零件名称 partType:"",//零件类型 - partChildType:"",//零件子类型 + partType2:"",//零件子类型 }, listExportQuery: { Filters: [ @@ -308,26 +314,34 @@ export default { isEdit: false, sortState:false, //标记刷新是否是排序调用 - partCode:'', - partName:'', - partType:'', - partChildType:'', + + + partType1Query:{ + dicTypeName:"客户零件类型1", + }, + partType2Query:{ + dicTypeName:"客户零件类型2", + }, + + partType1List:[], + partType2List:[], }; }, mounted() { this.$nextTick(() => { var offsetHei = document.documentElement.clientHeight; - console.log(offsetHei); + //console.log(offsetHei); let boxH = this.$refs.box.offsetHeight; this.tableHeight = offsetHei - boxH - 57 - 79;//57为footer高度,79为页面上部标签高度 - console.log(this.$refs.box.offsetHeight); - console.log(this.tableHeight); + //console.log(this.$refs.box.offsetHeight); + //console.log(this.tableHeight); }); }, created() { //this.getVersionInfo(); //if (this.versionList == []) { + this.getPartType(); this.getList(); //} }, @@ -353,7 +367,7 @@ export default { }); tempsTabs.push({ label: "零件子类型", - prop: "partChildType", + prop: "partType2", width: 120, }); tempsTabs.push({ @@ -452,16 +466,16 @@ export default { //return moment(date).format("YYYY-MM-DD HH:mm:ss"); return moment(date).format("YYYY-MM-DD"); } */ - if(column.property === 'customerCode') + if(column.property === "partType") { - if(row[column.property] === 'R0001') + if(row[column.property] === "1") { - var vname = '二配'; + var vname = '门板'; return vname; } - else if(row[column.property] === 'R0003') + else if(row[column.property] === '2') { - var vname = '结算'; + var vname = '柱护板'; return vname; } else @@ -472,7 +486,7 @@ export default { return row[column.property] || "--"; }, importExcelData() { - this.getVersionInfo(); + //this.getVersionInfo(); this.listLoading = false; //关闭导入窗体时调用 this.showExcelImport = false; @@ -480,34 +494,29 @@ export default { //导出功能 async handleDownload() { this.listLoading = true; - if (this.versionValue === "") { - this.$message.error("必需选择版本!"); - this.listLoading = false; - return; - } - if (this.versionValue != "") { - this.listQuery.version = this.versionValue; - } + // if (this.versionValue === "") { + // this.$message.error("必需选择版本!"); + // this.listLoading = false; + // return; + // } + // if (this.versionValue != "") { + // this.listQuery.version = this.versionValue; + // } console.log("发票导出:" + JSON.stringify(this.listQuery)); this.$axios .posts( - "/api/settleaccount/SettlementPart/Export", + "/api/newjit/part-cfg/export", this.listQuery ) .then((res) => { - let fileNameOfProject = res; + let filename = res.item; this.$axios - .BolbGets( - "/api/settleaccount/getblobfile/download/" + fileNameOfProject - ) + .BolbGets("/api/newjit/exclude-part-cfg/download/" + filename) .then((response) => { - if (fileNameOfProject.indexOf("_") != -1) { + if (filename.indexOf("_") != -1) { let downName = - fileNameOfProject.slice( - 0, - fileNameOfProject.lastIndexOf("_") - ) + - fileNameOfProject.slice(fileNameOfProject.lastIndexOf(".")); + filename.slice(0, filename.lastIndexOf("_")) + + filename.slice(filename.lastIndexOf(".")); downloadFile(response, downName); this.$notify({ title: "成功", @@ -516,7 +525,7 @@ export default { duration: 2000, }); } else { - downloadFile(response, fileNameOfProject); + downloadFile(response, filename); this.$notify({ title: "成功", message: "数据-导出成功!", @@ -541,22 +550,22 @@ export default { } console.log("列表查询条件:" + JSON.stringify(this.listQuery)); this.$axios - .posts( + .gets( "/api/newjit/part-cfg/list", this.listQuery ) .then((response) => { this.list = response.items; - this.list.forEach(item => { - if(item.customerCode === 'R0001') - { - item.customerCode = '二配'; - } - else if(item.customerCode === 'R0003') - { - item.customerCode = '结算'; - } - }); + // this.list.forEach(item => { + // if(item.customerCode === 'R0001') + // { + // item.customerCode = '二配'; + // } + // else if(item.customerCode === 'R0003') + // { + // item.customerCode = '结算'; + // } + // }); this.totalCount = response.totalCount; setTimeout(() => { //大数据量加载时 @@ -617,15 +626,15 @@ export default { this.listQuery.Filters.push(filter); } - if (this.partChildType != "") { - var column = "partChildType"; + if (this.partType2 != "") { + var column = "partType2"; let filter = { logic: 0, column: column, action: 0, - value: this.partChildType, + value: this.partType2, }; - this.listQuery.Filters = this.listQuery.Filters.filter(u => u.column !== "partChildType") + this.listQuery.Filters = this.listQuery.Filters.filter(u => u.column !== "partType2") this.listQuery.Filters.push(filter); } */ @@ -677,9 +686,12 @@ export default { }, /** 重置按钮操作 */ resetQuery(refName) { - this.OnlineTimeVale = []; - this.ReceiveTimeVale = []; + this.listQuery.partCode = ""; + this.listQuery.partName = ""; + this.listQuery.partType = ""; + this.listQuery.partType2 = ""; this.$refs[refName].resetFields(); + this.getPartType() this.handleFilter(); }, sortChange(data) { @@ -723,6 +735,32 @@ export default { this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.toggleRowSelection(row); }, + //获取零件类型 + getPartType() + { + this.$axios + .gets( + "/api/newjit/dic/list",this.partType1Query + ) + .then((response) => { + console.log(response); + this.partType1List = response.item; + //console.log() + }) + .catch(() => { + }); + this.$axios + .gets( + "/api/newjit/dic/list",this.partType2Query + ) + .then((response) => { + console.log(response); + this.partType2List = response.item; + //console.log() + }) + .catch(() => { + }); + }, }, }; diff --git a/vue/src/views/pg-fis/basedate/m100BIll/detail.vue b/vue/src/views/pg-fis/basedate/m100BIll/detail.vue new file mode 100644 index 00000000..5ba51a93 --- /dev/null +++ b/vue/src/views/pg-fis/basedate/m100BIll/detail.vue @@ -0,0 +1,347 @@ + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/m100BIll/index.vue b/vue/src/views/pg-fis/basedate/m100BIll/index.vue index 6121f3e8..789de8c9 100644 --- a/vue/src/views/pg-fis/basedate/m100BIll/index.vue +++ b/vue/src/views/pg-fis/basedate/m100BIll/index.vue @@ -320,9 +320,9 @@ - + - + - + - + - 添加ERP总成 + @@ -454,9 +454,9 @@ - + @@ -464,17 +464,17 @@ - + - 添加ERP结算件 + @@ -559,6 +559,7 @@ import CRMTableHead from "../../components/CRMTableHead"; import importExcel from "@/components/ImportExcel-vw"; import Lockr from "lockr"; import moment from "moment"; +import Detail from "./detail.vue"; import { downloadFile } from "@/utils/crmindex.js"; //组件计量单位 @@ -574,7 +575,7 @@ const projectTypeKeyValue = bomUnit.reduce((acc, cur) => { export default { name: "m100Bill", - components: { Pagination, CRMTableHead, importExcel }, + components: { Pagination, CRMTableHead, importExcel, Detail }, directives: { permission }, filters: { IsCustomerSignFilter(status) { @@ -652,6 +653,11 @@ export default { //UserId: "00000000-0000-0000-0000-000000000000", }, form:{ + knr:"", + vehicleModelCode:"", + vin:"", + hostSN:"", + onlineTimeVale:"", leftdetails:[], rightdetails:[], }, @@ -758,11 +764,12 @@ export default { this.$refs.form.validate((valid) => { if (valid) { console.log("保存参数:" + JSON.stringify(this.form)); + console.log(this.form); this.formLoading = true; if (this.isEdit) { //修改 this.$axios - .puts("/api/newjit/assembly-cfg-erp/" + this.form.id, this.form) + .puts("/api/newjit/new-m100" + this.form.id, this.form) .then((response) => { this.formLoading = false; this.$notify({ @@ -875,9 +882,9 @@ export default { fetchData(id) { //循环动态 this.$axios - .gets("/api/newjit/assembly-cfg-erp/" + id) + .gets("/api/newjit/new-m100/" + id) .then((response) => { - this.form = response.item; + this.form = response.item.m100Bill; //this.details = response.item.details; //console.log(this.details); }); @@ -889,7 +896,7 @@ export default { this.listExportQuery.erpAssemblyName = this.listQuery.ErpAssemblyName; console.log(JSON.stringify(this.listExportQuery)); this.$axios - .posts("/api/newjit/assembly-cfg-erp/export", this.listExportQuery) + .posts("/api/newjit/new-m100/export", this.listExportQuery) .then((res) => { let filename = res.item; this.$axios @@ -932,10 +939,10 @@ export default { this.listQuery.KNREnd = ""; this.listQuery.VINBegin = ""; this.listQuery.VINEnd = ""; - this.listQuery.OnlineTimeValue = ""; + this.listQuery.OnlineTimeValue = []; this.listQuery.OnlineTimeBegin = ""; this.listQuery.OnlineTimeEnd = ""; - this.listQuery.ReceiveTimeValue = ""; + this.listQuery.ReceiveTimeValue = []; this.listQuery.ReceiveTimeBegin = ""; this.listQuery.ReceiveTimeEnd = ""; this.handleQuery(); @@ -968,24 +975,42 @@ export default { } }, - handleAddDetails() { - if (this.form.details === undefined) { - this.form.details = []; + handleAddLeftDetails() { + this.$forceUpdate(); + if (this.form.leftdetails === undefined) { + this.form.leftdetails = []; //console.log(679); } let obj = {}; - obj.partCode = ""; - obj.partName = ""; - obj.partNum = ""; - obj.isKey = false; - obj.description = ""; + obj.erpAssemblyCode = ""; + obj.erpAssemblyName = ""; + obj.vehicleModel = this.form.vehicleModel; - console.log(this.form.details); - this.form.details.push(obj); + console.log(this.form.leftdetails); + this.form.leftdetails.push(obj); //console.log(688); }, - handleDeleteDetails(index){ - this.form.details.splice(index, 1); + handleAddRightDetails() { + this.$forceUpdate(); + if (this.form.rightdetails === undefined) { + this.form.rightdetails = []; + //console.log(679); + } + let obj = {}; + obj.customerPartCode = ""; + obj.customerpartName = ""; + obj.partQty= ""; + + console.log(this.form.rightdetails); + this.form.rightdetails.push(obj); + //console.log(688); + }, + handleLeftDeleteDetails(index){ + this.form.leftdetails.splice(index, 1); + //console.log(693); + }, + handleRightDeleteDetails(index){ + this.form.rightdetails.splice(index, 1); //console.log(693); }, @@ -1009,8 +1034,22 @@ export default { getList() { this.listLoading = true; this.listQuery.SkipCount = (this.page - 1) * 10; + console.log(1030) + if(this.listQuery.OnlineTimeValue!== undefined) + { + console.log(1033) + console.log(this.listQuery.OnlineTimeValue) + this.listQuery.OnlineTimeBegin = this.listQuery.OnlineTimeValue[0]; + this.listQuery.OnlineTimeEnd = this.listQuery.OnlineTimeValue[1]; + } + console.log(this.listQuery.OnlineTimeValue) + if(this.listQuery.ReceiveTimeValue!== undefined) + { + this.listQuery.ReceiveTimeBegin = this.listQuery.ReceiveTimeValue[0]; + this.listQuery.ReceiveTimeEnd = this.listQuery.ReceiveTimeValue[1]; + } this.$axios - .gets("/api/newjit/bill-r100/list", this.listQuery) + .gets("/api/newjit/new-m100/list", this.listQuery) .then((response) => { this.list = response.items; this.totalCount = response.totalCount; @@ -1121,6 +1160,7 @@ export default { //console.log(this.listQuery.productType) //console.log(this.PLChildList) }, + //获取车型 getvehicleModel() { this.$axios @@ -1141,7 +1181,7 @@ export default { let obj = {}; obj.erpAssemblyCode = this.form.erpAssemblyCode; obj.erpAssemblyName = this.form.erpAssemblyName; - obj.vehicleModel = this.form.vehicleModel; + obj.vehicleModel = this.form.vehicleModelCode; if (this.form.leftdetails === undefined) { this.form.leftdetails = []; diff --git a/vue/src/views/pg-fis/basedate/m100Online/detail.vue b/vue/src/views/pg-fis/basedate/m100Online/detail.vue new file mode 100644 index 00000000..25108fdd --- /dev/null +++ b/vue/src/views/pg-fis/basedate/m100Online/detail.vue @@ -0,0 +1,354 @@ + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/m100Online/index.vue b/vue/src/views/pg-fis/basedate/m100Online/index.vue index 2246fc30..26d182b4 100644 --- a/vue/src/views/pg-fis/basedate/m100Online/index.vue +++ b/vue/src/views/pg-fis/basedate/m100Online/index.vue @@ -39,7 +39,7 @@ v-for="item in PLChildList" :key="item.id" :label="item.productLineName" - :value="item.id"/> + :value="item.productLineCode"/> @@ -141,7 +141,7 @@ --> - - + + {{ item.name }} @@ -294,6 +294,12 @@ :visible.sync="drawer" :before-close="handleDrawerClose" > +
+ +
@@ -306,6 +312,7 @@ import CRMTableHead from "../../components/CRMTableHead"; import importExcel from "@/components/ImportExcel-vw"; import Lockr from "lockr"; import moment from "moment"; +import Detail from "./detail.vue"; import { downloadFile } from "@/utils/crmindex.js"; //组件计量单位 @@ -323,7 +330,7 @@ const projectTypeKeyValue = bomUnit.reduce((acc, cur) => { export default { name: "M100Online", - components: { Pagination, CRMTableHead, importExcel }, + components: { Pagination, CRMTableHead, importExcel, Detail }, directives: { permission }, filters: { IsCustomerSignFilter(status) { @@ -381,7 +388,7 @@ export default { MaxResultCount: 15, productType: 1, ProductLine: undefined, - version:undefined, + Version:undefined, serialNumBegin:undefined, serialNumEnd:undefined, HostSNBegin:undefined, @@ -390,12 +397,13 @@ export default { KNREnd:undefined, VINBegin:undefined, VINEnd:undefined, - OnlineTimeValue:undefined, + OnlineTimeValue:[], OnlineTimeBegin:undefined, OnlineTimeEnd:undefined, - ReceiveTimeValue:undefined, + ReceiveTimeValue:[], ReceiveTimeBegin:undefined, ReceiveTimeEnd:undefined, + billStatus:undefined, state:[], }, @@ -439,6 +447,12 @@ export default { }); }, created() { + this.billState.forEach((element,index) => { + if(index === 0) + { + this.listQuery.state.push(element.id); + } + }); this.getList(); this.getProductLine(); }, @@ -488,6 +502,11 @@ export default { prop: "r100ReceiveTime", width: 180, }); + tempsTabs.push({ + label: "产线", + prop: "productLine", + width: 120, + }); tempsTabs.push({ label: "备注", prop: "remark", @@ -500,7 +519,9 @@ export default { //抽屉 handleDrawerOpen(param) { this.drawer = true; - var parentId = param.id; //主键id + console.log(510) + console.log(param) + var parentId = param.assemblyID; //主键id this.customerInfos = [ { ParentId: parentId, @@ -525,9 +546,9 @@ export default { this.listLoading = true; this.listExportQuery.erpAssemblyCode = this.listQuery.ErpAssemblyCode; this.listExportQuery.erpAssemblyName = this.listQuery.ErpAssemblyName; - console.log(JSON.stringify(this.listExportQuery)); + console.log(JSON.stringify(this.listQuery)); this.$axios - .posts("/api/newjit/assembly-cfg-erp/export", this.listExportQuery) + .posts("/api/newjit/assembly-cfg-erp/export", this.listQuery) .then((res) => { let filename = res.item; this.$axios @@ -563,19 +584,23 @@ export default { //this.$refs[refName].resetFields(); this.listQuery.billType = ""; this.listQuery.productLine = ""; - this.listQuery.version = ""; + this.listQuery.Version = ""; + this.listQuery.serialNumBegin = ""; + this.listQuery.serialNumEnd = ""; this.listQuery.HostSNBegin = ""; this.listQuery.HostSNEnd = ""; this.listQuery.KNRBegin = ""; this.listQuery.KNREnd = ""; this.listQuery.VINBegin = ""; this.listQuery.VINEnd = ""; - this.listQuery.OnlineTimeValue = ""; + this.listQuery.OnlineTimeValue = []; this.listQuery.OnlineTimeBegin = ""; this.listQuery.OnlineTimeEnd = ""; - this.listQuery.ReceiveTimeValue = ""; + this.listQuery.ReceiveTimeValue = []; this.listQuery.ReceiveTimeBegin = ""; this.listQuery.ReceiveTimeEnd = ""; + this.listQuery.state = []; + this.listQuery.billStatus = ""; this.handleQuery(); this.getProductLine(); }, @@ -647,6 +672,20 @@ export default { getList() { this.listLoading = true; this.listQuery.SkipCount = (this.page - 1) * 10; + if(this.listQuery.OnlineTimeValue!== undefined) + { + this.listQuery.OnlineTimeBegin = this.listQuery.OnlineTimeValue[0]; + this.listQuery.OnlineTimeEnd = this.listQuery.OnlineTimeValue[1]; + } + if(this.listQuery.ReceiveTimeValue!== undefined) + { + this.listQuery.ReceiveTimeBegin = this.listQuery.ReceiveTimeValue[0]; + this.listQuery.ReceiveTimeEnd = this.listQuery.ReceiveTimeValue[1]; + } + if(this.listQuery.state!== undefined) + { + this.listQuery.billStatus = this.listQuery.state[0]; + } this.$axios .gets("/api/newjit/bill-m100/list", this.listQuery) .then((response) => { @@ -759,6 +798,19 @@ export default { this.PLChildList = this.PLList.filter(u => u.productType === parseInt(this.listQuery.productType)); //console.log(this.PLList) }, + /*单据状态变更 */ + checkedListChange(index) + { + if(this.listQuery.state.length <= 1) + { + this.listQuery.state.push(this.billState[index].id); + } + else + { + this.listQuery.state = []; + this.listQuery.state.push(this.billState[index].id); + } + }, }, }; diff --git a/vue/src/views/pg-fis/basedate/productLine/index.vue b/vue/src/views/pg-fis/basedate/productLine/index.vue index 3d824d00..b30113d7 100644 --- a/vue/src/views/pg-fis/basedate/productLine/index.vue +++ b/vue/src/views/pg-fis/basedate/productLine/index.vue @@ -394,9 +394,9 @@ export default { version: "", customerCode: "", //userId: "00000000-0000-0000-0000-000000000000", - userName:"",//用户名称 - name:"",//真实姓名 - productLineCode:"",//生产线 + userName:undefined,//用户名称 + name:undefined,//真实姓名 + productLineCode:undefined,//生产线 }, listExportQuery: { Filters: [ diff --git a/vue/src/views/pg-fis/basedate/r100Online/detail.vue b/vue/src/views/pg-fis/basedate/r100Online/detail.vue new file mode 100644 index 00000000..25108fdd --- /dev/null +++ b/vue/src/views/pg-fis/basedate/r100Online/detail.vue @@ -0,0 +1,354 @@ + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/r100Online/index.vue b/vue/src/views/pg-fis/basedate/r100Online/index.vue index 0fe9f3c3..f107c337 100644 --- a/vue/src/views/pg-fis/basedate/r100Online/index.vue +++ b/vue/src/views/pg-fis/basedate/r100Online/index.vue @@ -39,7 +39,7 @@ v-for="item in PLChildList" :key="item.id" :label="item.productLineName" - :value="item.id"/> + :value="item.productLineCode"/> @@ -98,7 +98,7 @@ - + --> - + {{ item.name }} @@ -210,9 +210,9 @@ @row-click="handleRowClick" > - + +
+ +
@@ -272,6 +278,7 @@ import CRMTableHead from "../../components/CRMTableHead"; import importExcel from "@/components/ImportExcel-vw"; import Lockr from "lockr"; import moment from "moment"; +import Detail from "./detail.vue"; import { downloadFile } from "@/utils/crmindex.js"; //组件计量单位 @@ -289,7 +296,7 @@ const projectTypeKeyValue = bomUnit.reduce((acc, cur) => { export default { name: "M100Online", - components: { Pagination, CRMTableHead, importExcel }, + components: { Pagination, CRMTableHead, importExcel , Detail}, directives: { permission }, filters: { IsCustomerSignFilter(status) { @@ -347,19 +354,20 @@ export default { MaxResultCount: 15, productType: 1, ProductLine: undefined, - version:undefined, + Version:undefined, HostSNBegin:undefined, HostSNBegin:undefined, KNRBegin:undefined, KNREnd:undefined, - VINBegin:undefined, + //VINBegin:undefined, VINEnd:undefined, - OnlineTimeValue:undefined, + OnlineTimeValue:[], OnlineTimeBegin:undefined, OnlineTimeEnd:undefined, - ReceiveTimeValue:undefined, + ReceiveTimeValue:[], ReceiveTimeBegin:undefined, ReceiveTimeEnd:undefined, + billStatus:undefined, state:[], }, @@ -402,6 +410,12 @@ export default { }); }, created() { + this.billState.forEach((element,index) => { + if(index === 0) + { + this.listQuery.state.push(element.id); + } + }); this.getList(); this.getProductLine(); }, @@ -415,11 +429,11 @@ export default { // prop: "vin", // width: 130, // }); - tempsTabs.push({ - label: "KNR", - prop: "knr", - width: 150, - }); + // tempsTabs.push({ + // label: "KNR", + // prop: "knr", + // width: 150, + // }); tempsTabs.push({ label: "单据状态", prop: "billState", @@ -455,6 +469,11 @@ export default { prop: "erpAssemblyName", width: 180, }); + tempsTabs.push({ + label: "产线", + prop: "productLine", + width: 120, + }); tempsTabs.push({ label: "备注", prop: "remark", @@ -467,7 +486,7 @@ export default { //抽屉 handleDrawerOpen(param) { this.drawer = true; - var parentId = param.id; //主键id + var parentId = param.assemblyID; //主键id this.customerInfos = [ { ParentId: parentId, @@ -482,9 +501,9 @@ export default { this.listLoading = true; this.listExportQuery.erpAssemblyCode = this.listQuery.ErpAssemblyCode; this.listExportQuery.erpAssemblyName = this.listQuery.ErpAssemblyName; - console.log(JSON.stringify(this.listExportQuery)); + console.log(JSON.stringify(this.listQuery)); this.$axios - .posts("/api/newjit/assembly-cfg-erp/export", this.listExportQuery) + .posts("/api/newjit/bill-r100/export", this.listQuery) .then((res) => { let filename = res.item; this.$axios @@ -520,19 +539,21 @@ export default { //this.$refs[refName].resetFields(); this.listQuery.billType = ""; this.listQuery.productLine = ""; - this.listQuery.version = ""; + this.listQuery.Version = ""; this.listQuery.HostSNBegin = ""; this.listQuery.HostSNEnd = ""; this.listQuery.KNRBegin = ""; this.listQuery.KNREnd = ""; - this.listQuery.VINBegin = ""; + //this.listQuery.VINBegin = ""; this.listQuery.VINEnd = ""; - this.listQuery.OnlineTimeValue = ""; + this.listQuery.OnlineTimeValue = []; this.listQuery.OnlineTimeBegin = ""; this.listQuery.OnlineTimeEnd = ""; - this.listQuery.ReceiveTimeValue = ""; + this.listQuery.ReceiveTimeValue = []; this.listQuery.ReceiveTimeBegin = ""; this.listQuery.ReceiveTimeEnd = ""; + this.listQuery.state = []; + this.listQuery.billStatus = ""; this.handleQuery(); this.getProductLine(); }, @@ -604,8 +625,22 @@ export default { getList() { this.listLoading = true; this.listQuery.SkipCount = (this.page - 1) * 10; + if(this.listQuery.OnlineTimeValue!== undefined) + { + this.listQuery.OnlineTimeBegin = this.listQuery.OnlineTimeValue[0]; + this.listQuery.OnlineTimeEnd = this.listQuery.OnlineTimeValue[1]; + } + if(this.listQuery.ReceiveTimeValue!== undefined) + { + this.listQuery.ReceiveTimeBegin = this.listQuery.ReceiveTimeValue[0]; + this.listQuery.ReceiveTimeEnd = this.listQuery.ReceiveTimeValue[1]; + } + if(this.listQuery.state!== undefined) + { + this.listQuery.billStatus = this.listQuery.state[0]; + } this.$axios - .gets("/api/newjit/bill-m100/list", this.listQuery) + .gets("/api/newjit/bill-r100/list", this.listQuery) .then((response) => { this.list = response.items; this.totalCount = response.totalCount; @@ -714,6 +749,19 @@ export default { this.PLChildList = this.PLList.filter(u => u.productType === parseInt(this.listQuery.productType)); //console.log(this.PLList) }, + /*单据状态变更 */ + checkedListChange(index) + { + if(this.listQuery.state.length <= 1) + { + this.listQuery.state.push(this.billState[index].id); + } + else + { + this.listQuery.state = []; + this.listQuery.state.push(this.billState[index].id); + } + }, }, }; diff --git a/vue/src/views/pg-fis/basedate/unknownAssembly/detail.vue b/vue/src/views/pg-fis/basedate/unknownAssembly/detail.vue new file mode 100644 index 00000000..e5bc3487 --- /dev/null +++ b/vue/src/views/pg-fis/basedate/unknownAssembly/detail.vue @@ -0,0 +1,270 @@ + + + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/weldingAssembly/index.vue b/vue/src/views/pg-fis/basedate/weldingAssembly/index.vue index 5e91f023..4638babd 100644 --- a/vue/src/views/pg-fis/basedate/weldingAssembly/index.vue +++ b/vue/src/views/pg-fis/basedate/weldingAssembly/index.vue @@ -19,9 +19,11 @@ style="margin-right: 15px" @change="ptypeselectChange" > - - - +
@@ -34,10 +36,10 @@ @change="valueselectChange" > + :value="item.id"/> @@ -139,7 +141,7 @@ --> - - + + {{ item.name }} @@ -192,7 +194,16 @@ size="mini" style="margin-left: 15px" @click="handleDownload()" - >导出焊装总成对比 + >导出焊装总成对比(Excel) + + 导出焊装总成对比(CSV) @@ -328,7 +339,7 @@ export default { { required: true, message: "必须输入!", trigger: "blur" }, ], }, - billState:[ + compareState:[ {id:0,name:"有焊装无总装"}, {id:1,name:"有焊装有总装"} ], @@ -373,7 +384,9 @@ export default { ReceiveTimeValue:undefined, ReceiveTimeBegin:undefined, ReceiveTimeEnd:undefined, - state:[], + HasR100NotHasM100:undefined,//有焊装无总装 + HasR100HasM100:undefined,//有焊装有总装 + cstate:[], }, listExportQuery: { @@ -400,6 +413,9 @@ export default { tableHeight: document.documentElement.clientHeight - 335, detailTableHeight:250, details:[], //修改子表数据源 + billStatus:[], + PLChildList:[],//筛选后产线下拉 + productTypeList:[{id:1,name:'门板'},{id:2,name:'柱护板'}] }; }, mounted() { @@ -413,6 +429,10 @@ export default { }); }, created() { + this.compareState.forEach((element,index) => { + this.listQuery.cstate.push(element.id); + }); + this.getProductLine(); this.getList(); }, computed: { @@ -514,7 +534,45 @@ export default { this.listExportQuery.erpAssemblyName = this.listQuery.ErpAssemblyName; console.log(JSON.stringify(this.listExportQuery)); this.$axios - .posts("/api/newjit/assembly-cfg-erp/export", this.listExportQuery) + .posts("/api/newjit/r100-m100-compare/export", this.listExportQuery) + .then((res) => { + let filename = res.item; + this.$axios + .BolbGets("/api/newjit/exclude-part-cfg/download/" + filename) + .then((response) => { + if (filename.indexOf("_") != -1) { + let downName = + filename.slice(0, filename.lastIndexOf("_")) + + filename.slice(filename.lastIndexOf(".")); + downloadFile(response, downName); + this.$notify({ + title: "成功", + message: "数据-导出成功!", + type: "success", + duration: 2000, + }); + } else { + downloadFile(response, filename); + this.$notify({ + title: "成功", + message: "数据-导出成功!", + type: "success", + duration: 2000, + }); + } + this.listLoading = false; + }); + }); + this.listLoading = false; + }, + /** 导出功能 */ + handleDownloadCSV() { + this.listLoading = true; + this.listExportQuery.erpAssemblyCode = this.listQuery.ErpAssemblyCode; + this.listExportQuery.erpAssemblyName = this.listQuery.ErpAssemblyName; + console.log(JSON.stringify(this.listQuery)); + this.$axios + .posts("/api/newjit/r100-m100-compare/export-CSV", this.listQuery) .then((res) => { let filename = res.item; this.$axios @@ -550,7 +608,9 @@ export default { //this.$refs[refName].resetFields(); this.listQuery.billType = ""; this.listQuery.productLine = ""; - this.listQuery.version = ""; + this.listQuery.Version = ""; + this.listQuery.serialNumBegin = ""; + this.listQuery.serialNumEnd = ""; this.listQuery.HostSNBegin = ""; this.listQuery.HostSNEnd = ""; this.listQuery.KNRBegin = ""; @@ -563,6 +623,7 @@ export default { this.listQuery.ReceiveTimeValue = ""; this.listQuery.ReceiveTimeBegin = ""; this.listQuery.ReceiveTimeEnd = ""; + this.listQuery.cstate = []; this.handleQuery(); this.getProductLine(); }, @@ -634,8 +695,38 @@ export default { getList() { this.listLoading = true; this.listQuery.SkipCount = (this.page - 1) * 10; + if(this.listQuery.OnlineTimeValue!== undefined) + { + this.listQuery.OnlineTimeBegin = this.listQuery.OnlineTimeValue[0]; + this.listQuery.OnlineTimeEnd = this.listQuery.OnlineTimeValue[1]; + } + if(this.listQuery.ReceiveTimeValue!== undefined) + { + this.listQuery.ReceiveTimeBegin = this.listQuery.ReceiveTimeValue[0]; + this.listQuery.ReceiveTimeEnd = this.listQuery.ReceiveTimeValue[1]; + } + + this.listQuery.HasR100NotHasM100 = false; + this.listQuery.HasR100HasM100 = false; + + if(this.listQuery.cstate!== undefined && this.listQuery.cstate.length > 0) + { + console.log(this.listQuery.cstate) + this.listQuery.cstate.forEach(element => { + console.log(element) + if(element === 0) + { + this.listQuery.HasR100NotHasM100 = true; + } + if(element === 1) + { + this.listQuery.HasR100HasM100 = true; + } + }); + + } this.$axios - .gets("/api/newjit/assembly-cfg-erp/list", this.listQuery) + .gets("/api/newjit/r100-m100-compare/list", this.listQuery) .then((response) => { this.list = response.items; this.totalCount = response.totalCount; @@ -729,7 +820,7 @@ export default { .then((response) => { //console.log(response); this.PLList = response.item; - //console.log(this.PLList); + this.PLChildList = this.PLList.filter(u => u.productType === parseInt(this.listQuery.productType)); }) .catch(() => { }); @@ -738,7 +829,8 @@ export default { ptypeselectChange() { //console.log(this.listQuery.productType); - this.PLList = this.PLList.filter(u => u.productType === this.listQuery.productType); + this.listQuery.productLine = ""; + this.PLChildList = this.PLList.filter(u => u.productType === parseInt(this.listQuery.productType)); //console.log(this.PLList); }, }, From c4acae792f8ea27ab88c28e843709850d27680ff Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Mon, 22 Nov 2021 10:16:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?20211122-=E5=A4=A7=E4=BC=97=E5=A4=87?= =?UTF-8?q?=E4=BB=B6=E5=8F=91=E8=B4=A7=E3=80=81=E5=A4=A7=E4=BC=97=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E5=8F=91=E8=B4=A7=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WMSKanBan/IWMSVWKanBanAppService.cs | 2 +- .../WMSSparePart/IWMSSparePartAppService.cs | 4 +- .../WMS-KanBan/WMSKanBanAppService.cs | 322 +++++++++++++++++ .../WMS-SparePart/WMSSparePartAppService.cs | 326 ++++++++++++++++++ .../SettleAccount.Application.xml | 160 +++++++++ 5 files changed, 811 insertions(+), 3 deletions(-) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs index 1ef8185e..35b74168 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs @@ -21,7 +21,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMSKanBan /// 上传的文件(前端已经限制只能上传一个附件) /// - Task WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode); + // Task WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs index 6696223f..56ee2272 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs @@ -17,8 +17,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMSSparePart /// 上传的文件(前端已经限制只能上传一个附件) /// - Task WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, - string year, string period, string version, string customerCode); + //Task WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, + // string year, string period, string version, string customerCode); /// /// 按ID获取唯一实体 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs new file mode 100644 index 00000000..07c1a9ee --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs @@ -0,0 +1,322 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Excel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Guids; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Entities.WMSKanBan; +using Win.Sfs.Shared.Filter; +using Shouldly; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Caching; +using Win.Abp.Snowflakes; +using Win.Sfs.SettleAccount.CommonManagers; +using Volo.Abp; +using Microsoft.AspNetCore.Http; +using Win.Sfs.SettleAccount.ExcelImporter; +using EFCore.BulkExtensions; +using Win.Sfs.SettleAccount.ExportReports; +using Volo.Abp.Domain.Repositories; +using Win.Sfs.SettleAccount.Constant; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; + +namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan +{ + /// + /// 大众看板发货明细 + /// + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + //[AllowAnonymous] + [Route("api/settleaccount/WMSVWKanBan")] + public class WMSKanBanAppService : SettleAccountApplicationBase, IWMSVWKanBanAppService + { + private readonly IGuidGenerator _guidGenerator; + + private readonly IExcelImportAppService _excelImportService; + + private readonly ISettleAccountBranchEfCoreRepository _versionRepository; + + private readonly ISettleAccountBranchEfCoreRepository _repository; + /// + /// 构建方法 + /// + /// 构建UID + /// 仓储接口 + /// 缓存 + public WMSKanBanAppService(IGuidGenerator guidGenerator, + ISettleAccountBranchEfCoreRepository versionRepository, + ISettleAccountBranchEfCoreRepository repository, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _versionRepository = versionRepository; + _guidGenerator = guidGenerator; + _excelImportService = excelImportService; + _repository = repository; + } + + + /// + /// 导入功能 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) + { + if (string.IsNullOrEmpty(version)) + { + throw new BusinessException("版本不能空,必须传入!"); + } + List listImport = new List(); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + var entityList = ObjectMapper.Map, List>(result); + //删除版本 + var _versionQuery = _versionRepository.Where(p => p.Version == version); + await _versionQuery.BatchDeleteAsync(); + //删除明细 + var _query = _repository.Where(p => p.Version == version); + await _query.BatchDeleteAsync(); + //插入数据前检验 + var checkList = new List(); + var _group = entityList.GroupBy(x => new { x.Kanban, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), Kanban = p.Key.Kanban, MaterialCode = p.Key.MaterialCode }); + foreach (var itm in _group) + { + if (itm.Count > 1) + { + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板条码号{1}有重复数据,请检查!", itm.MaterialCode, itm.Kanban), string.Empty)); + } + } + var _id = GuidGenerator.Create(); + var _bomList = new List(); + _bomList.Add(new WMSKanBanVersion(_id, branchId, year, period, version, customerCode)); + foreach (var itm in entityList) + { + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id); + } + if (checkList.Count > 0) + { + return await ExportErrorReportAsync(checkList); + } + await _repository.GetDbContext().BulkInsertAsync(entityList); + await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + return ApplicationConsts.SuccessStr; + } + + /// + /// 按ID获取唯一实体 + /// + /// + /// 返回实体全部属性 + /// + /// ID + /// 实体DTO + [HttpGet] + [Route("{id}")] + [Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task GetAsync(Guid id) + { + var result = await GetFromCacheAsync(id); + var dto = ObjectMapper.Map(result); + return dto; + } + + + private async Task GetFromCacheAsync(Guid id) + { + var result = await _repository.GetAsync(id); + return result; + } + + + private async Task GetCountAsync(WMSVWKanBanRequestDto input) + { + return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + private async Task GetCountAsync(WMSVWKanBanVersionRequestDto input) + { + return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + + /// + /// 导出文件 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(WMSVWKanBanRequestDto input) + { + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, + 0, true); + + var dtoDetails = ObjectMapper.Map, List>(entities); + + string _fileName = string.Empty; + //声明导出容器 + + byte[] result = null; + switch (input.FileType) + { + case 0: + _fileName = string.Format("大众看板发货明细_{0}.csv", input.UserId.ToString()); + result = await _csv.ExportAsByteArray(dtoDetails); + break; + case 1: + _fileName = string.Format("大众看板发货明细_{0}.xlsx", input.UserId.ToString()); + result = await _excel.ExportAsByteArray(dtoDetails); + break; + } + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + } + + + /// + /// 根据筛选条件获取实体列表 + /// + /// + /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + /// + /// 请求条件 + /// 实体DTO列表 + [HttpPost] + [Route("list")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WMSVWKanBanRequestDto input) + { + + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + else + { + return new PagedResultDto(0, new List()); + } + var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + var totalCount = await GetCountAsync(input); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); + } + + + /// + /// 获取实体总数 + /// + /// 实体总数 + [HttpGet] + [Route("count")] + [Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task GetTotalCountAsync(Guid branchId) + { + return await _repository.GetCountAsync(branchId); + } + + /// + /// 获取全部实体列表 + /// + /// 实体DTO列表 + [HttpGet] + [Route("all")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetAllAsync(Guid branchId) + { + var entities = await _repository.GetAllAsync(branchId, true); + + + var dtos = ObjectMapper.Map, List>(entities); + + + return new ListResultDto(dtos); + } + + + + /// + /// 删除实体 + /// + /// ID + /// + [HttpDelete] + [Route("{id}")] + /// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteAsync(Guid id) + { + await _repository.DeleteAsync(id); + } + + /// + /// 按IDs删除实体列表 + /// + /// IDs + /// 是否执行成功 + [HttpPost] + [Route("delete")] + // [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteListAsync(List ids) + { + foreach (var id in ids) + { + var entity = await GetFromCacheAsync(id); + //await Cache.DeleteAsync(id.ToString()); + } + + return await _repository.DeleteListAsync(ids); + } + + + + /// + /// 版本列表查询 + /// + /// + /// + [HttpPost] + [Route("listversion")] + public async Task> GetVersionListAsync(WMSVWKanBanVersionRequestDto input) + { + var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + var dtos = ObjectMapper.Map, List>(entities); + + return new PagedResultDto(totalCount, dtos); + } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs new file mode 100644 index 00000000..59bd24f0 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs @@ -0,0 +1,326 @@ +using EFCore.BulkExtensions; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Caching; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.WMSSparePart; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.Shared.Filter; +using Shouldly; + + + + +namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart +{ + /// + /// 大众备件服务 + /// + [Route("api/settleaccount/WMSSparePart")] + public class WMSSparePartAppService : SettleAccountApplicationBase, IWMSSparePartAppService + { + private readonly IGuidGenerator _guidGenerator; + + private readonly IExcelImportAppService _excelImportService; + + private readonly ISettleAccountBranchEfCoreRepository _versionRepository; + + private readonly ISettleAccountBranchEfCoreRepository _repository; + /// + /// 构建方法 + /// + /// 构建UID + /// 仓储接口 + /// 缓存 + public WMSSparePartAppService(IGuidGenerator guidGenerator, + ISettleAccountBranchEfCoreRepository versionRepository, + ISettleAccountBranchEfCoreRepository repository, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _versionRepository = versionRepository; + _guidGenerator = guidGenerator; + _excelImportService = excelImportService; + _repository = repository; + } + + + /// + /// 导入功能 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) + { + if (string.IsNullOrEmpty(version)) + { + throw new BusinessException("版本不能空,必须传入!"); + } + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + var entityList = ObjectMapper.Map, List>(result); + //删除版本 + var _versionQuery = _versionRepository.Where(p => p.Version == version); + await _versionQuery.BatchDeleteAsync(); + //删除明细 + var _query = _repository.Where(p => p.Version == version); + await _query.BatchDeleteAsync(); + //插入数据前检验 + var checkList = new List(); + var _group = entityList.GroupBy(x => new { x.LineNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), LineNumber = p.Key.LineNumber, MaterialCode = p.Key.MaterialCode }); + foreach (var itm in _group) + { + if (string.IsNullOrEmpty(itm.MaterialCode)) + { + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的行号为{0}的物料代码为空,请检查!", itm.LineNumber), string.Empty)); + } + } + var _id = GuidGenerator.Create(); + var _bomList = new List(); + _bomList.Add(new WMSSparePartVersion(_id, branchId, year, period, version, customerCode)); + foreach (var itm in entityList) + { + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + } + if (checkList.Count > 0) + { + return await ExportErrorReportAsync(checkList); + } + await _repository.GetDbContext().BulkInsertAsync(entityList); + await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + return ApplicationConsts.SuccessStr; + } + + /// + /// 按ID获取唯一实体 + /// + /// + /// 返回实体全部属性 + /// + /// ID + /// 实体DTO + [HttpGet] + [Route("{id}")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task GetAsync(Guid id) + { + var result = await GetFromCacheAsync(id); + var dto = ObjectMapper.Map(result); + return dto; + } + + + private async Task GetFromCacheAsync(Guid id) + { + var result = await _repository.GetAsync(id); + return result; + } + + + private async Task GetCountAsync(WMSSparePartRequestDto input) + { + return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + private async Task GetCountAsync(WMSSparePartVersionRequestDto input) + { + return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + + /// + /// 导出文件 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(WMSSparePartRequestDto input) + { + if (string.IsNullOrEmpty(input.Version)) + { + throw new BusinessException("版本不能空,必须传入!"); + } + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + 0, true); + + var dtoDetails = ObjectMapper.Map, List>(entities); + + string _fileName = string.Empty; + //声明导出容器 + + byte[] result = null; + switch (input.FileType) + { + case 0: + _fileName = string.Format("大众备件发货明细_{0}.csv", input.UserId.ToString()); + result = await _csv.ExportAsByteArray(dtoDetails); + break; + case 1: + _fileName = string.Format("大众备件发货明细_{0}.xlsx", input.UserId.ToString()); + result = await _excel.ExportAsByteArray(dtoDetails); + break; + } + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + } + + + /// + /// 根据筛选条件获取实体列表 + /// + /// + /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + /// + /// 请求条件 + /// 实体DTO列表 + [HttpPost] + [Route("list")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WMSSparePartRequestDto input) + { + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + else + { + return new PagedResultDto(0, new List()); + } + + var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + var dtos = ObjectMapper.Map, List>(entities); + + return new PagedResultDto(totalCount, dtos); + } + + + /// + /// 获取实体总数 + /// + /// 实体总数 + [HttpGet] + [Route("count")] + [Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task GetTotalCountAsync(Guid branchId) + { + return await _repository.GetCountAsync(branchId); + } + + /// + /// 获取全部实体列表 + /// + /// 实体DTO列表 + [HttpGet] + [Route("all")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetAllAsync(Guid branchId) + { + var entities = await _repository.GetAllAsync(branchId, true); + + + var dtos = ObjectMapper.Map, List>(entities); + + + return new ListResultDto(dtos); + } + + + + /// + /// 删除实体 + /// + /// ID + /// + [HttpDelete] + [Route("{id}")] + /// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteAsync(Guid id) + { + await _repository.DeleteAsync(id); + } + + /// + /// 按IDs删除实体列表 + /// + /// IDs + /// 是否执行成功 + [HttpPost] + [Route("delete")] + // [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteListAsync(List ids) + { + foreach (var id in ids) + { + var entity = await GetFromCacheAsync(id); + //await Cache.DeleteAsync(id.ToString()); + } + + return await _repository.DeleteListAsync(ids); + } + + + + /// + /// 版本列表查询 + /// + /// + /// + [HttpPost] + [Route("listversion")] + public async Task> GetVersionListAsync(WMSSparePartVersionRequestDto input) + { + var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + var dtos = ObjectMapper.Map, List>(entities); + + return new PagedResultDto(totalCount, dtos); + } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 17a52d32..929d29bb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -1739,6 +1739,166 @@ + + + 大众看板发货明细 + + + + + 构建方法 + + 构建UID + 仓储接口 + 缓存 + + + + 导入功能 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 按ID获取唯一实体 + + + 返回实体全部属性 + + ID + 实体DTO + + + + 导出文件 + + + + + + + 根据筛选条件获取实体列表 + + + 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + + 请求条件 + 实体DTO列表 + + + + 获取实体总数 + + 实体总数 + + + + 获取全部实体列表 + + 实体DTO列表 + + + + 删除实体 + + ID + + + + + 按IDs删除实体列表 + + IDs + 是否执行成功 + + + + 版本列表查询 + + + + + + + 大众备件服务 + + + + + 构建方法 + + 构建UID + 仓储接口 + 缓存 + + + + 导入功能 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 按ID获取唯一实体 + + + 返回实体全部属性 + + ID + 实体DTO + + + + 导出文件 + + + + + + + 根据筛选条件获取实体列表 + + + 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + + 请求条件 + 实体DTO列表 + + + + 获取实体总数 + + 实体总数 + + + + 获取全部实体列表 + + 实体DTO列表 + + + + 删除实体 + + ID + + + + + 按IDs删除实体列表 + + IDs + 是否执行成功 + + + + 版本列表查询 + + + + 区域相关应用服务