采购入库成功
This commit is contained in:
@@ -7,19 +7,25 @@ namespace NX.ERP.U8.Purchase
|
||||
{
|
||||
public class ArrivalDAL
|
||||
{
|
||||
public IEnumerable<Model.Purchase.Arrival> GetList()
|
||||
public IEnumerable<Model.Purchase.Arrival> GetList(string strWhere = "", object param = null)
|
||||
{
|
||||
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||
{
|
||||
|
||||
string strSQL = @"select a.id,a.cCode as ArrivalCode,a.dDate as date,A.cVenCode AS SupplierCode,
|
||||
B.Autoid as id,b.ID as ArrivalID,
|
||||
b.cInvCode AS MaterielCode,
|
||||
b.cBatch AS BatchNo,
|
||||
b.cUnitID AS UnitCode,
|
||||
B.iQuantity as Quantity
|
||||
from PU_ArrivalVouch as a
|
||||
left join PU_ArrivalVouchs as b on a.id=b.id";
|
||||
string strSQL = @"select a.id,a.cCode as ArrivalCode,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as date,A.cVenCode AS SupplierCode,
|
||||
B.Autoid as id,b.ID as ArrivalID,
|
||||
b.cInvCode AS MaterielCode,
|
||||
b.cBatch AS BatchNo,
|
||||
b.cUnitID AS UnitCode,
|
||||
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from
|
||||
pu_ArrHead as a
|
||||
left join pu_arrbody as b on a.id=b.id
|
||||
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" where {strWhere} ";
|
||||
}
|
||||
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) =>
|
||||
@@ -27,16 +33,31 @@ namespace NX.ERP.U8.Purchase
|
||||
if (!lookup.TryGetValue(arrival.Id, out var _arrival))
|
||||
{
|
||||
lookup.Add(arrival.Id, arrival);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
arrival = _arrival;
|
||||
}
|
||||
|
||||
arrival.ArrivalDetails.Add(ArrivalDetail);
|
||||
return arrival;
|
||||
}, null, null, true, "id", 10, System.Data.CommandType.Text);
|
||||
}, param, null, true, "id", 10, System.Data.CommandType.Text);
|
||||
return lookup.Values;
|
||||
}
|
||||
}
|
||||
|
||||
public Model.Purchase.Arrival GetModel(int id)
|
||||
{
|
||||
return this.GetList(" a.id=@Id ", new { id }).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Model.Purchase.Arrival GetModel(string Code)
|
||||
{
|
||||
return this.GetList(" a.cCode=@Code ", new { Code }).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user