服务插件:此操作对该事务的状态无效
金蝶云社区-SunShineBoy
SunShineBoy
1人赞赏了该文章 1,906次浏览 未经作者许可,禁止转载编辑于2016年06月06日 13:26:44

将A单据列表勾选的行数据 赋值到B单据的单据体中 用的是服务插件按钮
FormMetadata meta = MetaDataServiceHelper.Load(this.Context, "QX_LOADTASK") as FormMetadata;
BusinessInfo _info = meta.BusinessInfo;
DynamicObject _currentChangeObj = new DynamicObject(_info.GetDynamicObjectType());
DynamicObjectCollection entryLoadingGoods = _currentChangeObj["FLoadingGoods"] as DynamicObjectCollection;

DynamicObject entryObj = new DynamicObject(_info.GetEntryEntity("FLoadingGoods").DynamicObjectType);
entryLoadingGoods.Add(entryObj);
entryObj["FLOADINGVEHICLE_Id"] = (item["FVEHICLE"] as DynamicObject)["Id"];
entryObj["FLOADINGVHNUM"] = item["FINFOCONTAINERNUM"];
(_currentChangeObj["FLoadingGoods"] as DynamicObjectCollection).Add(entryObj);
OperateOption SaveOption = OperateOption.Create();
IOperationResult result = BusinessDataServiceHelper.Save(this.Context, _info, new DynamicObject[] { _currentChangeObj }, SaveOption, "Save");