服务插件

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

服务插件

using System;

using System.Collections.Generic;

using System.Text;

using Kingdee.BOS.Log;

using Kingdee.BOS.Util;

using System.ComponentModel;

using Kingdee.BOS.Orm.DataEntity;

using Kingdee.BOS.ServiceHelper;

using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;

using Kingdee.BOS.Core;

using Kingdee.BOS.Core.DynamicForm.PlugIn;

namespace QJ.xunjia.plugIn

{

    [Description("【服务插件】"), HotUpdate]

    public class UpdatePlugIn : AbstractOperationServicePlugIn

    {

        public override void OnPreparePropertys(PreparePropertysEventArgs e)

        {

            base.OnPreparePropertys(e);

            if (this.FormOperation.Operation.ToUpperInvariant() == "AUDIT")

            {

                e.FieldKeys.Add("F_BEC_WL");

            }

        }

        public override void EndOperationTransaction(EndOperationTransactionArgs e)

        {

            base.EndOperationTransaction(e);

            if (this.FormOperation.Operation.ToUpperInvariant() == "AUDIT")

            {

                List<string> sqlList = new List<string>();

                var entity1 = this.BusinessInfo.GetEntity("FEntity");

                foreach (DynamicObject entity in e.DataEntitys)

                {

                    DynamicObjectCollection entry = (DynamicObjectCollection)entity[entity1.DynamicProperty.Name];

                    foreach (var entityRow in entry)

                    {

                        DynamicObject F_BEC_WL = entityRow["F_BEC_WL"] as DynamicObject;

                        string WLNumber = Convert.ToString(F_BEC_WL["Number"]);

                        var sql = string.Format(@"/*dialect*/

update T_BD_MATERIAL set F_BEC_MODIFIERID={1},F_BEC_MODIFIERTIME='{2}' from 

T_BD_MATERIAL t1 inner join T_BD_MATERIALSTOCK t2 on t1.FMATERIALID=t2.FMATERIALID where t1.FNUMBER='{0}'"

                         , WLNumber, this.Context.UserId, DateTime.Now.ToString("yyyy/MM/dd"));

                         sqlList.Add(sql);

                    }

                }

                if (sqlList.Count > 0)

                {

                    DBServiceHelper.ExecuteBatch(this.Context, sqlList);

                }

            }

        }

    }

}


服务插件

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