| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 组织名称='" + Organization + "'"); |
| | | //string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 组织名称='" + Organization + "'"); |
| | | string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 1=1 "); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn(sql1 + sWhere, "h_v_IF_EmployeeList"); |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #region 职员 树形图 |
| | | public class TreeModel |
| | | { |
| | | public string id { get; set; } |
| | | public string title { get; set; } |
| | | public List<TreeModel> children = new List<TreeModel>(); |
| | | } |
| | | [Route("Gy_Employee/Gy_EmployeeTreeList")] |
| | | [HttpGet] |
| | | public object Gy_SourceTreeList(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | string sql1 = string.Format("select hitemid,hnumber,hname,HUSEORGID from Gy_Employee" + sWhere + " order by hnumber"); |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "Gy_Employee"); |
| | | |
| | | List<TreeModel> treeModels = new List<TreeModel>(); |
| | | TreeModel first = new TreeModel(); |
| | | first.id = "0"; |
| | | first.title = "职员设置"; |
| | | treeModels.Add(first); |
| | | |
| | | foreach (DataRow row in ds.Tables[0].Rows) |
| | | { |
| | | var strLen = row["hitemid"].ToString().Split('.'); |
| | | if (strLen.Length == 1) |
| | | { |
| | | TreeModel tree = new TreeModel(); |
| | | tree.id = row["hitemid"].ToString(); |
| | | tree.title = row["hname"].ToString(); |
| | | treeModels[0].children.Add(tree); |
| | | } |
| | | } |
| | | digui(ds.Tables[0], treeModels[0].children, 2); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels); |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 递归函数 |
| | | /// </summary> |
| | | public void digui(DataTable dt, List<TreeModel> tree, int num) |
| | | { |
| | | for (int m = 0; m < tree.Count; m++) |
| | | { |
| | | tree[m].children = new List<TreeModel>(); |
| | | for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集 |
| | | { |
| | | var strLen = dt.Rows[i]["hnumber"].ToString().Split('.'); |
| | | if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + ".")) |
| | | { |
| | | TreeModel tbjson = new TreeModel(); |
| | | tbjson.id = dt.Rows[i]["hitemid"].ToString(); |
| | | tbjson.title = dt.Rows[i]["hname"].ToString(); |
| | | tree[m].children.Add(tbjson); |
| | | } |
| | | } |
| | | var strLens = tree[m].id.Split('.'); |
| | | for (int i = 0; i < tree[m].children.Count; i++) |
| | | { |
| | | digui(dt, tree[m].children, strLens.Length + 2);//再次用子集去循环,拿出子集的子集 |
| | | } |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | ///// <summary> |
| | | ///// 新增职员-保存按钮 |
| | |
| | | [HttpPost] |
| | | public object ModifyByID([FromBody] JObject oMain) |
| | | { |
| | | |
| | | try |
| | | { |
| | | { |
| | | DAL.ClsGy_Employee_Ctl oDept = new DAL.ClsGy_Employee_Ctl(); |
| | | DAL.ClsGy_Employee_View oDeptHlp = new DAL.ClsGy_Employee_View(); |
| | | |
| | |
| | | string msg4 = sArray[2].ToString(); |
| | | //string msg4 = sArray[2].ToString(); |
| | | //string msg5 = sArray[3].ToString(); |
| | | |
| | | oCN.BeginTran(); |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_Employee_Edit", 1, false, msg3)) |
| | | { |
| | |
| | | long HCTPrjID = list[0].HCTPrjID; |
| | | long HProcID = list[0].HProcID; |
| | | string HBasePay = list[0].HBasePay; |
| | | DateTime HInComDate = list[0].HInComDate; //进厂日期 |
| | | DateTime HDimissionDate = list[0].HDimissionDate; //离职日期 (允许NULL) |
| | | DateTime HInComDate = list[0].HInComDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HInComDate.Value; //进厂日期 |
| | | DateTime HDimissionDate = list[0].HDimissionDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HDimissionDate.Value; //离职日期 (允许NULL) |
| | | bool HOverType = list[0].HOverType; |
| | | string HEmpType = list[0].HEmpType; |
| | | string HOtherDeduct3 = list[0].HOtherDeduct3; |
| | |
| | | string HDimissionReason = list[0].HDimissionReason; |
| | | long HDormID = list[0].HDormID; |
| | | string HArchivesNo = list[0].HArchivesNo; |
| | | DateTime HStayCardEDate = list[0].HStayCardEDate; //暂住证到期日 |
| | | DateTime HStayCardEDate = list[0].HStayCardEDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HStayCardEDate.Value; //暂住证到期日 |
| | | DateTime HCheckCardEDate = Convert.ToDateTime("1900/1/1"); //审检证到期日 |
| | | string HJobCardNo = list[0].HJobCardNo ?? ""; |
| | | DateTime HJobCardEDate = Convert.ToDateTime("1900/1/1"); //就业证到期日 |
| | | string HWorkType = list[0].HWorkType; |
| | | long HContractYear = list[0].HContractYear; |
| | | DateTime HContractBDate = list[0].HContractBDate; //合同开始日 |
| | | DateTime HContractEDate = list[0].HContractEDate; //合同到期日 |
| | | DateTime HContractBDate = list[0].HContractBDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HContractBDate.Value; //合同开始日 |
| | | DateTime HContractEDate = list[0].HContractEDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HContractEDate.Value; //合同到期日 |
| | | string HInsuranceNo = list[0].HInsuranceNo; |
| | | DateTime HInsuranceDate = list[0].HInsuranceDate; //参保日期 |
| | | DateTime HInsuranceDate = list[0].HInsuranceDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HInsuranceDate.Value; //参保日期 |
| | | bool HInsuranceStatus = list[0].HInsuranceStatus; |
| | | DateTime HSignDate = Convert.ToDateTime("1900/1/1"); //签约日期 |
| | | bool HSignStatus = list[0].HSignStatus; |
| | |
| | | string HSpec = list[0].HSpec ?? ""; |
| | | string HCompLev = list[0].HCompLev ?? ""; |
| | | string HEngLev = list[0].HEngLev ?? ""; |
| | | DateTime HGradDate = list[0].HGradDate; //毕业日期 |
| | | DateTime HGradDate = list[0].HGradDate == null ? Convert.ToDateTime("1900/1/1") : list[0].HGradDate.Value; //毕业日期 |
| | | string HGradSchool = list[0].HGradSchool ?? ""; |
| | | string HSalaryLev = list[0].HSalaryLev ?? ""; |
| | | long HDutyID = list[0].HDutyID; |
| | |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | //查询数据中是否存在重复代码 |
| | | ds = oCN.RunProcReturn("Select HItemID from Gy_Employee Where HItemID<>" + HItemID + " and HNumber='" + HNumber + "' and HUSEORGID=" + HUSEORGID, "Gy_Warehouse"); |
| | | |
| | |
| | | //保存完毕后处理 |
| | | if (HItemID == 0) |
| | | { |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("Insert into Gy_Employee (" + |
| | | "HNumber,HName,HShortNumber,HEmpRate,HExamRate" + |
| | | ",HLevel,HParentID,HEndflag,HHighestPay,HOverPayRate" + |
| | |
| | | } |
| | | LogService.Write(sql3); |
| | | oCN.RunProcReturn(sql3, "Gy_Employee_Post"); |
| | | oCN.Commit(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | //若MAINDI重复则重新获取 |
| | | oCN.BeginTran(); |
| | | |
| | | //已审核不允许修改 |
| | | DataSet dss; |
| | | dss = oCN.RunProcReturn("select * from Gy_Employee where HItemID=" + HItemID, "Gy_Employee"); |
| | |
| | | } |
| | | LogService.Write(sql3); |
| | | oCN.RunProcReturn(sql3, "Gy_WorkCenterSub"); |
| | | oCN.Commit(); |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //oCN.RollBack(); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.Message; |