销售未发 查询后端
This commit is contained in:
@@ -20,6 +20,8 @@ namespace NX.ERP.Model.Request
|
|||||||
|
|
||||||
public bool byFinish { get; set; }
|
public bool byFinish { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<string> flag { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -851,6 +851,121 @@ select *from tempdb..tablepzck20210526
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleOrderRequest info1)
|
||||||
|
{
|
||||||
|
string sql = $@"
|
||||||
|
|
||||||
|
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(
|
||||||
|
(SELECT isnull(SUM(iquantity),0) qty
|
||||||
|
FROM currentstock WITH (nolock) where cInvCode=a.cInvCode
|
||||||
|
GROUP BY cInvCode
|
||||||
|
),0)-( select sum(aa.iQuantity - isnull(dd.cqty,0)) as swfiQuantity from SO_SODetails aa WITH (nolock) LEFT JOIN
|
||||||
|
SO_SOMain bb WITH (nolock) on aa.ID=bb.id left join
|
||||||
|
(SELECT ipesodid, sum(iQuantity) AS cqty
|
||||||
|
FROM rdrecords32 WITH (nolock)
|
||||||
|
GROUP BY ipesodid) dd on isnull(dd.ipesodid,'')=isnull(aa.iSOsID ,'')
|
||||||
|
where aa.cInvCode=a.cInvCode and bb.cVerifier is not null and isnull(CONVERT(varchar(100),aa.dPreDate, 23),'1900-01-01')<=isnull(CONVERT(varchar(100),a.dPreDate, 23),'1900-01-01') and (aa.iQuantity - isnull(dd.cqty,0))>0
|
||||||
|
group by aa.cInvCode
|
||||||
|
) as kcyl
|
||||||
|
,
|
||||||
|
CONVERT(varchar(100),a.dPreDate, 23) as dPreDate , a.cMemo,
|
||||||
|
CASE
|
||||||
|
WHEN DATEDIFF(day,a.dPreDate,GETDATE()) > -15 AND DATEDIFF(day,a.dPreDate,GETDATE()) < 0 THEN '15天内发货'
|
||||||
|
WHEN DATEDIFF(day,a.dPreDate,GETDATE()) <= -15 THEN '15天以上发货'
|
||||||
|
WHEN DATEDIFF(day,a.dPreDate,GETDATE()) >=0 THEN '超期'
|
||||||
|
END AS datewaring,
|
||||||
|
DATEDIFF(day,a.dPreDate,GETDATE()) as jandate
|
||||||
|
from SO_SODetails a WITH (nolock) left join SO_SOMain b WITH (nolock) on a.ID=b.id
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT ipesodid, sum(iQuantity) AS cqty
|
||||||
|
FROM rdrecords32 WITH (nolock)
|
||||||
|
GROUP BY ipesodid) d on d.ipesodid=a.iSOsID
|
||||||
|
left join
|
||||||
|
(SELECT cinvcode, SUM(iquantity) qty
|
||||||
|
FROM currentstock WITH (nolock)
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
List<string> where = new List<string>();
|
||||||
|
|
||||||
|
where.Add(" a.iQuantity - isnull(d.cqty,0) >0 and b.cVerifier is not null ");
|
||||||
|
|
||||||
|
if (info1.InvCodes != null)
|
||||||
|
{
|
||||||
|
where.Add(" a.cinvcode in @cinvcode");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(info1.InvStd))
|
||||||
|
{
|
||||||
|
where.Add(" g.cInvStd like @cInvStd ");
|
||||||
|
}
|
||||||
|
if (info1.SoCodes != null)
|
||||||
|
{
|
||||||
|
where.Add(" b.cSOCode in @cSOCode ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info1.BeginDate != null && info1.EndDate != null)
|
||||||
|
{
|
||||||
|
where.Add(" b.dDate between @beginDate and @endDate ");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info1.flag != null)
|
||||||
|
{
|
||||||
|
List<string> str = new List<string>();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in info1.flag)
|
||||||
|
{
|
||||||
|
if (item == "1")
|
||||||
|
{
|
||||||
|
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) > -15 AND DATEDIFF(day,a.dPreDate,GETDATE()) < 0) ");
|
||||||
|
}
|
||||||
|
else if (item == "2")
|
||||||
|
{
|
||||||
|
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) <= -15) ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str.Add(" (DATEDIFF(day, a.dPreDate, GETDATE()) >= 0) ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var strs = string.Join(" or ", str.ToArray());
|
||||||
|
|
||||||
|
strs = " ( " + strs + " ) ";
|
||||||
|
|
||||||
|
where.Add(strs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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}%", cSOCode = info1.SoCodes, info1.BeginDate, info1.EndDate });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<object> InventoryPo(NX.ERP.Model.Request.PoOrderRequest info1)
|
public IEnumerable<object> InventoryPo(NX.ERP.Model.Request.PoOrderRequest info1)
|
||||||
{
|
{
|
||||||
string sql = $@"
|
string sql = $@"
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ namespace NX.ERP.WebAPi.Controllers
|
|||||||
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
|
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
|
||||||
return PmcQuery.Inventorysocode(info);
|
return PmcQuery.Inventorysocode(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Route("api/Pmc/InventorySale")]
|
||||||
|
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleOrderRequest info1)
|
||||||
|
{
|
||||||
|
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
|
||||||
|
return PmcQuery.InventorySale(info1);
|
||||||
|
}
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("api/Pmc/InventoryPocode")]
|
[Route("api/Pmc/InventoryPocode")]
|
||||||
|
|||||||
Reference in New Issue
Block a user