到货单

This commit is contained in:
杰 朱
2021-05-31 17:06:19 +08:00
parent aa9153e25b
commit 504e915b52
17 changed files with 733 additions and 31 deletions

View File

@@ -7,7 +7,7 @@ namespace NX.ERP.U8.Purchase
{
public class ArrivalDAL
{
public IEnumerable<Model.Purchase.Arrival> GetList(string strWhere = "", object param = null)
public IEnumerable<Model.Purchase.Arrival> GetList(List<string> strWhere , object param = null)
{
using (var conn = U8LoginContext.Instance.Connection)
{
@@ -17,18 +17,35 @@ namespace NX.ERP.U8.Purchase
b.cBatch AS BatchNo,
b.fvalidinquan as RealQuantity,
b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum,
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate,
Pos.cPosName
FROM pu_ArrBody b inner join pu_ArrHead a on a.id=b.id
inner join (select cinvcode as cinvcode1,iId from inventory) inventory on b.cinvcode=inventory.cinvcode1
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工')
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID ,
(SELECT cinvcode,
STUFF(
(
SELECT ','+ cPosName FROM ( select b.cPosName,a.cInvCode,a.iQuantity from InvPositionSum a WITH (NOLOCK) left join Position b WITH (NOLOCK) on a.cPosCode=b.cPosCode
where a.iQuantity <>0) a WHERE b.cinvcode = a.cinvcode order by a.iQuantity desc FOR XML PATH('')
),1 ,1, '') cPosName
FROM InvPositionSum b
GROUP BY cinvcode
) Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>''
And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1";
if (!string.IsNullOrEmpty(strWhere))
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
";
var aa = string.Join(" and ", strWhere.ToArray());
if (!string.IsNullOrEmpty(aa))
{
strSQL += $" and {strWhere} ";
strSQL += " and " + aa;
}
var lookup = new Dictionary<int, Model.Purchase.Arrival>();
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
var list = conn.Query<Model.Purchase.Arrival, Model.Purchase.ArrivalDetail, Model.Purchase.Arrival>(strSQL, (arrival, ArrivalDetail) =>
@@ -51,32 +68,54 @@ namespace NX.ERP.U8.Purchase
public Model.Purchase.Arrival GetModel(int id)
{
return this.GetList(" a.id=@Id ", new { id }).FirstOrDefault();
List<string> where = new List<string>();
where.Add("a.id=@Id");
return this.GetList(where, new { id }).FirstOrDefault();
}
public IEnumerable<Model.Purchase.Arrival> Query(NX.ERP.Model.Request.Arrival arrival)
{
var where = "";
List<string> where = new List<string>();
//处理-
if (!string.IsNullOrEmpty(arrival.cInvCode) )
{
where.Add(" b.cinvcode = @cinvcode");
}
if (arrival.ArrivalNolist != null && arrival.ArrivalNolist.Count > 0)
{
where.Add(" a.cCode in @cCodelist");
}
if (!string.IsNullOrEmpty(arrival.ArrivalNo))
{
where = " a.cCode like @Code ";
where.Add(" a.cCode = @cCode");
}
return this.GetList(where, new { Code = $"%{arrival.ArrivalNo}%" });
return this.GetList(where, new { cCodelist = arrival.ArrivalNolist, cinvcode= arrival.cInvCode, cCode = arrival.ArrivalNo });
}
public IEnumerable<Model.Purchase.Arrival> GetListByLastId(int Id)
{
List<string> where = new List<string>();
return this.GetList(" a.id>=@Id ", new { Id });
where.Add(" a.id>=@Id ");
return this.GetList(where, new { Id });
}
public Model.Purchase.Arrival GetModel(string Code)
{
return this.GetList(" a.cCode=@Code ", new { Code }).FirstOrDefault();
List<string> where = new List<string>();
where.Add(" a.cCode=@Code ");
return this.GetList(where, new { Code }).FirstOrDefault();
}