物料升大小版本时,如何维护升版原因
【应用场景】
支持升版时必须录入升版原因,且升版成功后清空升版原因。
【注意事项】
首选需要分别在升大版,升小版操作基础上注册二开服务插件,用于校验升版原因必填;
然后研发物料列表插件和表单插件注册单据插件,用于清空升版原因,下列以物料库上升版为demo,物料详情思路一致。
【实现步骤】
<1.1>编写校验升版原因必填服务插件,代码如下。
using Kingdee.BOS.Orm.DataEntity; using Kingdee.K3.PLM.CFG.App.ServicePlugIn.VersionService; using Kingdee.K3.PLM.CFG.Common.BusinessEntity.Manager; using Kingdee.K3.PLM.Common.BusinessEntity; using Kingdee.K3.PLM.Common.Core.BOSBridge; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace Kingdee.K3.PLM.CFG.App.ServicePlugIn { [Description("校验升版原因必填插件")] public class CheckUpgradeCondition : UpgradeBigVersion { public override bool CheckUpgradeVersionRule(PLMContext context, DynamicObject upgradeObj, PLMOperationParam param, out string errorMsg) { if (this.PLMParam.Type == PLMOperationType.Bill) { var baseId = Convert.ToInt64(upgradeObj["Id"]); var categoryId = Convert.ToInt64(upgradeObj["CategoryID_Id"]); var pdmobj = DomainObjectManager.Instance(this.PLMContext, categoryId).Get(this.PLMContext, baseId); if (pdmobj != null) { string upgradeReason = Convert.ToString(pdmobj["Reason"]); if (string.IsNullOrEmpty(pdmobj["UpgradeReason"].ToString())) { errorMsg = string.Format("请填写升版原因!"); return false; } } } errorMsg = null; return true; } } }
<1.2>升版成功后清空升版原因插件,代码如下。
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.ServiceHelper; using Kingdee.K3.PLM.Business.PlugIn; using Kingdee.K3.PLM.CFG.Common.BusinessEntity.Manager; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace Kingdee.K3.PLM.CFG.Business.PlugIn { [Description("清空升版原因列表插件")] public class ClearUpgradeReason : AbstractPLMListPlugIn { string upgradeType = ""; public override void PreOpenForm(PreOpenFormEventArgs e) { var paras = this.View.OpenParameter.GetCustomParameters(); if (paras.ContainsKey("Kingdee.BOS.CosmicOptionKey")) //按钮操作key { upgradeType = (string)this.View.OpenParameter.GetCustomParameter("Kingdee.BOS.CosmicOptionKey"); } base.PreOpenForm(e); } public override void OnLoad(EventArgs e) { //如果是升大版本,小版本操作,升版成功之后清空升版原因 if (!string.IsNullOrEmpty(upgradeType) && (upgradeType == "UpgradeBigVersion" || upgradeType == "UpgradeSmallVersion")) { var lst = this.ListView.SelectedRowsInfo; var dynMats = DomainObjectManager.AutoLoad(PLMContext, lst.Select(m => Convert.ToInt64(m.PrimaryKeyValue)).ToArray()).ToArray(); foreach (var obj in dynMats) { obj["UpgradeReason"] = string.Empty; } BusinessDataServiceHelper.Save(PLMContext.BOSContext, dynMats); } base.OnLoad(e); } } }
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE扩展研发物料,注册服务插件和列表插件,保存元数据,开发完毕。
注册服务插件:
注册列表插件:
【功能验证】
<1>登录业务站点,更新物料下层某个业务类型模型即可测试二开插件效果。
【参考资料】
【汇总】星空PLM二开指南(持续更新)https://vip.kingdee.com/article/329914697153905408?productLineId=1&isKnowledge=2
【合辑】金蝶云.星空 PLM知识合辑(持续更新) https://vip.kingdee.com/article/329662872047302912?productLineId=1&isKnowledge=2
金蝶云星空PLM表结构(V8.0) https://vip.kingdee.com/article/350294658524016128?productLineId=1
二次开发扩展程序开发之插件模式 https://vip.kingdee.com/article/83591896433330944?productLineId=1
PLM云 -- 基于BOS平台的二次开发扩展https://vip.kingdee.com/article/10875?productLineId=1
PLM云 -- 基于配置系统的二次开发扩展(对象属性扩展)https://vip.kingdee.com/article/10887?productLineId=1
PLM云 -- 基于标准业务系统的二次开发扩展 https://vip.kingdee.com/article/10901?productLineId=1
金蝶云星空BOS二次开发指南https://vip.kingdee.com/article/94751030918525696?productLineId=1&isKnowledge=2
金蝶云星空数据字典V7.6 https://open.kingdee.com/K3Cloud/WenKu/DocumentView.aspx?docId=102613
物料升大小版本时,如何维护升版原因
本文2024-09-23 03:03:13发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-156363.html