套打.二开案例.条码打印按照仓位字段排序

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

套打.二开案例.条码打印按照仓位字段排序

# 【场景】 针对部分字段,列表不支持字段排序(如仓位),同时不支持列表多选(无法修改返回顺序); 在条码打印中需要按照数据仓位排序打印时无法实现。 # 【案例】 即时库存、条码打印,按照仓位组合值排序 # 【方案】 在条码打印界面(BD_BarCodePrint),配置表单插件,增加一个排序的单据体菜单;对单据体数据包进行排序,排序后打印则按照仓位顺序输出。 ![image.webp](/download/0100b8cc9205a56942d7858e8a62b10e321b.webp) ![image.webp](/download/01003b23127f624840bf907b0f1779b2fbcc.webp) ```csharp using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Core.Metadata.FieldElement; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; namespace DynamicFormPlugIn.BarCodePrint { public class BarcodePlugIn : AbstractBillPlugIn { public override void EntryBarItemClick(BarItemClickEventArgs e) { base.EntryBarItemClick(e); if (e.BarItemKey.EqualsIgnoreCase("CustomSort")) { SortEntity(); } } private void SortEntity() { const string EntityKey = "FEntityToBill"; const string SortField = "FSTOCKLOCID"; EntryEntity entity = View.BillBusinessInfo.GetEntity(EntityKey) as EntryEntity; if (entity == null) return; RelatedFlexGroupField flexField = View.BillBusinessInfo.GetField(SortField) as RelatedFlexGroupField; if (flexField == null) return; BaseDataField bdField = View.BillBusinessInfo.GetField(flexField.RelatedBaseDataFlexGroupField) as BaseDataField; if (bdField == null) return; DynamicObjectCollection rowObjs = View.Model.GetEntityDataObject(entity) as DynamicObjectCollection; rowObjs.Sort(rowObj => { var flexObj = rowObj[flexField.PropertyName] as DynamicObject; if (flexObj == null) return string.Empty; var bdObj = rowObj[bdField.PropertyName] as DynamicObject; if (bdObj == null) return string.Empty; return ObjectUtils.Object2String(flexField.GetDisplayName(this.View, flexObj, bdField, bdObj)); }); const string Seq = "Seq"; int seqVal = 1; foreach(var rowObj in rowObjs) { rowObj[Seq] = seqVal++; } View.UpdateView(EntityKey); } } } ``` # 【演示效果】 <1>选单后,点击排序,列表数据按照仓位排序;点生成条码,最终按照数据顺序生成。 ![image.webp](/download/010060c14f704ef14ede8ba4fad2c69dd29a.webp) ![image.webp](/download/01001091fdf510eb486f81160366bb3f8a1b.webp) <2>不点排序,直接生成,还是按照原来的数据顺序生成。 ![image.webp](/download/01003875673a81004e97882db7deb2d90a89.webp) ![image.webp](/download/010063514ae4e5e548d69e34c4671837d58a.webp)

套打.二开案例.条码打印按照仓位字段排序

# 【场景】针对部分字段,列表不支持字段排序(如仓位),同时不支持列表多选(无法修改返回顺序);在条码打印中需要按照数据仓位排序打...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息