二开案例.工序计划保存时自动排程
【应用场景】
在工序计划保存时,自动进行工序排程,计算各道序的开工、完工时间。
【实现步骤】
<1>编写操作服务插件,代码如下。
using Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Orm.DataEntity; using Kingdee.K3.MFG.App; using Kingdee.K3.MFG.Contracts.SFC; using System; using System.Collections.Generic; using System.Linq; namespace MyTest { public class ProcessScheduling : AbstractOperationServicePlugIn { public override void AfterExecuteOperationTransaction(BOS.Core.DynamicForm.PlugIn.Args.AfterExecuteOperationTransaction e) { base.AfterExecuteOperationTransaction(e); //构造排程参数对象 FormMetadata paramMetaData = (FormMetadata)AppServiceContext.MetadataService.Load(this.Context, "SFC_ProcessScheduling"); DynamicObject param = new DynamicObject(paramMetaData.BusinessInfo.GetDynamicObjectType()); Entity entity = paramMetaData.BusinessInfo.GetEntity("FBillHead"); IDynamicFormModel model = AppServiceContext.CreateDynamicFormModel(this.Context, paramMetaData.BusinessInfo, param, null); IDefaultValueCalculator calculator = model.GetService<IDefaultValueCalculator>(); calculator.Initialize(model); calculator.ApplyDefaultValue(entity, param, 0); param["SchedulingModeSetting"] = "P"; //进行标准排程 param["StandardScheduling"] = true; //网络控制 param["IsNetCtrl"] = false; //指定工序排程 param["SpecifiedScheduling"] = true; //忽略审核状态 param["IgnoreAudit"] = true; //自动排程 param["IsAutoScheduling"] = true; // 构建工序排程(指定工序)[序列-工序]内码字典 List<Dictionary<long, long>> lstDicSeqOperIds = new List<Dictionary<long, long>>(); DynamicObjectCollection seqCol; DynamicObjectCollection operCol; IEnumerable<DynamicObject> operColOrdered; foreach(var dataEntity in e.DataEntitys) { seqCol = dataEntity["Entity"] as DynamicObjectCollection; foreach (var seq in seqCol) { long seqId = Convert.ToInt64(seq["Id"]); operCol = seq["SubEntity"] as DynamicObjectCollection; //按工序号排序,以便依次调用指定工序排程 operColOrdered = operCol.OrderBy(o => Convert.ToInt32(o["OperNumber"])); foreach (var oper in operColOrdered) { Dictionary<long, long> dicSeqOperIds = new Dictionary<long, long>(); dicSeqOperIds[seqId] = Convert.ToInt64(oper["Id"]); lstDicSeqOperIds.Add(dicSeqOperIds); } } } //调用排程接口 if (lstDicSeqOperIds.Count > 0) { foreach (Dictionary<long, long> dicSeqOperIds in lstDicSeqOperIds) { string transactionID = Guid.NewGuid().ToString(); AppServiceContext.GetMFGService<IOperationPlanningService>().ProcessScheduling(this.Context, dicSeqOperIds, param, transactionID); } } } } }
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE扩展工序计划,注册保存操作服务插件,保存元数据。
【金蝶云星空BOS二次开发案例演示】
https://vip.kingdee.com/article/94751030918525696
二开案例.工序计划保存时自动排程
【应用场景】在工序计划保存时,自动进行工序排程,计算各道序的开工、完工时间。【实现步骤】<1>编写操作服务插件,代码如下。using Kingd...
点击下载文档
本文2024-09-23 03:26:03发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-158831.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章