更新基础资料数据

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

更新基础资料数据

using System;
using System.Text;
using System.ComponentModel;
using System.Collections.Generic;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Validation;
using Kingdee.K3.Core.FIN;
using Kingdee.BOS.Core;
using Kingdee.K3.SCM.App.Validator;
using Kingdee.K3.BD.Contracts.FIN;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS;
using Kingdee.BOS.Log;
using Kingdee.BOS.Util;
namespace QJ.xunjia.plugIn
{
    [Description("审核操作更新物料"), HotUpdate]
    public class sss : AbstractOperationServicePlugIn
    {
        public override void OnPreparePropertys(PreparePropertysEventArgs e)//加载必要的字段属性
        {
            if (this.FormOperation.Operation.ToUpperInvariant() == "AUDIT")//审核
            {
                e.FieldKeys.Add("F_BEC_WL");
                e.FieldKeys.Add("F_BEC_Price1");
                return;
            }
        }

        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            if (this.FormOperation.Operation.ToUpperInvariant() == "AUDIT")//审核
            {
                foreach (DynamicObject entity in e.DataEntitys)
                {
                    if (entity != null)
                    {
                        DynamicObjectCollection obj = entity["FEntity"] as DynamicObjectCollection;
                        
                        for (int i = 0; i < obj.Count; i++)
                        {
                            string F_BEC_WL_Id = Convert.ToString(obj[i]["F_BEC_WL_Id"]);
                            string F_BEC_Price1 = Convert.ToString(obj[i]["F_BEC_Price1"]);

                            // 需要输出的字段集合,通过限定输出字段,减少数据传输量
                            List<SelectorItemInfo> goodsFields = new List<SelectorItemInfo>();
                            goodsFields.Add(new SelectorItemInfo("FMATERIALID"));
                            goodsFields.Add(new SelectorItemInfo("F_BEC_MODIFIERIDMC"));
                            goodsFields.Add(new SelectorItemInfo("F_BEC_TEXT"));
                            goodsFields.Add(new SelectorItemInfo("FREFCOST"));

                            OQLFilter filter = new OQLFilter();
                            filter.Add(new OQLFilterHeadEntityItem() { FilterString = string.Format(" FMASTERID  = '{0}' ", F_BEC_WL_Id) });
                            //数据库查询基础资料数据
                            DynamicObject[] materials = BusinessDataServiceHelper.Load(this.Context, "BD_MATERIAL", goodsFields, filter);
                            foreach (DynamicObject doItem in materials)
                            {
                                doItem["F_BEC_ModifierIdMC_Id"] = this.Context.UserId;
                                doItem["F_BEC_Text"] = DateTime.Now.ToString("yyyy/MM/dd");
                            }
                            //存储业务数据 
                            BusinessDataServiceHelper.Save(this.Context, materials);
                        }
                    }
                }
            }
        }
    }
}


更新基础资料数据

using System;using System.Text;using System.ComponentModel;using System.Collections.Generic;using Kingdee.BOS.Core.DynamicForm.Plu...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息