二开案例-【Python】实现物料审核后自动分配到指定组织
一、插件配置位置
二、插件代码
import clr clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.DataEntity') clr.AddReference('Kingdee.BOS.Contracts') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference("Kingdee.K3.MFG.App") from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Contracts import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.BOS.DataEntity import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import * from System.Data import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * from Kingdee.BOS.Log import * from Kingdee.BOS.Core.Metadata import * from Kingdee.BOS.Core.Metadata.Operation import AllocateParameter from Kingdee.BOS.Core.Enums import BOSEnums from Kingdee.K3.MFG.App import AppServiceContext from Kingdee.BOS.Contracts import IAllocateService def AfterExecuteOperationTransaction(e): Logger.Info("Kingdee001","Kingdee001"); strSQL=" SELECT T1.FORGID,T2.FNAME AS ORGNAME FROM T_ORG_ORGANIZATIONS T1 INNER JOIN T_ORG_ORGANIZATIONS_L T2 ON T1.FORGID=T2.FORGID AND T2.FLOCALEID=2052 WHERE T1.FORGID IN (100038,100039) "; orgIds =DBUtils.ExecuteDynamicObject(this.Context, strSQL); Logger.Info("Kingdee0066","Kingdee0066"); if(orgIds.Count <=0): Logger.Info("Kindgee0088","Kindgee0088"); return; mtrlIdLst=List[object](); for mtrlObj in e.SelectedRows: mtrlId=mtrlObj.DataEntity["Id"]; Logger.Info("Kingdee002","002"); usrOrdId=mtrlObj.DataEntity["UseOrgId_Id"]; Logger.Info("Kingdee003","Kingdee003"); creatOrgId=mtrlObj.DataEntity["CreateOrgId_Id"]; Logger.Info("Kingdee004","Kingdee004"); creatOrgIdName=mtrlObj.DataEntity["CreateOrgId"]["Name"].ToString(); Logger.Info("Kingdee005","Kingdee005"); if(usrOrdId==creatOrgId): Logger.Info("Kingdee006","Kingdee006"); mtrlIdLst.Add(mtrlId); mtrlMeta=MetaDataServiceHelper.Load(this.Context,"BD_MATERIAL"); for orgId in orgIds: allocateParameter=AllocateParameter(mtrlMeta.BusinessInfo,mtrlMeta.InheritPath,creatOrgId,BOSEnums.Enu_AllocateType.Allocate, "Allocate"); Logger.Info("Kingdee007","Kingdee007"); allocateParameter.PkId=mtrlIdLst; allocateParameter.DestOrgId=orgId["FORGID"]; allocateParameter.DestOrgName=orgId["ORGNAME"]; allocateParameter.AutoSubmitAndAudit=True; allocateParameter.AllocateUserId=this.Context.UserId; allocateService =BusinessDataServiceHelper.Allocate(this.Context,allocateParameter); Logger.Info("Kingdee008","Kingdee008");
三、插件说明
1、插件中Logger.Info只是为了方便调试,可删除。
2、AllocateParameter参数说明:
PKId:物料内码集合。
DestOrgId:分配使用组织。
DestOrgName:分配使用组织名称。
AutoSubmitAndAudit:分配后是否自动提交审核。
AllocateUserId:当前操作用户。
3、只有创建组织等于使用组织的时候才允许分配。
4、复制代码时注意字符串换行导致错误。
5、插件点击确定时,下图错误无需在意,点击确定即可。
二开案例-【Python】实现物料审核后自动分配到指定组织
一、插件配置位置二、插件代码import clrclr.AddReference('System')clr.AddReference('System.Data')clr.AddReference(&#...
点击下载文档
本文2024-09-23 04:25:41发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-165239.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章