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_SCTLFSH : AbstractOperationServicePlugIn
|
{
|
public override void OnPreparePropertys(PreparePropertysEventArgs e)
|
{
|
base.OnPreparePropertys(e);
|
e.FieldKeys.Add("FSrcBillType");
|
e.FieldKeys.Add("FSrcBillNo");
|
e.FieldKeys.Add("FID");
|
e.FieldKeys.Add("FTreeEntity_FEntryID");
|
e.FieldKeys.Add("FBillNo");
|
e.FieldKeys.Add("FBFLowId");
|
e.FieldKeys.Add("FMaterialId");
|
e.FieldKeys.Add("FBaseUnitQty");
|
e.FieldKeys.Add("FBaseJoinQty");
|
e.FieldKeys.Add("FDayPlanBillNo");
|
e.FieldKeys.Add("FDayPlanFentryId");
|
e.FieldKeys.Add("FisFX");
|
}
|
/// <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("FEntity");//获取明细信息
|
foreach (var billObj in e.SelectedRows)
|
{
|
DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
|
as DynamicObjectCollection;
|
foreach (var entryRow in entryRows)
|
{
|
//生产用料清单为空时
|
if (Convert.ToString(entryRow["FDayPlanBillNo"]) == "" || !Convert.ToBoolean(entryRow["FisFX"]))
|
continue;
|
string fentryId = entryRow["FDayPlanFentryId"].ToString();
|
decimal FBaseQty = Convert.ToDecimal(entryRow["BaseQty"]);
|
sql = string.Format($"/*dialect*/update Sc_DayPlanPPBomBillSub set FRetunrnQty -= {FBaseQty} where FEntryID = { fentryId} ");
|
sqlList.Add(sql);
|
sql = string.Format($"/*dialect*/update T_PRD_RETURNMTRLENTRY set FisFX = 0 where FentryId = {entryRow["Id"]}");
|
sqlList.Add(sql);
|
}
|
}
|
DBServiceHelper.ExecuteBatch(Context, sqlList);
|
}
|
}
|
}
|