import clr
clr.AddReference("System")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS.DataEntity")
clr.AddReference("Kingdee.BOS.App")
clr.AddReference("Kingdee.BOS.Contracts")
clr.AddReference("Kingdee.BOS.ServiceHelper")
from Kingdee.BOS import*
from Kingdee.BOS.Contracts import*
from Kingdee.BOS.Contracts.Report import*
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.BOS.Core.Report import*
from Kingdee.BOS.Core.SqlBuilder import*
from Kingdee.BOS.Core.Enums import *
from Kingdee.BOS.App.Data import*
from Kingdee.BOS.Orm.DataEntity import*
from System import*
from System.ComponentModel import*
from System.Collections.Generic import*
from System.Text import*
from System.Threading.Tasks import*
from Kingdee.BOS.ServiceHelper import *
#select * from T_BD_CUSTOMER A
#INNER JOIN T_BD_CUSTOMER_L B ON A.FCUSTID=B.FCUSTID AND B.FNAME='上海淼田实业有限公司'
#这是查询custid的sql
'''上海煜谦贸易有限公司 148393
深圳市壹果农产品有限公司 148408
陕西品尚农产品贸易有限公司 607370
江苏卓誉信息技术有限公司 1411253
成都森三森农业有限公司 1445279
盒马生鲜 1465909
北京云农佳品农业发展有限公司 1487513
北京京东世纪信息技术有限公司 1509563
148393, 148408 ,607370, 1411253, 1445279, 1465909, 1487513, 1509563,1412728
上海煜谦贸易有限公司,深圳市壹果农产品有限公司,陕西品尚农产品贸易有限公司 江苏卓誉信息技术有限公司 成都森三森农业有限公司 盒马生鲜 北京云农佳品农业发展有限公司 北京京东世纪信息技术有限公司 沃尔玛(中国)投资有限公司
148393, 148408,607370, 1411253,1445279,1465909,1487513,1509563,1412728
'''
def PrepareFilterParameter(e):
custfilterObj=e.CustomFilter;#过滤框实体数据包
filterStr=e.FilterString;#过滤框条件过滤表达式
sortStr=e.SortString#排序字段表达式
statusFilterStr=e.StatusFilterString;#状态字段过滤表达式
#msg=("{0}").format(statusFilterStr);
#this.View.ShowMessage(msg);
userName=this.Context.UserName
#this.View.ShowMessage(userName)
myFilterStr=(" FCustId NOT IN (148393, 148408,607370, 1411253,1445279,1465909,1487513,1509563,1412728)")#单据编号包含1
if(userName in ("罗雨生","卢诗懿","曾艺婉","袁嘉琪")):
myFilterStr=("1=1")#单据编号包含1
elif(userName == "曾小芳"):
myFilterStr=(" FCustId NOT IN (148393,607370,1445279,1465909,1487513,1509563,1412728)")#单据编号包含1
elif(userName in( "蔡晓君","喻达金","王传志")):
myFilterStr=(" FCustId NOT IN (148393,148408,1411253,1445279,1487513,1509563,1412728)")#单据编号包含1
elif(userName in( "钟陈佺")):
myFilterStr=(" FCustId NOT IN (148393,148408,607370, 1411253,1465909,1509563,1412728)")#单据编号包含1
elif(userName in( "杨黎辉")):
myFilterStr=(" FCustId NOT IN (148408,607370,1411253,1445279,1465909,1487513,1509563,1412728)")#单据编号包含1
elif(userName in( "童强")):
myFilterStr=(" FCustId NOT IN (148393,148408,607370,1411253,1445279,1465909,1487513)")#单据编号包含1
try:
e.AppendQueryFilter(myFilterStr);#追加过滤条件
except:
raise Exception("您无权查看该客户的销售订单,请勿选择该客户");