/// <summary> /// 相关人上传意见 /// </summary> /// <param name="advise">意见</param> /// <param name="sdbNo">流程单号</param> public void PointAdvise(string advise, string sdbNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.FM_ReviewProcessPointListInfo where a.SDBNo == sdbNo && a.PointPersonnel == BasicInfo.LoginID select a; if (varData.Count() == 1) { FM_ReviewProcessPointListInfo lnqList = varData.Single(); lnqList.Advise = advise; } ctx.SubmitChanges(); }
/// <summary> /// 相关人确认流程信息 /// </summary> /// <param name="sdbNo">流程单号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool PointAffirmProcess(string sdbNo, out string error) { error = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.FM_ReviewProcessPointListInfo where a.SDBNo == sdbNo && a.PointPersonnel == BasicInfo.LoginID select a; if (varData.Count() != 1) { throw new Exception("数据错误"); } else { FM_ReviewProcessPointListInfo lnqTemp = varData.Single(); lnqTemp.OperateTime = ServerTime.Time; } ctx.SubmitChanges(); varData = from a in ctx.FM_ReviewProcessPointListInfo where a.SDBNo == sdbNo && a.OperateTime == null select a; if (varData.Count() == 0) { var varMain = from a in ctx.FM_ReviewProcess where a.SDBNo == sdbNo select a; if (varMain.Count() != 1) { throw new Exception("数据错误"); } else { FM_ReviewProcess lnqReview = varMain.Single(); lnqReview.SDBStatus = "等待判定"; m_billMessageServer.PassFlowMessage(sdbNo, string.Format("{0}号文件审查流程已确认,请体系工程师判定", sdbNo), BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.体系工程师.ToString()); } } else { List <string> list = new List <string>(); foreach (FM_ReviewProcessPointListInfo item in varData) { if (item.PointPersonnel != BasicInfo.LoginID) { list.Add(item.PointPersonnel); } } m_billMessageServer.PassFlowMessage(sdbNo, string.Format("{0}号文件审查流程已审核,请相关人员确认", sdbNo), BillFlowMessage_ReceivedUserType.用户, list); } ctx.SubmitChanges(); ctx.Transaction.Commit(); return(true); } catch (Exception ex) { error = ex.Message; ctx.Transaction.Rollback(); return(false); } }
/// <summary> /// 新建流程 /// </summary> /// <param name="reviewProcess">流程主要信息</param> /// <param name="pointPersonnel">指定相关确认人</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool AddProcess(FM_ReviewProcess reviewProcess, List <string> pointPersonnel, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.FM_ReviewProcess where a.SDBNo == reviewProcess.SDBNo select a; if (varData.Count() == 0) { FM_ReviewProcess lnqTemp = new FM_ReviewProcess(); lnqTemp.SDBNo = reviewProcess.SDBNo; lnqTemp.SDBStatus = "等待主管审核"; lnqTemp.Remark = reviewProcess.Remark; lnqTemp.Propoer = BasicInfo.LoginName; lnqTemp.PropoerTime = ServerTime.Time; lnqTemp.FileName = reviewProcess.FileName; lnqTemp.FileNo = reviewProcess.FileNo; lnqTemp.FileUnique = reviewProcess.FileUnique; ctx.FM_ReviewProcess.InsertOnSubmit(lnqTemp); } else if (varData.Count() == 1) { FM_ReviewProcess lnqTemp = varData.Single(); lnqTemp.SDBNo = reviewProcess.SDBNo; lnqTemp.SDBStatus = "等待主管审核"; lnqTemp.Remark = reviewProcess.Remark; lnqTemp.Propoer = BasicInfo.LoginName; lnqTemp.PropoerTime = ServerTime.Time; lnqTemp.FileName = reviewProcess.FileName; lnqTemp.FileNo = reviewProcess.FileNo; lnqTemp.FileUnique = reviewProcess.FileUnique; } else { error = "数据错误"; return(false); } var varList = from a in ctx.FM_ReviewProcessPointListInfo where a.SDBNo == reviewProcess.SDBNo select a; ctx.FM_ReviewProcessPointListInfo.DeleteAllOnSubmit(varList); //var varPersonnel = (from a in ctx.HR_Personnel // where pointPersonnel.Contains(a.WorkID) // select a.Dept.Substring(0, 2)).Distinct(); //PlatformManagement.IDeptManagerRole deptManagerRole = PlatformFactory.GetObject<IDeptManagerRole>(); //PlatformManagement.IUserManagement userManagerRole = PlatformFactory.GetObject<IUserManagement>(); //foreach (string item in varPersonnel) //{ // IQueryable<View_Auth_User> usersInfo = // userManagerRole.GetUsers(deptManagerRole.GetManagementRole(item, RoleStyle.负责人).Keys.ToArray()); // if (usersInfo != null) // { // pointPersonnel.AddRange((from r in usersInfo select r.登录名).ToList()); // } //} foreach (string personnel in pointPersonnel) { FM_ReviewProcessPointListInfo lnqPoint = new FM_ReviewProcessPointListInfo(); lnqPoint.SDBNo = reviewProcess.SDBNo; lnqPoint.PointPersonnel = personnel; ctx.FM_ReviewProcessPointListInfo.InsertOnSubmit(lnqPoint); } ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }