自己写的插件,销售订单数量值更新,更新单价,代码调试有值,但是显示不出来。标准插件逻辑清空怎么解决啊!!
代码如下
public override void DataChanged(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.DataChangedEventArgs e)
{
base.DataChanged(e);
switch (e.Key)
{
case "FQty":
#region 数量值更新获取阶梯价
DynamicObject cust = this.View.Model.GetValue("FCustId") as DynamicObject;
if (cust == null)
{
this.View.ShowErrMessage("单据头基础资料'客户'不能为空", "", Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error);
return;
}
string sql = "";
//物料引用属性 获取客户系列FXLBase
DynamicObject material = this.View.Model.GetValue("FMaterialId", e.Row) as DynamicObject;
DynamicObject PriceList = this.View.Model.GetValue("FPriceListId") as DynamicObject;
if (material == null)
{
this.View.ShowMessage("单据体基础资料物料不能为空", Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error);
return;
}
if (PriceList == null)
{
this.View.ShowMessage("单据头财务信息价目表不能为空", Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error);
return;
}
//查物料所有信息
sql = string.Format(@"select e.* from T_SAL_ORDER o inner join T_SAL_ORDERENTRY e on o.FID = e.FID
where o.FCANCELSTATUS ='A' and FDOCUMENTSTATUS='C' and e.FMATERIALID = '{0}'", Convert.ToInt64(material["Id"]));
DynamicObjectCollection QtyList = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
int Count = 0;
if (QtyList.Count != 0)
{
Count = Convert.ToInt32(QtyList[0]["FQTY"]) + Convert.ToInt32(this.View.Model.GetValue("FQty", e.Row));
}
else
{
Count = Convert.ToInt32(this.View.Model.GetValue("FQty", e.Row));
}
//物料里面的客户系列
sql = string.Format(@"select * from ABC_t_Cust_Entry100037 where FID='{0}'and F_ABC_CUSTOMER ={1} and F_ABC_FROM <= {2} and F_ABC_TO >= {2} ", PriceList["Id"], Convert.ToInt64(material["FXLBase_Id"]), Count);
DynamicObjectCollection JTJEntry = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
if (JTJEntry == null || JTJEntry.Count == 0)
{
this.View.ShowMessage("不存在阶梯价", Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error);
return;
}
DynamicObject Object = JTJEntry[0];
this.View.Model.BeginIniti();
this.View.Model.SetValue("FPrice",Convert.ToDecimal( Object["F_ABC_DISCOUNTPRICE"]), e.Row);
this.View.Model.SetValue("FTaxPrice",Convert.ToDecimal( Object["F_ABC_DISCOUNTPRICE"]), e.Row);
this.View.Model.EndIniti();
this.View.UpdateView("FPrice",e.Row);
this.View.UpdateView("FTaxPrice",e.Row);
break;
#endregion
}
}
推荐阅读