销售出库、采购入库、生产领料、直接调拨 修改单据的仓位展示为固定列,注册单据插件
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace xxx.K3.SCM.Bill.Oprate
{
[Kingdee.BOS.Util.HotUpdate]
[Description("修改仓位为固定列时,仓位维度显示格式为“仓位.XX维度")]
public class ModifyStorelocationName : AbstractBillPlugIn
{
/// <summary>
/// 处理仓位固定列字段标题
/// </summary>
/// <param name="e"></param>
public override void AfterBindData(EventArgs e)
{
base.AfterBindData(e);
string entityKey = "";
switch (base.View.BusinessInfo.GetForm().Id.ToUpper())
{
//销售出库单
case "SAL_OUTSTOCK":
entityKey = "FEntity";
break;
//采购入库单
case "STK_INSTOCK":
entityKey = "FInStockEntry";
break;
//生产领料单
case "PRD_PICKMTRL":
entityKey = "FEntity";
break;
//直接调拨单
case "STK_TRANSFERDIRECT":
entityKey = "FBillEntry";
break;
//case "STK_TRANSFERAPPLY":
// entityKey = "FEntity";
// break;
//case "STK_TRANSFERDIRECT":
// entityKey = "FBillEntry";
// break;
}
if (string.IsNullOrWhiteSpace(entityKey))
{
return;
}
EntryEntity entryEntity = base.View.BusinessInfo.GetEntryEntity(entityKey);
if (entryEntity != null)
{
//linq搜索符合条件的仓位字段
List<RelatedFlexGroupField> locFields = (from x in entryEntity.Fields.OfType<RelatedFlexGroupField>()
where x.BDFlexType != null && x.BDFlexType.FormId == "BD_FLEXVALUESDETAIL" && x.FlexDisplayFormat == FlexType.Format.FIXEDCOLUMN
select x).ToList();
if (locFields != null && locFields.Count >= 1)
{
EntryGrid entryGrid = base.View.GetControl(entryEntity.Key) as EntryGrid;
foreach (RelatedFlexGroupField locField in locFields)
{
RelatedFlexGroupFieldAppearance locFieldApp = base.View.LayoutInfo.GetAppearance(locField.Key) as RelatedFlexGroupFieldAppearance;
if (locFieldApp != null)
{
List<FieldAppearance> locSubFieldApps = locFieldApp.RelateFlexLayoutInfo.GetFieldAppearances();
foreach (FieldAppearance locSubApp in locSubFieldApps)
{
string colKey = string.Format("$${0}__{1}", locField.Key.ToUpper(), locSubApp.Field.FieldName);
//标题修改为仓位+维度
string caption = string.Format("{0}.{1}", locFieldApp.Caption, locSubApp.Caption);
entryGrid.UpdateHeader(colKey, caption);
//设置维度可见性
//locSubApp.Visible = 28;
}
}
}
}
}
}
}
}
BOS可以直接设置,写插件的目的是?
销售出库、采购入库、生产领料、直接调拨 修改单据的仓位展示为固定列,注册单据插件
本文2024-09-16 18:38:32发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-23452.html