using DBUtility;
|
using Model;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Web;
|
using System.Web.Http;
|
using System.Windows.Forms;
|
using WebAPI.Models;
|
|
namespace WebAPI.Controllers.项目管理.工作任务
|
{
|
public class HR_EmpEngageRequestBillController : ApiController
|
{
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
|
private json objJsonResult = new json();
|
public DataSet ds = new DataSet();
|
public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
|
string user_LongShan = "";
|
string HName_LongShan = "";
|
|
#region 入职申请单 新增/编辑
|
#region 入职申请单 表头数据
|
public class HR_EmpEngageRequestBillMain
|
{
|
public int HInterID;
|
public string HBillNo;
|
public string HDate;
|
public string HName;
|
public string HSex;
|
public string HMarr;
|
public string HBirthday;
|
public int HAge;
|
public string HBlighty;
|
public string HNation;
|
public string HBlightyType;
|
public string HGovStatus;
|
public string HBloodType;
|
public string HStature;
|
public string HAvoird;
|
public string HKnowLev;
|
public string HProTitleID;
|
public double HWantPay;
|
public string HGradSchool;
|
public string HGradDate;
|
public string HSpec;
|
public string HEngLev;
|
public string HCompLev;
|
public string HLinkPhone;
|
public string HEmail;
|
public string HNowAdd;
|
public string HHomeAdd;
|
public string HIDCard;
|
public string HPostalCode;
|
public string HOldCompany;
|
public bool HInsuranceStatus;
|
public string HInsuranceDate;
|
public string HInsuranceNo;
|
public string HContractBDate;
|
public int HContractYear;
|
public string HContractEDate;
|
public string HJobCardEDate;
|
public string HJobCardNo;
|
public string HCheckCardEDate;
|
public string HStayCardEDate;
|
public string HHealthCardEDate;
|
public string HArchivesNo;
|
|
public string HMaker;
|
public string HMakerDate;
|
public string HUpdater;
|
public string HUpdaterDate;
|
public string HChecker;
|
public string HCheckerDate;
|
public string HCloseMan;
|
public string HCloseManDate;
|
public string HDeleteMan;
|
public string HDeleteManDate;
|
public string HBacker;
|
public string HBackerDate;
|
public string HBackRemark;
|
}
|
#endregion
|
|
#region 入职申请单 新增/编辑
|
/// <summary>
|
/// 新增单据-保存按钮
|
///参数:string sql。
|
///返回值:object。
|
/// </summary>
|
[Route("HR_EmpEngageRequestBill/AddEmpEngageRequestBill")]
|
[HttpPost]
|
public object AddEmpEngageRequestBill([FromBody] JObject sMainSub)
|
{
|
//获取参数
|
var _value = sMainSub["sMainSub"].ToString();
|
string msg1 = _value.ToString();
|
//开始事务
|
oCN.BeginTran();
|
//保存主表
|
objJsonResult = AddEmpEngageRequestBillMain(msg1);
|
if (objJsonResult.code == "0")
|
{
|
oCN.RollBack();
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = objJsonResult.Message;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
oCN.Commit();
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "新增单据成功!";
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
#endregion
|
#region 添加 入职申请单 主表
|
public json AddEmpEngageRequestBillMain(string msg1)
|
{
|
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
string msg2 = sArray[0].ToString();
|
int OperationType = int.Parse(sArray[1].ToString());//数据类型 1添加 3修改 2 复制
|
string user = sArray[2].ToString();//用户名
|
string HComputerName = SystemInformation.ComputerName; //设备名称
|
user_LongShan = sArray[2].ToString();//用户名
|
|
try
|
{
|
if(OperationType == 1)
|
{
|
//判断是否有新增权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Edit", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无新增权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
else if(OperationType == 3)
|
{
|
//判断是否有编辑权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Edit", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无编辑权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
msg2 = "[" + msg2.ToString() + "]";
|
List<HR_EmpEngageRequestBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HR_EmpEngageRequestBillMain>>(msg2);
|
|
int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
|
int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
|
string HBillType = "2301";
|
string HBillSubType = "";
|
|
int HInterID = mainList[0].HInterID;
|
string HBillNo = mainList[0].HBillNo;
|
string HDate = mainList[0].HDate;
|
string HName = mainList[0].HName;
|
string HSex = mainList[0].HSex;
|
string HMarr = mainList[0].HMarr;
|
string HBirthday = mainList[0].HBirthday;
|
int HAge = mainList[0].HAge;
|
string HBlighty = mainList[0].HBlighty;
|
string HNation = mainList[0].HNation;
|
string HBlightyType = mainList[0].HBlightyType;
|
string HGovStatus = mainList[0].HGovStatus;
|
string HBloodType = mainList[0].HBloodType;
|
string HStature = mainList[0].HStature;
|
string HAvoird = mainList[0].HAvoird;
|
string HKnowLev = mainList[0].HKnowLev;
|
string HProTitleID = mainList[0].HProTitleID;
|
double HWantPay = mainList[0].HWantPay;
|
string HGradSchool = mainList[0].HGradSchool;
|
string HGradDate = mainList[0].HGradDate;
|
string HSpec = mainList[0].HSpec;
|
string HEngLev = mainList[0].HEngLev;
|
string HCompLev = mainList[0].HCompLev;
|
string HLinkPhone = mainList[0].HLinkPhone;
|
string HEmail = mainList[0].HEmail;
|
string HNowAdd = mainList[0].HNowAdd;
|
string HHomeAdd = mainList[0].HHomeAdd;
|
string HIDCard = mainList[0].HIDCard;
|
string HPostalCode = mainList[0].HPostalCode;
|
string HOldCompany = mainList[0].HOldCompany;
|
int HInsuranceStatus = mainList[0].HInsuranceStatus?1:0;
|
string HInsuranceDate = mainList[0].HInsuranceDate;
|
string HInsuranceNo = mainList[0].HInsuranceNo;
|
string HContractBDate = mainList[0].HContractBDate;
|
int HContractYear = mainList[0].HContractYear;
|
string HContractEDate = mainList[0].HContractEDate;
|
string HJobCardEDate = mainList[0].HJobCardEDate;
|
string HJobCardNo = mainList[0].HJobCardNo;
|
string HCheckCardEDate = mainList[0].HCheckCardEDate;
|
string HStayCardEDate = mainList[0].HStayCardEDate;
|
string HHealthCardEDate = mainList[0].HHealthCardEDate;
|
string HArchivesNo = mainList[0].HArchivesNo;
|
|
string HRemark = "";
|
string HMaker = mainList[0].HMaker;
|
string HMakerDate = mainList[0].HMakerDate;
|
string HUpdater = mainList[0].HUpdater;
|
string HUpdaterDate = mainList[0].HUpdaterDate;
|
|
|
//if (OperationType == 2)
|
//{
|
// ds = oCN.RunProcReturn("select * from PM_WorkTaskBillMain where HBillNo ='" + HBillNo + "'", "PM_WorkTaskBillMain");
|
// if (ds.Tables[0].Rows.Count > 0)
|
// {
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "单据号重复,请重新输入!";
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
// }
|
//}
|
|
ds = oCN.RunProcReturn("select * from HR_EmpEngageRequestBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "HR_EmpEngageRequestBillMain");
|
|
if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
|
{
|
string sql = "insert into HR_EmpEngageRequestBillMain" +
|
"(HYear,HPeriod,HBillType,HBillSubType,HInterID,HBillNo,HDate,HName,HSex,HMarr,HBirthday,HAge,HBlighty,HNation,HBlightyType,HGovStatus,HBloodType,HStature" +
|
",HAvoird,HKnowLev,HProTitleID,HWantPay,HGradSchool ,HGradDate,HSpec,HEngLev,HCompLev,HLinkPhone ,HEmail,HNowAdd,HHomeAdd" +
|
",HIDCard,HPostalCode,HOldCompany,HInsuranceStatus,HInsuranceDate,HInsuranceNo,HContractBDate,HContractYear,HContractEDate" +
|
",HJobCardEDate,HJobCardNo,HCheckCardEDate,HStayCardEDate,HHealthCardEDate,HArchivesNo,HRemark,HMaker,HMakeDate)" +
|
"values(" +
|
"" + HYear +
|
"," + HPeriod +
|
",'" + HBillType +
|
"','" + HBillSubType +
|
"'," + HInterID +
|
",'" + HBillNo +
|
"','" + HDate +
|
"','" + HName +
|
"','" + HSex +
|
"','" + HMarr +
|
"','" + HBirthday +
|
"'," + HAge +
|
",'" + HBlighty +
|
"','" + HNation +
|
"','" + HBlightyType +
|
"','" + HGovStatus +
|
"','" + HBloodType +
|
"','" + HStature +
|
"','" + HAvoird +
|
"','" + HKnowLev +
|
"','" + HProTitleID +
|
"'," + HWantPay +
|
",'" + HGradSchool +
|
"','" + HGradDate +
|
"','" + HSpec +
|
"','" + HEngLev +
|
"','" + HCompLev +
|
"','" + HLinkPhone +
|
"','" + HEmail +
|
"','" + HNowAdd +
|
"','" + HHomeAdd +
|
"','" + HIDCard +
|
"','" + HPostalCode +
|
"','" + HOldCompany +
|
"'," + HInsuranceStatus +
|
",'" + HInsuranceDate +
|
"','" + HInsuranceNo +
|
"','" + HContractBDate +
|
"'," + HContractYear +
|
",'" + HContractEDate +
|
"','" + HJobCardEDate +
|
"','" + HJobCardNo +
|
"','" + HCheckCardEDate +
|
"','" + HStayCardEDate +
|
"','" + HHealthCardEDate +
|
"','" + HArchivesNo +
|
"','" + HRemark +
|
"','" + HMaker +
|
"','" + HMakerDate +
|
"')";
|
|
//主表
|
oCN.RunProc(sql);
|
LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增入职申请单:" + HBillNo);
|
oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增入职申请单:" + HBillNo + "','LMES-入职申请单模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) //编辑
|
{
|
string sql = "update HR_EmpEngageRequestBillMain set " +
|
"HYear = " + HYear +
|
",HPeriod = " + HPeriod +
|
",HBillType = '" + HBillType +
|
"',HBillSubType = '" + HBillSubType +
|
"', HBillNo = '" + HBillNo +
|
"', HDate = '" + HDate +
|
"', HName = '" + HName +
|
"', HSex = '" + HSex +
|
"', HMarr = '" + HMarr +
|
"', HBirthday = '" + HBirthday +
|
"', HAge = " + HAge +
|
", HBlighty = '" + HBlighty +
|
"', HNation = '" + HNation +
|
"', HBlightyType = '" + HBlightyType +
|
"', HGovStatus = '" + HGovStatus +
|
"', HBloodType = '" + HBloodType +
|
"', HStature = '" + HStature +
|
"', HAvoird = '" + HAvoird +
|
"', HKnowLev = '" + HKnowLev +
|
"', HProTitleID = '" + HProTitleID +
|
"', HWantPay = " + HWantPay +
|
", HGradSchool = '" + HGradSchool +
|
"', HGradDate = '" + HGradDate +
|
"', HSpec = '" + HSpec +
|
"', HEngLev = '" + HEngLev +
|
"', HCompLev = '" + HCompLev +
|
"', HLinkPhone = '" + HLinkPhone +
|
"', HEmail = '" + HEmail +
|
"', HNowAdd = '" + HNowAdd +
|
"', HHomeAdd = '" + HHomeAdd +
|
"', HIDCard = '" + HIDCard +
|
"', HPostalCode = '" + HPostalCode +
|
"', HOldCompany = '" + HOldCompany +
|
"', HInsuranceStatus = " + HInsuranceStatus +
|
", HInsuranceDate = '" + HInsuranceDate +
|
"', HInsuranceNo = '" + HInsuranceNo +
|
"', HContractBDate = '" + HContractBDate +
|
"', HContractYear = " + HContractYear +
|
", HContractEDate = '" + HContractEDate +
|
"', HJobCardEDate = '" + HJobCardEDate +
|
"', HJobCardNo = '" + HJobCardNo +
|
"', HCheckCardEDate = '" + HCheckCardEDate +
|
"', HStayCardEDate = '" + HStayCardEDate +
|
"', HHealthCardEDate = '" + HHealthCardEDate +
|
"', HArchivesNo = '" + HArchivesNo +
|
"',HUpdater = '" + HUpdater +
|
"',HUpdateDate = '" + HUpdaterDate +
|
"' where HInterID = " + HInterID;
|
|
oCN.RunProc(sql);
|
|
//删除子表
|
oCN.RunProc("delete from HR_EmpEngageRequestBillSub where HInterID='" + HInterID + "'");
|
//记录日志
|
LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改入职申请单:" + HBillNo);
|
oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "修改入职申请单:" + HBillNo + "','LMES-入职申请单模块','" + DBUtility.ClsPub.IPAddress + "','修改单据'", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
//保存子表
|
objJsonResult = AddEmpEngageRequestBillSub(HInterID, HBillNo, OperationType);
|
|
if (objJsonResult.code == "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = objJsonResult.Message;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = null;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 添加入职申请单 子表
|
public json AddEmpEngageRequestBillSub(long HInterID, string HBillNo, int OperationType)
|
{
|
string sql = "insert into HR_EmpEngageRequestBillSub" +
|
"(HInterID,HEntryID,HRemark) " +
|
"values(" +
|
"" + HInterID +
|
"," + 1 +
|
",'" + "" +
|
"')";
|
|
oCN.RunProc(sql);
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = null;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
#endregion
|
#endregion
|
|
#region 入职申请单列表 查询
|
/// <summary>
|
/// 返回项目阶段列表
|
///参数:string sql。
|
///返回值:object。
|
/// </summary>
|
[Route("HR_EmpEngageRequestBill/list")]
|
[HttpGet]
|
public object getEmpEngageRequestBill(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
//if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
|
//{
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "无查看权限!";
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
//}
|
|
if (sWhere == null || sWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select * from h_v_HR_EmpEngageRequestBillList order by 单据号 ", "h_v_HR_EmpEngageRequestBillList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_HR_EmpEngageRequestBillList where 1 = 1 ";
|
string sql = sql1 + sWhere + " order by 单据号 ";
|
ds = oCN.RunProcReturn(sql, "h_v_HR_EmpEngageRequestBillList");
|
}
|
|
//添加列名
|
foreach (DataColumn col in ds.Tables[0].Columns)
|
{
|
Type dataType = col.DataType;
|
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
|
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
|
}
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "Sucess!";
|
objJsonResult.data = ds.Tables[0];
|
objJsonResult.list = columnNameList;
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 入职申请单 编辑-页面赋值
|
/// <summary>
|
///参数:string HInterID。
|
///返回值:object。
|
/// </summary>
|
[Route("HR_EmpEngageRequestBill/editInit")]
|
[HttpGet]
|
public object getEmpEngageRequestBilleditInit(string HInterID, string user)
|
{
|
try
|
{
|
//查看权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Edit", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无编辑权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
if(HInterID == null || HInterID.Equals(""))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "HInterID不能为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
ds = oCN.RunProcReturn("exec h_p_HR_EmpEngageRequestBill_EditInit " + HInterID, "h_p_HR_EmpEngageRequestBill_EditInit");
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "Sucess!";
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 入职申请单 删除
|
/// <summary>
|
///参数:string HInterID。
|
///返回值:object。
|
/// </summary>
|
[Route("HR_EmpEngageRequestBill/delete")]
|
[HttpGet]
|
public object deleteEmpEngageRequestBill(string HInterID, string user)
|
{
|
try
|
{
|
//查看权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Drop", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无删除权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
if(HInterID == null || HInterID.Equals(""))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "HInterID不能为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
oCN.BeginTran();
|
|
oCN.RunProc("delete from HR_EmpEngageRequestBillMain where HInterID = " + HInterID);
|
oCN.RunProc("delete from HR_EmpEngageRequestBillSub where HInterID= " + HInterID);
|
|
oCN.Commit();
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "Sucess!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 入职申请单 审核/反审核
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[Route("HR_EmpEngageRequestBill/AuditHR_EmpEngageRequestBill")]
|
[HttpGet]
|
public object AuditHR_EmpEngageRequestBill(string HInterID, int Type, string user)
|
{
|
try
|
{
|
//判断是否有审核权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Check", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无权限审核!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
if (string.IsNullOrWhiteSpace(HInterID))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "HInterID为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
ClsPub.CurUserName = user;
|
BillOld.MvarItemKey = "HR_EmpEngageRequestBillMain";
|
oCN.BeginTran();//开始事务
|
|
//Type 1 审核 2 反审核
|
if (Type == 1)
|
{
|
//判断单据是否已经审核
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已审核!不需要再审核!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//审核单据
|
if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
else
|
{
|
//判断单据是否已经反审核
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已反审核!不需要再反审核!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//反审核单据
|
if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
oCN.Commit();//提交事务
|
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "执行成功!";
|
objJsonResult.data = null;
|
return objJsonResult; ;
|
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "执行失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 入职申请单 关闭/反关闭功能
|
[Route("HR_EmpEngageRequestBill/CloseHR_EmpEngageRequestBill")]
|
[HttpGet]
|
public object CloseHR_EmpEngageRequestBill(string HInterID, int Type, string user)
|
{
|
try
|
{
|
//判断是否有删除权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Close", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无权限关闭!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
if (string.IsNullOrWhiteSpace(HInterID))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "HInterID为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
ClsPub.CurUserName = user;
|
BillOld.MvarItemKey = "HR_EmpEngageRequestBillMain";
|
oCN.BeginTran();//开始事务
|
|
//Type 1 关闭 2 反关闭
|
if (Type == 1)
|
{
|
//判断单据是否已经关闭
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已关闭!不需要再关闭!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//关闭单据
|
if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
else
|
{
|
//判断单据是否已经反关闭
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//反关闭单据
|
if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
oCN.Commit();//提交事务
|
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "执行成功!";
|
objJsonResult.data = null;
|
return objJsonResult; ;
|
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "执行失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 入职申请单 作废/反作废功能
|
[Route("HR_EmpEngageRequestBill/DropHR_EmpEngageRequestBill")]
|
[HttpGet]
|
public object DropHR_EmpEngageRequestBill(string HInterID, int Type, string user)
|
{
|
try
|
{
|
//判断是否有作废权限
|
if (!DBUtility.ClsPub.Security_Log("HR_EmpEngageRequestBill_Delete", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无权限作废!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
if (string.IsNullOrWhiteSpace(HInterID))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "HInterID为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
ClsPub.CurUserName = user;
|
BillOld.MvarItemKey = "HR_EmpEngageRequestBillMain";
|
oCN.BeginTran();//开始事务
|
|
//Type 1 作废 2 反作废
|
if (Type == 1)
|
{
|
//判断单据是否已经作废
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已作废!不需要再作废!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//作废单据
|
if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
else
|
{
|
//判断单据是否已经反作废
|
DataSet ds;
|
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
|
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
|
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
{
|
if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已反作废!不需要再反作废!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
//反作废单据
|
if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
oCN.Commit();//提交事务
|
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "执行成功!";
|
objJsonResult.data = null;
|
return objJsonResult; ;
|
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "执行失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
}
|
}
|