From 674688f0f1868e3f73eabf0d33acf76f85c62142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Tue, 18 May 2021 14:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=9F=E5=8D=95=E5=8A=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/NX.ERP.Model.csproj | 2 + NX.ERP.Model/Request/MomRequest.cs | 14 + .../Response/Pmc/PmcInventorymomRes.cs | 284 ++++++++++++++++++ NX.ERP.U8/Pmc/PmcQuery.cs | 56 +++- .../Controllers/Pmc/PmcController.cs | 4 +- NX.ERP.WebAPi/Web.config | 138 ++++----- NX.ERP.Webapp/src/libs/tools.js | 7 + NX.ERP.Webapp/src/views/inventory-mom.vue | 41 +-- NX.ERP.Webapp/src/views/inventory-so.vue | 9 +- 9 files changed, 451 insertions(+), 104 deletions(-) create mode 100644 NX.ERP.Model/Request/MomRequest.cs create mode 100644 NX.ERP.Model/Response/Pmc/PmcInventorymomRes.cs diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index 7869ccc..0cc0bdd 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -65,10 +65,12 @@ + + diff --git a/NX.ERP.Model/Request/MomRequest.cs b/NX.ERP.Model/Request/MomRequest.cs new file mode 100644 index 0000000..41e3394 --- /dev/null +++ b/NX.ERP.Model/Request/MomRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class MomRequest + { + public IEnumerable Momcode { get; set; } + + + } +} diff --git a/NX.ERP.Model/Response/Pmc/PmcInventorymomRes.cs b/NX.ERP.Model/Response/Pmc/PmcInventorymomRes.cs new file mode 100644 index 0000000..78029ab --- /dev/null +++ b/NX.ERP.Model/Response/Pmc/PmcInventorymomRes.cs @@ -0,0 +1,284 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +namespace NX.ERP.Model +{ + public class PmcInventorymomRes : BaseModel + { + + private string mocode; + private int sortSeq; + private string invCode; + private string cInvName; + private string cInvStd; + private string cComUnitName; + private double qty; + private double qualifiedInQty; + private string invcode1; + private string cinvname1; + private string cinvstd1; + private string cComUnitName1; + private string std; + private double qty1; + private double issqty; + private double mdqty; + private double wqty; + private double cqty; + private double issqtyxc; + private double dqty; + private double rqty; + private double rqty1; + private double rqty3; + private double momqty; + private double mqty; + private double q; + private string st; + + /// + /// + /// + public string Mocode + { + get { return this.mocode; } + set { this.mocode = value; } + } + + /// + /// + /// + public int SortSeq + { + get { return this.sortSeq; } + set { this.sortSeq = value; } + } + + /// + /// + /// + public string InvCode + { + get { return this.invCode; } + set { this.invCode = value; } + } + + /// + /// + /// + public string CInvName + { + get { return this.cInvName; } + set { this.cInvName = value; } + } + + /// + /// + /// + public string CInvStd + { + get { return this.cInvStd; } + set { this.cInvStd = value; } + } + + /// + /// + /// + public string CComUnitName + { + get { return this.cComUnitName; } + set { this.cComUnitName = value; } + } + + /// + /// + /// + public double Qty + { + get { return this.qty; } + set { this.qty = value; } + } + + /// + /// + /// + public double QualifiedInQty + { + get { return this.qualifiedInQty; } + set { this.qualifiedInQty = value; } + } + + /// + /// + /// + public string Invcode1 + { + get { return this.invcode1; } + set { this.invcode1 = value; } + } + + /// + /// + /// + public string Cinvname1 + { + get { return this.cinvname1; } + set { this.cinvname1 = value; } + } + + /// + /// + /// + public string Cinvstd1 + { + get { return this.cinvstd1; } + set { this.cinvstd1 = value; } + } + + /// + /// + /// + public string CComUnitName1 + { + get { return this.cComUnitName1; } + set { this.cComUnitName1 = value; } + } + + /// + /// + /// + public string Std + { + get { return this.std; } + set { this.std = value; } + } + + /// + /// + /// + public double Qty1 + { + get { return this.qty1; } + set { this.qty1 = value; } + } + + /// + /// + /// + public double Issqty + { + get { return this.issqty; } + set { this.issqty = value; } + } + + /// + /// + /// + public double Mdqty + { + get { return this.mdqty; } + set { this.mdqty = value; } + } + + /// + /// + /// + public double Wqty + { + get { return this.wqty; } + set { this.wqty = value; } + } + + /// + /// + /// + public double Cqty + { + get { return this.cqty; } + set { this.cqty = value; } + } + + /// + /// + /// + public double Issqtyxc + { + get { return this.issqtyxc; } + set { this.issqtyxc = value; } + } + + /// + /// + /// + public double Dqty + { + get { return this.dqty; } + set { this.dqty = value; } + } + + /// + /// + /// + public double Rqty + { + get { return this.rqty; } + set { this.rqty = value; } + } + + /// + /// + /// + public double Rqty1 + { + get { return this.rqty1; } + set { this.rqty1 = value; } + } + + /// + /// + /// + public double Rqty3 + { + get { return this.rqty3; } + set { this.rqty3 = value; } + } + + /// + /// + /// + public double Momqty + { + get { return this.momqty; } + set { this.momqty = value; } + } + + /// + /// + /// + public double Mqty + { + get { return this.mqty; } + set { this.mqty = value; } + } + + /// + /// + /// + public double Q + { + get { return this.q; } + set { this.q = value; } + } + + /// + /// + /// + public string St + { + get { return this.st; } + set { this.st = value; } + } + + + } +} diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index f189ccb..25c2237 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -123,10 +123,12 @@ namespace NX.ERP.U8.Pmc } - public IEnumerable Inventorymom(List moCodes) + public IEnumerable Inventorymom(List moCodes) { string sql = $@" - SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty, ma.InvCode invcode1, +select *from ( + +SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty, ma.InvCode invcode1, c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS std, ma.Qty qty1, ma.IssQty issqty,mdsss.mdqty, mas.wqty wqty, ISNULL(cs.qty, 0) cqty, ISNULL(misss.issqty, 0) issqtyxc,ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty, @@ -143,13 +145,13 @@ namespace NX.ERP.U8.Pmc WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0 GROUP BY ma.InvCode) mas ON ma.InvCode = mas.InvCode LEFT JOIN - (SELECT ma.invcode,SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) mdqty + (SELECT mom.MoId, ma.invcode,SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) mdqty FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId - WHERE md.Status <> 4 and MoCode in @moCodes - GROUP BY ma.InvCode) mdsss ON ma.InvCode = mdsss.InvCode LEFT JOIN + WHERE md.Status <> 4 + GROUP BY ma.InvCode,mom.MoId) mdsss ON ma.InvCode = mdsss.InvCode and m.MoId=mdsss.MoId LEFT JOIN (SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN @@ -204,13 +206,30 @@ namespace NX.ERP.U8.Pmc (select InvCode,sum(qty) as momqty from mom_orderdetail WITH (NOLOCK) where Status=3 group by InvCode) momq on MA.INVCODE = momq.InvCode left join ComputationUnit kk WITH (nolock) on p.cComUnitCode=kk.cComunitCode left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode - WHERE md.Status <> 4 AND ma.Qty - IsNull(ma.IssQty, 0) > 0 - and m.mocode in @moCodes - order by m.mocode,md.SortSeq, ma.InvCode + where md.Status <> 4 AND ma.Qty - IsNull(ma.IssQty, 0) > 0 ) mmm "; + + List where = new List(); + + ///处理- + if (moCodes != null && moCodes.Count>0 ) + { + where.Add(" mmm.mocode in @moCodes"); + } + + + var aa = string.Join(" and ", where.ToArray()); + + if (!string.IsNullOrEmpty(aa)) + { + sql += "where " + aa; + } + + + using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - return conn.Query(sql, new { moCodes = moCodes }); + return conn.Query(sql, new { moCodes = moCodes }); } } @@ -353,7 +372,7 @@ namespace NX.ERP.U8.Pmc public IEnumerable Inventorysocode(NX.ERP.Model.Request.SaleOrderRequest info1) { string sql = $@" - select j.cSTName,b.cSOCode,b.dDate,a.iRowNo,f.cCusAbbName,a.cInvCode,a.cInvName,g.cInvStd,a.iQuantity, h.dDate as fhdDate ,isnull(c.fqty,0)fqty,isnull(d.cqty,0)cqty + select j.cSTName,b.cSOCode,CONVERT(varchar(100),b.dDate, 23) as dDate ,a.iRowNo,f.cCusAbbName,a.cInvCode,a.cInvName,g.cInvStd,a.iQuantity, CONVERT(varchar(100),a.dPreDate, 23) as dPreDate , CONVERT(varchar(100),h.dDate, 23) as fhdDate ,isnull(c.fqty,0)fqty,isnull(d.cqty,0)cqty ,isnull(cs.qty,0)qty,isnull(momq.momqty,0)momqty from SO_SODetails a WITH (nolock) left join SO_SOMain b WITH (nolock) on a.ID=b.id LEFT JOIN @@ -375,6 +394,7 @@ namespace NX.ERP.U8.Pmc left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode left join DispatchList h WITH (nolock) on b.cSOCode =h.cSOCode left join SaleType j WITH (nolock) on j.cSTCode=b.cSTCode + "; @@ -444,14 +464,22 @@ namespace NX.ERP.U8.Pmc sql = $@" Usp_BO_ExpandByParent_BU_20210513 "; } //var sql = $@"Usp_BO_ExpandByParent_BU_20210208 "; - foreach (var item in info1.inumsc) + if (info1.inumsc != null) { + foreach (var item in info1.inumsc) + { - sql = sql +"'"+ item + "'" + ","; } - sql = sql.Substring(0, sql.Length - 1); + sql = sql + "'" + item + "'" + ","; + } + sql = sql.Substring(0, sql.Length - 1); + } + else { + sql = ""; + } + try { return conn.Query(sql, new { inumsc = info1.inumsc }); } + catch { return null; } - return conn.Query(sql, new { inumsc = info1.inumsc }); } } diff --git a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs index 7588f79..4168188 100644 --- a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs +++ b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs @@ -21,10 +21,10 @@ namespace NX.ERP.WebAPi.Controllers [HttpPost] [Route("api/Pmc/Inventorymom")] - public IEnumerable Inventorymom([FromBody] List moCodes) + public IEnumerable Inventorymom([FromBody] List moCodes) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.Inventorymom(moCodes); + return PmcQuery.Inventorymom(moCodes).OrderByDescending(m=> m.Mocode).ThenBy(m => m.SortSeq).ThenBy(m => m.Invcode1); } [HttpPost] diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index b6945a4..9e67996 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -4,73 +4,73 @@ https://go.microsoft.com/fwlink/?LinkId=301879 --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NX.ERP.Webapp/src/libs/tools.js b/NX.ERP.Webapp/src/libs/tools.js index 0c91cf8..9491526 100644 --- a/NX.ERP.Webapp/src/libs/tools.js +++ b/NX.ERP.Webapp/src/libs/tools.js @@ -19,6 +19,13 @@ export const numberFormat = (data) => { return '' } } +export const numberFormat2 = (data) => { + if (data != null) { + return data.Number(num.toString().match(/^\d+(?:\.\d{0,2})?/)); + } else { + return '' + } +} export const edit2 = (k, data) => { var aa = axios.post('/api/erp/wmsgz1', { date: k, duration: data }) diff --git a/NX.ERP.Webapp/src/views/inventory-mom.vue b/NX.ERP.Webapp/src/views/inventory-mom.vue index 9fc3300..1baef7c 100644 --- a/NX.ERP.Webapp/src/views/inventory-mom.vue +++ b/NX.ERP.Webapp/src/views/inventory-mom.vue @@ -25,6 +25,7 @@ { @@ -155,7 +160,7 @@ export default { title: '在制量', align: 'center', key: 'momqty' - } + } ] } },