工序计划下推二开单据,下推行都是默认第一行的二开问题解决
【应用场景】
通过工序计划下推生成的二开单据(配置转换规则),下推行的问题,因为工序计划的特殊性(单据头单据体子单据体三层结构),下推的时候默认都是找第一行数据。所以需要二开代码特殊处理下。
【实现步骤】
<1>配置好工序计划到二开单据的单据转换规则
<2>编写二开插件,参考示例如下:
using Kingdee.BOS.Core; using Kingdee.BOS.Core.Const; using Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args; using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using Kingdee.K3.Core.MFG.EnumConst; using Kingdee.K3.MFG.App; using Kingdee.K3.MFG.App.ConvertPlugIn; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Kingdee.BOS; using Kingdee.BOS.Core.Metadata; using Kingdee.K3.Core.MFG.EntityHelper; using Kingdee.K3.MFG.SFC.App.BillConvertServicePlugIn.Utils; using Kingdee.K3.Core.MFG; namespace Kingdee.K3.MFG.SFC.App.BillConvertServicePlugIn { public class Class1 : BaseBillConvertServicePlugIn { /// <summary> /// 下推、从选单界面选择行返回后 /// </summary> /// <param name="e"></param> public override void OnInSelectedRow(InSelectedRowEventArgs e) { base.OnInSelectedRow(e); string subFilter = GetPlanSubEntryFilter(e); if (!subFilter.IsNullOrEmpty()) e.InSelectedRowsSQL = e.InSelectedRowsSQL.JoinFilterString(subFilter, "AND"); } /// <summary> /// 获取源单中子单据体选择行的过滤条件 /// </summary> /// <param name="e">下推事件</param> /// <returns>过滤条件</returns> private string GetPlanSubEntryFilter(BOS.Core.Metadata.ConvertElement.PlugIn.Args.InSelectedRowEventArgs e) { string filterStr = string.Empty; List<long> detailIds = new List<long>(); string subEntityKey = "FSubEntity"; Entity subEntity = e.SourceBusinessInfo.GetEntity(subEntityKey); foreach (var selectRow in e.SelectedRows) { string detailId = "0"; //从选择行中获取子弹据体主键 if (selectRow.FieldValues.TryGetValue(subEntityKey, out detailId)) { detailIds.Add(Convert.ToInt64(detailId)); } } if (detailIds.Count > 0) { //生成过滤条件:FSubEntity_FDetailId in (10001,10002) filterStr = string.Format("{0}_{1} in ({2})", subEntityKey, subEntity.EntryPkFieldName, string.Join(",", detailIds)); } return filterStr; } } }
<3>BOSIDE上面注册二开插件,保存,重启IIS
【参考资料】
【二开案例.基础资料.联动查询(GetValue)】
https://vip.kingdee.com/article/127710528226504960
【金蝶云星空BOS二次开发案例演示】
https://vip.kingdee.com/article/94751030918525696
工序计划下推二开单据,下推行都是默认第一行的二开问题解决
【应用场景】通过工序计划下推生成的二开单据(配置转换规则),下推行的问题,因为工序计划的特殊性(单据头单据体子单据体三层结构),下...
点击下载文档
本文2024-09-23 03:29:27发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-159193.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章