97 lines
3.4 KiB
Python
97 lines
3.4 KiB
Python
|
|
#引入clr运行库
|
|||
|
|
import clr
|
|||
|
|
#添加对cloud插件开发的常用组件引用
|
|||
|
|
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.Contracts')
|
|||
|
|
clr.AddReference('Kingdee.BOS.DataEntity')
|
|||
|
|
clr.AddReference('Kingdee.BOS.ServiceHelper')
|
|||
|
|
clr.AddReference('E_ZKEccSDK')
|
|||
|
|
|
|||
|
|
#dairycloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
|
|||
|
|
from Kingdee.BOS.Core import *
|
|||
|
|
from Kingdee.BOS.Util import *
|
|||
|
|
from Kingdee.BOS.Core.Bill import *
|
|||
|
|
from Kingdee.BOS.Core.Bill.PlugIn import *
|
|||
|
|
from Kingdee.BOS.Orm.DataEntity import *
|
|||
|
|
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
|
|||
|
|
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
|
|||
|
|
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
|
|||
|
|
from System import *
|
|||
|
|
from System.Data import *
|
|||
|
|
from System.Collections.Generic import *
|
|||
|
|
from Kingdee.BOS.App.Data import *
|
|||
|
|
from Kingdee.BOS.ServiceHelper import *
|
|||
|
|
from E_ZKEcc.Domian import *
|
|||
|
|
from E_ZKEcc.Service import *
|
|||
|
|
from E_ZKEcc.Request import *
|
|||
|
|
|
|||
|
|
# 操作后事务前
|
|||
|
|
def EndOperationTransaction(e):
|
|||
|
|
# 保存8提交9审核1反审核26删除3
|
|||
|
|
if this.FormOperation.OperationId == 1 and e.DataEntitys.Count > 0:
|
|||
|
|
# raise Exception(JsonUtil.Serialize(e.DataEntitys))
|
|||
|
|
DoUpdateEmployeeFunc(e.DataEntitys)
|
|||
|
|
|
|||
|
|
# 审核后更新考勤信息
|
|||
|
|
def DoUpdateEmployeeFunc(dataEntitys):
|
|||
|
|
apiInfo = GetE_ZKEccSDKAPIInfo()
|
|||
|
|
service = EmployeeService(apiInfo)
|
|||
|
|
datas = List[EmployeeUpdateRequest]()
|
|||
|
|
|
|||
|
|
idList = set(map(lambda x:x["Id"] , dataEntitys))
|
|||
|
|
dataList = GetDataList(idList)
|
|||
|
|
|
|||
|
|
if dataList != None and dataList.Count > 0:
|
|||
|
|
for entity in dataList:
|
|||
|
|
domain = EmployeeUpdateRequest()
|
|||
|
|
# 员工编号
|
|||
|
|
domain.pin = entity["FNUMBER"]
|
|||
|
|
# domain.pin = "99999"
|
|||
|
|
domain.name = entity["FNAME"]
|
|||
|
|
domain.deptnumber = "999"
|
|||
|
|
# 身份证
|
|||
|
|
domain.identitycard = entity["FIDTYPENUMBER"]
|
|||
|
|
|
|||
|
|
# 头像
|
|||
|
|
imageFilePath = entity["FLOCATIONPATH"]
|
|||
|
|
if imageFilePath != None:
|
|||
|
|
enrollpic = "" if imageFilePath == "" else ImageUtil.ImageFileToBase64(imageFilePath)
|
|||
|
|
domain.enrollpic = enrollpic;
|
|||
|
|
|
|||
|
|
datas.Add(domain)
|
|||
|
|
# raise Exception(JsonUtil.Serialize(datas))
|
|||
|
|
result = service.UpdateEmployee(datas)
|
|||
|
|
|
|||
|
|
if result.ret != 0:
|
|||
|
|
# raise Exception("错误信息:{0} ;请求数据:{1}".format(result.msg, JsonUtil.Serialize(datas)))
|
|||
|
|
raise Exception(result.msg)
|
|||
|
|
|
|||
|
|
# 获取数据
|
|||
|
|
def GetDataList(idList):
|
|||
|
|
sql ="""/*dialect*/
|
|||
|
|
SELECT t0.FID,t0.FNUMBER,t0_l.FNAME,t0.FIDTYPENUMBER,ISNULL(t1.FLOCATIONPATH,'') AS 'FLOCATIONPATH'
|
|||
|
|
FROM T_BD_StaffData t0
|
|||
|
|
INNER JOIN T_BD_StaffData_l t0_l on t0.FID = t0_l.FID AND t0_l.FLOCALEID = 2052
|
|||
|
|
LEFT JOIN T_BAS_FileServerFileInfo t1 on t0.FIMAGE = t1.FFILEID
|
|||
|
|
WHERE 1 = 1
|
|||
|
|
AND t0.FID IN ({0})
|
|||
|
|
""".format(",".join(map(str,idList)))
|
|||
|
|
return DBUtils.ExecuteDynamicObject(this.Context, sql)
|
|||
|
|
|
|||
|
|
# 获取api信息
|
|||
|
|
def GetE_ZKEccSDKAPIInfo():
|
|||
|
|
vSql = "/*dialect*/ SELECT * FROM V_E_ZKEccSDK_API_INFO "
|
|||
|
|
dataTable = DBUtils.ExecuteDynamicObject(this.Context, vSql)
|
|||
|
|
dataRow = dataTable[0]
|
|||
|
|
|
|||
|
|
apiInfo = ApiInfoDomian()
|
|||
|
|
apiInfo.appKey = dataRow["appKey"]
|
|||
|
|
apiInfo.apiVersion = dataRow["apiVersion"]
|
|||
|
|
apiInfo.serverUrl = dataRow["serverUrl"]
|
|||
|
|
|
|||
|
|
return apiInfo
|