diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index 45e67ab..b953cb9 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/PoOrderRequest.cs b/NX.ERP.Model/Request/PoOrderRequest.cs new file mode 100644 index 0000000..1cac536 --- /dev/null +++ b/NX.ERP.Model/Request/PoOrderRequest.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class PoOrderRequest + { + public IEnumerable PoCodes { get; set; } + + public IEnumerable AppCodes { get; set; } + public string InvStd { get; set; } + + public IEnumerable InvCodes { get; set; } + + + + public DateTime? BeginDate { get; set; } + public DateTime? EndDate { get; set; } + + public DateTime? BeginDate2 { get; set; } + public DateTime? EndDate2 { get; set; } + + + + + + } +} diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index 25c2237..4055c21 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -439,6 +439,77 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam } } + public IEnumerable InventoryPo(NX.ERP.Model.Request.PoOrderRequest info1) + { + string sql = $@" + Select cpoid,dpodate,zpurpoheader.cvenabbname,zpurpotail.cinvcode,zpurpotail.cinvname,zpurpotail.cinvstd,zpurpotail.cinvm_unit,zpurpotail.ireceivedqty, + iquantity,prd.rqty,zpurpotail.darrivedate,cupsocode,d.ddate,c.drequirdate + From zpurpoheader with(nolock) inner join zpurpotail with(nolock) on zpurpoheader.poid=zpurpotail.poid + left join pu_appbody c with(nolock) on zpurpotail.iAppIds =c.autoid + left join pu_apphead d with(nolock) on d.id =c.id + LEFT JOIN + (SELECT cinvcode, SUM(rqty) AS rqty + FROM (SELECT PDS.cInvCode, PDS.iQuantity - ISNULL(rds.qty, 0) AS Rqty + FROM PO_Pomain PM WITH (NOLOCK) INNER JOIN + PO_Podetails PDS WITH (NOLOCK) ON PM.POID = PDS.POID LEFT JOIN + (SELECT IPOSID, SUM(IQUANTITY) AS QTY + FROM rdrecords01 rds WITH (NOLOCK) INNER JOIN + RdRecord01 rd WITH (nolock) ON rds.ID = rd.ID + WHERE CBUSTYPE = '普通采购' + GROUP BY IPOSID) RDS ON PDS.ID = RDS.iPOsID + WHERE ISNULL(PM.CCLOSER, N'') = N'' AND ISNULL(PDS.CBCLOSER, N'') = N'' AND + pds.iQuantity - ISNULL(rds.qty, 0) > 0) x + GROUP BY cInvCode) prd ON zpurpotail.cinvcode = prd.CINVCODE + + + "; + + + List where = new List(); + + if (info1.InvCodes != null) + { + where.Add(" zpurpotail.cinvcode in @cinvcode"); + } + if (!string.IsNullOrEmpty(info1.InvStd)) + { + where.Add(" zpurpotail.cinvstd like @cInvStd "); + } + if (info1.PoCodes != null) + { + where.Add(" cpoid in @PoCodes "); + } + if (info1.AppCodes != null) + { + where.Add(" cupsocode in @AppCodes "); + } + + if (info1.BeginDate != null && info1.EndDate != null) + { + where.Add(" zpurpoheader.dPODate between @beginDate and @endDate "); + + } + if (info1.BeginDate2 != null && info1.EndDate2 != null) + { + where.Add(" d.dDate between @beginDate2 and @endDate2 "); + + } + + 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 { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", info1.PoCodes, info1.AppCodes, info1.BeginDate, info1.EndDate, info1.BeginDate2, info1.EndDate2 }); + } + } + + + public IEnumerable Inventorybu(NX.ERP.Model.Request.Inventorybu info1) { diff --git a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs index 4168188..2b96b55 100644 --- a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs +++ b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs @@ -43,6 +43,14 @@ namespace NX.ERP.WebAPi.Controllers return PmcQuery.Inventorysocode(info); } + [HttpPost] + [Route("api/Pmc/InventoryPocode")] + public IEnumerable InventoryPo(NX.ERP.Model.Request.PoOrderRequest info) + { + var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); + return PmcQuery.InventoryPo(info); + } + [HttpPost] [Route("api/Pmc/Inventorybu")]