105 lines
3.9 KiB
C#
105 lines
3.9 KiB
C#
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 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("FCustID"))
|
|
{
|
|
var custId_Id = e.NewValue.Long2Int();
|
|
if (custId_Id > 0)
|
|
{
|
|
var custId = this.View.Model.GetValue("FCustID", e.Row) as DynamicObject;
|
|
//KHXYFL013
|
|
var creditClassificationId = custId["F_CreditClassification_Id"];
|
|
if (!creditClassificationId.IsNullOrEmptyOrWhiteSpace())
|
|
{
|
|
var creditClassification = custId["F_CreditClassification"] as DynamicObject;
|
|
var number = creditClassification["Number"].ToString();
|
|
|
|
this.View.Model.SetValue("FIsBigCust", number.EqualsIgnoreCase("KHXYFL013"), e.Row);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.View.Model.SetValue("FIsBigCust", false, e.Row);
|
|
}
|
|
}
|
|
|
|
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("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);
|
|
}
|
|
}
|
|
}
|