bom成本查询如果加工费来源于价目表,显示对应的委外供应商
在bom成本查询单据体增加供应商基础资料,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Kingdee.K3.Core.MFG.EntityHelper;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using System.ComponentModel;
using Kingdee.BOS.Core.Permission;
using Kingdee.BOS.App.Data;
using System.Data;
using Kingdee.BOS.Core.Metadata;
namespace Kingdee.K3.MFG.ENG.Business.PlugIn.DynamicForm.BomQueryCost1
{
[Description("获取委外加工供应商")]
[HotUpdate]
public class BomQueryCostExtend : BomQueryCost
{
public override void ButtonClick(ButtonClickEventArgs e)
{
base.ButtonClick(e);
if(e.Key =="FREFRESH")
{
Entity entity = this.Model.BillBusinessInfo.GetEntryEntity("FBottomEntity");
DynamicObjectCollection dataEntity = this.Model.GetEntityDataObject(entity);//获取单据体数据包
foreach(var item in dataEntity)
{
decimal price = Convert.ToDecimal(item["SubPrice"]);//获取委外加工单价
if (price > 0)
{
DynamicObject MaterialObj = (DynamicObject)item["MaterialId"];//获取物料数据包
string MaterialId = Convert.ToString(MaterialObj["ID"]);//获取物料ID
DynamicObject CurrObj = (DynamicObject)item["CurrId"];//获取币别数据包
string CurrId_Id = Convert.ToString(CurrObj["ID"]);//获取币别ID
//获取根据物料价格币别获取委外价目表里面的供应商
string Sql = string.Format(@"select b.FSUPPLIERID from t_PUR_PriceListEntry a join t_PUR_PriceList b on a.FID = b.fid
where b.FPRICETYPE = '3' and a.FMATERIALID = '{0}' and a.FPRICE ='{1}' and b.FCURRENCYID = '{2}'", MaterialId, price, CurrId_Id);
DataTable ds = DBUtils.ExecuteDataSet(this.Context, Sql).Tables[0];
var supid = Convert.ToInt32(ds.Rows[0]["FSUPPLIERID"]);//获取供应商内码
//var supid1 = ds.Rows[0]["FSUPPLIERID"];//
FormMetadata meta = (FormMetadata)MetaDataServiceHelper.Load(this.Context, "BD_Supplier");
var supOjb = BusinessDataServiceHelper.LoadSingle(this.Context, supid, meta.BusinessInfo.GetDynamicObjectType());//获取供应商数据包
item.SetDynamicObjectItemValue("F_PDXQ_wwgys", supOjb); //将供应商数据包赋值给单据体供应商基础资料字段
}
}
View.UpdateView("FBottomEntity");
}
}
}
}
重写点击事件参考帖子:https://wenku.my7c.com/article/555409063366887936?productLineId=1&lang=zh-CN
根据内码获取数据包参考帖子:https://wenku.my7c.com/questions/477522038479679488/answers/477529079675990272?productLineId=1&lang=zh-CN
bom成本查询如果加工费来源于价目表,显示对应的委外供应商
本文2024-09-16 19:09:03发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-26727.html