/// <summary> /// 根据申报部门获取设置过对应关系的项目+项目的预算部门为该申报部门的项目 /// </summary> /// <returns></returns> public string GetXMbySBDept() { string Dept = System.Web.HttpContext.Current.Request.Params["Dept"]; Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "GKBM")) .Add(ORMRestrictions <string> .Eq("Dydm", Dept)); List <string> ProjcodeList = CorrespondenceSettings2Service.Find(dicWhere).Data.ToList().Select(x => x.Dwdm).Distinct().ToList(); Dictionary <string, object> dicWhereys = new Dictionary <string, object>(); Dictionary <string, object> dicWhereys1 = new Dictionary <string, object>(); Dictionary <string, object> dicWhereys2 = new Dictionary <string, object>(); Dictionary <string, object> dicWhereys3 = new Dictionary <string, object>(); new CreateCriteria(dicWhereys1).Add(ORMRestrictions <List <string> > .In("FProjCode", ProjcodeList)); new CreateCriteria(dicWhereys2).Add(ORMRestrictions <string> .Eq("FYear", DateTime.Now.Year.ToString())) .Add(ORMRestrictions <string> .Eq("FBudgetDept", Dept)) .Add(ORMRestrictions <System.Int32> .Eq("FLifeCycle", 0)) .Add(ORMRestrictions <System.String> .Eq("FApproveStatus", "3")) .Add(ORMRestrictions <String> .Eq("FMidYearChange", "0")); new CreateCriteria(dicWhereys3).Add(ORMRestrictions <string> .Eq("FYear", DateTime.Now.Year.ToString())) .Add(ORMRestrictions <string> .Eq("FDeclarationDept", Dept)) .Add(ORMRestrictions <System.Int32> .Eq("FLifeCycle", 0)) .Add(ORMRestrictions <System.String> .Eq("FApproveStatus", "3")) .Add(ORMRestrictions <String> .Eq("FMidYearChange", "0")); new CreateCriteria(dicWhereys).Add(ORMRestrictions.Or(dicWhereys1, dicWhereys2, dicWhereys3)); string[] Array = BudgetMstService.Find(dicWhereys).Data.ToList().Select(x => x.FProjCode).Distinct().ToArray(); var result = JsonConvert.SerializeObject(Array); return(result); }
/// <summary> /// 取列表数据 /// </summary> /// <returns>返回Json串</returns> public string GetExpenseMstList() { string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"]; //查询条件 Dictionary <string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery); //查询条件转Dictionary var userId = System.Web.HttpContext.Current.Request.Params["userId"]; var dicWhereDept = new Dictionary <string, object>(); new CreateCriteria(dicWhereDept) .Add(ORMRestrictions <string> .Eq("Dwdm", userId)).Add(ORMRestrictions <string> .Eq("Dylx", "97")); //闭区间 var deptList = CorrespondenceSettingsService.Find(dicWhereDept); List <string> deptL = new List <string>(); for (var i = 0; i < deptList.Data.Count; i++) { deptL.Add(deptList.Data[i].Dydm); } new CreateCriteria(dicWhere) .Add(ORMRestrictions <IList <String> > .In("FBudgetDept", deptL)); DataStoreParam storeparam = this.GetDataStoreParam(); var result = ExpenseMstService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere, new string[] { "FPerformevaltype Desc" }); return(DataConverterHelper.EntityListToJson <ExpenseMstModel>(result.Results, (Int32)result.TotalItems)); }
public string PostDelete([FromBody] InfoBaseModel <List <long> > phids) { var deletedresult = new DeletedResult(); if (phids.infoData.Count > 0) { List <long> usePhids = BankAccountService.judgeIfUse(phids.infoData); if (usePhids.Count > 0) { string Msg = "银行账户名称为"; Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PhId", usePhids)); IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data; foreach (BankAccountModel bankAccount in bankAccounts) { Msg = Msg + bankAccount.FBankname + ","; } Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除"; deletedresult.Status = ResponseStatus.Error; deletedresult.Msg = Msg; } else { for (var i = 0; i < phids.infoData.Count; i++) { deletedresult = BankAccountService.Delete <System.Int64>(phids.infoData[i]); //BankAccountService.Find(t => phids.infoData.Contains(t.PhId)); } } } return(DataConverterHelper.SerializeObject(deletedresult)); }
/// <summary> /// 验证数据 /// </summary> /// <returns></returns> public FindedResults <PerformEvalTargetTypeModel> ExecuteDataCheck(ref List <PerformEvalTargetTypeModel> performEvalTargetType, string otype) { IList <string> dm = new List <string>(); FindedResults <PerformEvalTargetTypeModel> results = new FindedResults <PerformEvalTargetTypeModel>(); if (performEvalTargetType == null) { results.Status = ResponseStatus.Error; results.Msg = "保存失败,数据异常!"; } else { for (int i = 0; i < performEvalTargetType.Count; i++) { performEvalTargetType[i].FCode = performEvalTargetType[i].FCode.Replace(" ", ""); performEvalTargetType[i].FName = performEvalTargetType[i].FName.Replace(" ", ""); performEvalTargetType[i].FRemark.Trim(); dm.Add(performEvalTargetType[i].FCode); } var dicWhere1 = new Dictionary <string, object>(); new CreateCriteria(dicWhere1). Add(ORMRestrictions <IList <string> > .In("FCode", dm)); if (base.Find(dicWhere1) != null && base.Find(dicWhere1).Data.Count > 0 && otype != "edit") { results = base.Find(dicWhere1); results.Status = ResponseStatus.Error; results.Msg = "保存失败,代码重复!"; } } return(results); }
/// <summary> /// 验证数据 /// </summary> /// <returns></returns> public FindedResults <BudgetAccountsModel> ExecuteDataCheck(ref List <BudgetAccountsModel> budgetAccounts, string otype) { IList <string> kmdm = new List <string>(); FindedResults <BudgetAccountsModel> results = new FindedResults <BudgetAccountsModel>(); if (budgetAccounts == null) { results.Status = ResponseStatus.Error; results.Msg = "保存失败,数据异常!"; } else { for (int i = 0; i < budgetAccounts.Count; i++) { budgetAccounts[i].KMDM = budgetAccounts[i].KMDM.Replace(" ", ""); budgetAccounts[i].KMMC = budgetAccounts[i].KMMC.Replace(" ", ""); budgetAccounts[i].KMLB = budgetAccounts[i].KMLB.Replace(" ", ""); kmdm.Add(budgetAccounts[i].KMDM); } var dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere) .Add(ORMRestrictions <IList <string> > .In("KMDM", kmdm)); results = base.Find(dicWhere); if (results != null && results.Data.Count > 0 && otype != "edit") { results.Status = ResponseStatus.Error; results.Msg = "保存失败,科目代码重复!"; } } return(results); }
/// <summary> /// 判断是否允许修改 /// </summary> /// <returns></returns> public string JudgeCode() { string code = System.Web.HttpContext.Current.Request.Params["code"]; Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic).Add(ORMRestrictions <string> .LLike("DM", code)); IList <ProjLibProjModel> ProjLibProjList = ProjLibProjService.Find(dic).Data; if (ProjLibProjList.Count > 0) { var dmList = ProjLibProjList.ToList().Select(x => x.DM).ToList(); Dictionary <string, object> dic2 = new Dictionary <string, object>(); new CreateCriteria(dic2).Add(ORMRestrictions <List <string> > .In("FProjCode", dmList)) .Add(ORMRestrictions <List <string> > .In("FApproveStatus", new List <string>() { "2", "3" })) .Add(ORMRestrictions <Int32> .Eq("FLifeCycle", 0));; var mst = ProjectMstService.Find(dic2).Data; if (mst.Count > 0) { return("false"); } else { return("true"); } } else { return("true"); } }
/// <summary> /// 根据操作员和申报单位取预算部门 /// </summary> /// <param name="Usercoode"></param> /// <param name="Unit"></param> /// <returns></returns> public IList <OrganizeModel> GetDept(string Usercoode, string Unit) { Dictionary <string, object> dic_Corr = new Dictionary <string, object>(); new CreateCriteria(dic_Corr) .Add(ORMRestrictions <String> .Eq("Dwdm", Usercoode)) .Add(ORMRestrictions <String> .Eq("Dylx", "97")) .Add(ORMRestrictions <String> .LLike("Dydm", Unit)); IList <CorrespondenceSettingsModel> correspondenceSettings = CorrespondenceSettingsRule.Find(dic_Corr); List <string> ocodeList = new List <string>(); if (correspondenceSettings.Count > 0) { for (var i = 0; i < correspondenceSettings.Count; i++) { if (!ocodeList.Contains(correspondenceSettings[i].Dydm)) { ocodeList.Add(correspondenceSettings[i].Dydm); } } } Dictionary <string, object> dic_org = new Dictionary <string, object>(); new CreateCriteria(dic_org) .Add(ORMRestrictions <String> .Eq("IfCorp", "N")) .Add(ORMRestrictions <String> .Eq("IsActive", "1")) .Add(ORMRestrictions <List <String> > .In("OCode", ocodeList)); IList <OrganizeModel> organizes = OrganizationRule.Find(dic_org); return(organizes); }
public FindedResults <PerformEvalTargetModel> FindPerformEvalTargetByAnyCode <TValType>(TValType values, string Pname) { Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere) .Add(ORMRestrictions <TValType> .In(Pname, values)); return(PerformEvalTargetFacade.Find(dicWhere)); }
/// <summary> /// 查看单个岗位的信息 /// </summary> /// <param name="phid">岗位的phid</param> /// <returns></returns> public GAppvalPostAndOpersModel GetAppvalPostOpers(long phid) { GAppvalPostAndOpersModel gAppvalPostAndOpers = new GAppvalPostAndOpersModel(); Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <long> .Eq("PhId", phid)); var result = this.GAppvalPostFacade.Find(dic).Data; if (result.Count > 0) { gAppvalPostAndOpers.GAppvalPost = result[0]; dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <long> .Eq("PostPhid", phid)); var res = this.GAppvalPost4OperFacade.Find(dic).Data; if (res.Count > 0) { var codeList = res.ToList().Select(t => t.OperatorCode).ToList(); dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <string> > .In("Dwdm", codeList)) .Add(ORMRestrictions <string> .Eq("Dylx", "08")) .Add(ORMRestrictions <int> .Eq("DefInt1", 1)); //根据操作员编码查找对应组织部门信息 var opers = this.CorrespondenceSettingsFacade.Find(dic).Data;//操作员编码:Dwdm;操作员姓名:DefStr1;部门代码:DefStr3;组织代码:Dydm if (opers.Count > 0) { foreach (CorrespondenceSettingsModel data in opers) { if (!string.IsNullOrEmpty(data.Dydm)) { data.DefStr4 = OrganizationFacade.FindMcByDm(data.Dydm);//DefStr4:组织名称 } if (!string.IsNullOrEmpty(data.DefStr3)) { data.DefStr5 = OrganizationFacade.FindMcByDm(data.DefStr3);//DefStr5:部门名称 } } foreach (GAppvalPost4OperModel gAppvalPost4Oper in res) { var corr = opers.Where(t => t.Dwdm == gAppvalPost4Oper.OperatorCode).ToList(); if (corr.Count > 0) { //将组织部门名存入到对象 gAppvalPost4Oper.OrgCode = corr[0].Dydm; gAppvalPost4Oper.OrgName = corr[0].DefStr4; gAppvalPost4Oper.DepCode = corr[0].DefStr3; gAppvalPost4Oper.DepName = corr[0].DefStr5; gAppvalPost4Oper.OperatorName = corr[0].DefStr1; } } } gAppvalPostAndOpers.GAppvalPost4Opers = res; } } return(gAppvalPostAndOpers); }
public string PostSave([FromBody] InfoBaseModel <List <BankAccountModel> > bankAccount) { /*UnChanged = 0, * Added = 1, * Modified = 2, * Deleted = 3*/ SavedResult <Int64> savedresult = new SavedResult <Int64>(); List <long> modifyPhids = new List <long>(); foreach (BankAccountModel data in bankAccount.infoData) { if (data.PersistentState == PersistentState.Modified || data.PersistentState == PersistentState.Deleted) { modifyPhids.Add(data.PhId); } } if (modifyPhids.Count > 0) { List <long> usePhids = BankAccountService.judgeIfUse(modifyPhids); if (usePhids.Count > 0) { string Msg = "银行账户名称为"; Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PhId", usePhids)); IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data; foreach (BankAccountModel a in bankAccounts) { Msg = Msg + a.FBankname + ","; } var data2 = bankAccount.infoData.Find(x => x.PhId == usePhids[0]);//因为只能删除或修改所以单据的状态只能是一个 if (data2.PersistentState == PersistentState.Deleted) { Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除"; } else { Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能修改"; } savedresult.Status = ResponseStatus.Error; savedresult.Msg = Msg; return(DataConverterHelper.SerializeObject(savedresult)); } } try { savedresult = BankAccountService.Save <Int64>(bankAccount.infoData, ""); } catch (Exception ex) { savedresult.Status = ResponseStatus.Error; savedresult.Msg = ex.Message.ToString(); } return(DataConverterHelper.SerializeObject(savedresult)); }
/// <summary> /// 根据预算部门查找部门所在预算进度 /// </summary> /// <param name="deptCode"></param> /// <returns></returns> public FindedResults <BudgetProcessCtrlModel> FindBudgetProcessCtrlByList(List <string> deptCode, string FYear) { Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere).Add(ORMRestrictions <IList <String> > .In("FDeptCode", deptCode)).Add(ORMRestrictions <String> .Eq("FYear", FYear)); FindedResults <BudgetProcessCtrlModel> results = base.ServiceHelper.Find <BudgetProcessCtrlModel>(dicWhere); return(results); }
/// <summary> /// 根据组织获取岗位(2019.10.17改成岗位根据操作员对应组织权限取) /// </summary> /// <param name="userId">操作员id</param> /// <returns></returns> public IList <GAppvalPostModel> GetAppvalPostList(long userId) { List <Int64> orgs = OrganizationFacade.GetSBUnit(userId).ToList().Select(x => x.PhId).ToList(); Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("OrgPhid", orgs)) .Add(ORMRestrictions <byte> .Eq("FEnable", (byte)EnumYesNo.Yes)); var result = this.GAppvalPostFacade.Find(dic, new string[] { "IsSystem desc", "FCode Asc" }).Data; return(result); }
/// <summary> /// 根据岗位主键集合删除岗位与岗位对应操作员信息 /// </summary> /// <param name="phidList">岗位主键集合</param> /// <param name="uCode">用户账号</param> /// <returns></returns> public DeletedResult DeletedPostOpers(List <long> phidList, string uCode) { DeletedResult deletedResult = new DeletedResult(); Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList)); var record = this.GAppvalRecordFacade.Find(dic).Data; if (record.Count > 0) { throw new Exception("此岗位已被审批使用,无法进行删除!"); } dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList)); var procPost = this.GAppvalProc4PostFacade.Find(dic).Data; if (procPost.Count > 0) { throw new Exception("此岗位已被流程使用,无法进行删除!"); } dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PhId", phidList)) .Add(ORMRestrictions <byte> .Eq("IsSystem", (byte)1)); var sysPosts = this.GAppvalPostFacade.Find(dic).Data; if (sysPosts.Count > 0 && uCode != "Admin") { throw new Exception("内置岗位普通操作员不能进行删除!"); } dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PhId", phidList)); var posts = this.GAppvalPostFacade.Find(dic).Data; if (posts.Count > 0) { deletedResult = this.GAppvalPostFacade.Delete(dic); dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList)); var opers = this.GAppvalPost4OperFacade.Find(dic).Data; if (opers.Count > 0) { deletedResult = this.GAppvalPost4OperFacade.Delete(dic); } } return(deletedResult); }
/// <summary> /// 批量更新主表支付状态 /// </summary> /// <param name="phIds"></param> /// <param name="payState"></param> /// <returns></returns> public SavedResult <long> UpdateMstPayState(List <long> phIds, byte payState) { Dictionary <string, object> oldMstWhere = new Dictionary <string, object>(); new CreateCriteria(oldMstWhere).Add(ORMRestrictions <List <long> > .In("PhId", phIds)); var findMst = this.GKPaymentMstRule.Find(oldMstWhere, new string[] { "PhId Asc" }); if (findMst != null && findMst.Count > 0) { Dictionary <string, object> dtlsWhere = new Dictionary <string, object>(); IList <GKPaymentDtlModel> dtls = null; int sameCount = 0; foreach (var mst in findMst) { //查找对应的明细数据 sameCount = 0; dtlsWhere.Clear(); dtlsWhere.Add("MstPhid", mst.PhId); dtls = this.GKPaymentDtlRule.Find(dtlsWhere); foreach (var dtl in dtls) { if (dtl.FState == payState) { sameCount++; } } //明细表所有状态和要更新的主表状态一致,可更新主表为对应状态 if (sameCount == dtls.Count) { /* * mst.FState = payState; * mst.PersistentState = PersistentState.Modified; * * var resutlt = this.Save<long>(mst); * if (resutlt.IsError == false) * { * this.UpdateZjbfPaymentPayState(mst.PhId, payState); //更新资金拨付单状态 * * } */ var resutlt = this.UpdatePaymentState(mst.PhId, payState, 0); //更新嵌套的主表状态 return(resutlt); } } } return(null); }
public string GetGHSubjectList([FromUri] GHSubjectRequestModel param) { if (string.IsNullOrEmpty(param.UserId)) { return(DCHelper.ErrorMessage("用户编码不能为空!")); } if (string.IsNullOrEmpty(param.Fkmlb)) { return(DCHelper.ErrorMessage("申报种类不能为空!")); } try { Dictionary <string, object> dicWhere = new Dictionary <string, object>();//查询条件转Dictionary new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FProjAttr", param.Fkmlb)); //增加搜索条件 if (!string.IsNullOrEmpty(param.FApproveStatus) && !"0".Equals(param.FApproveStatus)) { new CreateCriteria(dicWhere) .Add(ORMRestrictions <string> .Eq("FApproveStatus", param.FApproveStatus)); } if (!string.IsNullOrEmpty(param.Year)) { new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FYear", param.Year)); } //增加根据操作员对应预算部门的过滤 var dicWhereDept = new Dictionary <string, object>(); new CreateCriteria(dicWhereDept) .Add(ORMRestrictions <string> .Eq("Dwdm", param.UserId)).Add(ORMRestrictions <string> .Eq("Dylx", "97")); //闭区间 var deptList = CorrespondenceSettingsService.Find(dicWhereDept); List <string> deptL = new List <string>(); for (var i = 0; i < deptList.Data.Count; i++) { deptL.Add(deptList.Data[i].Dydm); } new CreateCriteria(dicWhere).Add(ORMRestrictions <IList <String> > .In("FDeclarationDept", deptL)) .Add(ORMRestrictions <string> .Eq("FYear", DateTime.Today.Year.ToString())); new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FType", "c")); var result = GHSubjectService.LoadWithPage(param.PageIndex, param.PageSize, dicWhere, new string[] { "NgInsertDt Desc", "NgUpdateDt Desc" }); //return DataConverterHelper.EntityListToJson<GHSubjectModel>(result.Results, (Int32)result.TotalItems); return(DCHelper.ModelListToJson <GHSubjectModel>(result.Results, (Int32)result.TotalItems)); } catch (Exception ex) { return(DCHelper.ErrorMessage(ex.Message)); } }
/// <summary> /// 批量作废单据 /// </summary> /// <param name="phids">单据集合</param> /// <returns></returns> public SavedResult <long> PostCancetPaymentList(List <long> phids) { SavedResult <long> savedResult = new SavedResult <long>(); Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic). Add(ORMRestrictions <List <long> > .In("PhId", phids)); var payments = this.PaymentMstRule.Find(dic); if (payments.Count > 0) { foreach (var payment in payments) { if (payment.FApproval != (byte)ApprovalType.not && payment.FApproval != (byte)ApprovalType.no) { throw new Exception("只有未送审与未通过的单据可以作废!"); } payment.FDelete = (byte)1; payment.PersistentState = PersistentState.Modified; } savedResult = this.PaymentMstRule.Save <long>(payments); dic.Clear(); new CreateCriteria(dic). Add(ORMRestrictions <List <long> > .In("MstPhid", phids)); var paymentXms = this.PaymentXmRule.Find(dic); if (paymentXms.Count > 0) { foreach (var paymentXm in paymentXms) { paymentXm.FDelete = (byte)1; paymentXm.PersistentState = PersistentState.Modified; } savedResult = this.PaymentXmRule.Save <long>(paymentXms); } dic.Clear(); new CreateCriteria(dic). Add(ORMRestrictions <List <long> > .In("MstPhid", phids)); var paymentDtls = this.PaymentDtlRule.Find(dic); if (paymentDtls.Count > 0) { foreach (var paymentDtl in paymentDtls) { paymentDtl.FDelete = (byte)1; paymentDtl.PersistentState = PersistentState.Modified; } savedResult = this.PaymentDtlRule.Save <long>(paymentDtls); } } return(savedResult); }
/// <summary> /// 取列表数据 /// </summary> /// <returns>返回Json串</returns> public string GetQtBaseProjectSelect() { //long Fphid = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["Fphid"]); string userCode = System.Web.HttpContext.Current.Request.Params["userCode"]; string FKMLB = System.Web.HttpContext.Current.Request.Params["FKMLB"]; string FType = System.Web.HttpContext.Current.Request.Params["FType"]; string FYear = System.Web.HttpContext.Current.Request.Params["FYear"]; Dictionary <string, object> dicWhere = new Dictionary <string, object>(); var DeptList = CorrespondenceSettingsService.GetRelationYSBMRightList(userCode).Results.ToList().Select(x => x.OCode).Distinct().ToList(); new CreateCriteria(dicWhere) .Add(ORMRestrictions <string> .Eq("FKMLB", FKMLB)) .Add(ORMRestrictions <string> .NotEq("FProjCode", "")) .Add(ORMRestrictions <List <string> > .In("FFillDept", DeptList)); if (!string.IsNullOrEmpty(FYear)) { new CreateCriteria(dicWhere) .Add(ORMRestrictions <string> .Eq("FYear", FYear)); } DataStoreParam storeparam = this.GetDataStoreParam(); //var result = QtBaseProjectService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere, new string[] { "FKmdm", "NgInsertDt" }); var result = new PagedResult <QtBaseProjectModel>(); if (FType == "c") { result = QtBaseProjectService.ServiceHelper.LoadWithPageInfinity("GQT.QT.TBJD.c", dicWhere); } else { result = QtBaseProjectService.ServiceHelper.LoadWithPageInfinity("GQT.QT.TBJD.z", dicWhere); foreach (QtBaseProjectModel a in result.Results) { if (a.FType == "c") { a.FProjName = a.FProjName + "(年初新增)"; } if (a.FType == "z") { a.FProjName = a.FProjName + "(年中新增)"; } if (a.FType == "tz") { a.FProjName = a.FProjName + "(年中调整)"; } } } //var result = QtBaseProjectService.ServiceHelper.LoadWithPageInfinity("GQT.QT.TBJD", dicWhere); return(DataConverterHelper.EntityListToJson <QtBaseProjectModel>(result.Results, (Int32)result.TotalItems)); }
/// <summary> /// 根据操作员取申报单位 /// </summary> /// <param name="USERID"></param> /// <returns></returns> public IList <OrganizeModel> GetSBUnit(long USERID) { //SELECT DISTINCT fg3_userorg.ORGID FROM fg3_userorg WHERE USERID=488181024000001 List <Int64> PHIDs1 = new List <Int64>(); List <Int64> PHIDs2 = new List <Int64>(); Dictionary <string, object> dic_userorg = new Dictionary <string, object>(); new CreateCriteria(dic_userorg) .Add(ORMRestrictions <Int64> .Eq("UserId", USERID)); IList <UserOrganize2Model> userOrganize2s = UserOrgRule.Find(dic_userorg); if (userOrganize2s.Count > 0) { for (var i = 0; i < userOrganize2s.Count; i++) { if (!PHIDs1.Contains(userOrganize2s[i].OrgId)) { PHIDs1.Add(userOrganize2s[i].OrgId); } } } Dictionary <string, object> dic_Corr2 = new Dictionary <string, object>(); new CreateCriteria(dic_Corr2) .Add(ORMRestrictions <String> .Eq("Dylx", "SB")); IList <CorrespondenceSettings2Model> correspondenceSettings2 = CorrespondenceSettings2Rule.Find(dic_Corr2); if (correspondenceSettings2.Count > 0) { for (var i = 0; i < correspondenceSettings2.Count; i++) { if (!PHIDs2.Contains(long.Parse(correspondenceSettings2[i].DefStr2))) { PHIDs2.Add(long.Parse(correspondenceSettings2[i].DefStr2)); } } } List <Int64> phid3 = PHIDs1.Intersect(PHIDs2).ToList(); Dictionary <string, object> dic_org = new Dictionary <string, object>(); new CreateCriteria(dic_org) .Add(ORMRestrictions <String> .Eq("IfCorp", "Y")) .Add(ORMRestrictions <String> .Eq("IsActive", "1")) .Add(ORMRestrictions <List <Int64> > .In("PhId", phid3)); IList <OrganizeModel> organizes = OrganizationRule.Find(dic_org, new string[] { "OCode" }); return(organizes); }
/// <summary> /// 取列表数据 /// </summary> /// <returns>List</returns> public IList <BudgetProcessCtrlModel> FindBudgetProcessCtrlModelByList(List <BudgetProcessCtrlModel> list) { List <Int64> ids = new List <long>(); for (int i = 0; i < list.Count; i++) { ids.Add(list[i].PhId); } Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere).Add(ORMRestrictions <List <Int64> > .In("PhId", ids)); FindedResults <BudgetProcessCtrlModel> results = base.ServiceHelper.Find <BudgetProcessCtrlModel>(dicWhere); return(results.Data); }
/// <summary> /// 根据组织代码串得到组织 /// </summary> /// <param name="OrgStr"></param> /// <returns></returns> public IList <OrganizeModel> GetUseOrg(string OrgStr) { if (!string.IsNullOrEmpty(OrgStr)) { var OrgCodeList = OrgStr.Split(',').ToList(); var dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere) .Add(ORMRestrictions <List <string> > .In("OCode", OrgCodeList)); var result = OrganizationFacade.Find(dicWhere, new string[] { "OCode Asc" }).Data; return(result); } else { return(new List <OrganizeModel>()); } }
/// <summary> /// 根据多个单据号删除多条单据以及单据明细 /// </summary> /// <param name="fCodes">多个单据号</param> /// <returns></returns> public int DeleteSignle(List <long> fCodes) { int deletedResult = 0; Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PhId", fCodes)); var result = this.PaymentMstRule.Find(dic); if (result != null && result.Count > 0) { //删除单据主表 deletedResult = this.PaymentMstRule.Delete(dic); var mstIdList = result.ToList().Select(t => t.PhId).ToList(); dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("MstPhid", mstIdList)); var result2 = this.PaymentXmRule.Find(dic); if (result2 != null && result2.Count > 0) { //删除单据集合对应的项目表 deletedResult = this.PaymentXmRule.Delete(dic); var xmIdList = result2.ToList().Select(t => t.PhId).ToList(); //删除明细 dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("PayXmPhid", xmIdList)); var result3 = this.PaymentDtlRule.Find(dic); if (result3 != null && result3.Count > 0) { deletedResult = this.PaymentDtlRule.Delete(dic); } //根据项目集合删除附件 dic.Clear(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("RelPhid", xmIdList)) .Add(ORMRestrictions <string> .Eq("BTable", "BK3_PAYMENT_XM")); var result4 = this.QtAttachmentRule.Find(dic); if (result4 != null && result4.Count > 0) { deletedResult = this.QtAttachmentRule.Delete(dic); } } } return(deletedResult); }
/// <summary> /// 取列表数据 /// </summary> /// <returns>返回Json串</returns> public PagedResult <BudgetProcessCtrlModel> GetBudgetProcessCtrlDistinctList(DataStoreParam storeParam, string query, string userId) { Dictionary <string, object> dicWhere = new Dictionary <string, object>(); Dictionary <string, object> dicWhere1 = new Dictionary <string, object>(); Dictionary <string, object> dicWhere2 = new Dictionary <string, object>(); /*if (query != null && query != "") * { * new CreateCriteria(dicWhere1).Add(ORMRestrictions<string>.Eq("FOcode", query)); * new CreateCriteria(dicWhere2).Add(ORMRestrictions<string>.Eq("FOname", query)); * new CreateCriteria(dicWhere).Add(ORMRestrictions.Or(dicWhere1, dicWhere2)); * }*/ if (userId != null && userId != "") { //根据用户id查出所有组织 long userid = Convert.ToInt64(userId); new CreateCriteria(dicWhere1).Add(ORMRestrictions <Int64> .Eq("UserId", userid)); FindedResults <UserOrganize2Model> findedResult = UserOrgFacade.Find(dicWhere1); List <long> orgIds = new List <long>(); for (int i = 0; i < findedResult.Data.Count; i++) { orgIds.Add(findedResult.Data[i].OrgId); } //根据组织id,查出所有的组织code new CreateCriteria(dicWhere2) .Add(ORMRestrictions <List <Int64> > .In("PhId", orgIds)) .Add(ORMRestrictions <string> .Eq("IfCorp", "Y")); FindedResults <OrganizeModel> findedResult2 = OrganizationFacade.Find(dicWhere2); List <string> orgCodes = new List <string>(); for (int i = 0; i < findedResult2.Data.Count; i++) { orgCodes.Add(findedResult2.Data[i].OCode); } new CreateCriteria(dicWhere).Add(ORMRestrictions <List <string> > .In("FOcode", orgCodes)); } var result = base.ServiceHelper.LoadWithPageInfinity("GQT.QT.GetAllProcessSetting", dicWhere); IList <BudgetProcessCtrlModel> processCtrlModels = result.Results; List <BudgetProcessCtrlModel> distinctList = processCtrlModels.GroupBy(r => r.FOcode).Select(r => r.First()).ToList(); result.Results = distinctList; result.TotalItems = distinctList.Count; return(result); }
///// <summary> ///// 方法实例 ///// </summary> ///// <returns></returns> //public IList<ExpenseCategoryModel> ExampleMethod<ExpenseCategoryModel>(string param) //{ // //编写代码 //} /// <summary> /// 验证数据 /// </summary> /// <returns></returns> public FindedResults <ExpenseCategoryModel> ExecuteDataCheck(ref List <ExpenseCategoryModel> expenseCategories, string otype) { IList <string> dm = new List <string>(); IList <string> mc = new List <string>(); FindedResults <ExpenseCategoryModel> results = new FindedResults <ExpenseCategoryModel>(); if (expenseCategories == null) { results.Status = ResponseStatus.Error; results.Msg = "保存失败,数据异常!"; } else { for (int i = 0; i < expenseCategories.Count; i++) { expenseCategories[i].Dm = expenseCategories[i].Dm.Replace(" ", ""); expenseCategories[i].Mc = expenseCategories[i].Mc.Replace(" ", ""); expenseCategories[i].Bz.Trim(); dm.Add(expenseCategories[i].Dm); mc.Add(expenseCategories[i].Mc); } var dicWhere1 = new Dictionary <string, object>(); var dicWhere2 = new Dictionary <string, object>(); new CreateCriteria(dicWhere1). Add(ORMRestrictions <IList <string> > .In("Dm", dm)); new CreateCriteria(dicWhere2). Add(ORMRestrictions <IList <string> > .In("Mc", mc)); if (base.Find(dicWhere1) != null && base.Find(dicWhere1).Data.Count > 0 && otype != "edit") { results = base.Find(dicWhere1); results.Status = ResponseStatus.Error; results.Msg = "保存失败,代码重复!"; } if (base.Find(dicWhere2) != null && base.Find(dicWhere2).Data.Count > 0) { results = base.Find(dicWhere2); results.Status = ResponseStatus.Error; results.Msg = "保存失败,名称重复!"; } } return(results); }
/// <summary> /// 验证数据 /// </summary> /// <returns></returns> public FindedResults <PaymentMethodModel> ExecuteDataCheck(ref List <PaymentMethodModel> paymentMethods, string otype) { FindedResults <PaymentMethodModel> results = new FindedResults <PaymentMethodModel>(); List <string> dm = new List <string>(); List <string> mc = new List <string>(); if (paymentMethods == null) { results.Status = ResponseStatus.Error; results.Msg = "保存失败,数据异常!"; } else { for (int i = 0; i < paymentMethods.Count; i++) { paymentMethods[i].Dm = paymentMethods[i].Dm.Replace(" ", ""); paymentMethods[i].Mc = paymentMethods[i].Mc.Replace(" ", ""); dm.Add(paymentMethods[i].Dm); mc.Add(paymentMethods[i].Mc); } Dictionary <string, object> dicWhere1 = new Dictionary <string, object>(); Dictionary <string, object> dicWhere2 = new Dictionary <string, object>(); new CreateCriteria(dicWhere1).Add(ORMRestrictions <IList <string> > .In("Dm", dm)); new CreateCriteria(dicWhere2).Add(ORMRestrictions <IList <string> > .In("Mc", mc)); results = base.Find(dicWhere1); if (results.Data.Count > 0 && results.Data[0] != null && otype != "edit") { results.Status = ResponseStatus.Error; results.Msg = "保存失败,代码重复!"; return(results); } results = base.Find(dicWhere2); if (results.Data.Count > 0 && results.Data[0] != null && otype != "edit") { results.Status = ResponseStatus.Error; results.Msg = "保存失败,名称重复!"; return(results); } } return(results); }
/// <summary> /// 判断是否被引用(返回被引用的银行账户主键list) /// </summary> /// <param name="phids"></param> /// <returns></returns> public List <long> judgeIfUse(List <long> phids) { List <long> usePhids = new List <long>();//被引用的银行账户主键 Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic) .Add(ORMRestrictions <List <long> > .In("BankPhid", phids)); IList <GKPaymentDtlModel> gKPaymentDtls = GKPaymentDtlFacade.Find(dic).Data; if (gKPaymentDtls.Count > 0) { foreach (GKPaymentDtlModel dtl in gKPaymentDtls) { if (!usePhids.Contains(dtl.BankPhid)) { usePhids.Add(dtl.BankPhid); } } } return(usePhids); }
/// <summary> /// 批量删除审批流程 /// </summary> /// <param name="procModels"></param> /// <returns></returns> public int DeleteAppvalProc(IList <GAppvalProcModel> procModels) { int result = 0; if (procModels != null && procModels.Count > 0) { List <GAppvalProcModel> models = procModels.ToList(); List <long> procIds = models.Select(t => t.PhId).ToList(); //加入判断,若审批流在审批中心已经被调用,则不能删除 if (procIds != null && procIds.Count > 0) { var records = this.GAppvalRecordRule.Find(t => procIds.Contains(t.PhId)); if (records != null && records.Count > 0) { throw new Exception("审批流已被调用,无法进行更改!"); } } //删除审批流程与审批岗位的对应关系 Dictionary <string, object> where = new Dictionary <string, object>(); new CreateCriteria(where) .Add(ORMRestrictions <List <long> > .In("ProcPhid", procIds)); result += GAppvalProc4PostRule.Delete(where); //删除审批流程条件 Dictionary <string, object> where2 = new Dictionary <string, object>(); new CreateCriteria(where2) .Add(ORMRestrictions <List <long> > .In("ProcPhid", procIds)); result += GAppvalProcCondsRule.Delete(where2); //删除审批流程 Dictionary <string, object> where3 = new Dictionary <string, object>(); new CreateCriteria(where3) .Add(ORMRestrictions <List <long> > .In("PhId", procIds)); result += GAppvalProcRule.Delete(where3); } return(result); }
/// <summary> /// 批量更新明细表支付状态 /// </summary> /// <param name="phIds"></param> /// <param name="payState"></param> /// <returns></returns> public SavedResult <long> UpdateDtlPayState(List <long> phIds, byte payState) { Dictionary <string, object> oldDtlWhere = new Dictionary <string, object>(); new CreateCriteria(oldDtlWhere).Add(ORMRestrictions <List <long> > .In("PhId", phIds)); var findDtl = this.GKPaymentDtlRule.Find(oldDtlWhere, new string[] { "PhId Asc" }); if (findDtl != null && findDtl.Count > 0) { SavedResult <long> resutlt = null; foreach (var dtl in findDtl) { dtl.FState = payState; dtl.PersistentState = PersistentState.Modified; resutlt = this.GKPaymentDtlRule.Save <long>(dtl); } return(resutlt); } return(null); }
/// <summary> /// 批量删除审批类型 /// </summary> /// <param name="ids">审批类型id集合</param> /// <returns></returns> public DeletedResult PostDeleteProcTypes(List <long> ids) { if (ids == null || ids.Count == 0) { return(null); } foreach (long proc_phid in ids) { IList <GAppvalProcModel> procModels = GAppvalProcFacade.Find(t => t.SPLXPhid == proc_phid).Data; //批量删除审批流程 GAppvalProcFacade.DeleteAppvalProc(procModels); } Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere) .Add(ORMRestrictions <List <long> > .In("PhId", ids)); DeletedResult deletedResult = QTSysSetFacade.Delete(dicWhere); return(deletedResult); }
/// <summary> /// 根据单据号集合作废单据 /// </summary> /// <param name="phids">单据集合</param> /// <returns></returns> public SavedResult <long> PostCancetGkPaymentList(List <long> phids) { SavedResult <long> savedResult = new SavedResult <long>(); Dictionary <string, object> dic = new Dictionary <string, object>(); new CreateCriteria(dic). Add(ORMRestrictions <List <long> > .In("PhId", phids)); var payments = this.GKPaymentMstRule.Find(dic); if (payments.Count > 0) { foreach (var payment in payments) { if (payment.FApproval != (byte)EnumApproval.NotPass && payment.FApproval != (byte)EnumApproval.PendingSend) { throw new Exception("只有未送审与未通过的单据可以作废!"); } payment.FDelete = (byte)1; payment.PersistentState = PersistentState.Modified; } savedResult = this.GKPaymentMstRule.Save <long>(payments); } return(savedResult); }
/// <summary> /// 获取预算数据 /// </summary> /// <returns></returns> public string GetBudgetMstList() { //string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];//查询条件 //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery);//查询条件转Dictionary var workType = System.Web.HttpContext.Current.Request.Params["workType"]; //业务种类(年初,年中,特殊)// c - 年初,z - 年中 var userId = System.Web.HttpContext.Current.Request.Params["userId"]; var ShowAll = System.Web.HttpContext.Current.Request.Params["ShowAll"]; var FBudgetDept = System.Web.HttpContext.Current.Request.Params["FBudgetDept"]; var dicWhereDept = new Dictionary <string, object>(); var dicWhere = new Dictionary <string, object>(); if (userId != null && !string.IsNullOrEmpty(userId)) { new CreateCriteria(dicWhereDept) .Add(ORMRestrictions <string> .Eq("Dwdm", userId)).Add(ORMRestrictions <string> .Eq("Dylx", "97")); //闭区间 var deptList = CorrespondenceSettingsService.Find(dicWhereDept); List <string> deptL = new List <string>(); for (var i = 0; i < deptList.Data.Count; i++) { deptL.Add(deptList.Data[i].Dydm); } new CreateCriteria(dicWhere).Add(ORMRestrictions <IList <String> > .In("FBudgetDept", deptL)); } if (ShowAll == "1") { new CreateCriteria(dicWhere).Add(ORMRestrictions <List <string> > .In("FApproveStatus", new List <string>() { "2", "3" })); } else { new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FApproveStatus", "3")); //审核通过 } if (!string.IsNullOrEmpty(FBudgetDept)) { new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FBudgetDept", FBudgetDept)); } new CreateCriteria(dicWhere) .Add(ORMRestrictions <Enum> .Eq("FIfPerformanceAppraisal", EnumYesNo.Yes)) //是否绩效评价 .Add(ORMRestrictions <int> .Eq("FLifeCycle", 0)) //版本标识 .Add(ORMRestrictions <string> .Eq("FMidYearChange", "0")); //单据调整判断 (0表示最新的数据) DataStoreParam storeparam = this.GetDataStoreParam(); var result = BudgetMstService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere, new string[] { "NgInsertDt Desc", "NgUpdateDt Desc" }); foreach (var data in result.Results) { if (string.IsNullOrEmpty(data.FAccount)) { data.FActualAmount = decimal.Round(0, 2);; } else { data.FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyXMCode(data.FAccount, data.FProjCode)), 2); } //data.FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyXMCode(data.FAccount, data.FProjCode)),2); data.FBalanceAmount = decimal.Round(data.FProjAmount - data.FActualAmount, 2); data.FImplRate = decimal.Round(data.FActualAmount * 100 / data.FProjAmount, 2); } return(DataConverterHelper.EntityListToJson <BudgetMstModel>(result.Results, (Int32)result.TotalItems)); }