11
This commit is contained in:
@@ -439,6 +439,77 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<object> 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<string> where = new List<string>();
|
||||
|
||||
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<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", info1.PoCodes, info1.AppCodes, info1.BeginDate, info1.EndDate, info1.BeginDate2, info1.EndDate2 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IEnumerable<object> Inventorybu(NX.ERP.Model.Request.Inventorybu info1)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user