private DynamicObject[] LoadPurchaseOrder(HashSet
{
IViewService viewService = ServiceHelper.GetService
string formId = "PUR_ReceiveBill";//单据标识
// 指定需要加载的采购订单字段
List
fields.Add(new SelectorItemInfo("FID")); // 单据主键
fields.Add(new SelectorItemInfo("FEntryID")); // 单据体主键
fields.Add(new SelectorItemInfo("FBillNo")); // 单据编号
fields.Add(new SelectorItemInfo("FBFLowId")); // 业务流程
fields.Add(new SelectorItemInfo("FMasterId")); // 物料
fields.Add(new SelectorItemInfo("FBaseUnitQty")); // 基本单位数量
fields.Add(new SelectorItemInfo("FJoinBaseQty")); // 基本单位关联数量
// 指定过滤条件
string filter = string.Format(" FBillNo IN ('{0}') ", string.Join("','", poBillNos));
OQLFilter ofilter = OQLFilter.CreateHeadEntityFilter(filter);
var objs = viewService.Load(this.Context, formId, fields, ofilter);
return objs;
}
///
/// 把采购订单单据体行构建为字典:Dictionary(单据编号, Dictionary(物料编码, 源单行));
///
///
///
private Dictionary
{
Dictionary
new Dictionary
foreach (var poObj in poObjs)
{
string billNo = Convert.ToString(poObj["BillNo"]);
Dictionary
DynamicObjectCollection entryRows = poObj["PUR_ReceiveEntry"] as DynamicObjectCollection;
foreach (var entryRow in entryRows)
{
DynamicObject materialObj = entryRow["FMaterialId"] as DynamicObject;//物料ID
if (materialObj == null) continue;
string materialNumber = Convert.ToString(materialObj["number"]);
dctOneBill[materialNumber] = entryRow;
}
dctAllBills.Add(billNo, dctOneBill);
}
return dctAllBills;
}
红色 代码 方法 是怎样的一个 逻辑 取不到值
推荐阅读