修订
This commit is contained in:
@@ -852,13 +852,14 @@ select *from tempdb..tablepzck20210526
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleOrderRequest info1)
|
||||
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleinvRequest info1)
|
||||
{
|
||||
string sql = $@"
|
||||
|
||||
select *from (
|
||||
select f.cCusAbbName,CONVERT(varchar(100),b.dDate, 23) as dDate ,b.cSOCode,a.cInvCode,a.cInvName,g.cInvStd, a.iQuantity - isnull(d.cqty,0) as wfiQuantity
|
||||
,
|
||||
isnull(cs.qty,0) as xcl
|
||||
isnull(cs.qty,0) as xcl,
|
||||
b.cVerifier
|
||||
,
|
||||
isnull(
|
||||
(SELECT isnull(SUM(iquantity),0) qty
|
||||
@@ -892,7 +893,7 @@ select *from tempdb..tablepzck20210526
|
||||
GROUP BY cInvCode) cs ON a.cInvCode = cs.cInvCode
|
||||
|
||||
left join Customer f WITH (nolock) on b.cCusCode=f.cCusCode
|
||||
left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode
|
||||
left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode ) mm
|
||||
|
||||
|
||||
|
||||
@@ -901,26 +902,112 @@ select *from tempdb..tablepzck20210526
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
where.Add(" a.iQuantity - isnull(d.cqty,0) >0 and b.cVerifier is not null ");
|
||||
// where.Add(" a.iQuantity - isnull(d.cqty,0) >0 and b.cVerifier is not null ");
|
||||
|
||||
where.Add(" mm.wfiQuantity >0 and mm.cVerifier is not null ");
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cCusAbbName))
|
||||
{
|
||||
where.Add(" mm.cCusAbbName like @cCusAbbName ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.dDate))
|
||||
{
|
||||
where.Add(" mm.dDate = @dDate ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cSOCode))
|
||||
{
|
||||
where.Add(" mm.cSOCode = @cSOCode ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cInvCode))
|
||||
{
|
||||
where.Add(" mm.cInvCode like @cInvCode ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cInvName))
|
||||
{
|
||||
where.Add(" mm.cInvName like @cInvName ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cInvStd))
|
||||
{
|
||||
where.Add(" mm.cInvStd like @cInvStd ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.cMemo))
|
||||
{
|
||||
where.Add(" mm.cMemo like @cMemo ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.dPreDate))
|
||||
{
|
||||
where.Add(" mm.dPreDate = @dPreDate ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.wfiQuantity))
|
||||
{
|
||||
where.Add(" mm.wfiQuantity = @wfiQuantity ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.kcyl))
|
||||
{
|
||||
where.Add(" mm.kcyl = @kcyl ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.jandate))
|
||||
{
|
||||
where.Add(" mm.jandate = @jandate ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.kcyl2))
|
||||
{
|
||||
if (info1.kcyl2 == "1")
|
||||
{
|
||||
where.Add(" mm.kcyl <= 0 ");
|
||||
}
|
||||
else if (info1.kcyl2 == "2")
|
||||
{
|
||||
where.Add(" mm.kcyl > 0 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.datewaring))
|
||||
{
|
||||
if (info1.datewaring == "1")
|
||||
{
|
||||
where.Add(" (mm.jandate > -15 AND mm.jandate < 0) ");
|
||||
}
|
||||
else if (info1.datewaring == "2")
|
||||
{
|
||||
where.Add("(mm.jandate <= -15) ");
|
||||
}
|
||||
else if (info1.datewaring == "3")
|
||||
{
|
||||
where.Add("(mm.jandate >= 0) ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
if (info1.InvCodes != null)
|
||||
{
|
||||
where.Add(" a.cinvcode in @cinvcode");
|
||||
where.Add(" mm.cinvcode in @cinvcode");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info1.InvStd))
|
||||
{
|
||||
where.Add(" g.cInvStd like @cInvStd ");
|
||||
where.Add(" mm.cInvStd like @cInvStd ");
|
||||
}
|
||||
if (info1.SoCodes != null)
|
||||
{
|
||||
where.Add(" b.cSOCode in @cSOCode ");
|
||||
where.Add(" mm.cSOCode in @SoCodes ");
|
||||
}
|
||||
|
||||
if (info1.BeginDate != null && info1.EndDate != null)
|
||||
{
|
||||
where.Add(" b.dDate between @beginDate and @endDate ");
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
if (info1.flag != null && info1.flag.ToList().Count>0)
|
||||
{
|
||||
@@ -931,15 +1018,15 @@ select *from tempdb..tablepzck20210526
|
||||
{
|
||||
if (item == "1")
|
||||
{
|
||||
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) > -15 AND DATEDIFF(day,a.dPreDate,GETDATE()) < 0) ");
|
||||
str.Add(" (mm.jandate > -15 AND mm.jandate < 0) ");
|
||||
}
|
||||
else if (item == "2")
|
||||
{
|
||||
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) <= -15) ");
|
||||
str.Add(" (mm.jandate <= -15) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
str.Add(" (DATEDIFF(day, a.dPreDate, GETDATE()) >= 0) ");
|
||||
str.Add(" (mm.jandate >= 0) ");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -962,7 +1049,7 @@ select *from tempdb..tablepzck20210526
|
||||
|
||||
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
|
||||
{
|
||||
return conn.Query<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", cSOCode = info1.SoCodes, info1.BeginDate, info1.EndDate });
|
||||
return conn.Query<object>(sql, new { cCusAbbName = $"%{info1.cCusAbbName}%", dDate = info1.dDate, dPreDate = info1.dPreDate, cSOCode = info1.cSOCode, cInvCode = $"%{info1.cInvCode}%" , cInvName = $"%{info1.cInvName}%" , cInvStd = $"%{info1.cInvStd}%" , cMemo = $"%{info1.cMemo}%", SoCodes = info1.SoCodes, info1.jandate, info1.wfiQuantity, info1.kcyl, });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user