using System;
|
using System.Collections.Generic;
|
using Kingdee.BOS.Util;
|
using Kingdee.BOS.Core.Metadata;
|
using Kingdee.BOS.Core.Metadata.EntityElement;
|
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
using Kingdee.BOS.Orm.DataEntity;
|
using Kingdee.BOS.Contracts;
|
using Kingdee.BOS.App;
|
using Kingdee.BOS.Core.Metadata.FieldElement;
|
using System.ComponentModel;
|
using Kingdee.BOS.ServiceHelper;
|
using Kingdee.K3.SCM.App;
|
|
|
namespace Demo.BillView.PRD
|
{
|
[Description("[生产订单-保存]服务插件 更新日计划工单数量]")]
|
[HotUpdate]
|
public class Pro_MoSave : AbstractOperationServicePlugIn
|
{
|
public override void OnPreparePropertys(PreparePropertysEventArgs e)
|
{
|
base.OnPreparePropertys(e);
|
e.FieldKeys.Add("FTreeEntity_FEntryID");
|
e.FieldKeys.Add("FDayPlanQty");
|
e.FieldKeys.Add("FDayPlanRemainQty");
|
}
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="e"></param>
|
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
|
{
|
base.AfterExecuteOperationTransaction(e);
|
List<string> sqlList = new List<string>();
|
string sql = "";
|
//审核时更新生产用料清单表明细领料数量
|
Entity entity = this.BusinessInfo.GetEntity("FTreeEntity");//获取明细信息
|
foreach (var billObj in e.SelectedRows)
|
{
|
DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
|
as DynamicObjectCollection;
|
foreach (var entryRow in entryRows)
|
{
|
var FDayPlanQty = entryRow["FDayPlanQty"];
|
var FDayPlanRemainQty = entryRow["FDayPlanRemainQty"];
|
var fentryId = entryRow["Id"];
|
if (Convert.ToDecimal(FDayPlanQty) == 0 && Convert.ToDecimal(FDayPlanRemainQty) == 0)
|
{
|
sql = string.Format($"/*dialect*/update T_PRD_MOENTRY set FDayPlanRemainQty = FQTY where FentryId = {fentryId}");
|
DBServiceHelper.Execute(Context, sql);
|
}
|
else
|
continue;
|
}
|
}
|
}
|
}
|
}
|