[Description("值更新插件")]
[HotUpdate]
public class FinishedProductInspectUpdate:AbstractBillPlugIn
{
//const string FieldKey2 = "F_XDUA_PlanValidPeriod";//计划周期
/// <summary>
/// 字段值更新触发
/// </summary>
/// <param name="e"></param>
public override void DataChanged(DataChangedEventArgs e)
{
base.DataChanged(e);
this.View.ShowErrMessage("1");
////只判断车型字段
if (e.Field.Key.ToString() == "F_UIMB_Base_CheXing")
{
this.View.ShowErrMessage("2");
DynamicObject CxModel = Utils.LoadDynamicObject(this.Context, "UIMB_CPJYXMPZ", $"FID=''");
DynamicObjectCollection CxModelEntry = CxModel["UIMB_Cust_Entry100008"] as DynamicObjectCollection;//查询选中车型
Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity"); //FEntity为单据体标识
DynamicObjectCollection entityrows = entity.DynamicProperty.GetValue(this.Model.DataObject) as DynamicObjectCollection;
int num = 0;
this.View.Model.DeleteEntryData("FEntity");//清空整个单据体数据
foreach (var rowObj in CxModelEntry.ToList())
{
this.Model.CreateNewEntryRow("FEntity");//增加单据行
this.View.Model.SetValue("F_UIMB_Project", Convert.ToString(rowObj["F_UIMB_Project"]), num);//项目
this.View.Model.SetValue("F_UIMB_JYBZYQ", Convert.ToString(rowObj["F_UIMB_XMJYBZYQ"]), num);//项目
num++;
}
this.View.Model.ClearNoDataRow();
this.View.UpdateView("FEntity");
}
}
}
推荐阅读