增加单据异常查询
This commit is contained in:
@@ -83,6 +83,54 @@ namespace NX.ERP.U8.Finance
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<object> Voucherror(NX.ERP.Model.Request.VouchererrorRequest info)
|
||||
{
|
||||
string sql = $@"
|
||||
select *from (
|
||||
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'超领' as error from mom_moallocate a WITH (NOLOCK)
|
||||
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
|
||||
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
|
||||
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
|
||||
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
|
||||
where a.Qty < a.IssQty
|
||||
|
||||
union all
|
||||
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'缺领' as error from mom_moallocate a WITH (NOLOCK)
|
||||
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
|
||||
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
|
||||
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
|
||||
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
|
||||
where a.IssQty < a.Qty*(b.QualifiedInQty/b.qty)
|
||||
) mm
|
||||
";
|
||||
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
if (info.Ccode != null)
|
||||
{
|
||||
where.Add(" mm.MoCode in @Ccode");
|
||||
}
|
||||
if (info.error != null)
|
||||
{
|
||||
where.Add(" mm.error in @error");
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 { info.Ccode, info.error });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user