import clr;
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DependencyRules import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Util import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.App.Data import *
from Kingdee.BOS.Orm.DataEntity import *
def BarItemClick(e):
if(e.BarItemKey=="tbApprove" or e.BarItemKey=="tbSplitApprove"):
orgId = this.Context.CurrentOrganizationInfo.ID.ToString();
userName = this.Context.UserName;
_sqlstr = " select a.FNUMBER,b.FNAME,d.FNAME FDEPT from T_HR_EMPINFO a inner join T_HR_EMPINFO_L b on a.FID=b.FID ";
_sqlstr=_sqlstr+" inner join T_BD_STAFF c on a.FNUMBER=c.FNUMBER ";
_sqlstr=_sqlstr+" inner join T_BD_DEPARTMENT_L d on c.FDEPTID=d.FDEPTID ";
_sqlstr=_sqlstr+" inner join T_BD_DEPARTMENT e on d.FDEPTID=e.FDEPTID ";
_sqlstr=_sqlstr+" where b.FLOCALEID=2052 and d.FLOCALEID=2052 ";
_sqlstr=_sqlstr+" and b.FNAME='"+userName+"' and d.FNAME like '%车间' and a.FFORBIDSTATUS='A' and a.FDocumentStatus='C' ";
_sqlstr=_sqlstr+" and e.FUseOrgId='"+orgId+"' ";
doc = DBUtils.ExecuteDynamicObject(this.Context, _sqlstr);
isOk = 0;
billObj = this.View.Model.DataObject;
entity=billObj["InStockEntry"];
for rObj in entity:
FStock = rObj["StockId"];
stock = ("{0}").format(FStock["Name"]);
k=0;
if(stock.IndexOf("车间倒冲") > 0):
k=k+1;
for objd in doc:
dept = objd["FDEPT"];
if(stock.IndexOf(dept) >= 0):
k=0;
break;
isOk=isOk+k;
if (isOk != 0):
e.Cancel = True;
this.View.ShowMessage("不是该车间人员不能审核");
金蝶云星空python插件代码
最新推荐文章于 2024-06-15 09:39:44 发布