/// <summary> /// 查询结果集封装对象 /// </summary> /// <param name="coll"></param> /// <returns></returns> private HashSet <SalOutStockBillInfo> BuildSalOutStockBillInfo(DynamicObjectCollection coll) { HashSet <SalOutStockBillInfo> bills = new HashSet <SalOutStockBillInfo>(); SalOutStockBillInfo bill = null; List <SalOutStockEntry> entries = null; SalOutStockEntry entry = null; if (coll != null && coll.Count > 0) { var groups = from l in coll group l by l.DynamicObjectType.Properties.Contains("FBillNo") into g select g; foreach (var group in groups) { if (group != null && group.Count() > 0) { bill = new SalOutStockBillInfo(); entries = new List <SalOutStockEntry>(); bill.SrcNo = SQLUtils.GetFieldValue(group.ElementAt(0), "FBillNo"); bill.OrderBillNo = SQLUtils.GetFieldValue(group.ElementAt(0), "FBillNo"); bill.CustomerNo = SQLUtils.GetFieldValue(group.ElementAt(0), "customerID"); bill.CarriageNO = SQLUtils.GetFieldValue(group.ElementAt(0), "FCARRYBILLNO"); bill.DeliDate = SQLUtils.GetFieldValue(group.ElementAt(0), "F_HS_DeliDate"); bill.LogisticsChannel = SQLUtils.GetLogisticsChannelNo(this.Context, SQLUtils.GetFieldValue(group.ElementAt(0), "F_HS_Channel")); bill.QueryURL = SQLUtils.GetFieldValue(group.ElementAt(0), "F_HS_QueryURL"); foreach (var item in group) { if (item != null) { entry = new SalOutStockEntry(); entry.MaterialNo = SQLUtils.GetFieldValue(item, "materialNO"); entry.Quantity = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "QTY")); entries.Add(entry); } } bill.StockEntry = entries; bills.Add(bill); } } } return(bills); }
/// <summary> /// 查询结果集封装对象 /// </summary> /// <param name="coll"></param> /// <returns></returns> private List <SalOutStockBillInfo> BuildSalOutStockBillInfo(DynamicObjectCollection coll) { List <SalOutStockBillInfo> bills = new List <SalOutStockBillInfo>(); SalOutStockBillInfo bill = null; SalOutStockEntry entry = null; if (coll != null && coll.Count > 0) { foreach (var item in coll) { if (item != null) { bill = new SalOutStockBillInfo(); bill.SrcNo = SQLUtils.GetFieldValue(item, "FDeliBillNo"); bill.BillNo = SQLUtils.GetFieldValue(item, "FDeliBillNo"); bill.OrderBillNo = SQLUtils.GetFieldValue(item, "FBillNo"); bill.CustomerNo = SQLUtils.GetFieldValue(item, "customerID"); bill.CarriageNO = SQLUtils.GetFieldValue(item, "F_HS_CARRYBILLNO"); bill.DeliDate = SQLUtils.GetFieldValue(item, "F_HS_DeliDate"); bill.LogisticsChannel = SQLUtils.GetLogisticsChannelNo(this.K3CloudContext, SQLUtils.GetFieldValue(item, "F_HS_Channel")); bill.QueryURL = SQLUtils.GetFieldValue(item, "F_HS_QueryURL"); entry = new SalOutStockEntry(); entry.StockName = SQLUtils.GetFieldValue(item, "F_HS_STOCKHSNAME"); entry.MaterialNo = SQLUtils.GetFieldValue(item, "materialNO"); entry.Quantity = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "QTY")); entry.Price = Math.Round(Convert.ToDecimal(SQLUtils.GetFieldValue(item, "price")), 4); entry.IntegralReturnRate = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "F_HS_IntegralReturnRate")); bill.StockEntry.Add(entry); bills.Add(bill); } } } return(bills); }
/// <summary> /// 获取明细信息 /// </summary> /// <param name="bills"></param> /// <returns></returns> private static List <SalOutStockEntry> GetSalOutStockEntry(List <SalOutStockBillInfo> bills) { List <SalOutStockEntry> entries = null; SalOutStockEntry entry = null; if (bills != null && bills.Count > 0) { entries = new List <SalOutStockEntry>(); foreach (var bill in bills) { if (bill != null) { if (bill.StockEntry != null && bill.StockEntry.Count > 0) { foreach (var en in bill.StockEntry) { if (en != null) { entry = new SalOutStockEntry(); entry.StockName = en.StockName; entry.MaterialNo = en.MaterialNo; entry.Quantity = en.Quantity; entry.Price = en.Price; entry.IntegralReturnRate = en.IntegralReturnRate; entries.Add(entry); } } } } } } return(entries); }