From ad23ae5dcbe715b73432c6adf922fa5d2557211c Mon Sep 17 00:00:00 2001 From: gongxh Date: Fri, 30 Apr 2021 11:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Request/Inventoryall.cs | 6 +- NX.ERP.U8/Pmc/PmcQuery.cs | 38 ++--- .../Controllers/Pmc/PmcController.cs | 14 +- NX.ERP.WebAPi/Web.config | 140 +++++++++--------- U8App.sln | 11 ++ 5 files changed, 109 insertions(+), 100 deletions(-) diff --git a/NX.ERP.Model/Request/Inventoryall.cs b/NX.ERP.Model/Request/Inventoryall.cs index c55b260..cf7ec6c 100644 --- a/NX.ERP.Model/Request/Inventoryall.cs +++ b/NX.ERP.Model/Request/Inventoryall.cs @@ -7,11 +7,11 @@ namespace NX.ERP.Model.Request { public class Inventoryall: BaseModel { - public IEnumerable cInvCode { get; set; } + public IEnumerable InvCodes { get; set; } - public string cInvStd { get; set; } + public string InvStd { get; set; } - public string socode { get; set; } + public string SoCode { get; set; } } } diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index 073473d..1817810 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -91,11 +91,11 @@ namespace NX.ERP.U8.Pmc List where = new List(); - if (info.cInvCode != null) + if (info.InvCodes != null) { where.Add(" c.cinvcode in @cinvcode"); } - if (!string.IsNullOrEmpty(info.cInvStd)) + if (!string.IsNullOrEmpty(info.InvStd)) { where.Add(" c.cInvStd like @cInvStd "); } @@ -111,13 +111,13 @@ namespace NX.ERP.U8.Pmc using (var conn = U8.U8LoginContext.Instance.Connection) { - - return conn.Query(sql, new { cinvcode = info.cInvCode, info.cInvStd }); + + return conn.Query(sql, new { cinvcode = info.InvCodes, cInvStd = $"%{info.InvStd}%" }); } } - public IEnumerable Post2(List info1) + public IEnumerable Inventorymom(List invCodes) { string sql = $@" SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty, ma.InvCode invcode1, @@ -193,14 +193,14 @@ namespace NX.ERP.U8.Pmc and m..mocode in @ins order by m.mocode "; - using (var conn = new System.Data.SqlClient.SqlConnection("Data Source =10.0.0.12;Initial Catalog =UFDATA_001_2019;User Id = sa;Password =1qaz@WSX;")) + using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - return conn.Query(sql, new { ins = info1 }); + return conn.Query(sql, new { ins = invCodes }); } } - public IEnumerable Post3(NX.ERP.Model.Request.Inventoryall info1) + public IEnumerable Inventorymonth(NX.ERP.Model.Request.Inventoryall info1) { string sql = $@" select a.cInvCode,c.cInvName,c.cInvStd,LL.cComUnitName , CASE WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS std @@ -315,11 +315,11 @@ namespace NX.ERP.U8.Pmc List where = new List(); - if (info1.cInvCode != null) + if (info1.InvCodes != null) { where.Add(" c.cinvcode in @cinvcode"); } - + var aa = string.Join(" and ", where.ToArray()); @@ -328,14 +328,14 @@ namespace NX.ERP.U8.Pmc sql += "where " + aa; } - using (var conn = new System.Data.SqlClient.SqlConnection("Data Source =10.0.0.12;Initial Catalog =UFDATA_001_2019;User Id = sa;Password =1qaz@WSX;")) + using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - return conn.Query(sql, new { cinvcode = info1.cInvCode }); + return conn.Query(sql, new { cinvcode = info1.InvCodes }); } } - public IEnumerable Post4(NX.ERP.Model.Request.Inventoryall info1) + public IEnumerable Inventorysocode(NX.ERP.Model.Request.Inventoryall info1) { string sql = $@" select j.cSTName,b.cSOCode,b.dDate,a.iRowNo,f.cCusAbbName,a.cInvCode,a.cInvName,g.cInvStd,a.iQuantity,isnull( h.dDate,'') as fhdDate ,isnull(c.fqty,0)fqty,isnull(d.cqty,0)cqty @@ -366,17 +366,17 @@ namespace NX.ERP.U8.Pmc List where = new List(); - if (info1.cInvCode != null) + if (info1.InvCodes != null) { where.Add(" a.cinvcode in @cinvcode"); } - if (!string.IsNullOrEmpty(info1.cInvStd)) + if (!string.IsNullOrEmpty(info1.InvStd)) { where.Add(" g.cInvStd like @cInvStd "); } - if (!string.IsNullOrEmpty(info1.socode)) + if (!string.IsNullOrEmpty(info1.SoCode)) { - where.Add(" b.cSOCode like @socode "); + where.Add(" b.cSOCode like @cSOCode "); } var aa = string.Join(" and ", where.ToArray()); @@ -386,9 +386,9 @@ namespace NX.ERP.U8.Pmc sql += "where " + aa; } - using (var conn = new System.Data.SqlClient.SqlConnection("Data Source =10.0.0.12;Initial Catalog =UFDATA_001_2019;User Id = sa;Password =1qaz@WSX;")) + using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - return conn.Query(sql, new { cinvcode = info1.cInvCode, info1.cInvStd, info1.socode }); + return conn.Query(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", cSOCode = $"%{info1.SoCode}%" }); } } diff --git a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs index eae1d6d..f91d910 100644 --- a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs +++ b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs @@ -12,7 +12,7 @@ namespace NX.ERP.WebAPi.Controllers { [HttpPost] [Route("api/Pmc/Inventoryall")] - public IEnumerable Post1(NX.ERP.Model.Request.Inventoryall info) + public IEnumerable Inventoryall(NX.ERP.Model.Request.Inventoryall info) { var dal = new NX.ERP.U8.Pmc.PmcQuery(); return dal.GetPmcInventoryallRes(info); @@ -21,26 +21,26 @@ namespace NX.ERP.WebAPi.Controllers [HttpPost] [Route("api/Pmc/Inventorymom")] - public IEnumerable Post2([FromBody] List info1) + public IEnumerable Inventorymom([FromBody] List invCodes) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.Post2(info1); + return PmcQuery.Inventorymom(invCodes); } [HttpPost] [Route("api/Pmc/Inventorymonth")] - public IEnumerable Post3(NX.ERP.Model.Request.Inventoryall info) + public IEnumerable Inventorymonth(NX.ERP.Model.Request.Inventoryall info) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.Post3(info); + return PmcQuery.Inventorymonth(info); } [HttpPost] [Route("api/Pmc/Inventorysocode")] - public IEnumerable Post4(NX.ERP.Model.Request.Inventoryall info) + public IEnumerable Inventorysocode(NX.ERP.Model.Request.Inventoryall info) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.Post4(info); + return PmcQuery.Inventorysocode(info); } diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 6119f7d..e9ce99a 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -4,75 +4,73 @@ https://go.microsoft.com/fwlink/?LinkId=301879 --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/U8App.sln b/U8App.sln index 60fd8c1..550cc2e 100644 --- a/U8App.sln +++ b/U8App.sln @@ -13,6 +13,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NX.ERP.U8.App", "NX.ERP.U8. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NX.ERP.BLL", "NX.ERP.BLL\NX.ERP.BLL.csproj", "{C1FFE393-1879-4FC1-A99E-695F2882553D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{272C1F7E-66F7-4E92-9777-3A7CB2E9D7CC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,6 +89,13 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A958D236-BAD0-4A56-ADB1-CEA3A1EF452B} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D} + {5D012E0A-AFED-474E-81A9-5820890B1B29} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D} + {BD673DA9-0606-4BCF-A016-FB5C4E7B5D59} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D} + {8A6603B0-444A-49C7-80C9-195638129068} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D} + {C1FFE393-1879-4FC1-A99E-695F2882553D} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8C57E044-32E1-444C-B548-E83838110953} EndGlobalSection