using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice { [HotUpdate, Description("客户价格管理_表单插件")] public class Bill : AbstractBillPlugIn { public override void OnLoad(EventArgs e) { base.OnLoad(e); } public override void AfterBindData(EventArgs e) { base.AfterBindData(e); var limitCustomer = this.View.Model.GetValue("FLimitCustomer").Long2Int(); SetBillContral(limitCustomer == 1); } public override void BeforeF7Select(BeforeF7SelectEventArgs e) { base.BeforeF7Select(e); } /// /// 下拉框根据编号取值前事件 /// /// public override void BeforeSetItemValueByNumber(BeforeSetItemValueByNumberArgs e) { base.BeforeSetItemValueByNumber(e); } /// /// 值更新事件 /// /// public override void DataChanged(DataChangedEventArgs e) { base.DataChanged(e); if (e.Field.Key.EqualsIgnoreCase("FLimitCustomer")) { var val = e.NewValue.Long2Int(); SetBillContral(val == 1); } if (e.Field.Key.EqualsIgnoreCase("FMaterialId")) { var materialId_Id = e.NewValue.Long2Int(); if (materialId_Id > 0) { var materialId = this.View.Model.GetValue("FMaterialId", e.Row) as DynamicObject; var cbj = materialId["F_CBJ"]; var jsj = materialId["F_JSJ"]; this.View.Model.SetValue("F_CostPrice", cbj, e.Row); this.View.Model.SetValue("F_SettlePrice", jsj, e.Row); } else { this.View.Model.SetValue("F_CostPrice", 0, e.Row); this.View.Model.SetValue("F_SettlePrice", 0, e.Row); } } } private void SetBillContral(bool visible) { visible = !visible; this.View.GetControl("F_MaterialModelGroup").Visible = !visible; this.View.GetControl("F_BigCustSettlePrice").Visible = !visible; this.View.GetControl("F_BigCustDiscRate").Visible = !visible; this.View.GetControl("FMaterialId").Visible = visible; this.View.GetControl("FMaterialName").Visible = visible; this.View.GetControl("FMaterialModel").Visible = visible; this.View.GetControl("F_AgreePrice").Visible = visible; this.View.GetControl("FTab_P1").Visible = visible; //字段必录项 mustinput 必须为小写 this.View.GetControl("F_MaterialModelGroup").SetCustomPropertyValue("mustinput", !visible); this.View.GetControl("F_BigCustSettlePrice").SetCustomPropertyValue("mustinput", !visible); this.View.GetControl("FMaterialId").SetCustomPropertyValue("mustinput", visible); this.View.GetControl("F_AgreePrice").SetCustomPropertyValue("mustinput", visible); this.View.GetControl("FCustID").SetCustomPropertyValue("mustinput", visible); } } }