增加序列号查询
This commit is contained in:
80
NX.ERP.U8/Pmc/FinanceQuery.cs
Normal file
80
NX.ERP.U8/Pmc/FinanceQuery.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using NX.ERP.U8.Purchase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Dapper;
|
||||
|
||||
|
||||
namespace NX.ERP.U8.Finance
|
||||
|
||||
{
|
||||
public class FinanceQuery
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
|
||||
public IEnumerable<object> InventorySNDetail(NX.ERP.Model.Request.SnOrderRequest info1)
|
||||
{
|
||||
string sql = $@"
|
||||
select a.cInvCode,e.cInvName,b.cCode as Cprk, b.dDate as rkrq,c.cWhName,b.cMPoCode,d.cDepName,a.cInvSN,g.cCode as Clck,g.dDate as ckrq,h.cCusAbbName,f.cInvSN as ckcInvSN from ST_SNDetail_PROIN a
|
||||
left join rdrecord10 b on a.iVouchID=b.id
|
||||
left join Warehouse c on b.cWhCode =c.cWhCode
|
||||
left join Department d on b.cDepCode =d.cDepCode
|
||||
left join Inventory e on a.cInvCode=e.cInvCode
|
||||
left join ST_SNDetail_SaleOut f on a.cInvSN= f.cInvSN
|
||||
left join rdrecord32 g on f.iVouchID=g.id
|
||||
left join Customer h on g.cCusCode=h.cCusCode
|
||||
|
||||
";
|
||||
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
if (info1.cInvCodes != null)
|
||||
{
|
||||
where.Add(" a.cInvCode in @cInvCode");
|
||||
}
|
||||
|
||||
if (info1.Cprk != null)
|
||||
{
|
||||
where.Add(" b.cCode in @Cprk ");
|
||||
}
|
||||
if (info1.Clck != null)
|
||||
{
|
||||
where.Add(" g.cCode in @Clck ");
|
||||
}
|
||||
if (info1.cInvSN != null)
|
||||
{
|
||||
where.Add(" a.cInvSN in @cInvSN ");
|
||||
}
|
||||
|
||||
if (info1.BeginDate != null && info1.EndDate != null)
|
||||
{
|
||||
where.Add(" b.dDate between @beginDate and @endDate ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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.cInvCodes, Cprk = info1.Cprk, info1.Clck, info1.cInvSN });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user