From 4ee8bbc8de51a3f4b06ad253e82dba8244707dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Tue, 7 Dec 2021 15:50:10 +0800 Subject: [PATCH] 1 --- .../Response/Pmc/PmcInventoryallsaleRes.cs | 17 + NX.ERP.U8/Pmc/PmcQuery.cs | 53 +- .../Controllers/Pmc/PmcController.cs | 8 +- NX.ERP.Webapp/package-lock.json | 4 +- NX.ERP.Webapp/src/App.vue | 9 +- NX.ERP.Webapp/src/views/FilterTable.vue | 17 +- .../src/views/inventory-sale copy.vue | 552 ++++++++++++++++++ NX.ERP.Webapp/src/views/inventory-sale.vue | 166 ++++-- NX.ERP.Webapp/vue.config.js | 2 +- 9 files changed, 741 insertions(+), 87 deletions(-) create mode 100644 NX.ERP.Webapp/src/views/inventory-sale copy.vue diff --git a/NX.ERP.Model/Response/Pmc/PmcInventoryallsaleRes.cs b/NX.ERP.Model/Response/Pmc/PmcInventoryallsaleRes.cs index 6c3b457..5465ce2 100644 --- a/NX.ERP.Model/Response/Pmc/PmcInventoryallsaleRes.cs +++ b/NX.ERP.Model/Response/Pmc/PmcInventoryallsaleRes.cs @@ -158,4 +158,21 @@ namespace NX.ERP.Model set { this.jandate = value; } } } + public class saleRes + { + public long sumWfiQuantity { get; set; } + + public IEnumerable wfdetails { get; set; } + + } + + public class Wfsum + { + public int wf { get; set; } + + public int xcl { get; set; } + + } + + } diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index 704127d..491eab6 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -852,15 +852,15 @@ select *from tempdb..tablepzck20210526 } - public IEnumerable InventorySale(NX.ERP.Model.Request.SaleinvRequest info1) + public NX.ERP.Model.saleRes InventorySale(NX.ERP.Model.Request.SaleinvRequest info1) { string sql = $@" - select *from ( - select f.cCusAbbName,CONVERT(varchar(100),b.dDate, 23) as dDate ,b.cSOCode,a.cInvCode,a.cInvName,g.cInvStd, a.iQuantity - isnull(d.cqty,0) as wfiQuantity,b.cCloser + select *from ( + select f.cCusAbbName,CONVERT(varchar(100),b.dDate, 23) as dDate ,b.cSOCode,a.cInvCode,a.cInvName,g.cInvStd, FLOOR(a.iQuantity - isnull(d.cqty,0)) as wfiQuantity,b.cCloser , - isnull(cs.qty,0) as xcl, + FLOOR(isnull(cs.qty,0)) as xcl, b.cVerifier - ,case when ( + ,FLOOR(case when ( isnull( (SELECT isnull(SUM(iquantity),0) qty FROM currentstock WITH (nolock) where cInvCode=a.cInvCode @@ -884,7 +884,7 @@ select *from tempdb..tablepzck20210526 GROUP BY ipesodid) dd on isnull(dd.ipesodid,'')=isnull(aa.iSOsID ,'') where aa.cInvCode=a.cInvCode and isnull( bb.cCloser ,'') =''and bb.cVerifier is not null and isnull(CONVERT(varchar(100),aa.dPreDate, 23),'1900-01-01')<=isnull(CONVERT(varchar(100),a.dPreDate, 23),'1900-01-01') and (aa.iQuantity - isnull(dd.cqty,0))>0 group by aa.cInvCode - ) ) end as kcyl + ) ) end )as kcyl , CONVERT(varchar(100),a.dPreDate, 23) as dPreDate , a.cMemo, CASE @@ -908,6 +908,7 @@ select *from tempdb..tablepzck20210526 left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode ) mm + @@ -996,14 +997,18 @@ select *from tempdb..tablepzck20210526 { if (info1.kcyl2 == "1") { - where.Add(" mm.kcyl <= 0 "); + where.Add(" mm.kcyl < 0 "); } - else if (info1.kcyl2 == "2") + if (info1.kcyl2 == "2") { - where.Add(" mm.kcyl > 0 "); + where.Add(" mm.kcyl >= 0 "); + } + else if (info1.kcyl2 == "3") + { + where.Add(" 1=1 "); } - } + } if (!string.IsNullOrEmpty(info1.datewaring)) { @@ -1080,10 +1085,32 @@ select *from tempdb..tablepzck20210526 using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - try { return conn.Query(sql, new { cCusAbbName = $"%{info1.cCusAbbName}%", dDate = info1.dDate, dPreDate = info1.dPreDate, cSOCode = $"%{info1.cSOCode}%" , cInvCode = $"%{info1.cInvCode}%", cInvName = $"%{info1.cInvName}%", cInvStd = $"%{info1.cInvStd}%", cMemo = $"%{info1.cMemo}%", SoCodes = info1.SoCodes, info1.jandate, info1.wfiQuantity, info1.kcyl, }); } - catch { return null; } - + var res= conn.Query(sql, new { cCusAbbName = $"%{info1.cCusAbbName}%", dDate = info1.dDate, dPreDate = info1.dPreDate, cSOCode = $"%{info1.cSOCode}%" , cInvCode = $"%{info1.cInvCode}%", cInvName = $"%{info1.cInvName}%", cInvStd = $"%{info1.cInvStd}%", cMemo = $"%{info1.cMemo}%", SoCodes = info1.SoCodes, info1.jandate, info1.wfiQuantity, info1.kcyl, }); + + + var resall = new NX.ERP.Model.saleRes(); + + resall.wfdetails = res; + + var a1 = res.Sum(m =>long.Parse( m.WfiQuantity)); + var a2 = res.GroupBy(m => m.CInvCode);//.Sum(m=>m.Max(n=>long.Parse(n.Xcl))); + resall.sumWfiQuantity = 0; + foreach (var item in a2) + { + var xuq = item.Sum(m => long.Parse( m.WfiQuantity)); + var kucun = item.Max(m =>long.Parse( m.Xcl)); + resall.sumWfiQuantity += Math.Min(kucun - xuq, 0); + } + + return resall; + + + + + } + + } public IEnumerable InventoryPo(NX.ERP.Model.Request.PoOrderRequest info1) diff --git a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs index 6296a0a..3dfa5c8 100644 --- a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs +++ b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs @@ -47,10 +47,14 @@ namespace NX.ERP.WebAPi.Controllers [HttpPost] [Route("api/Pmc/InventorySale")] - public IEnumerable InventorySale(NX.ERP.Model.Request.SaleinvRequest info1) + public NX.ERP.Model.saleRes InventorySale(NX.ERP.Model.Request.SaleinvRequest info1) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.InventorySale(info1).OrderBy(m => m.DPreDate).ThenBy(m => m.CInvStd).ThenBy(m => m.CInvName); + var aa= PmcQuery.InventorySale(info1); + aa.wfdetails = aa.wfdetails.OrderBy(m => m.CInvCode).ThenBy(m => m.CInvStd).ThenBy(m => m.DPreDate); + return aa; + + } [Obsolete] [HttpPost] diff --git a/NX.ERP.Webapp/package-lock.json b/NX.ERP.Webapp/package-lock.json index 051081d..18b656f 100644 --- a/NX.ERP.Webapp/package-lock.json +++ b/NX.ERP.Webapp/package-lock.json @@ -7627,8 +7627,8 @@ }, "lodash": { "version": "4.17.21", - "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835817439&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz", - "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.debounce": { "version": "4.0.8", diff --git a/NX.ERP.Webapp/src/App.vue b/NX.ERP.Webapp/src/App.vue index 6702b64..e356e57 100644 --- a/NX.ERP.Webapp/src/App.vue +++ b/NX.ERP.Webapp/src/App.vue @@ -6,21 +6,23 @@ ERP查询 + 销售未发明细表 + + 销售订单表 序列号查询 补料量查询 采购跟进表(采购部) 采购查询汇总 + --> - +
diff --git a/NX.ERP.Webapp/src/views/FilterTable.vue b/NX.ERP.Webapp/src/views/FilterTable.vue index 3dfe052..580bad1 100644 --- a/NX.ERP.Webapp/src/views/FilterTable.vue +++ b/NX.ERP.Webapp/src/views/FilterTable.vue @@ -5,10 +5,10 @@
@@ -20,7 +20,9 @@ export default { name: "FilterTable", props: { columns: Array, //列描述数据对象 - data: Array //表格数据 + data: Array, //表格数据 + wf: Number + }, computed: { /* @@ -237,6 +239,15 @@ export default { }; return; } + if (column.wfsum == true) { + console.log(this.wf) + sums[key] = { + key, + value: this.wf + }; + return; + } + if (column.issum != true) { sums[key] = { key, diff --git a/NX.ERP.Webapp/src/views/inventory-sale copy.vue b/NX.ERP.Webapp/src/views/inventory-sale copy.vue new file mode 100644 index 0000000..6cf2a47 --- /dev/null +++ b/NX.ERP.Webapp/src/views/inventory-sale copy.vue @@ -0,0 +1,552 @@ + + + + + + + \ No newline at end of file diff --git a/NX.ERP.Webapp/src/views/inventory-sale.vue b/NX.ERP.Webapp/src/views/inventory-sale.vue index 6c431dc..4522a6d 100644 --- a/NX.ERP.Webapp/src/views/inventory-sale.vue +++ b/NX.ERP.Webapp/src/views/inventory-sale.vue @@ -49,7 +49,7 @@ - + import { getInventorySale } from "@/api/pmc"; +import debounce from "lodash/debounce"; import FilterTable from "./FilterTable"; import { pageingData, @@ -88,6 +89,11 @@ const isqj = { value: 2, name: "否", color: "green" + }, + 3: { + value: 3, + name: "全", + color: "blue" } }; const stateListq = { @@ -112,7 +118,10 @@ export default { pageNo: 1, strfilter: "", multiple: false, + searchText: {}, pageSize: 9999, + temp: 1, + qhsum:0, datas: [], filter: { inv_codes: "", @@ -145,7 +154,7 @@ export default { { title: "客户", align: "center", - key: "cCusAbbName", + key: "c_cus_abb_name", width: 145, filter: { type: "AutoComplete" @@ -154,10 +163,10 @@ export default { { title: "订单日期", align: "center", - width: 145, - key: "dDate", + width: 140, + key: "d_date", render: (h, params) => { - return
{dateFormat(params.row.dDate)}
; + return
{dateFormat(params.row.d_date)}
; }, filter: { type: "DatePicker" @@ -166,7 +175,7 @@ export default { { title: "销售单号", align: "center", - key: "cSOCode", + key: "c_so_code", width: "160", filter: { type: "AutoComplete" @@ -176,18 +185,18 @@ export default { { title: "产品编码", align: "center", - key: "cInvCode", + key: "c_inv_code", width: "120", className: "demo-table-info-new", filter: { - type: "Input" + type: "AutoComplete" } }, { title: "产品名称", align: "center", width: "150", - key: "cInvName", + key: "c_inv_name", filter: { type: "AutoComplete" } @@ -195,27 +204,18 @@ export default { { title: "规格型号", align: "center", - key: "cInvStd", - width: "220", + key: "c_inv_std", + width: "180", filter: { - type: "AutoComplete", - } + type: "AutoComplete" + } }, { title: "未发数量", align: "center", - width: "120", - issum:true, - key: "wfiQuantity", - filter: { - type: "Input" - } - }, - { - title: "欠货量", - align: "center", - width: "120", - key: "kcyl", + width: "100", + issum: true, + key: "wfi_quantity", filter: { type: "Input" } @@ -223,17 +223,27 @@ export default { { title: "现存量", align: "center", - width: "120", + width: "100", key: "xcl", filter: { type: "Input" } }, + { + title: "欠货量", + align: "center", + width: "100", + wfsum: true, + key: "kcyl", + filter: { + type: "Input" + } + }, { title: "预计发货日期", align: "center", - width: 145, - key: "dPreDate", + width: 140, + key: "d_pre_date", filter: { type: "DatePicker" } @@ -242,8 +252,8 @@ export default { { title: "技术要求", align: "center", - key: "cMemo", - width: "300", + key: "c_memo", + width: "280", filter: { type: "Input" } @@ -344,10 +354,10 @@ export default { this.loadData(); }, Formatkcyl(kcyl) { - if (kcyl > 0) { - return "否"; - } else { + if (kcyl < 0) { return "是"; + } else { + return "否"; } }, async loadData() { @@ -378,8 +388,9 @@ export default { }; let resp = await getInventorySale(_filert); this.pageNo = 1; - this.datas = resp.data.data; - this.datas = sortByKey(resp.data.data, "dDate"); + this.datas = resp.data.data.wfdetails; + this.qhsum = resp.data.data.sum_wfi_quantity; + //this.datas = sortByKey(resp.data.data, "dDate"); this.datas.forEach(item => { if (item.datewaring === "15天内发货") { item.cellClassName = { @@ -396,7 +407,26 @@ export default { } }); }, - async onSearch(search) { + // throttle(method, context) { + // clearTimeout(method); + // method = setTimeout(function() { + // //method.call(context); + // }, 1200); + // }, + throttle(method, delay) { + var timer = null; + return function() { + var context = this, + args = arguments; + clearTimeout(timer); + timer = setTimeout(function() { + method.apply(context, args); + }, delay); + }; + }, + + async SonSearch(search) { + console.log(1); //模拟数据库查询数据 //这个search应该是传到后台,然后台来根据条件查询数据库 //alert("查询条件:" + JSON.stringify(search, null, 4)); @@ -404,24 +434,23 @@ export default { //console.log(search); - if (JSON.stringify(search.cCusAbbName) == "{}") { - search.cCusAbbName = ""; + if (JSON.stringify(search.c_cus_abb_name) == "{}") { + search.c_cus_abb_name = ""; } - if (JSON.stringify(search.cSOCode) == "{}") { - search.cSOCode = ""; + if (JSON.stringify(search.c_so_code) == "{}") { + search.c_so_code = ""; } - if (JSON.stringify(search.cInvCode) == "{}") { - search.cInvCode = ""; + if (JSON.stringify(search.c_inv_code) == "{}") { + search.c_inv_code = ""; } - if (JSON.stringify(search.cInvName) == "{}") { - search.cInvName = ""; + if (JSON.stringify(search.c_inv_name) == "{}") { + search.c_inv_name = ""; } - if (JSON.stringify(search.cInvStd) == "{}") { - - search.cInvStd = ""; + if (JSON.stringify(search.c_inv_std) == "{}") { + search.c_inv_std = ""; } - if (JSON.stringify(search.wfiQuantity) == "{}") { - search.wfiQuantity = ""; + if (JSON.stringify(search.wfi_quantity) == "{}") { + search.wfi_quantity = ""; } if (JSON.stringify(search.kcyl) == "{}") { search.kcyl = ""; @@ -429,30 +458,33 @@ export default { if (JSON.stringify(search.datewaring) == "{}") { search.datewaring = ""; } - if (JSON.stringify(search.cMemo) == "{}") { - search.cMemo = ""; + if (JSON.stringify(search.c_memo) == "{}") { + search.c_memo = ""; } let _filert = { - c_cus_abb_name: search.cCusAbbName, - d_date: search.dDate, - c_so_code: search.cSOCode, - c_inv_code: search.cInvCode, - c_inv_name: search.cInvName, - c_inv_std: search.cInvStd, - wfi_quantity: search.wfiQuantity, + c_cus_abb_name: search.c_cus_abb_name, + d_date: search.d_date, + c_so_code: search.c_so_code, + c_inv_code: search.c_inv_code, + c_inv_name: search.c_inv_name, + c_inv_std: search.c_inv_std, + wfi_quantity: search.wfi_quantity, kcyl: search.kcyl, - d_pre_date: search.dPreDate, + d_pre_date: search.d_pre_date, datewaring: search.datewaring, - c_memo: search.cMemo, + c_memo: search.c_memo, jandate: search.jandate, kcyl2: search.kcyl2 }; let resp = await getInventorySale(_filert); + + //let resp = await getInventorySale(_filert); this.pageNo = 1; - this.datas = resp.data.data; - this.datas = sortByKey(resp.data.data, "dDate"); + this.datas = resp.data.data.wfdetails; + this.qhsum = resp.data.data.sum_wfi_quantity; + //this.datas = sortByKey(resp.data.data, "dDate"); this.datas.forEach(item => { if (item.datewaring === "15天内发货") { item.cellClassName = { @@ -469,6 +501,14 @@ export default { } }); }, + getRemote: debounce(function() { + this.SonSearch(this.searchText); + }, 500), + + onSearch(search) { + this.searchText = search; + this.getRemote(); + }, handlePagechange(page) { this.pageNo = page; @@ -541,6 +581,6 @@ body { } .ivu-auto-complete.ivu-select-dropdown { - max-height: 500px; + max-height: 500px; } \ No newline at end of file diff --git a/NX.ERP.Webapp/vue.config.js b/NX.ERP.Webapp/vue.config.js index ec9247c..6f9fcfd 100644 --- a/NX.ERP.Webapp/vue.config.js +++ b/NX.ERP.Webapp/vue.config.js @@ -58,7 +58,7 @@ module.exports = { disableHostCheck: true, proxy: { '/api': { - // target: 'http://10.0.0.250:8081', // 接口域名 + //target: 'http://10.0.0.250:30087', // 接口域名 target: 'http://localhost:61448', // 接口域名 changeOrigin: true, // 是否跨域 pathRewrite: {}