子单据特携带问题
1. 根据源单编号获取源单的数据信息
2. 将源单的数据信息填充到当前单据中
public override void AfterConvert(AfterConvertEventArgs e)
{
base.AfterConvert(e);
if (e.Result == null)
return;
string formId = e.TargetBusinessInfo.GetForm().Id;
var targetBillResults = e.Result.FindByEntityKey("FBillHead");
targetBillResults.Select(item => item.DataEntity).ToList().ForEach(headObj =>
{
DynamicObject[] gyList = MyUtils.LoadDynamicObjectList(this.Context, "xxxxxx", " FBILLNO ='" + headObj["F_YCVE_SourceNo"] + "'", "", null);
if (gyList.Length > 0)
{
DynamicObject gyObj = gyList[0];
if (gyObj != null)
{
//headObj["YCVE_GBXX"] = gyObj["YCVE_GBXX"];
var JGList = headObj["YCVE_SJGB"] as DynamicObjectCollection;
JGList.Clear();
DynamicObjectCollection dyList = gyObj["YCVE_GBXX"] as DynamicObjectCollection;
foreach (var dy in dyList)
{
var addEntity = new DynamicObject(JGList.DynamicCollectionItemPropertyType);
addEntity["FGBH"] = dy["FGBH"];
JGList.Add(addEntity);
}
}
}
});
}