1
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
#引入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 *
|
||||
|
||||
|
||||
def EndOperationTransaction(e):
|
||||
# 保存8提交9审核1反审核26删除3
|
||||
if this.FormOperation.OperationId == 1:
|
||||
Audit2DoUpdAttendanceData(e)
|
||||
|
||||
# 审核后更新考勤信息
|
||||
def Audit2DoUpdAttendanceData(e):
|
||||
ACCESS_KEY = "3391hexqe5h0wv4z4veju_dvn7gntnr5oiv_dxjabqtt"
|
||||
# 人员对接 employee
|
||||
更新人员 = "http://127.0.0.1:8088/api/v2/employee/update/?key=" + ACCESS_KEY
|
||||
获取人员信息 = "http://127.0.0.1:8088/api/v2/employee/get/?key=" + ACCESS_KEY
|
||||
人员离职 = "http://127.0.0.1:81/api/v2/employee/leave/?key=" + ACCESS_KEY
|
||||
离职恢复 = "http://127.0.0.1:81/api/v2/employee/restore/?key=" + ACCESS_KEY
|
||||
# http://14.21.32.187:8088/api/v2/transaction/get/?key=3391hexqe5h0wv4z4veju_dvn7gntnr5oiv_dxjabqtt
|
||||
|
||||
# 外部接口 http://14.21.32.187:8088/accounts/login/?next=/iclock/imanager
|
||||
url = "http://127.0.0.1:8088/api/v2"
|
||||
return
|
||||
|
||||
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
|
||||
@@ -22,10 +22,10 @@
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="DB_StaffData\" />
|
||||
<Folder Include="GAT_StaffData\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DB_StaffData\OperationEventPlugInEx.py" />
|
||||
<Compile Include="GAT_StaffData\OperationEventPlugInEx.py" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
||||
<!-- Uncomment the CoreCompile target to enable the Build command in
|
||||
|
||||
96
13.得米新材/Demi.Python/GAT_StaffData/OperationEventPlugInEx.py
Normal file
96
13.得米新材/Demi.Python/GAT_StaffData/OperationEventPlugInEx.py
Normal file
@@ -0,0 +1,96 @@
|
||||
#引入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
|
||||
@@ -56,7 +56,8 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DB_StaffData\OperationEventPlugInEx.cs" />
|
||||
<Compile Include="GAT_HR_LeaveData\OperationEventPlugInEx.cs" />
|
||||
<Compile Include="GAT_StaffData\OperationEventPlugInEx.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
146
13.得米新材/Demi/GAT_HR_LeaveData/OperationEventPlugInEx.cs
Normal file
146
13.得米新材/Demi/GAT_HR_LeaveData/OperationEventPlugInEx.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using E_ZKEcc.Domian;
|
||||
using E_ZKEcc.Service;
|
||||
using E_ZKEcc.Request;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kingdee.BOS.Util;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Demi.GAT_HR_LeaveData
|
||||
{
|
||||
[Description("员工离职单-考勤机"), HotUpdate]
|
||||
public class OperationEventPlugInEx : AbstractOperationServicePlugIn
|
||||
{
|
||||
public override void OnPreparePropertys(PreparePropertysEventArgs e)
|
||||
{
|
||||
base.OnPreparePropertys(e);
|
||||
e.FieldKeys.Add("FActualDate");
|
||||
e.FieldKeys.Add("FLeaveReason");
|
||||
e.FieldKeys.Add("FLeaveCause");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作结束-事务内
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public override void EndOperationTransaction(EndOperationTransactionArgs e)
|
||||
{
|
||||
base.EndOperationTransaction(e);
|
||||
|
||||
// 保存8提交9审核1反审核26删除3
|
||||
if (this.FormOperation.OperationId == 1)
|
||||
{
|
||||
if (e.DataEntitys.Any())
|
||||
{
|
||||
//throw new Exception(JsonUtil.Serialize(e.DataEntitys));
|
||||
DoLeaveEmployeeFunc(e.DataEntitys);
|
||||
}
|
||||
}
|
||||
else if (this.FormOperation.OperationId == 26)
|
||||
{
|
||||
if (e.DataEntitys.Any())
|
||||
{
|
||||
//throw new Exception(JsonUtil.Serialize(e.DataEntitys));
|
||||
DoRestoreEmployee(e.DataEntitys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反审核后离职人员恢复离职
|
||||
/// </summary>
|
||||
/// <param name="DataEntitys"></param>
|
||||
private void DoRestoreEmployee(DynamicObject[] DataEntitys)
|
||||
{
|
||||
var apiInfo = GetE_ZKEccSDKAPIInfo();
|
||||
var service = new EmployeeService(apiInfo);
|
||||
|
||||
var list = new List<string>();
|
||||
foreach (var entity in DataEntitys)
|
||||
{
|
||||
var staffData = entity["FStaffId"] as DynamicObject;
|
||||
var number = staffData["Number"].ToString();
|
||||
list.Add(number);
|
||||
}
|
||||
|
||||
if (list.Any())
|
||||
{
|
||||
var result = service.RestoreEmployee(list.ToArray());
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
OperationResult.OperateResult.Add(new Kingdee.BOS.Core.DynamicForm.OperateResult
|
||||
{
|
||||
Message = result.msg,
|
||||
SuccessStatus = result.ret == 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核后进行人员更新
|
||||
/// </summary>
|
||||
/// <param name="DataEntitys"></param>
|
||||
private void DoLeaveEmployeeFunc(DynamicObject[] DataEntitys)
|
||||
{
|
||||
var apiInfo = GetE_ZKEccSDKAPIInfo();
|
||||
var service = new EmployeeService(apiInfo);
|
||||
|
||||
var list = new List<EmployeeUpdateRequest>();
|
||||
foreach (var entity in DataEntitys)
|
||||
{
|
||||
var domain = new EmployeeUpdateRequest();
|
||||
list.Add(domain);
|
||||
|
||||
var staffData = entity["FStaffId"] as DynamicObject;
|
||||
var number = staffData["Number"].ToString();
|
||||
var FActualDate = ((DateTime)entity["FActualDate"]).ToString("yyyy-MM-dd HH:MM");
|
||||
var FLeaveReason = entity["FLeaveReason"].ToString();
|
||||
var FLeaveCause = entity["FLeaveCause"] as DynamicObject;
|
||||
var leaveCauseNumber = FLeaveCause["FNumber"].ToString();
|
||||
//离职种类
|
||||
var leaveCause = (leaveCauseNumber.Equals("ZL") ? 0 : (leaveCauseNumber.Equals("CT") ? 1 : 2));
|
||||
var result = service.LeaveEmployee(number, FActualDate, leaveCause, FLeaveReason);
|
||||
if (result != null)
|
||||
{
|
||||
OperationResult.OperateResult.Add(new Kingdee.BOS.Core.DynamicForm.OperateResult
|
||||
{
|
||||
Message = result.msg,
|
||||
SuccessStatus = result.ret == 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (result.ret != 0)
|
||||
//{
|
||||
// throw new Exception(result.msg);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取E_ZKEcc考勤机api连接信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private ApiInfoDomian GetE_ZKEccSDKAPIInfo()
|
||||
{
|
||||
var vSql = "/*dialect*/ SELECT * FROM V_E_ZKEccSDK_API_INFO ";
|
||||
var dataTable = DBUtils.ExecuteDynamicObject(this.Context, vSql);
|
||||
var dataRow = dataTable[0];
|
||||
var apiInfo = new ApiInfoDomian
|
||||
{
|
||||
appKey = dataRow["appKey"].ToString(),
|
||||
apiVersion = dataRow["apiVersion"].ToString(),
|
||||
serverUrl = dataRow["serverUrl"].ToString()
|
||||
};
|
||||
|
||||
return apiInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using E_ZKEcc.Domian;
|
||||
using E_ZKEcc.Service;
|
||||
using E_ZKEccSDK.Request;
|
||||
using E_ZKEcc.Request;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
@@ -8,15 +8,18 @@ using Kingdee.BOS.Orm.DataEntity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kingdee.BOS.Util;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Demi.DB_StaffData
|
||||
namespace Demi.GAT_StaffData
|
||||
{
|
||||
[Description("员工档案-考勤机"), HotUpdate]
|
||||
public class OperationEventPlugInEx : AbstractOperationServicePlugIn
|
||||
{
|
||||
public override void OnPreparePropertys(PreparePropertysEventArgs e)
|
||||
{
|
||||
base.OnPreparePropertys(e);
|
||||
e.FieldKeys.Add("FSTATUS");
|
||||
e.FieldKeys.Add("FIDTypeNumber");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,18 +50,25 @@ namespace Demi.DB_StaffData
|
||||
var service = new EmployeeService(apiInfo);
|
||||
|
||||
var list = new List<EmployeeUpdateRequest>();
|
||||
|
||||
foreach (var entity in DataEntitys)
|
||||
{
|
||||
var domain = new EmployeeUpdateRequest();
|
||||
list.Add(domain);
|
||||
|
||||
domain.pin = entity["FNumber"].ToString();
|
||||
domain.name = entity["FName"].ToString();
|
||||
|
||||
//domain.pin = entity["Number"].ToString();
|
||||
domain.pin = "99999";
|
||||
var nameObjs = entity["Name"] as DynamicObject[];
|
||||
//domain.name = nameObjs.FirstOrDefault(x => x["Key"].Long2Int() == 2052)["Value"].ToString();
|
||||
foreach (var obj in nameObjs)
|
||||
{
|
||||
if (obj["Key"].Long2Int() == 2052)
|
||||
domain.name = obj["Value"].ToString();
|
||||
}
|
||||
//domain.deptnumber = item["FDeptName"].ToSafeTurnString();
|
||||
//暂时固定部门
|
||||
domain.deptnumber = "11001100";
|
||||
domain.identitycard = entity["IdentityCard"].ToString();
|
||||
domain.deptnumber = "999";
|
||||
domain.identitycard = entity["FIDTypeNumber"].ToString();
|
||||
}
|
||||
|
||||
var result = service.UpdateEmployee(list);
|
||||
Reference in New Issue
Block a user