/// <summary> /// 分页集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageList <ORD_PurchaseOrderResult> GetPageList(ORD_PurchaseOrderParam param) { this.CheckSession(); PageList <ORD_PurchaseOrderResult> ret = new PageList <ORD_PurchaseOrderResult>(); try { List <Field> field = new List <Field>() { Field.All }; ret = this.SelectList <ORD_PurchaseOrderResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), ORD_PurchaseOrder._.CreatedTime.Desc); if (ret.ResultList != null && ret.ResultList.Count > 0) { HR_OrgBLL orgBLL = new HR_OrgBLL(); orgBLL.SessionInfo = this.SessionInfo; HR_OrgParam orgParam = new HR_OrgParam(); orgParam.OrgIDs = ret.ResultList.Where(a => a.PurOrgID != null).Select(a => a.PurOrgID).Distinct().ToArray(); List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentParam deptParam = new HR_DepartmentParam(); deptParam.DeptIDs = ret.ResultList.Where(a => a.PurDeptID != null).Select(a => a.PurDeptID).Distinct().ToArray(); List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam); HR_Org findOrg = null; HR_DepartmentResult findDept = null; foreach (ORD_PurchaseOrderResult orderResult in ret.ResultList) { findOrg = orgList.Find(a => a.OrgID == orderResult.PurOrgID); if (findOrg != null) { orderResult.PurOrgName = findOrg.OrgName; } findDept = deptList.Find(a => a.DeptID == orderResult.PurDeptID); if (findDept != null) { orderResult.PurDeptName = findDept.DeptName; } orderResult.AllStatus = orderResult.StkInStatus + "->" + orderResult.StkOutStatus; } } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 分页集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageList <STK_OutResult> GetPageList(STK_OutParam param) { this.CheckSession(); PageList <STK_OutResult> ret = new PageList <STK_OutResult>(); try { List <Field> field = new List <Field>() { Field.All }; ret = this.SelectList <STK_OutResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), STK_Out._.CreatedTime.Desc); if (ret.ResultList != null && ret.ResultList.Count > 0) { HR_OrgBLL orgBLL = new HR_OrgBLL(); orgBLL.SessionInfo = this.SessionInfo; HR_OrgParam orgParam = new HR_OrgParam(); orgParam.OrgIDs = ret.ResultList.Where(a => a.OperDeptID != null).Select(a => a.OperOrgID).Distinct().ToArray(); List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentParam deptParam = new HR_DepartmentParam(); deptParam.DeptIDs = ret.ResultList.Where(a => a.OperDeptID != null).Select(a => a.OperDeptID).Distinct().ToArray(); List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam); foreach (STK_OutResult orderResult in ret.ResultList) { if (orderResult.OperOrgID != null) { orderResult.OperOrgName = orgList.FirstOrDefault(a => a.OrgID == orderResult.OperOrgID).OrgName; } if (orderResult.OperDeptID != null) { orderResult.OperDeptName = deptList.FirstOrDefault(a => a.DeptID == orderResult.OperDeptID).DeptName; } } } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
public PageList <ORD_SalesOrderResult> GetSimplePageList(ORD_SalesOrderParam param, List <Field> fields) { PageList <ORD_SalesOrderResult> ret = new PageList <ORD_SalesOrderResult>(); try { ret = this.SelectList <ORD_SalesOrderResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), fields, GetWhereClip(param), ORD_SalesOrder._.CreatedTime.Desc); if (ret.ResultList != null && ret.ResultList.Count > 0) { HR_OrgBLL orgBLL = new HR_OrgBLL(); orgBLL.SessionInfo = this.SessionInfo; HR_OrgParam orgParam = new HR_OrgParam(); orgParam.OrgIDs = ret.ResultList.Where(a => a.SalDeptID != null).Select(a => a.SalOrgID).Distinct().ToArray(); List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentParam deptParam = new HR_DepartmentParam(); deptParam.DeptIDs = ret.ResultList.Where(a => a.SalDeptID != null).Select(a => a.SalDeptID).Distinct().ToArray(); List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam); foreach (ORD_SalesOrderResult orderResult in ret.ResultList) { if (orderResult.SalOrgID != null) { orderResult.SalOrgName = orgList.FirstOrDefault(a => a.OrgID == orderResult.SalOrgID).OrgName; } if (orderResult.SalDeptID != null) { orderResult.SalDeptName = deptList.FirstOrDefault(a => a.DeptID == orderResult.SalDeptID).DeptName; } orderResult.AllStatus = orderResult.NotifyStatus + "->" + orderResult.PurchaseStatus + "->" + orderResult.StkInStatus + "->" + orderResult.StkOutStatus; } } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 获取一条信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public ORD_SalesOrderResult GetInfo(ORD_SalesOrderParam param) { this.CheckSession(); ORD_SalesOrderResult rst = new ORD_SalesOrderResult(); #region 判断 if (param.SOGuid == null) { throw new WarnException("请指定销售单GUID!"); } #endregion #region 获取实体 rst = this.Select <ORD_SalesOrderResult>(GetWhereClip(param)); if (rst != null) { string[] statusArr = new string[] { rst.NotifyStatus, rst.PurchaseStatus, rst.StkTakeStatus, rst.StkInStatus, rst.StkOutStatus, rst.ShipmentStatus, rst.ReturnStatus, rst.ReceivableStatus }; rst.AllStatus = string.Join(",", statusArr); ORD_SalesOrderLineBLL lineBLL = new ORD_SalesOrderLineBLL(); lineBLL.SessionInfo = this.SessionInfo; rst.OrderLineList = lineBLL.GetList(new ORD_SalesOrderLineParam() { SOGuid = rst.SOGuid }); //this.SelectList<ORD_SalesOrderLineResult>(ORD_SalesOrderLine._.SOGuid == rst.SOGuid); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentResult deptResult = deptBLL.GetInfo(new HR_DepartmentParam() { DeptID = rst.SalDeptID }); rst.SalDeptName = deptResult.DeptName; } #endregion return(rst); }
public SYS_UserAccountResult UserLogin(SYS_UserAccountParam param) { var result = new SYS_UserAccountResult(); try { #region 用户帐号判定 param.Account.ThrowIfNullOfEmpty("请指定用户名!"); param.CompanyName.ThrowIfNullOfEmpty("请指定公司名称!"); param.PWD.ThrowIfNullOfEmpty("请指定登录密码!"); #endregion #region 验证公司 //正式版验证时需要排除平台用户相关的公司 WhereClip coInfoWhereClip = SYS_CompanyInfo._.CompanyName == param.CompanyName && SYS_CompanyInfo._.IsActive != (int)ZNLCRM.Utility.CommonEnum.IsActive.Deleted; if (!string.IsNullOrEmpty(param.PartnerCode)) { coInfoWhereClip = coInfoWhereClip && SYS_CompanyInfo._.PartnerCode == param.PartnerCode; } else { coInfoWhereClip = coInfoWhereClip && SYS_CompanyInfo._.PartnerCode.IsNull(); } SYS_CompanyInfo coInfo = Select <SYS_CompanyInfo>(coInfoWhereClip); coInfo.ThrowIfNull("未找到公司帐户信息!"); SYS_UserAccount userAccount = Select <SYS_UserAccount>( SYS_UserAccount._.GCompanyID == coInfo.CompanyID && SYS_UserAccount._.Account == param.Account && SYS_UserAccount._.IsActive != (int)ZNLCRM.Utility.CommonEnum.IsActive.Deleted && SYS_UserAccount._.IsDeleted == false ); userAccount.ThrowIfNull("未找到公司用户信息!"); userAccount.IsActive.ThrowIfEqual( (int?)ZNLCRM.Utility.CommonEnum.IsActive.Disabled, "当前用户已被禁用!" ); HR_Employee userEmpInfo = Select <HR_Employee>( HR_Employee._.GCompanyID == coInfo.CompanyID && HR_Employee._.EmpCode == param.Account && HR_Employee._.IsActive != (int)ZNLCRM.Utility.CommonEnum.IsActive.Deleted && HR_Employee._.IsDeleted == false ); userEmpInfo.ThrowIfNull("未找到公司用户信息!"); userEmpInfo.IsActive.ThrowIfEqual( (int?)ZNLCRM.Utility.CommonEnum.IsActive.Disabled, "当前用户已被禁用!" ); bool isMater = false; userEmpInfo.EmpStatus.ThrowIfEqual(3, "当前用户状态已离职!"); //子帐号需要做验证逻辑判断 if (!isMater) { if (userAccount.NeedValidate.ToBooleanHasNull() && !string.IsNullOrEmpty(userAccount.MacAddress.ToStringHasNull()) && !string.IsNullOrEmpty(userAccount.HardDiskSN.ToStringHasNull())) { if (userAccount.MacAddress.ToStringHasNull().Trim().ToLower() != param.MacAddress.ToStringHasNull().Trim().ToLower() || userAccount.HardDiskSN.ToStringHasNull().Trim().ToLower() != param.HardSN.ToStringHasNull().Trim().ToLower()) { throw new WarnException("您不能在本机登录!"); } } if (!string.IsNullOrEmpty(userAccount.UseTimeBegin.ToStringHasNull()) && !string.IsNullOrEmpty(userAccount.UseTimeOver.ToStringHasNull())) { DateTime start = (DateTime.Now.ToString("yyyy-MM-dd") + " " + userAccount.UseTimeBegin).ToDateTime(); DateTime end = (DateTime.Now.ToString("yyyy-MM-dd") + " " + userAccount.UseTimeOver).ToDateTime(); if (!(DateTime.Now >= start && DateTime.Now <= end)) { throw new WarnException("您不能在非工作时间(" + userAccount.UseTimeBegin + " - " + userAccount.UseTimeOver + ")登录!"); } } } #endregion #region 判断登录用户数 SYS_SignLogInfoBLL signBll = new SYS_SignLogInfoBLL(); signBll.SessionInfo = this.SessionInfo; signBll.CheckLogUserRuler( userAccount.GCompanyID, userEmpInfo.EmpID, userEmpInfo.EmpGuid, userEmpInfo.EmpName, SessionInfo.ClientIP, SessionInfo.AdapterAddress); #endregion #region 修改登录统计信息 this.Update <SYS_UserAccount>(new Field[] { SYS_UserAccount._.SignInTimes, SYS_UserAccount._.LastSignIP, SYS_UserAccount._.LastSignTime, SYS_UserAccount._.MacAddress, SYS_UserAccount._.HardDiskSN }, new object[] { userAccount.SignInTimes.GetValueOrDefault(0) + 1, param.ClientIP, DateTime.Now, param.MacAddress, param.HardSN }, SYS_UserAccount._.UserID == userAccount.UserID); #endregion #region 修改登录session SYS_SignLogInfoResult signParam = new SYS_SignLogInfoResult(); signBll.SessionInfo = this.SessionInfo; signParam.GCompanyID = userAccount.GCompanyID; signParam.UserID = userAccount.UserID; signParam.UserName = userEmpInfo.EmpName; signParam.UserAdapter = this.SessionInfo.AdapterAddress; signParam.UserIP = this.SessionInfo.ClientIP; signBll.UpdateUserOnline(signParam); #endregion #region 返回值 result.GCompanyID = userAccount.GCompanyID; result.UserID = userAccount.UserID; result.EmpName = userEmpInfo.EmpName; result.UserGUID = userAccount.UserGUID; result.Account = userAccount.Account; result.SaleCurrency = userEmpInfo.DefaultSaleCurreny; result.BuyCurrency = userEmpInfo.DefaultBuyCurreny; result.OrgID = userEmpInfo.OrgID; result.DeptID = userEmpInfo.DeptID; result.LoginSucceed = 1; #endregion #region 获取部门名称和机构名称 HR_OrgBLL orgBll = new HR_OrgBLL(); HR_DepartmentBLL deptBll = new HR_DepartmentBLL(); orgBll.SessionInfo = this.SessionInfo; deptBll.SessionInfo = this.SessionInfo; result.OrgName = orgBll.GetOrgName(result.OrgID.ToInt32()); result.DeptName = deptBll.GetDeptName(result.DeptID.ToInt32()); #endregion } catch (Exception ex) { throw ex; } return(result); }