OA补打卡代码

var dic = new Dictionary<string, object>();

dic.Add("USER_ID", ent.USER_ID);

dic.Add("WORK_CENTER", ent.WORK_CENTER);

dic.Add("WORK_DATE", ent.WORK_DATE);

dic.Add("CLASSES", ent.CLASSES);

dic.Add("ITREMARK", "OA补打卡");

string sqlString = "--看本班次是否已打卡\n" +

"select id /*,MASTER_ID, work_center, user_id, start_time, work_date, classes*/\n" +

"from class_record_line x\n" +

"where work_center = '" + ent.WORK_CENTER + "'\n" +

" and CLASSES='" + ent.CLASSES + "' and work_date = to_date('" + ent.WORK_DATE + "','yyyymmdd') \n" + //yyyy-mm-dd hh24:mi:ss

" and ENABLED=1 and user_id = '" + ent.USER_ID + "'\n" +

" and end_time is null\n" +

"/* and close_time is null*/";

 

int mid = imes.db.Ado.QuerySingle<int>(sqlString);

if (mid > 0)

{

//更新为离岗卡

sqlString = "update CLASS_RECORD_LINE set ITREMARK='OA补打离岗卡'. SRC_TIME2 = 1, END_TIME =to_date('" + ent.CHECKTIME + "','yyyy-mm-dd hh24:mi:ss') where id =" + mid;

XLog.XTrace.WriteLine("OA补打离岗卡" + sqlString);

int row = imes.db.Ado.ExecuteNonQuery(sqlString);

XLog.XTrace.WriteLine(row + "OA补打离岗卡" + ent.USER_ID);

return "ok";

}

 

//获取员工班次轨道

sqlString = "select classes, work_date, stand_start_time, stand_end_time, organization_team, organization_team_desc, user_id\n" +

"from checkinoutplan x\n" +

"where user_id = '" + ent.USER_ID + "'\n" +

" and CLASSES <> 'OFF' and to_date('" + ent.CHECKTIME + "','yyyy-mm-dd hh24:mi:ss') between stand_start_time - 4 / 24 and stand_end_time + 2 / 24";

XLog.XTrace.WriteLine("1.获取员工班次轨道\r\n" + sqlString);

userplan 班次轨道 = imes.db.Ado.QuerySingle<userplan>(sqlString);

if (班次轨道 != null)

{

XLog.XTrace.WriteLine("抓到班次轨道");

dic.Add("STAND_START_TIME", 班次轨道.STAND_START_TIME);

dic.Add("STAND_END_TIME", 班次轨道.STAND_END_TIME);

dic.Add("WORK_DATE", 班次轨道.WORK_DATE);

dic.Add("CLASSES", 班次轨道.CLASSES);

}

else

{

dic.Add("REMARK", "无班次轨道 或者 排班错误");

}

 

//获取头表信息

sqlString = "select ID , STAND_START_TIME, STAND_END_TIME,WORK_DATE,CLASSES,start_time ,END_TIME \n" +

"from class_record_master x\n" +

"where work_center = '" + ent.WORK_CENTER + "'\n" +

" and work_date = to_date('" + ent.WORK_DATE + "','yyyy-mm-dd hh24:mi:ss')\n" +

" and classes = '" + ent.CLASSES + "'";

XLog.XTrace.WriteLine("3.首次打卡获取是否已经开班\r\n" + sqlString);

masterInfo 头表信息 = imes.db.Ado.QuerySingle<masterInfo>(sqlString);

if (头表信息 == null)

{

cc.sendwx("20151763", "OA补打卡没有找到开班头表");

}

else

{

dic.Add("MASTER_ID", 头表信息.ID);

XLog.XTrace.WriteLine("抓到头表信息3.true " + ent.USER_ID + "继承头表ID");

}

获取前次派岗信息(ent.USER_ID, ent.WORK_CENTER, dic);

dic.Add("ENABLED", 1);

int i = imes.db.InsertDict(dic).AsTable("CLASS_RECORD_LINE").ExecuteAffrows();

XLog.XTrace.WriteLine("上岗逻辑执行完成,插表行数 " + i + Newtonsoft.Json.JsonConvert.SerializeObject(dic, Formatting.Indented));

 

posted @   网络来者  阅读(37)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
点击右上角即可分享
微信分享提示