调用服务来保存单据,在单据插件里面写保存单据的过程,业务需求就是一张入库单生成多张销售出库单和入库单
中间的赋值过程不会写,求指导。。。
public IOperationResult OutStock_Save()
{
//获取销售出库单的元数据
FormMetadata meta = MetaDataServiceHelper.Load(this.Context, "SAL_OUTSTOCK") as FormMetadata;
BusinessInfo info = meta.BusinessInfo;
DynamicObject objData = new DynamicObject(info.GetDynamicObjectType());
EntryEntity recEntity = (EntryEntity)info.GetEntity("FEntity");
DynamicObject recObj = null;
objData["SaleOrgId_Id"] = 100892;
objData["StockOrgId_Id"] = 100892;
objData["CustomerID_Id"] = 873825;
objData["ReceiverID_Id"] = 100892;
objData["SettleID_Id"] = 100892;
objData["PayerID_Id"] = 100892;
int Seq = 1;
//for (int i = 0; i < dt.Rows.Count; i++)
//{
recObj = new DynamicObject(recEntity.DynamicObjectType);
recEntity.DynamicProperty.GetValue
//recEntity.Seq = Seq;
recObj["Seq"] = Seq;
recObj["MaterialID_Id"] = 769107;
recObj["UnitID_Id"] = 10101;
recObj["BaseUnitID_Id"] = 10101;
recObj["AuxPropId_Id"] = 100021;
recObj["RealQty"] = 1;
recObj["StockID_Id"] = 145485;
recObj["Lot_Id"] = 1439283;
recObj["Lot_text"] = "123123123";
info.Entrys[2] = recEntity;
//Seq++;
//}
//然后调用保存服务接口,得到保存结果result
IOperationResult result = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.Save(this.Context, info, objData, null, "Save");
return result;
}
推荐阅读