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);
}
}
}
}
}
推荐阅读
您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!
请选择打赏金币数 *