示例#1
0
        /// <summary>
        /// 创建发文单后,发起发文流程
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="docKeyword"></param>
        /// <param name="DocList"></param>
        /// <returns></returns>
        public static JObject DocumentStartWorkFlow(string sid, string docKeyword, string DocList)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc doc = dbsource.GetDocByKeyWord(docKeyword);
                if (doc == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档不存在!";
                    return(reJo.Value);
                }
            }
            catch (Exception exception)
            {
                WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                //AssistFun.PopUpPrompt(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "启动流程失败!" + exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace;
            }
            return(reJo.Value);
        }
示例#2
0
        /// <summary>
        /// 收文流程设置通过回复并提交到下一流程
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="DocKeyword"></param>
        /// <returns></returns>
        public static JObject RecWorflowPassReplyState(string sid, string DocKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc m_Doc = dbsource.GetDocByKeyWord(DocKeyword);

                if (m_Doc == null)
                {
                    reJo.msg = "参数错误!文档不存在!";
                    return(reJo.Value);
                }

                WorkFlow flow = m_Doc.WorkFlow;
                flow.O_suser3 = "pass";
                flow.Modify();

                WorkStateBranch wsb = null;
                // m_Doc.WorkFlow.
                wsb = flow.CuWorkState.workStateBranchList.Find(w => w.defStateBrach.O_Description == "回复");
                if (wsb == null)
                {
                    reJo.msg = "流程分支不存在!";
                    return(reJo.Value);
                }

                ExReJObject GotoNextReJo = WebWorkFlowEvent.GotoNextStateAndSelectUser(wsb);// flow.CuWorkState.workStateBranchList[0]);

                if (!GotoNextReJo.success)
                {
                }
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
示例#3
0
        //获取文件著录编码流水号
        public static JObject GetFileCodeNumber(string sid, string FileCodePerfix)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                string runNum = "";

                string strSql = string.Format(
                    "select lf.FILECODE from CDMS_Doc as cd inner join " +
                    "(select Itemno, CA_FILECODE as FILECODE from User_CATALOGUING where CA_FILECODE like '%{0}%')" +
                    " as lf " +
                    "on  cd.o_itemno = lf.Itemno " +
                    " where cd.o_dmsstatus != 10 order by lf.FILECODE ",
                    FileCodePerfix);

                string[] strArry = dbsource.DBExecuteSQL(strSql);

                if (strArry == null || strArry.Length == 0 ||
                    (strArry[strArry.Length - 1]).Length < FileCodePerfix.Length + 3
                    )
                {
                    runNum = "001";
                }
                else
                {
                    //5位数,不够位数补零
                    int tempNum = Convert.ToInt32((strArry[strArry.Length - 1]).Substring(FileCodePerfix.Length, 3));

                    runNum = (tempNum + 1).ToString("d3");
                }
                reJo.success = true;
                reJo.data    = new JArray(new JObject(new JProperty("RunNum", runNum)));
                return(reJo.Value);
            }
            catch (Exception exception)
            {
                WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "获取文件编号失败!" + exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace;
            }
            return(reJo.Value);
        }
示例#4
0
        public static JObject GetDepartmentSecUser(string sid, string DepartmentList)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                string[] strArry = DepartmentList.Split(new char[] { ',' });
                //bool isAdd = false;
                string resultUserList = "";
                foreach (string strDepartment in strArry)
                {
                    resultUserList = resultUserList + CommonFunction.GetSecUserByDepartmentCode(dbsource, strDepartment) + ";";
                }

                if (!string.IsNullOrEmpty(resultUserList))
                {
                    resultUserList = resultUserList.Substring(0, resultUserList.Length - 1);
                }

                reJo.data = new JArray(new JObject(new JProperty("userList", resultUserList)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#5
0
        public static JObject GetMeetMinutesCNNumber(string sid, string ProjectCode, string SendCompany, string RecCompany)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }


                //string runNum = getDocNumber(dbsource,ProjectCode, SendCompany, RecCompany);
                string runNum = Document.getDocTempNumber(dbsource, ProjectCode, "S", "MOM", SendCompany, RecCompany);
                if (string.IsNullOrEmpty(runNum))
                {
                    runNum = "SMOM" + "00001";
                }
                reJo.success = true;
                reJo.data    = new JArray(new JObject(new JProperty("RunNum", runNum)));
            }
            catch (Exception exception)
            {
                WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                //AssistFun.PopUpPrompt(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "获取会议纪要编号失败!" + exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace;
            }
            return(reJo.Value);
        }
示例#6
0
        /// <summary>
        /// 处理拖拽文件到DocGrid控件的处理事件
        /// </summary>
        /// <returns></returns>
        public static JObject OnBeforeFileAddEvent(string sid, string ProjectKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
示例#7
0
        public static JObject DraftDocument(string sid, string ProjectKeyword, string DocAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(DocAttrJson);

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                //定位到发文目录
                //m_Project = LocalProject(m_Project);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                #region 获取项目参数项目

                //获取项目参数项目
                string documentCode = "", title = "", deliveryUnit = "",
                       content = "", contact = "", tel = "";



                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    //获取函件编号
                    if (strName == "documentCode")
                    {
                        documentCode = strValue.Trim();
                    }

                    //获取标题
                    else if (strName == "title")
                    {
                        title = strValue;
                    }

                    //获取主送单位
                    else if (strName == "deliveryUnit")
                    {
                        deliveryUnit = strValue;
                    }

                    //获取正文内容
                    else if (strName == "content")
                    {
                        content = strValue;
                    }

                    //获取联系人
                    else if (strName == "contact")
                    {
                        contact = strValue;
                    }

                    //获取联系电话
                    else if (strName == "tel")
                    {
                        tel = strValue;
                    }
                }


                if (string.IsNullOrEmpty(documentCode))
                {
                    reJo.msg = "请填写函件编号!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(title))
                {
                    reJo.msg = "请填写函件标题!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(deliveryUnit))
                {
                    reJo.msg = "请填写主送单位!";
                    return(reJo.Value);
                }

                #endregion

                reJo.data    = new JArray(new JObject(new JProperty("projectKeyword", m_Project.KeyWord)));
                reJo.success = true;
                return(reJo.Value);

                //AVEVA.CDMS.WebApi.DBSourceController.RefreshDBSource(sid);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#8
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateCompanyProject(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                //获取所有厂家信息
                TempDefn mTempDefn = GetTempDefn(dbsource, "COM_UNIT");
                if (mTempDefn == null)
                {
                    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                    return(reJo.Value);
                }

                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyCode = "", strCompanyDesc = "", companyType = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "companyType":
                        companyType = strValue;
                        break;
                    }
                }
                #endregion

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "新建参建单位目录失败,请输入单位编码!";
                    return(reJo.Value);
                }

                Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                if (project == null)
                {
                    reJo.msg = "新建参建单位目录失败,请联系管理员!";
                    return(reJo.Value);
                }

                #region 添加文控角色到新建立的参建单位目录
                //增加附加属性
                try
                {
                    string secretarilMan = "";
                    if (companyType == "项目部门")
                    {
                        //获取所有项目部门(不区分项目)
                        List <DictData> departDdList = dbsource.GetDictDataList("Communication");

                        foreach (DictData data6 in departDdList)
                        {
                            if (data6.O_sValue1.Trim() != strCompanyCode)
                            {
                                continue;
                            }
                            if (!string.IsNullOrEmpty(data6.O_sValue4.Trim()))
                            {
                                secretarilMan = data6.O_sValue4.Trim();
                            }
                        }
                    }
                    else if (companyType == "参建单位")
                    {
                        Project rootProj = CommonFunction.getParentProjectByTempDefn(project, "HXNY_DOCUMENTSYSTEM");
                        if (rootProj != null)
                        {
                            string rootProjCode = rootProj.Code;

                            List <DictData> departDdList = dbsource.GetDictDataList("Unit");

                            foreach (DictData data6 in departDdList)
                            {
                                if (string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                                {
                                    continue;
                                }
                                if (data6.O_sValue1.Trim() != rootProjCode)
                                {
                                    continue;
                                }
                                if (data6.O_Code.Trim() != strCompanyCode)
                                {
                                    continue;
                                }
                                if (!string.IsNullOrEmpty(data6.O_sValue3.Trim()))
                                {
                                    secretarilMan = data6.O_sValue3.Trim();
                                }
                            }
                        }
                    }

                    project.GetAttrDataByKeyWord("UN_SECRETAARECTOR").SetCodeDesc(secretarilMan);    //文控
                    project.AttrDataList.SaveData();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                    reJo.msg = "获取厂家模板失败,请联系管理员!";
                    return(reJo.Value);
                }
                #endregion

                reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#9
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateSystem(string sid, string ProjectKeyword, string systemAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(systemAttrJson);

                string strSystemCode = "", strSystemDesc = "",
                       strSystemEngDesc = "", strSystemChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "systemCode":
                        strSystemCode = strValue;
                        break;

                    case "systemDesc":
                        strSystemDesc = strValue;
                        break;

                    case "systemEngDesc":
                        strSystemEngDesc = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strSystemCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strSystemDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }

                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                JArray  jaData   = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode && data6.O_Code == strSystemCode)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                string format = "insert CDMS_DictData (" +
                                "o_parentno,o_datatype,o_ikey,o_skey,o_Code,o_Desc,o_sValue1,o_sValue2,o_sValue3,o_sValue4,o_sValue5,o_iValue1 ,o_iValue2)" +
                                " values ({0},{1},{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',{11},{12}" + ")";
                //0,2,0,'Unit','"+strSystemCode+"','"+strSystemDesc+"','"+strProjCode+ "','','','','',0,0
                format = string.Format(format, new object[] {
                    0, 2, 0, "System", strSystemCode, strSystemDesc, strSystemEngDesc, strProjCode, "", "", "", 0, 0
                });
                dbsource.DBExecuteSQL(format);

                DBSourceController.refreshDBSource(sid);

                #endregion


                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#10
0
        /// <summary>
        /// 新建厂家资料目录时,获取默认值
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        public static JObject GetEditSystemDefault(string sid, string ProjectKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;
                string strProjDesc = prjProject.Description;

                JArray  jaSystem = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode)
                    {
                        joSystem = new JObject(
                            new JProperty("systemId", data6.O_ID.ToString()),
                            new JProperty("systemCode", data6.O_Code),
                            new JProperty("systemDesc", data6.O_Desc),
                            new JProperty("systemEngDesc", data6.O_sValue1)
                            );
                        jaSystem.Add(joSystem);
                    }
                }


                reJo.data = new JArray(
                    new JObject(new JProperty("projectCode", strProjCode),
                                new JProperty("projectDesc", strProjDesc),
                                new JProperty("SystemList", jaSystem)));
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#11
0
        public static JObject GetSelectProfessionList(string sid, string ProjectKeyword, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                //Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                //if (prjProject == null)
                //{
                //    reJo.msg = "获取项目目录失败!";
                //    return reJo.Value;
                //}

                Filter = Filter.Trim().ToLower();

                //string curProfessionCode = "";

                //curProfessionCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                //if (string.IsNullOrEmpty(curProfessionCode))
                //{
                //    reJo.msg = "获取项目来源失败!";
                //    return reJo.Value;
                //}

                JArray jaData = new JArray();
                //获取所有参建单位
                List <DictData> dictDataList = dbsource.GetDictDataList("Profession");

                ////按代码排序
                //dictDataList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_Code.CompareTo(y.O_Code);
                //});

                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    //if (data6.O_sValue1 == curProfessionCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("professionType", "专业"),
                            new JProperty("professionId", data6.O_ID.ToString()),
                            new JProperty("professionCode", data6.O_Code),
                            new JProperty("professionDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }



                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curProfessionCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("professionType", "项目部门"),
                //            new JProperty("professionId", data6.O_ID.ToString()),
                //            new JProperty("professionCode", data6.O_Code),
                //            new JProperty("professionDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                ////获取所有项目部门(不区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("Communication");

                ////按代码排序
                //departDdList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_sValue1.CompareTo(y.O_sValue1);
                //});

                //foreach (DictData data6 in departDdList)
                //{
                //    //判断是否符合过滤条件
                //    if (!string.IsNullOrEmpty(Filter) &&
                //        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                //    {
                //        continue;
                //    }

                //    //if (data6.O_sValue1 == curProfessionCode)
                //    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("professionType", "项目部门"),
                //            new JProperty("professionId", data6.O_ID.ToString()),
                //            new JProperty("professionCode", data6.O_sValue1),
                //            new JProperty("professionDesc", data6.O_Desc)
                //            );
                //        jaData.Add(joData);
                //    }
                //}

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#12
0
        /// <summary>
        /// 获取创建认质认价表单的默认配置
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="ProjectKeyword"></param>
        /// <returns></returns>
        public static JObject GetDraftRecognitionDefault(string sid, string ProjectKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                //定位到发文目录
                //m_Project = LocalProject(m_Project);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                //获取项目号
                string RootProjectCode = m_Project.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_CODE");
                if (RootProjectCode == null)
                {
                    RootProjectCode = "";
                }

                //设计阶段目录
                Project designphase = CommonFunction.GetDesign(m_Project);

                //获取发文单位列表
                JObject joSendCompany = new JObject();

                //获取收文单位列表
                JObject joRecCompany = new JObject();

                //Dictionary<string, string> dictionary = new Dictionary<string, string>();
                List <DictData> dictDataList = dbsource.GetDictDataList("Communication");
                //[o_Code]:英文描述,[o_Desc]:中文描述,[o_sValue1]:通信代码
                //string str3 = m_Project.ExcuteDefnExpression("$(DESIGNPROJECT_CODE)")[0];
                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1))
                    {
                        joRecCompany.Add(new JProperty(data6.O_sValue1, data6.O_Desc));
                        joSendCompany.Add(new JProperty(data6.O_sValue1, data6.O_Desc));
                    }
                }

                //获取根目录
                Project rootProj   = CommonFunction.getParentProjectByTempDefn(m_Project, "HXNY_DOCUMENTSYSTEM");
                string  strCompany = "";
                if (rootProj != null)
                {
                    strCompany = rootProj.GetAttrDataByKeyWord("PRO_COMPANY").ToString;
                }


                //string DocNumber = getDocNumber(m_Project, companyList[0].ToString);//设置编号

                string DocNumber = "";// 设置编号

                JObject joData = new JObject(
                    new JProperty("RootProjectCode", RootProjectCode),
                    new JProperty("DocNumber", DocNumber),
                    new JProperty("RecCompanyList", joRecCompany),
                    new JProperty("SendCompanyList", joSendCompany),
                    new JProperty("SourceCompany", strCompany)
                    );


                reJo.data    = new JArray(joData);
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
示例#13
0
        public static JObject ResetFileCode(string sid, string DocKeyword, string DocAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc doc = dbsource.GetDocByKeyWord(DocKeyword);
                if (doc == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档不存在!";
                    return(reJo.Value);
                }

                #region 获取信函参数内容

                //获取信函参数内容
                string mainFeeder = "", copyParty = "", sender = "",
                       sendCode = "", recCode = "", totalPages = "",
                       urgency = "", sendDate = "", seculevel = "",
                       secrTerm = "", needreply = "", replyDate = "",
                       title = "", content = "", approvpath = "",
                       nextStateUserList = "";

                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(DocAttrJson);

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    ////获取函件编号
                    //if (strName == "documentCode") documentCode = strValue.Trim();

                    //获取主送
                    if (strName == "mainFeeder")
                    {
                        mainFeeder = strValue.Trim();
                    }

                    //获取抄送
                    else if (strName == "copyParty")
                    {
                        copyParty = strValue;
                    }

                    //获取发送方
                    else if (strName == "sender")
                    {
                        sender = strValue;
                    }

                    //获取发文编码
                    else if (strName == "sendCode")
                    {
                        sendCode = strValue;
                    }

                    //获取发送日期
                    else if (strName == "sendDate")
                    {
                        sendDate = strValue;
                    }
                }


                if (string.IsNullOrEmpty(sendCode))
                {
                    reJo.msg = "请填写函件编号!";
                    return(reJo.Value);
                }
                //else if (string.IsNullOrEmpty(mainFeeder))
                //{
                //    reJo.msg = "请填写主送!";
                //    return reJo.Value;
                //}
                //else if (string.IsNullOrEmpty(sender))
                //{
                //    reJo.msg = "请选择发送方!";
                //    return reJo.Value;
                //}



                #endregion



                #region 填写发文信息进入word表单

                //获取即将函件的文件路径
                string locFileName = doc.FullPathFile;

                if (string.IsNullOrEmpty(locFileName))
                {
                    reJo.msg = "填写发文信息错误,获取函件文件失败!";
                    return(reJo.Value);
                }
                if (!System.IO.File.Exists(locFileName))
                {
                    reJo.msg = "填写发文信息失败,函件文件不存在!";
                    return(reJo.Value);
                }

                //格式化日期
                DateTime senddate    = Convert.ToDateTime(sendDate);
                string   strSenddate = senddate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");
                string   str         = doc.O_filename.ToUpper();

                Hashtable htUserKeyWord = new Hashtable();
                //htUserKeyWord.Add("MAINFEEDER", mainFeeder);//主送
                //htUserKeyWord.Add("SENDER", sender);//发送方
                htUserKeyWord.Add("SENDCODE", sendCode);//发文编码
                //htUserKeyWord.Add("COPY", copyParty);//抄送
                //htUserKeyWord.Add("SENDDATE", strSenddate);//发送日期

                if ((str.EndsWith(".DOC") || str.EndsWith(".DOCX")) || (str.EndsWith(".XLS") || str.EndsWith(".XLSX")))
                {
                    //线程锁
                    muxConsole.WaitOne();
                    try
                    {
                        WebApi.CDMSWebOffice office = new WebApi.CDMSWebOffice
                        {
                            CloseApp   = true,
                            VisibleApp = false
                        };
                        office.Release(true);
                        if (doc.WorkFlow != null)
                        {
                            enWorkFlowStatus status1 = doc.WorkFlow.O_WorkFlowStatus;
                        }
                        office.WriteDataToDocument(doc, locFileName, htUserKeyWord, htUserKeyWord);
                    }
                    catch (Exception ExOffice)
                    {
                        WebApi.CommonController.WebWriteLog(ExOffice.Message);
                    }
                    finally
                    {
                        //解锁
                        muxConsole.ReleaseMutex();
                    }
                }
                #endregion


                if (doc.WorkFlow != null)
                {
                    AttrData data;
                    string   orgSendCode = "";
                    if ((data = doc.GetAttrDataByKeyWord("CA_SENDCODE")) != null)
                    {
                        orgSendCode = data.ToString;
                        //FileCode = FileCode + data.ToString + "-";
                    }

                    string orgName = doc.O_itemname;
                    foreach (Doc docItem in doc.WorkFlow.DocList)
                    {
                        if (docItem != doc)
                        {
                            docItem.O_itemname = docItem.O_itemname.Replace(orgSendCode, sendCode);
                            docItem.Modify();
                        }
                    }
                    doc.O_itemname = doc.O_itemname.Replace(orgSendCode, sendCode);
                    // doc.O_filename = regex.Replace(doc.O_filename, replacement);

                    string fullPathFile = doc.FullPathFile;
                    fullPathFile = fullPathFile.Replace('/', '\\');
                    string newFileName = doc.FullPathFile.Replace(orgSendCode, sendCode);

                    try
                    {
                        File.Move(fullPathFile, newFileName);
                    }
                    catch { }

                    doc.O_filename = doc.O_filename.Replace(orgSendCode, sendCode);

                    #region 设置信函文档附加属性



                    ////主送
                    //if ((data = doc.GetAttrDataByKeyWord("CA_MAINFEEDER")) != null)
                    //{
                    //    data.SetCodeDesc(mainFeeder);
                    //}
                    ////发送方
                    //if ((data = doc.GetAttrDataByKeyWord("CA_SENDER")) != null)
                    //{
                    //    data.SetCodeDesc(sender);
                    //}
                    //发文编码
                    if ((data = doc.GetAttrDataByKeyWord("CA_SENDCODE")) != null)
                    {
                        data.SetCodeDesc(sendCode);
                    }

                    ////抄送
                    //if ((data = doc.GetAttrDataByKeyWord("CA_COPY")) != null)
                    //{
                    //    data.SetCodeDesc(copyParty);
                    //}

                    //////发送日期
                    //if ((data = doc.GetAttrDataByKeyWord("CA_SENDDATE")) != null)
                    //{
                    //    data.SetCodeDesc(sendDate);
                    //}

                    ////保存项目属性,存进数据库
                    doc.AttrDataList.SaveData();

                    #endregion

                    doc.Modify();

                    doc.WorkFlow.O_suser3 = "pass";
                    doc.WorkFlow.Modify();

                    DBSourceController.refreshDBSource(sid);
                }



                reJo.data = new JArray(new JObject(new JProperty("WorkFlowKeyword", doc.WorkFlow.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception exception)
            {
                //WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "填写发文信息失败,请手动填写发文信息!" + exception.Message;
            }
            return(reJo.Value);
        }
示例#14
0
        //发文流程盖章
        public static JObject DocumenteSeal(string sid, string DocKeyword, string isSeal)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc doc = dbsource.GetDocByKeyWord(DocKeyword);
                if (doc == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档不存在!";
                    return(reJo.Value);
                }

                if (doc.WorkFlow == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档流程不存在!";
                    return(reJo.Value);
                }

                //录入数据进入表单
                //格式化日期
                DateTime inscribedate    = Convert.ToDateTime(DateTime.Now);
                string   strInscribedate = inscribedate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");

                Hashtable htUserKeyWord = new Hashtable();

                string   inscribe = "", sendercode = "";
                AttrData data;
                //获取发送方
                if ((data = doc.GetAttrDataByKeyWord("CA_SENDER")) != null)
                {
                    inscribe = data.ToString;
                }

                //获取发送方代码
                if ((data = doc.GetAttrDataByKeyWord("CA_SENDERCODE")) != null)
                {
                    sendercode = data.ToString;
                }

                if (isSeal == "true")
                {
                    if (!string.IsNullOrEmpty(sendercode))
                    {
                        //盖章图片名
                        htUserKeyWord["SEAL"] = sendercode + "SEAL";
                    }
                    else
                    {
                        //盖章图片名
                        htUserKeyWord["SEAL"] = "BLANK" + "SEAL";
                    }
                }
                else
                {
                    //盖章图片名
                    htUserKeyWord["SEAL"] = "BLANK" + "SEAL";
                }


                //落款
                htUserKeyWord["INSCRIBE"] = inscribe;
                //落款时间
                htUserKeyWord["INSCRIBEDATE"] = strInscribedate;



                //获取即将生成的联系单文件路径
                string locFileName = doc.FullPathFile;

                FileInfo info = new FileInfo(locFileName);

                if (System.IO.File.Exists(locFileName))
                {
                    //线程锁
                    muxConsole.WaitOne();
                    try
                    {
                        //把参数直接写进office
                        CDMSWebOffice office = new CDMSWebOffice
                        {
                            CloseApp   = true,
                            VisibleApp = false
                        };
                        office.Release(true);
                        office.WriteDataToDocument(doc, locFileName, htUserKeyWord, htUserKeyWord);
                    }
                    catch { }
                    finally
                    {
                        //解锁
                        muxConsole.ReleaseMutex();
                    }
                }

                if (doc.WorkFlow.CuWorkState.Code == "APPROV" &&
                    dbsource.LoginUser.O_userno == doc.WorkFlow.CuWorkState.CuWorkUser.O_userno)
                {
                    doc.WorkFlow.O_suser3 = "approvpass";
                    doc.WorkFlow.Modify();

                    DBSourceController.refreshDBSource(sid);
                }

                reJo.data = new JArray(new JObject(new JProperty("WorkFlowKeyword", doc.WorkFlow.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception exception)
            {
                //WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "盖章失败!" + exception.Message;
            }
            return(reJo.Value);
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="DocKeyword"></param>
        /// <param name="Operator">主办人</param>
        /// <param name="Coordinator">协办人</param>
        /// <returns></returns>
        public static JObject SendDistriProcess(string sid, string DocKeyword, string Operator, string Coordinator)
        {
            // return RecDocument.SendDistriProcess(sid, DocKeyword, Operator, Coordinator);

            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc doc = dbsource.GetDocByKeyWord(DocKeyword);
                if (doc == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档不存在!";
                    return(reJo.Value);
                }
                WorkFlow flow;
                if ((flow = doc.WorkFlow) == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档流程不存在!";
                    return(reJo.Value);
                }

                #region 设置本部门文控(登录用户)到部门人员状态

                Server.Group group = new Server.Group();

                group.AddUser(curUser);

                DefWorkState defWorkStateCu = flow.DefWorkFlow.DefWorkStateList.Find(dwsx => dwsx.O_Code == "DEPARTMENTCONTROL");
                WorkState    stateCu        = flow.NewWorkState(defWorkStateCu);
                stateCu.SaveSelectUser(group);

                stateCu.IsRuning = true;

                stateCu.PreWorkState = flow.CuWorkState;
                stateCu.O_iuser5     = new int?(flow.CuWorkState.O_stateno);
                stateCu.Modify();


                #endregion



                #region 设置协办部门人员状态

                string[] strArry2 = Coordinator.Split(new char[] { ';' });

                //每个部门一个协办分支
                foreach (string op in strArry2)
                {
                    string       strUser          = op.IndexOf("_") >= 0 ? op.Substring(0, op.IndexOf("_")) : op;
                    Server.Group CoordinatorGroup = new Server.Group();
                    User         CoordinatorUser  = dbsource.GetUserByCode(strUser);
                    if (CoordinatorUser != null)
                    {
                        CoordinatorGroup.AddUser(CoordinatorUser);

                        DefWorkState defWorkStateCo = flow.DefWorkFlow.DefWorkStateList.Find(dwsx => dwsx.O_Code == "DEPARTMENTCONTROL");
                        WorkState    state2         = flow.NewWorkState(defWorkStateCo);
                        state2.SaveSelectUser(CoordinatorGroup);

                        state2.IsRuning = true;

                        state2.PreWorkState = flow.CuWorkState;
                        state2.O_iuser5     = new int?(flow.CuWorkState.O_stateno);
                        state2.Modify();
                    }
                }

                #endregion

                WorkStateBranch branch = flow.CuWorkState.workStateBranchList.Find(wsb => wsb.KeyWord == "TOCONTROL1");//[0];
                branch.NextStateAddGroup(group);

                ExReJObject GotoNextReJo = WebWorkFlowEvent.GotoNextStateAndSelectUser(flow.CuWorkState.workStateBranchList[0]);

                #region 设置本部门办理人状态
                string[]     strArry       = Operator.Split(new char[] { ';' });
                Server.Group OperatorGroup = new Server.Group();

                foreach (string op in strArry)
                {
                    User OperatorUser = dbsource.GetUserByCode(op);
                    if (OperatorUser != null)
                    {
                        OperatorGroup.AddUser(OperatorUser);
                    }
                }



                //放置本部门办理状态人员
                //WorkState state = flow.WorkStateList.Find(wsx => (wsx.Code == "MAINHANDLE") &&
                //    (wsx.CheckGroup.AllUserList.Count == 0));

                //if (state == null)
                //{
                DefWorkState defWorkState = flow.DefWorkFlow.DefWorkStateList.Find(dwsx => dwsx.O_Code == "MAINHANDLE");
                WorkState    state        = flow.NewWorkState(defWorkState);
                state.SaveSelectUser(OperatorGroup);

                state.IsRuning = true;

                state.PreWorkState = stateCu;
                state.O_iuser5     = new int?(stateCu.O_stateno);
                state.Modify();
                // }
                #endregion


                //reJo.data = new JArray(new JObject(new JProperty("WorkFlowKeyword", doc.WorkFlow.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception exception)
            {
                //WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "分发失败!" + exception.Message;
            }
            return(reJo.Value);
        }
示例#16
0
        /// <summary>
        /// 起草会议纪要
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="ProjectKeyword"></param>
        /// <param name="DocAttrJson"></param>
        /// <returns></returns>
        public static JObject DraftMeetMinutesCN(string sid, string ProjectKeyword, string DocAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(DocAttrJson);

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                //定位到发文目录
                //m_Project = LocalProject(m_Project);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                #region 获取项目参数项目

                //获取项目参数项目
                string fileCode = "", sendCode = "",//documentCode = "",
                       sendDate = "", totalPages = "",
                       mainFeeder = "", copyParty = "", title = "",
                       meetTime = "", meetPlace = "", hostUnit = "",
                       moderator = "", participants = "", content = "",
                       approvpath = "", nextStateUserList = "";



                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    //获取文件编码
                    if (strName == "fileCode")
                    {
                        fileCode = strValue.Trim();
                    }

                    //获取发文编号
                    else if (strName == "sendCode")
                    {
                        sendCode = strValue.Trim();
                    }

                    //获取发文日期
                    else if (strName == "sendDate")
                    {
                        sendDate = strValue;
                    }
                    //获取页数
                    else if (strName == "totalPages")
                    {
                        totalPages = strValue;
                    }

                    //获取主送
                    if (strName == "mainFeeder")
                    {
                        mainFeeder = strValue.Trim();
                    }
                    //获取抄送
                    else if (strName == "copyParty")
                    {
                        copyParty = strValue;
                    }

                    //获取会议主题
                    else if (strName == "title")
                    {
                        title = strValue;
                    }
                    //获取会议时间
                    else if (strName == "meetTime")
                    {
                        meetTime = strValue;
                    }
                    //获取会议地点
                    else if (strName == "meetPlace")
                    {
                        meetPlace = strValue;
                    }

                    //获取主办单位
                    else if (strName == "hostUnit")
                    {
                        hostUnit = strValue;
                    }
                    //获取主持人
                    else if (strName == "moderator")
                    {
                        moderator = strValue;
                    }
                    //获取参会单位与人员
                    else if (strName == "participants")
                    {
                        participants = strValue;
                    }

                    //获取会议内容
                    else if (strName == "content")
                    {
                        content = strValue;
                    }

                    //获取审批路径
                    else if (strName == "approvpath")
                    {
                        approvpath = strValue;
                    }

                    //获取下一状态人员
                    else if (strName == "nextStateUserList")
                    {
                        nextStateUserList = strValue;
                    }
                }


                if (string.IsNullOrEmpty(fileCode))
                {
                    reJo.msg = "请填写文件编号!";
                    return(reJo.Value);
                }

                else if (string.IsNullOrEmpty(sendCode))
                {
                    reJo.msg = "请填写发文编码!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(title))
                {
                    reJo.msg = "请填写函件标题!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(nextStateUserList))
                {
                    reJo.msg = "请选择校审人员!";
                    return(reJo.Value);
                }

                #endregion


                #region 根据会议纪要模板,生成会议纪要文档

                //获取立项单文档所在的目录
                //Project m_Project = m_NewProject;

                List <TempDefn> docTempDefnByCode = m_Project.dBSource.GetTempDefnByCode("MEETINGSUMMARY");
                TempDefn        docTempDefn       = (docTempDefnByCode != null && docTempDefnByCode.Count > 0) ? docTempDefnByCode[0] : null;
                if (docTempDefn == null)
                {
                    reJo.msg = "没有与其相关的模板管理,创建无法正常完成";
                    return(reJo.Value);
                }

                IEnumerable <string> source = from docx in m_Project.DocList select docx.Code;
                string filename             = sendCode + " " + title;
                if (source.Contains <string>(filename))
                {
                    for (int i = 1; i < 0x3e8; i++)
                    {
                        filename = sendCode + " " + title + i.ToString();
                        if (!source.Contains <string>(filename))
                        {
                            //reJo.msg = "新建会议纪要出错!";
                            //return reJo.Value;
                            break;
                        }
                    }
                }

                //文档名称
                Doc docItem = m_Project.NewDoc(filename + ".docx", filename, "", docTempDefn);
                if (docItem == null)
                {
                    reJo.msg = "新建会议纪要出错!";
                    return(reJo.Value);
                }

                #endregion

                #region 设置文会议纪要文档附加属性


                AttrData data;


                //函件编号
                if ((data = docItem.GetAttrDataByKeyWord("ME_FILECODE")) != null)
                {
                    data.SetCodeDesc(fileCode);
                }

                //会议主题
                if ((data = docItem.GetAttrDataByKeyWord("ME_TITLE")) != null)
                {
                    data.SetCodeDesc(title);
                }

                //会议时间
                if ((data = docItem.GetAttrDataByKeyWord("ME_TIME")) != null)
                {
                    data.SetCodeDesc(meetTime);
                }

                //函件编号
                if ((data = docItem.GetAttrDataByKeyWord("ME_SENDCODE")) != null)
                {
                    data.SetCodeDesc(sendCode);
                }

                //发文日期
                if ((data = docItem.GetAttrDataByKeyWord("ME_SENDDATE")) != null)
                {
                    data.SetCodeDesc(sendDate);
                }

                //主送
                if ((data = docItem.GetAttrDataByKeyWord("ME_MAINSEND")) != null)
                {
                    data.SetCodeDesc(mainFeeder);
                }

                //页数
                if ((data = docItem.GetAttrDataByKeyWord("ME_PAGE")) != null)
                {
                    data.SetCodeDesc(totalPages);
                }

                //抄送
                if ((data = docItem.GetAttrDataByKeyWord("ME_COPY")) != null)
                {
                    data.SetCodeDesc(copyParty);
                }


                ////保存项目属性,存进数据库
                docItem.AttrDataList.SaveData();

                #endregion

                #region 录入数据进入word表单

                string strDocList = "";//获取附件

                //录入数据进入表单
                Hashtable htUserKeyWord = new Hashtable();


                //格式化日期
                DateTime senddate = Convert.ToDateTime(sendDate);

                string strSenddate = senddate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");


                htUserKeyWord.Add("HEADERCODE", fileCode);   //页眉里面的发文编码

                htUserKeyWord.Add("SENDDATE", strSenddate);  //发送日期
                htUserKeyWord.Add("PAGE", totalPages);       //页数

                htUserKeyWord.Add("MAINFEEDER", mainFeeder); //主送
                //htUserKeyWord.Add("DOCUMENTCODE", documentCode);//发文编码

                htUserKeyWord.Add("COPY", copyParty);            //抄送方

                htUserKeyWord.Add("TITLE", title);               //标题
                htUserKeyWord.Add("MEETTIME", meetTime);         //会议时间
                htUserKeyWord.Add("MEETPLACE", meetPlace);       //会议地点

                htUserKeyWord.Add("HOSTUNIT", hostUnit);         //主办单位
                htUserKeyWord.Add("MODERATOR", moderator);       //主持人
                htUserKeyWord.Add("PARTICIPANTS", participants); //参会单位与人员

                htUserKeyWord.Add("CONTENT", content);           //会议内容


                string workingPath = m_Project.dBSource.LoginUser.WorkingPath;


                try
                {
                    //上传下载文档
                    string exchangfilename = "会议纪要中文模板";

                    //获取网站路径
                    string sPath = System.Web.HttpContext.Current.Server.MapPath("/ISO/HXEPC/");

                    //获取模板文件路径
                    string modelFileName = sPath + exchangfilename + ".docx";

                    //获取即将生成的联系单文件路径
                    string locFileName = docItem.FullPathFile;

                    FileInfo info = new FileInfo(locFileName);

                    if (System.IO.File.Exists(modelFileName))
                    {
                        //如果存储子目录不存在,就创建目录
                        if (!Directory.Exists(info.Directory.FullName))
                        {
                            Directory.CreateDirectory(info.Directory.FullName);
                        }

                        //复制模板文件到存储目录,并覆盖同名文件
                        System.IO.File.Copy(modelFileName, locFileName, true);


                        //线程锁
                        muxConsole.WaitOne();
                        try
                        {
                            //把参数直接写进office
                            CDMSWebOffice office = new CDMSWebOffice
                            {
                                CloseApp   = true,
                                VisibleApp = false
                            };
                            office.Release(true);
                            office.WriteDataToDocument(docItem, locFileName, htUserKeyWord, htUserKeyWord);
                        }
                        catch { }
                        finally
                        {
                            //解锁
                            muxConsole.ReleaseMutex();
                        }
                    }


                    int length = (int)info.Length;
                    docItem.O_size = new int?(length);
                    docItem.Modify();


                    if (string.IsNullOrEmpty(strDocList))
                    {
                        strDocList = docItem.KeyWord;
                    }
                    else
                    {
                        strDocList = docItem.KeyWord + "," + strDocList;
                    }

                    //这里刷新数据源,否则创建流程的时候获取不了专业字符串
                    DBSourceController.RefreshDBSource(sid);

                    reJo.success = true;
                    reJo.data    = new JArray(new JObject(new JProperty("ProjectKeyword", docItem.Project.KeyWord),
                                                          new JProperty("DocKeyword", docItem.KeyWord), new JProperty("DocList", strDocList)));
                    return(reJo.Value);
                }
                catch { }
                #endregion

                reJo.data    = new JArray(new JObject(new JProperty("projectKeyword", m_Project.KeyWord)));
                reJo.success = true;
                return(reJo.Value);

                //AVEVA.CDMS.WebApi.DBSourceController.RefreshDBSource(sid);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#17
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EditCompany(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyId = "", strCompanyCode = "", strCompanyDesc = "",
                       strSecretarilman = "", strCompanyChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyId":
                        strCompanyId = strValue;
                        break;

                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strCompanyDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }
                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //User secretarilman = dbsource.GetUserByKeyWord(strSecretarilman);
                //if (secretarilman == null)
                //{
                //    reJo.msg = "参数错误!文控角色所选择的用户不存在!";
                //    return reJo.Value;
                //}

                int companyId = Convert.ToInt32(strCompanyId);
                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;


                JArray  jaData    = new JArray();
                JObject joCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode &&
                        data6.O_Code == strCompanyCode && data6.O_ID != companyId)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData


                #region 添加到数据字典
                //添加到数据字典

                //DictData dictdata = new DictData();
                //dictdata.StatusNew = true;
                //dictdata.O_skey = "Unit";
                //dictdata.O_datatype = (int)enDictDataType.TableHead;
                //dictdata.O_Code = strCompanyCode;
                //dictdata.O_Desc = strCompanyDesc;
                //dictdata.O_sValue1 = strProjCode;

                ////设置属性的值
                //SetDictDataPropertyValue(dictdata, 0);

                //dictdata.Modify();
                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == companyId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "参建单位ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                //自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                SetUnitSecUser(sid, dbsource, prjProject, strCompanyCode, strCompanyDesc, ref strSecretarilman);
                //#region 自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                //User secUser = null;
                //if (string.IsNullOrEmpty(strSecretarilman))
                //{
                //    secUser = dbsource.GetUserByCode(strCompanyCode);
                //    if (secUser == null)
                //    {
                //        ////UserController. CreateUser(sid, strCompanyCode, strCompanyDesc + "文控", "", "0",
                //        ////            "0", "", strCompanyCode, strCompanyCode);
                //        ////secUser = dbsource.GetUserByCode(strCompanyCode);
                //        secUser = dbsource.NewUser(
                //                            enUserFlage.OnLine,
                //                            enUserType.Default,
                //                                "",
                //                               strCompanyCode,
                //                                strCompanyDesc + "文控",
                //                                strCompanyCode,
                //                                "",
                //                                null
                //                                );

                //        if (secUser != null)
                //        {

                //            User m_user = secUser;
                //            m_user.O_suser1 = m_user.dBSource.GUID;

                //            m_user.Modify();



                //            // 强制刷新共享数据源
                //            //
                //            //DBSourceController.RefreshShareDBManager();
                //            DBSourceController.RefreshDBSource(sid);
                //            strSecretarilman = secUser.ToString;
                //        }
                //    }
                //    else
                //    {
                //        strSecretarilman = secUser.ToString;
                //    }


                //}

                //if (secUser != null)
                //{
                //    //把用户添加到项目管理类里面的项目单位用户组
                //    Group group = dbsource.GetGroupByName(prjProject.Code + "_ALLUnit");


                //    if (group != null)
                //    {
                //        group.AddUser(secUser);
                //        group.Modify();
                //    }
                //}
                //    #endregion

                dictData.O_Code    = strCompanyCode;
                dictData.O_Desc    = strCompanyDesc;
                dictData.O_sValue1 = strProjCode;
                dictData.O_sValue3 = strSecretarilman;// secretarilman.ToString;//
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                ////通过以上的dictdata新建一个DictData
                //DictData newDictData = CreateNewDictData(dbsource, dictdata, enDictDataType.TableHead);

                //if (!newDictData.Write())
                //{
                //    //MessageBox.Show("创建失败!", "提示", MessageBoxButtons.OK);
                //    reJo.msg = "创建失败!";
                //    return reJo.Value;
                //}
                #endregion

                //自动创建通信类下的单位目录
                CreateUnitProject(dbsource, prjProject, strCompanyCode, strCompanyDesc, strSecretarilman);

                ////自动创建通信类下的单位目录
                //#region 自动创建通信类下的单位目录
                //try
                //{
                //    TempDefn mTempDefn = Company.GetTempDefn(dbsource, "COM_UNIT");
                //    if (mTempDefn != null)
                //    {
                //        Project cdProject = CommonFunction.GetProjectByDesc(prjProject, "存档管理");
                //        if (cdProject != null)
                //        {
                //            Project txProject = CommonFunction.GetProjectByDesc(cdProject, "通信类");
                //            if (txProject != null)
                //            {
                //                Project project = txProject.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);

                //                if (project != null)
                //                {
                //                    //增加附加属性
                //                    try
                //                    {
                //                        project.GetAttrDataByKeyWord("UN_SECRETAARECTOR").SetCodeDesc(strSecretarilman);             //文控
                //                        project.AttrDataList.SaveData();
                //                    }
                //                    catch (Exception ex)
                //                    {
                //                        //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                //                        reJo.msg = "获取厂家模板失败,请联系管理员!";
                //                        return reJo.Value;
                //                    }

                //                    TempDefn sfwTempDefn = Company.GetTempDefn(dbsource, "STO_SUBDOCUMENT");
                //                    if (sfwTempDefn != null)
                //                    {
                //                        Project swProject = project.NewProject("收文", "", m_prj.Storage, sfwTempDefn);
                //                        Project fwProject = project.NewProject("发文", "", m_prj.Storage, sfwTempDefn);

                //                        TempDefn typeTempDefn = Company.GetTempDefn(dbsource, "STO_COMTYPE");
                //                        if (typeTempDefn != null)
                //                        {
                //                            if (swProject != null)
                //                            {
                //                                swProject.NewProject("红头文", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("会议纪要", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("文件传递单", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("信函", "", m_prj.Storage, typeTempDefn);
                //                            }

                //                            if (fwProject != null)
                //                            {
                //                                fwProject.NewProject("红头文", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("会议纪要", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("文件传递单", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("信函", "", m_prj.Storage, typeTempDefn);
                //                            }
                //                        }
                //                    }
                //                }
                //            }
                //        }
                //    }
                //}
                //catch
                //{

                //}
                //#endregion

                //prjProject.GetProjectByName();


                //    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                //if (project == null)
                //{
                //    reJo.msg = "新建版本目录失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //增加附加属性
                try
                {
                    //project.GetAttrDataByKeyWord("FC_COMPANYCODE").SetCodeDesc(strCompanyCode);       //厂家编码
                    //project.GetAttrDataByKeyWord("FC_COMPANYCHINESE").SetCodeDesc(strCompanyChinese);    //厂家名称
                    //project.GetAttrDataByKeyWord("FC_ADDRESS").SetCodeDesc(strAddress);           //厂家地址
                    //project.GetAttrDataByKeyWord("FC_PROVINCE").SetCodeDesc(strProvince);          //厂家省份
                    //project.GetAttrDataByKeyWord("FC_POSTCODE").SetCodeDesc(strPostCode);          //厂家邮政
                    //project.GetAttrDataByKeyWord("FC_EMAIL").SetCodeDesc(strEMail);             //厂家邮箱
                    //project.GetAttrDataByKeyWord("FC_RECEIVER").SetCodeDesc(strReceiver);          //厂家收件人
                    //project.GetAttrDataByKeyWord("FC_FAXNO").SetCodeDesc(strFaxNo);             //厂家传真号
                    //project.GetAttrDataByKeyWord("FC_PHONE").SetCodeDesc(strPhone);             //收件人电话
                    //project.AttrDataList.SaveData();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                    reJo.msg = "获取厂家模板失败,请联系管理员!";
                    return(reJo.Value);
                }

                //reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#18
0
        public static JObject DraftRecognition(string sid, string ProjectKeyword, string DocAttrJson, string ContentJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }


                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);


                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                #region 获取信函参数内容

                //获取信函参数内容
                string fileCode = "", projectName = "", contractCode = "",
                       sendDate = "", sendCode = "", recCode = "",
                       recType = "", materialType = "";

                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(DocAttrJson);

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    ////获取函件编号
                    //if (strName == "documentCode") documentCode = strValue.Trim();

                    //获取文件编码
                    if (strName == "fileCode")
                    {
                        fileCode = strValue.Trim();
                    }

                    //获取项目名称
                    else if (strName == "projectName")
                    {
                        projectName = strValue;
                    }

                    //获取合同号
                    else if (strName == "contractCode")
                    {
                        contractCode = strValue;
                    }

                    //获取发文日期
                    else if (strName == "sendDate")
                    {
                        sendDate = strValue;
                    }

                    //获取发文编码
                    else if (strName == "sendCode")
                    {
                        sendCode = strValue;
                    }

                    //获取收文编码
                    else if (strName == "recCode")
                    {
                        recCode = strValue;
                    }

                    //获取来文类型
                    else if (strName == "recType")
                    {
                        recType = strValue;
                    }

                    //获取物资类型
                    else if (strName == "materialType")
                    {
                        materialType = strValue;
                    }
                }


                if (string.IsNullOrEmpty(fileCode))
                {
                    reJo.msg = "请填写文件编号!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(projectName))
                {
                    reJo.msg = "请填写工程名称!";
                    return(reJo.Value);
                }


                #endregion

                #region 获取材料或设备列表
                List <Material> materialList = new List <Material>();
                if (!string.IsNullOrEmpty(ContentJson))
                {
                    int    index   = 0;
                    JArray jaFiles = (JArray)JsonConvert.DeserializeObject(ContentJson);

                    foreach (JObject joAttr in jaFiles)
                    {
                        string strMatName     = joAttr["matName"].ToString();     //材料(设备)名称
                        string strSpec        = joAttr["spec"].ToString();        //规格型号
                        string strMeaUnit     = joAttr["meaUnit"].ToString();     //计量单位
                        string strDesignNum   = joAttr["designNum"].ToString();   //设计图号
                        string strBrand       = joAttr["brand"].ToString();       //品牌
                        string strQuantity    = joAttr["quantity"].ToString();    //报审数量
                        string strAudit       = joAttr["audit"].ToString();       //意见
                        string strPrice       = joAttr["price"].ToString();       //报审单价
                        string strCostPrice   = joAttr["costPrice"].ToString();   //造价员单价
                        string strCenterPrice = joAttr["centerPrice"].ToString(); //财务中心单价
                        string strTenderPrice = joAttr["tenderPrice"].ToString(); //招标部单价
                        string strAuditPrice  = joAttr["auditPrice"].ToString();  //审核 合价
                        string strRemark      = joAttr["remark"].ToString();      //备注

                        if (string.IsNullOrEmpty(strMatName))
                        {
                            continue;
                        }

                        index++;
                        string   strIndex = index.ToString();
                        Material afItem   = new Material()
                        {
                            No          = strIndex,
                            MatName     = strMatName,
                            Spec        = strSpec,
                            MeaUnit     = strMeaUnit,
                            DesignNum   = strDesignNum,
                            Brand       = strBrand,
                            Quantity    = strQuantity,
                            Audit       = strAudit,
                            Price       = strPrice,
                            CostPrice   = strCostPrice,
                            CenterPrice = strCenterPrice,
                            TenderPrice = strTenderPrice,
                            AuditPrice  = strAuditPrice,
                            Remark      = strRemark
                        };

                        materialList.Add(afItem);
                    }
                }
                #endregion


                #region 根据信函模板,生成信函文档

                //获取立项单文档所在的目录
                //Project m_Project = m_NewProject;

                List <TempDefn> docTempDefnByCode = m_Project.dBSource.GetTempDefnByCode("PRICEFILE");
                TempDefn        docTempDefn       = (docTempDefnByCode != null && docTempDefnByCode.Count > 0) ? docTempDefnByCode[0] : null;
                if (docTempDefn == null)
                {
                    reJo.msg = "没有与其相关的模板管理,创建无法正常完成";
                    return(reJo.Value);
                }

                IEnumerable <string> source = from docx in m_Project.DocList select docx.Code;
                string filename             = fileCode + " " + projectName + "认质认价报审单";
                if (source.Contains <string>(filename))
                {
                    for (int i = 1; i < 0x3e8; i++)
                    {
                        filename = fileCode + " " + projectName + "认质认价报审单" + i.ToString();
                        if (!source.Contains <string>(filename))
                        {
                            //reJo.msg = "新建信函出错!";
                            //return reJo.Value;
                            break;
                        }
                    }
                }

                //文档名称
                Doc docItem = m_Project.NewDoc(filename + ".docx", filename, "", docTempDefn);
                if (docItem == null)
                {
                    reJo.msg = "新建认质认价单出错!";
                    return(reJo.Value);
                }

                #endregion

                #region 设置信函文档附加属性


                AttrData data;
                //文件编码
                if ((data = docItem.GetAttrDataByKeyWord("PR_FILECODE")) != null)
                {
                    data.SetCodeDesc(fileCode);
                }
                //工程名称
                if ((data = docItem.GetAttrDataByKeyWord("PR_PROJECTNAME")) != null)
                {
                    data.SetCodeDesc(projectName);
                }
                //合同号
                if ((data = docItem.GetAttrDataByKeyWord("PR_CONTRACTCODE")) != null)
                {
                    data.SetCodeDesc(contractCode);
                }
                //发文日期
                if ((data = docItem.GetAttrDataByKeyWord("PR_SENDDATE")) != null)
                {
                    data.SetCodeDesc(sendDate);
                }

                //发文编号
                if ((data = docItem.GetAttrDataByKeyWord("PR_SENDCODE")) != null)
                {
                    data.SetCodeDesc(sendCode);
                }
                //来文编号
                if ((data = docItem.GetAttrDataByKeyWord("PR_RECCODE")) != null)
                {
                    data.SetCodeDesc(recCode);
                }
                //来文类型
                if ((data = docItem.GetAttrDataByKeyWord("PR_RECTYPE")) != null)
                {
                    data.SetCodeDesc(recType);
                }
                //采购类型
                if ((data = docItem.GetAttrDataByKeyWord("PR_MATERIALTYPE")) != null)
                {
                    data.SetCodeDesc(materialType);
                }
                //材料列表
                if ((data = docItem.GetAttrDataByKeyWord("PR_CONTENT")) != null)
                {
                    data.SetCodeDesc(ContentJson);
                }


                ////保存项目属性,存进数据库
                docItem.AttrDataList.SaveData();

                #endregion

                #region 录入数据进入word表单

                string strDocList = "";//获取附件

                //录入数据进入表单
                Hashtable htUserKeyWord = new Hashtable();


                //格式化日期
                DateTime senddate    = Convert.ToDateTime(sendDate);
                string   strSenddate = senddate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");


                htUserKeyWord.Add("FILECODE", fileCode);         //文件编码
                htUserKeyWord.Add("PROJECTNAME", projectName);   //发送方
                htUserKeyWord.Add("CONTRACTCODE", contractCode); //合同号
                htUserKeyWord.Add("SENDDATE", strSenddate);      //日期
                htUserKeyWord.Add("SENDCODE", sendCode);         //编号
                htUserKeyWord.Add("RECCODE", recCode);           //来文编号
                htUserKeyWord.Add("RECTYPE", recType);           //来文类型
                htUserKeyWord.Add("MATERIALTYPE", materialType); //采购类型 (材料或者设备)


                //htUserKeyWord.Add("RHEADER", sendCode);//页眉里面的编码


                //htUserKeyWord["PREPAREDSIGN"] = curUser.O_username;
                //htUserKeyWord["DRAFTTIME"] = DateTime.Now.ToString("yyyy.MM.dd");


                #region 获取项目名称
                Project proj = docItem.Project;
                //Project rootProj = new Project();
                string  rootProjDesc = "";
                Project rootProj     = CommonFunction.getParentProjectByTempDefn(proj, "HXNY_DOCUMENTSYSTEM");

                #endregion
                string proSource = "";
                if (rootProj != null)
                {
                    proSource = rootProj.GetValueByKeyWord("PRO_COMPANY").ToString();

                    //    //string proAddress = rootProj.GetValueByKeyWord("PRO_ADDRESS").ToString();
                    //    //string proTel = rootProj.GetValueByKeyWord("PRO_NUMBER").ToString();

                    //    //htUserKeyWord.Add("PRO_ADDRESS", proAddress);//项目地址
                    //    //htUserKeyWord.Add("PRO_TEL", proTel);//项目电话

                    //    //htUserKeyWord["PROJECTDESC"] = "(" + rootProj.Description + "项目部)";
                }

                //添加附件
                List <string> list3 = new List <string>();
                foreach (Material mat in materialList)
                {
                    list3.Add(mat.No);
                    list3.Add(mat.MatName);
                    list3.Add(mat.Spec);
                    list3.Add(mat.MeaUnit);
                    list3.Add(mat.DesignNum);
                    list3.Add(mat.Brand);
                    list3.Add(mat.Quantity);
                    list3.Add(mat.Audit);
                    list3.Add(mat.Price);
                    list3.Add(mat.CostPrice);
                    list3.Add(mat.CenterPrice);
                    list3.Add(mat.TenderPrice);
                    list3.Add(mat.AuditPrice);
                    list3.Add(mat.Remark);
                }


                //用htAuditDataList传送附件列表到word
                Hashtable htAuditDataList = new Hashtable();
                //word里面表格关键字的设置公式(不需要加"$()") :表格关键字+":"+已画好表格线的行数+":"+表格列数
                //例如关键字是"DRAWING",画了一行表格线,从第二行起画表格线,每行有6列,则公式是:"DRAWING:1:6"
                htAuditDataList.Add("DRAWING", list3);

                //attrDataByKeyWord = mShortDoc.GetAttrDataByKeyWord("IFR_NOTE");
                //if ((attrDataByKeyWord != null) && (this.m_doc != null))
                //{
                //    List<Doc> list4 = this.m_doc.WorkFlow.DocList.Distinct<Doc>().ToList<Doc>();
                //    string docids = "";
                //    list4.ForEach((Action<Doc>)(d => docids = docids + d.O_itemno + ","));
                //    docids = docids.TrimEnd(new char[] { ',' });
                //    attrDataByKeyWord.SetCodeDesc(docids);
                //    mShortDoc.AttrDataList.SaveData();
                //}

                string workingPath = m_Project.dBSource.LoginUser.WorkingPath;


                try
                {
                    //上传下载文档
                    string exchangfilename = (proSource == "CWEC") ? "认质认价工程有限" : "认质认价工业股份";


                    //获取网站路径
                    string sPath = System.Web.HttpContext.Current.Server.MapPath("/ISO/HXEPC/");

                    //获取模板文件路径
                    string modelFileName = sPath + exchangfilename + ".docx";

                    //获取即将生成的联系单文件路径
                    string locFileName = docItem.FullPathFile;

                    FileInfo info = new FileInfo(locFileName);

                    if (System.IO.File.Exists(modelFileName))
                    {
                        //如果存储子目录不存在,就创建目录
                        if (!Directory.Exists(info.Directory.FullName))
                        {
                            Directory.CreateDirectory(info.Directory.FullName);
                        }

                        //复制模板文件到存储目录,并覆盖同名文件
                        System.IO.File.Copy(modelFileName, locFileName, true);


                        //线程锁
                        muxConsole.WaitOne();
                        try
                        {
                            //把参数直接写进office
                            CDMSWebOffice office = new CDMSWebOffice
                            {
                                CloseApp   = true,
                                VisibleApp = false
                            };
                            office.Release(true);
                            office.WriteDataToDocument(docItem, locFileName, htUserKeyWord, htAuditDataList);
                        }
                        catch { }
                        finally
                        {
                            //解锁
                            muxConsole.ReleaseMutex();
                        }
                    }


                    int length = (int)info.Length;
                    docItem.O_size = new int?(length);
                    docItem.Modify();


                    if (string.IsNullOrEmpty(strDocList))
                    {
                        strDocList = docItem.KeyWord;
                    }
                    else
                    {
                        strDocList = docItem.KeyWord + "," + strDocList;
                    }

                    //这里刷新数据源,否则创建流程的时候获取不了专业字符串
                    DBSourceController.RefreshDBSource(sid);

                    reJo.success = true;
                    reJo.data    = new JArray(new JObject(new JProperty("ProjectKeyword", docItem.Project.KeyWord),
                                                          new JProperty("DocKeyword", docItem.KeyWord), new JProperty("DocList", strDocList),
                                                          new JProperty("DocCode", docItem.Code)));
                    return(reJo.Value);
                }
                catch { }
                #endregion

                reJo.data    = new JArray(new JObject(new JProperty("projectKeyword", m_Project.KeyWord)));
                reJo.success = true;
                return(reJo.Value);

                //AVEVA.CDMS.WebApi.DBSourceController.RefreshDBSource(sid);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#19
0
        private static bool SetUnitSecUser(string sid, DBSource dbsource, Project prjProject, string strCompanyCode, string strCompanyDesc, ref string strSecretarilman)
        {
            try
            {
                #region 自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                User secUser = null;
                if (string.IsNullOrEmpty(strSecretarilman))
                {
                    secUser = dbsource.GetUserByCode(strCompanyCode);
                    if (secUser == null)
                    {
                        ////UserController. CreateUser(sid, strCompanyCode, strCompanyDesc + "文控", "", "0",
                        ////            "0", "", strCompanyCode, strCompanyCode);
                        ////secUser = dbsource.GetUserByCode(strCompanyCode);
                        secUser = dbsource.NewUser(
                            enUserFlage.OnLine,
                            enUserType.Default,
                            "",
                            strCompanyCode,
                            strCompanyDesc + "文控",
                            strCompanyCode,
                            "",
                            null
                            );

                        if (secUser != null)
                        {
                            User m_user = secUser;
                            m_user.O_suser1 = m_user.dBSource.GUID;

                            m_user.Modify();



                            // 强制刷新共享数据源
                            //
                            //DBSourceController.RefreshShareDBManager();
                            DBSourceController.RefreshDBSource(sid);
                            strSecretarilman = secUser.ToString;
                        }
                    }
                    else
                    {
                        strSecretarilman = secUser.ToString;
                    }
                }
                else
                {
                    secUser = dbsource.GetUserByCode(strCompanyCode);
                }

                if (secUser != null)
                {
                    //把用户添加到项目管理类里面的项目单位用户组
                    Group group = dbsource.GetGroupByName(prjProject.Code + "_ALLUnit");

                    if (group != null)
                    {
                        if (!group.UserList.Contains(secUser))
                        {
                            group.AddUser(secUser);
                            group.Modify();
                        }
                    }
                }
                #endregion
            }
            catch { }
            return(true);
        }
示例#20
0
        /// <summary>
        /// 创建发文单后,发起发文流程
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="docKeyword"></param>
        /// <param name="DocList"></param>
        /// <returns></returns>
        public static JObject RecognitionStartWorkFlow(string sid, string docKeyword, string DocList, string UserList)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc doc = dbsource.GetDocByKeyWord(docKeyword);
                if (doc == null)
                {
                    reJo.msg = "错误的文档操作信息!指定的文档不存在!";
                    return(reJo.Value);
                }

                #region 获取下一状态用户
                string[] userArray = (string.IsNullOrEmpty(UserList) ? "" : UserList).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                Server.Group group = new Server.Group();
                //List<User> m_UserList = new List<User>();
                //启动工作流程
                //反转列表
                //m_UserList.Reverse();
                foreach (string strObj in userArray)
                {
                    object obj = dbsource.GetObjectByKeyWord(strObj);

                    if (obj is User)
                    {
                        //m_UserList.Add((User)obj);
                        group.AddUser((User)obj);
                    }
                }
                if (group.UserList.Count <= 0)
                {
                    reJo.msg = "获取下一流程状态用户错误,自动启动流程失败!请手动启动流程";
                    return(reJo.Value);
                }
                #endregion

                {
                    #region 获取文档列表
                    string[] strArray = (string.IsNullOrEmpty(DocList) ? "" : DocList).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    List <Doc> m_DocList = new List <Doc>();
                    //启动工作流程
                    m_DocList.Reverse();
                    foreach (string strObj in strArray)
                    {
                        object obj = dbsource.GetObjectByKeyWord(strObj);

                        if (obj is Doc)
                        {
                            m_DocList.Add((Doc)obj);
                        }
                    }
                    #endregion

                    WorkFlow flow = dbsource.NewWorkFlow(m_DocList, "RECOGNITION");
                    //if (flow == null || flow.CuWorkState == null || flow.CuWorkState.workStateBranchList == null || (flow.CuWorkState.workStateBranchList.Count <= 0))
                    if (flow == null)
                    {
                        reJo.msg = "自动启动流程失败!请手动启动";
                        return(reJo.Value);
                    }



                    //获取下一状态
                    //me.approvpathdata = [{ text: "二级-编批", value: "二级-编批" }, { text: "三级-编审批", value: "三级-编审批" },
                    //{ text: "四级-编审定批", value: "四级-编审定批" }, { text: "五级-编校审定批", value: "五级-编校审定批" }];

                    WorkState ws = new WorkState();

                    DefWorkState dws = flow.DefWorkFlow.DefWorkStateList.Find(s => s.KeyWord == "APPROV");// CHECK");
                    ws.DefWorkState = dws;

                    //if (ApprovPath == "二级-编批")
                    //{
                    //    DefWorkState dws = flow.DefWorkFlow.DefWorkStateList.Find(s => s.KeyWord == "APPROV");// CHECK");
                    //    ws.DefWorkState = dws;
                    //}
                    //else if (ApprovPath == "三级-编审批" || ApprovPath == "四级-编审定批")
                    //{
                    //    DefWorkState dws = flow.DefWorkFlow.DefWorkStateList.Find(s => s.KeyWord == "AUDIT");// CHECK");
                    //    ws.DefWorkState = dws;
                    //}
                    //else if (ApprovPath == "五级-编校审定批")
                    //{
                    //    DefWorkState dws = flow.DefWorkFlow.DefWorkStateList.Find(s => s.KeyWord == "CHECK");// CHECK");
                    //    ws.DefWorkState = dws;

                    //}
                    //else
                    //{
                    //    flow.Delete();
                    //    flow.Delete();

                    //    reJo.msg = "审批路径参数错误,自动启动流程失败!请手动启动流程";
                    //    return reJo.Value;
                    //}

                    //foreach (User user in group.UserList)
                    //{
                    //    ws.group.AddUser(user);
                    //}
                    //flow.WorkStateList.Add(ws);
                    //flow.Modify();


                    ////启动流程
                    WorkStateBranch branch = flow.CuWorkState.workStateBranchList[0];
                    branch.NextStateAddGroup(group);

                    ExReJObject GotoNextReJo = WebWorkFlowEvent.GotoNextStateAndSelectUser(flow.CuWorkState.workStateBranchList[0]);

                    if (!GotoNextReJo.success)
                    {
                        //  doc.dBSource.ProgramRun = false;
                        flow.Delete();
                        flow.Delete();

                        reJo.msg = "自动启动流程失败!请手动启动流程";
                        return(reJo.Value);
                    }

                    DBSourceController.RefreshDBSource(sid);

                    return(GotoNextReJo.Value);
                }
            }
            catch (Exception exception)
            {
                WebApi.CommonController.WebWriteLog(exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace);
                reJo.msg = "启动流程失败!" + exception.Message + "\r\n" + exception.Source + "\r\n" + exception.StackTrace;
            }
            return(reJo.Value);
        }
示例#21
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateCompany(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyCode = "", strCompanyDesc = "",
                       strSecretarilman = "", strCompanyChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strCompanyDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }

                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                JArray  jaData    = new JArray();
                JObject joCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode && data6.O_Code == strCompanyCode)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }

                //自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                SetUnitSecUser(sid, dbsource, prjProject, strCompanyCode, strCompanyDesc, ref strSecretarilman);

                //#region 自动设置文控,如果没有与单位代码一样的用户,就自动添加用户

                //if (string.IsNullOrEmpty(strSecretarilman))
                //{
                //    User secUser = dbsource.GetUserByCode(strCompanyCode);
                //    if (secUser == null)
                //    {
                //        ////UserController. CreateUser(sid, strCompanyCode, strCompanyDesc + "文控", "", "0",
                //        ////            "0", "", strCompanyCode, strCompanyCode);
                //        ////secUser = dbsource.GetUserByCode(strCompanyCode);
                //        secUser = dbsource.NewUser(
                //                            enUserFlage.OnLine,
                //                            enUserType.Default,
                //                                "",
                //                               strCompanyCode,
                //                                strCompanyDesc + "文控",
                //                                strCompanyCode,
                //                                "",
                //                                null
                //                                );

                //        if (secUser != null)
                //        {

                //            User m_user = secUser;
                //            m_user.O_suser1 = m_user.dBSource.GUID;

                //            m_user.Modify();

                //            // 强制刷新共享数据源
                //            //
                //            //DBSourceController.RefreshShareDBManager();
                //            DBSourceController.RefreshDBSource(sid);
                //            strSecretarilman = secUser.ToString;
                //        }
                //    }
                //    else
                //    {
                //        strSecretarilman = secUser.ToString;
                //    }
                //}
                //#endregion

                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                //DictData dictdata = new DictData();
                //dictdata.StatusNew = true;
                //dictdata.O_skey = "Unit";
                //dictdata.O_datatype = (int)enDictDataType.TableHead;
                //dictdata.O_Code = strCompanyCode;
                //dictdata.O_Desc = strCompanyDesc;
                //dictdata.O_sValue1 = strProjCode;

                ////设置属性的值
                //SetDictDataPropertyValue(dictdata, 0);

                //dictdata.Modify();
                //strProjCode = "GEDI";

                string format = "insert CDMS_DictData (" +
                                "o_parentno,o_datatype,o_ikey,o_skey,o_Code,o_Desc,o_sValue1,o_sValue2,o_sValue3,o_sValue4,o_sValue5,o_iValue1 ,o_iValue2)" +
                                " values ({0},{1},{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',{11},{12}" + ")";
                //0,2,0,'Unit','"+strCompanyCode+"','"+strCompanyDesc+"','"+strProjCode+ "','','','','',0,0
                format = string.Format(format, new object[] {
                    0, 2, 0, "Unit", strCompanyCode, strCompanyDesc, strProjCode, "", strSecretarilman, "", "", 0, 0
                });
                dbsource.DBExecuteSQL(format);

                DBSourceController.refreshDBSource(sid);

                //自动创建通信类下的单位目录
                CreateUnitProject(dbsource, prjProject, strCompanyCode, strCompanyDesc, strSecretarilman);

                ////通过以上的dictdata新建一个DictData
                //DictData newDictData = CreateNewDictData(dbsource, dictdata, enDictDataType.TableHead);

                //if (!newDictData.Write())
                //{
                //    //MessageBox.Show("创建失败!", "提示", MessageBoxButtons.OK);
                //    reJo.msg = "创建失败!";
                //    return reJo.Value;
                //}
                #endregion

                ////获取所有厂家信息
                //TempDefn mTempDefn = GetTempDefn(dbsource, "COM_UNIT");
                //if (mTempDefn == null)
                //{
                //    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                //if (project == null)
                //{
                //    reJo.msg = "新建版本目录失败,请联系管理员!";
                //    return reJo.Value;
                //}

                ////增加附加属性
                //try
                //{
                //    //project.GetAttrDataByKeyWord("FC_COMPANYCODE").SetCodeDesc(strCompanyCode);       //厂家编码
                //    //project.GetAttrDataByKeyWord("FC_COMPANYCHINESE").SetCodeDesc(strCompanyChinese);    //厂家名称
                //    //project.GetAttrDataByKeyWord("FC_ADDRESS").SetCodeDesc(strAddress);           //厂家地址
                //    //project.GetAttrDataByKeyWord("FC_PROVINCE").SetCodeDesc(strProvince);          //厂家省份
                //    //project.GetAttrDataByKeyWord("FC_POSTCODE").SetCodeDesc(strPostCode);          //厂家邮政
                //    //project.GetAttrDataByKeyWord("FC_EMAIL").SetCodeDesc(strEMail);             //厂家邮箱
                //    //project.GetAttrDataByKeyWord("FC_RECEIVER").SetCodeDesc(strReceiver);          //厂家收件人
                //    //project.GetAttrDataByKeyWord("FC_FAXNO").SetCodeDesc(strFaxNo);             //厂家传真号
                //    //project.GetAttrDataByKeyWord("FC_PHONE").SetCodeDesc(strPhone);             //收件人电话
                //    //project.AttrDataList.SaveData();
                //}
                //catch (Exception ex)
                //{
                //    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                //    reJo.msg = "获取厂家模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#22
0
        public static JObject GetSelectProjectList(string sid, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_RootProject = dbsource.RootLocalProjectList.Find(itemProj => itemProj.TempDefn.KeyWord == "PRODOCUMENTADMIN");
                if (m_RootProject == null)
                {
                    reJo.msg = "[项目管理类文件目录]不存在,或者未添加目录模板!不能获取项目列表";
                    return(reJo.Value);
                }

                JArray jaData = new JArray();
                foreach (Project proj in m_RootProject.AllProjectList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        proj.Code.ToLower().IndexOf(Filter) < 0 && proj.Description.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    if (proj.TempDefn.KeyWord == "HXNY_DOCUMENTSYSTEM")
                    {
                        JObject joData = new JObject(
                            new JProperty("projectType", "项目"),
                            new JProperty("projectId", proj.KeyWord),
                            new JProperty("projectCode", proj.Code),
                            new JProperty("projectDesc", proj.Description)
                            );
                        jaData.Add(joData);
                    }
                }



                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#23
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EditDepartment(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strDepartmentId = "", strDepartmentCode = "", strDepartmentDesc = "",
                       strSecretarilman = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "departmentId":
                        strDepartmentId = strValue;
                        break;

                    case "departmentCode":
                        strDepartmentCode = strValue;
                        break;

                    case "departmentDesc":
                        strDepartmentDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strDepartmentCode))
                {
                    reJo.msg = "请输入部门编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strDepartmentDesc))
                {
                    reJo.msg = "请输入部门名称!";
                    return(reJo.Value);
                }
                #endregion

                //Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                //if (prjProject == null)
                //{
                //    reJo.msg = "获取项目目录失败!";
                //    return reJo.Value;
                //}



                //获取项目代码
                //string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                int departmentId = Convert.ToInt32(strDepartmentId);

                JArray  jaData       = new JArray();
                JObject joDepartment = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Communication");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    //if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode
                    if (data6.O_sValue1 == strDepartmentCode && data6.O_ID != departmentId)
                    {
                        reJo.msg = "已经存在相同的项目部门,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == departmentId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "项目部门ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                dictData.O_sValue1 = strDepartmentCode;
                dictData.O_Desc    = strDepartmentDesc;
                //dictData.O_sValue1 = strProjCode;
                dictData.O_sValue4 = strSecretarilman;// secretarilman.ToString;//
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                #endregion


                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#24
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EDITSystem(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strSystemId = "", strSystemCode = "", strSystemDesc = "",
                       strSystemEngDesc = "", strSystemChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "systemId":
                        strSystemId = strValue;
                        break;

                    case "systemCode":
                        strSystemCode = strValue;
                        break;

                    case "systemDesc":
                        strSystemDesc = strValue;
                        break;

                    case "systemEngDesc":
                        strSystemEngDesc = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strSystemCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strSystemDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }
                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }


                int systemId = Convert.ToInt32(strSystemId);
                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;


                JArray  jaData   = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode &&
                        data6.O_Code == strSystemCode && data6.O_ID != systemId)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }

                #region 添加到数据字典

                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == systemId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "参建单位ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                dictData.O_Code    = strSystemCode;
                dictData.O_Desc    = strSystemDesc;
                dictData.O_sValue2 = strProjCode;
                dictData.O_sValue1 = strSystemEngDesc;
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                #endregion

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#25
0
        public static JObject DraftTransmittalCN(string sid, string ProjectKeyword, string DocAttrJson, string FileListJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(DocAttrJson);

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                //定位到发文目录
                //m_Project = LocalProject(m_Project);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                #region 获取项目参数项目

                //获取项目参数项目
                string fileCode = "", documentCode = "", mainFeeder = "", copyParty = "",
                       sender = "", sendDate = "", totalPages = "",
                       seculevel = "", secrTerm = "", needreply = "",
                       replyDate = "", transmode = "", transmodeSupp = "",
                       purpose = "", purposeSupp = "", title = "",
                       content = "", approvpath = "";



                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    //获取文件编码
                    if (strName == "fileCode")
                    {
                        fileCode = strValue.Trim();
                    }

                    //获取函件编号
                    if (strName == "documentCode")
                    {
                        documentCode = strValue.Trim();
                    }

                    //获取主送
                    if (strName == "mainFeeder")
                    {
                        mainFeeder = strValue.Trim();
                    }
                    //获取发送方
                    else if (strName == "sender")
                    {
                        sender = strValue;
                    }

                    //获取发送日期
                    else if (strName == "sendDate")
                    {
                        sendDate = strValue;
                    }
                    //获取页数
                    else if (strName == "totalPages")
                    {
                        totalPages = strValue;
                    }

                    //获取保密等级
                    else if (strName == "seculevel")
                    {
                        seculevel = strValue;
                    }
                    //获取保密期限
                    else if (strName == "secrTerm")
                    {
                        secrTerm = strValue;
                    }

                    //获取是否需要回复
                    else if (strName == "needreply")
                    {
                        needreply = strValue;
                    }
                    //获取回文日期
                    else if (strName == "replyDate")
                    {
                        replyDate = strValue;
                    }

                    //获取传递方式
                    else if (strName == "transmode")
                    {
                        transmode = strValue;
                    }
                    //获取传递方式补充说明
                    else if (strName == "transmodeSupp")
                    {
                        transmodeSupp = strValue;
                    }

                    //获取提交目的
                    else if (strName == "purpose")
                    {
                        purpose = strValue;
                    }
                    //获取提交目的补充说明
                    else if (strName == "purposeSupp")
                    {
                        purposeSupp = strValue;
                    }

                    //获取标题
                    else if (strName == "title")
                    {
                        title = strValue;
                    }
                    //获取正文内容
                    else if (strName == "content")
                    {
                        content = strValue;
                    }

                    else if (strName == "approvpath")
                    {
                        approvpath = strValue;
                    }
                }


                if (string.IsNullOrEmpty(documentCode))
                {
                    reJo.msg = "请填写函件编号!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(title))
                {
                    reJo.msg = "请填写函件标题!";
                    return(reJo.Value);
                }
                else if (string.IsNullOrEmpty(mainFeeder))
                {
                    reJo.msg = "请填写主送单位!";
                    return(reJo.Value);
                }

                #endregion

                #region 获取文件列表
                List <LetterAttaFile> attaFiles   = new List <LetterAttaFile>();
                if (!string.IsNullOrEmpty(FileListJson))
                {
                    int    index   = 0;
                    JArray jaFiles = (JArray)JsonConvert.DeserializeObject(FileListJson);

                    foreach (JObject joAttr in jaFiles)
                    {
                        string strFileName  = joAttr["fn"].ToString(); //文件名
                        string strFileCode  = joAttr["fc"].ToString(); //文件编码
                        string strFileDesc  = joAttr["fd"].ToString(); //文件题名
                        string strFilePage  = joAttr["fp"].ToString(); //页数
                        string strEdition   = joAttr["fe"].ToString(); //版次
                        string strSeculevel = joAttr["sl"].ToString(); //密级
                        string strFileState = joAttr["fs"].ToString(); //状态
                        string strRemark    = joAttr["fr"].ToString(); //状态

                        index++;
                        string         strIndex = index.ToString();
                        LetterAttaFile afItem   = new LetterAttaFile()
                        {
                            No        = strIndex,
                            Name      = strFileName,
                            Code      = strFileCode,
                            Desc      = strFileDesc,
                            Page      = strFilePage,
                            Edition   = strEdition,
                            Seculevel = strSeculevel,
                            Status    = strFileState,
                            Remark    = strRemark
                        };

                        attaFiles.Add(afItem);
                    }
                }
                #endregion

                #region 根据文件传递单模板,生成文件传递单文档

                //获取立项单文档所在的目录
                //Project m_Project = m_NewProject;

                List <TempDefn> docTempDefnByCode = m_Project.dBSource.GetTempDefnByCode("FILETRANSMIT");
                TempDefn        docTempDefn       = (docTempDefnByCode != null && docTempDefnByCode.Count > 0) ? docTempDefnByCode[0] : null;
                if (docTempDefn == null)
                {
                    reJo.msg = "没有与其相关的模板管理,创建无法正常完成";
                    return(reJo.Value);
                }

                IEnumerable <string> source = from docx in m_Project.DocList select docx.Code;
                string filename             = documentCode + " " + title;
                if (source.Contains <string>(filename))
                {
                    for (int i = 1; i < 0x3e8; i++)
                    {
                        filename = documentCode + " " + title + i.ToString();
                        if (!source.Contains <string>(filename))
                        {
                            //reJo.msg = "新建文件传递单出错!";
                            //return reJo.Value;
                            break;
                        }
                    }
                }

                //文档名称
                Doc docItem = m_Project.NewDoc(filename + ".xlsx", filename, "", docTempDefn);
                if (docItem == null)
                {
                    reJo.msg = "新建文件传递单出错!";
                    return(reJo.Value);
                }

                #endregion

                #region 设置文件传递单文档附加属性


                AttrData data;

                //文件编码
                if ((data = docItem.GetAttrDataByKeyWord("FI_FILECODE")) != null)
                {
                    data.SetCodeDesc(fileCode);
                }

                //主送
                if ((data = docItem.GetAttrDataByKeyWord("FI_MAINFEEDER")) != null)
                {
                    data.SetCodeDesc(mainFeeder);
                }
                //发送方
                if ((data = docItem.GetAttrDataByKeyWord("FI_SENDER")) != null)
                {
                    data.SetCodeDesc(sender);
                }

                //发文日期
                if ((data = docItem.GetAttrDataByKeyWord("FI_SENDDATE")) != null)
                {
                    data.SetCodeDesc(sendDate);
                }

                //页数
                if ((data = docItem.GetAttrDataByKeyWord("FI_PAGE")) != null)
                {
                    data.SetCodeDesc(totalPages);
                }

                //保密等级
                if ((data = docItem.GetAttrDataByKeyWord("FI_SECRETGRADE")) != null)
                {
                    data.SetCodeDesc(seculevel);
                }
                //保密期限
                if ((data = docItem.GetAttrDataByKeyWord("FI_SECRETTERM")) != null)
                {
                    data.SetCodeDesc(secrTerm);
                }

                //获取是否需要回复
                if ((data = docItem.GetAttrDataByKeyWord("FI_IFREPLY")) != null)
                {
                    data.SetCodeDesc(needreply);
                }
                //回复日期
                if ((data = docItem.GetAttrDataByKeyWord("FI_REPLYDATE")) != null)
                {
                    data.SetCodeDesc(replyDate);
                }

                //传递方式
                if ((data = docItem.GetAttrDataByKeyWord("FI_TRANSMITMETHOD")) != null)
                {
                    data.SetCodeDesc(transmode);
                }
                //传递方式的补充说明
                if ((data = docItem.GetAttrDataByKeyWord("FI_TRANSMITMETHODSUPP")) != null)
                {
                    data.SetCodeDesc(transmodeSupp);
                }

                //提交目的
                if ((data = docItem.GetAttrDataByKeyWord("FI_SUBMISSIONOBJ")) != null)
                {
                    data.SetCodeDesc(purpose);
                }
                //提交目的补充说明
                if ((data = docItem.GetAttrDataByKeyWord("FI_SUBMISSIONOBJSUPP")) != null)
                {
                    data.SetCodeDesc(purposeSupp);
                }

                //标题
                if ((data = docItem.GetAttrDataByKeyWord("FI_TRANSMITTITLE")) != null)
                {
                    data.SetCodeDesc(title);
                }

                //摘要
                if ((data = docItem.GetAttrDataByKeyWord("FI_ABSTRACT")) != null)
                {
                    data.SetCodeDesc(content);
                }

                //校审级数(审批路径)
                if ((data = docItem.GetAttrDataByKeyWord("CA_SERIES")) != null)
                {
                    data.SetCodeDesc(approvpath);
                }
                ////保存项目属性,存进数据库
                docItem.AttrDataList.SaveData();

                #endregion

                #region 录入数据进入word表单

                string strDocList = "";//获取附件

                //录入数据进入表单
                Hashtable htUserKeyWord = new Hashtable();

                #region 添加勾选项

                #region 初始化勾选选项注释

                ////////////////保密等级////////////////////////
                string SECULEVEL_SECRET = "□";     //商业秘密
                string SECULEVEL_LIMIT  = "□";     //受限
                string SECULEVEL_PUBLIC = "□";     //公开

                string SECULEVEL_SECRET_TERM = ""; //保密期限
                string SECULEVEL_LIMIT_TERM  = ""; //保密期限

                ///////////////是否需要回复/////////////////////
                string NEEDREPLY_YES = "□"; //是
                string NEEDREPLY_NO  = "□"; //否

                ///////////////传递方式/////////////////////
                string TRANSMITMETHOD_POST   = "□"; //邮寄
                string TRANSMITMETHOD_ONFACE = "□"; //当面递交
                string TRANSMITMETHOD_MAIL   = "□"; //邮件
                string TRANSMITMETHOD_OA     = "□"; //OA
                string TRANSMITMETHOD_CDMS   = "□"; //CDMS
                string TRANSMITMETHOD_OTHER  = "□"; //其他

                string TRANSMITMETHOD_SUPP = "";    //传递方式补充说明

                //////////////提交目的/////////////////////
                string SUBMISSIONOBJ_SUBMI    = "□"; //提交
                string SUBMISSIONOBJ_DEMAND   = "□"; //按需求提交
                string SUBMISSIONOBJ_CHECK    = "□"; //审查
                string SUBMISSIONOBJ_RECORD   = "□"; //备案
                string SUBMISSIONOBJ_PURCHASE = "□"; //采购
                string SUBMISSIONOBJ_SUPPLY   = "□"; //供货
                string SUBMISSIONOBJ_CONS     = "□"; //施工
                string SUBMISSIONOBJ_DEBUG    = "□"; //调试
                string SUBMISSIONOBJ_INFORM   = "□"; //告知
                string SUBMISSIONOBJ_HANDOVER = "□"; //交工资料
                string SUBMISSIONOBJ_OTHER    = "□"; //其他

                string SUBMISSIONOBJ_SUPP = "";      //提交目的补充说明

                #endregion

                #region 勾选选项


                //勾选保密等级
                if (seculevel == "商业秘密")
                {
                    SECULEVEL_SECRET      = "☑";
                    SECULEVEL_SECRET_TERM = secrTerm;
                }
                else if (seculevel == "受限")
                {
                    SECULEVEL_LIMIT      = "☑";
                    SECULEVEL_LIMIT_TERM = secrTerm;
                }
                else if (seculevel == "公开")
                {
                    SECULEVEL_PUBLIC = "☑";
                }

                //勾选保密等级
                if (needreply == "是")
                {
                    NEEDREPLY_YES = "☑";
                }
                else if (needreply == "否")
                {
                    NEEDREPLY_NO = "☑";
                }

                //勾选传递方式
                if (transmode == "邮寄")
                {
                    TRANSMITMETHOD_POST = "☑";
                }
                else if (transmode == "当面递交")
                {
                    TRANSMITMETHOD_ONFACE = "☑";
                }
                else if (transmode == "邮件")
                {
                    TRANSMITMETHOD_MAIL = "☑";
                }
                else if (transmode == "OA")
                {
                    TRANSMITMETHOD_OA = "☑";
                }
                else if (transmode == "CDMS")
                {
                    TRANSMITMETHOD_CDMS = "☑";
                }
                else if (transmode == "其他")
                {
                    TRANSMITMETHOD_OTHER = "☑";
                    TRANSMITMETHOD_SUPP  = transmodeSupp;//传递方式补充说明
                }


                //勾选提交目的
                if (purpose == "提交")
                {
                    SUBMISSIONOBJ_SUBMI = "☑";
                }
                else if (purpose == "按需求提交")
                {
                    SUBMISSIONOBJ_DEMAND = "☑";
                }
                else if (purpose == "审查")
                {
                    SUBMISSIONOBJ_CHECK = "☑";
                }
                else if (purpose == "备案")
                {
                    SUBMISSIONOBJ_RECORD = "☑";
                }
                else if (purpose == "采购")
                {
                    SUBMISSIONOBJ_PURCHASE = "☑";
                }
                else if (purpose == "供货")
                {
                    SUBMISSIONOBJ_SUPPLY = "☑";
                }
                else if (purpose == "施工")
                {
                    SUBMISSIONOBJ_CONS = "☑";
                }
                else if (purpose == "调试")
                {
                    SUBMISSIONOBJ_DEBUG = "☑";
                }
                else if (purpose == "告知")
                {
                    SUBMISSIONOBJ_INFORM = "☑";
                }
                else if (purpose == "交工资料")
                {
                    SUBMISSIONOBJ_HANDOVER = "☑";
                }
                else if (purpose == "其他")
                {
                    SUBMISSIONOBJ_OTHER = "☑";
                    SUBMISSIONOBJ_SUPP  = purposeSupp;//提交目的补充说明
                }


                #endregion

                #region 添加勾选项到哈希表

                ////////////////保密等级////////////////////////
                htUserKeyWord.Add("C101", SECULEVEL_SECRET);      //商业秘密
                htUserKeyWord.Add("C102", SECULEVEL_LIMIT);       //受限
                htUserKeyWord.Add("C103", SECULEVEL_PUBLIC);      //公开

                htUserKeyWord.Add("T001", SECULEVEL_SECRET_TERM); //商业秘密保密期限
                htUserKeyWord.Add("T002", SECULEVEL_LIMIT_TERM);  //受限保密期限

                ///////////////是否需要回复/////////////////////
                htUserKeyWord.Add("C201", NEEDREPLY_YES); //是
                htUserKeyWord.Add("C202", NEEDREPLY_NO);  //否

                ///////////////传递方式/////////////////////
                htUserKeyWord.Add("C301", TRANSMITMETHOD_POST);   //邮寄
                htUserKeyWord.Add("C302", TRANSMITMETHOD_ONFACE); //当面递交
                htUserKeyWord.Add("C303", TRANSMITMETHOD_MAIL);   //邮件
                htUserKeyWord.Add("C304", TRANSMITMETHOD_OA);     //OA
                htUserKeyWord.Add("C305", TRANSMITMETHOD_CDMS);   //CDMS
                htUserKeyWord.Add("C306", TRANSMITMETHOD_OTHER);  //其他

                htUserKeyWord.Add("T003", TRANSMITMETHOD_SUPP);   //传递方式补充说明

                //////////////提交目的/////////////////////
                htUserKeyWord.Add("C401", SUBMISSIONOBJ_SUBMI);    //提交
                htUserKeyWord.Add("C402", SUBMISSIONOBJ_DEMAND);   //按需求提交
                htUserKeyWord.Add("C403", SUBMISSIONOBJ_CHECK);    //审查
                htUserKeyWord.Add("C404", SUBMISSIONOBJ_RECORD);   //备案
                htUserKeyWord.Add("C405", SUBMISSIONOBJ_PURCHASE); //采购
                htUserKeyWord.Add("C406", SUBMISSIONOBJ_SUPPLY);   //供货
                htUserKeyWord.Add("C407", SUBMISSIONOBJ_CONS);     //施工
                htUserKeyWord.Add("C408", SUBMISSIONOBJ_DEBUG);    //调试
                htUserKeyWord.Add("C409", SUBMISSIONOBJ_INFORM);   //告知
                htUserKeyWord.Add("C410", SUBMISSIONOBJ_HANDOVER); //交工资料
                htUserKeyWord.Add("C411", SUBMISSIONOBJ_OTHER);    //其他

                htUserKeyWord.Add("T004", SUBMISSIONOBJ_SUPP);     //提交目的补充说明


                #endregion
                #endregion

                //格式化日期
                DateTime senddate     = Convert.ToDateTime(sendDate);
                DateTime replydate    = Convert.ToDateTime(replyDate);
                string   strSenddate  = senddate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");
                string   strReplydate = replydate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");

                //htUserKeyWord.Add("DOCUMENTCODE", documentCode);//函件编号
                //htUserKeyWord.Add("MAINFEEDER", mainFeeder);//主送
                //htUserKeyWord.Add("SENDER", sender);//发送方
                //htUserKeyWord.Add("SENDDATE", strSenddate);//发送日期
                //htUserKeyWord.Add("PAGE", totalPages);//页数

                //htUserKeyWord.Add("REPLYDATE", strReplydate);//回复日期

                //htUserKeyWord.Add("TITLE", title);//标题
                //htUserKeyWord.Add("CONTENT", content);//摘要正文

                //htUserKeyWord.Add("T005", documentCode);//函件编号
                htUserKeyWord.Add("T006", mainFeeder);   //主送
                htUserKeyWord.Add("T007", sender);       //发送方
                htUserKeyWord.Add("T008", strSenddate);  //发送日期
                htUserKeyWord.Add("T009", totalPages);   //页数

                htUserKeyWord.Add("T010", strReplydate); //回复日期

                htUserKeyWord.Add("T011", title);        //标题
                htUserKeyWord.Add("T012", content);      //摘要正文

                //htUserKeyWord.Add("RIGHT__HEADER", "编码:"+ fileCode);//设置右边页眉

                //添加附件
                List <string> list3 = new List <string>();
                foreach (LetterAttaFile file in attaFiles)
                {
                    //string remark = string.IsNullOrEmpty(file.Seculevel) ? "" : (file.Seculevel+",");
                    //remark = remark+(string.IsNullOrEmpty(file.Status) ? "" : (file.Status + ","));
                    //remark = remark + (string.IsNullOrEmpty(file.Remark) ? "" : (file.Remark + ","));

                    //if (remark.Substring(remark.Length - 1, 1) == ","&& (!string.IsNullOrEmpty(remark))) {
                    //    remark=remark.Substring(0, remark.Length-1);
                    //}

                    list3.Add(file.No);
                    list3.Add(file.Code);
                    list3.Add(file.Desc);
                    list3.Add(file.Page);
                    list3.Add(file.Edition);
                    list3.Add(file.Seculevel);
                    list3.Add(file.Status);
                    list3.Add(file.Remark);
                }

                //用htAuditDataList传送附件列表到word
                Hashtable htAuditDataList = new Hashtable();
                //word里面表格关键字的设置公式(不需要加"$()") :表格关键字+":"+已画好表格线的行数+":"+表格列数
                //例如关键字是"DRAWING",画了一行表格线,从第二行起画表格线,每行有6列,则公式是:"DRAWING:1:6"
                htAuditDataList.Add("DRAWING", list3);

                string workingPath = m_Project.dBSource.LoginUser.WorkingPath;


                try
                {
                    //上传下载文档
                    string exchangfilename = "文件传递单中文模板";

                    //获取网站路径
                    string sPath = System.Web.HttpContext.Current.Server.MapPath("/ISO/HXEPC/");

                    //获取模板文件路径
                    string modelFileName = sPath + exchangfilename + ".xlsx";

                    //获取即将生成的联系单文件路径
                    string locFileName = docItem.FullPathFile;

                    FileInfo info = new FileInfo(locFileName);

                    if (System.IO.File.Exists(modelFileName))
                    {
                        //如果存储子目录不存在,就创建目录
                        if (!Directory.Exists(info.Directory.FullName))
                        {
                            Directory.CreateDirectory(info.Directory.FullName);
                        }

                        //复制模板文件到存储目录,并覆盖同名文件
                        System.IO.File.Copy(modelFileName, locFileName, true);


                        //线程锁
                        muxConsole.WaitOne();
                        try
                        {
                            //把参数直接写进office
                            CDMSWebOffice office = new CDMSWebOffice
                            {
                                CloseApp   = true,
                                VisibleApp = false
                            };
                            office.Release(true);
                            office.WriteDataToDocument(docItem, locFileName, htUserKeyWord, htAuditDataList);
                        }
                        catch { }
                        finally
                        {
                            //解锁
                            muxConsole.ReleaseMutex();
                        }
                    }


                    int length = (int)info.Length;
                    docItem.O_size = new int?(length);
                    docItem.Modify();


                    if (string.IsNullOrEmpty(strDocList))
                    {
                        strDocList = docItem.KeyWord;
                    }
                    else
                    {
                        strDocList = docItem.KeyWord + "," + strDocList;
                    }

                    //这里刷新数据源,否则创建流程的时候获取不了专业字符串
                    DBSourceController.RefreshDBSource(sid);

                    reJo.success = true;
                    reJo.data    = new JArray(new JObject(new JProperty("ProjectKeyword", docItem.Project.KeyWord),
                                                          new JProperty("DocKeyword", docItem.KeyWord), new JProperty("DocList", strDocList)));
                    return(reJo.Value);
                }
                catch { }
                #endregion

                reJo.data    = new JArray(new JObject(new JProperty("projectKeyword", m_Project.KeyWord)));
                reJo.success = true;
                return(reJo.Value);

                //AVEVA.CDMS.WebApi.DBSourceController.RefreshDBSource(sid);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#26
0
        public static JObject GetSelectUnitList(string sid, string ProjectKeyword, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                Filter = Filter.Trim().ToLower();

                string curUnitCode = "";

                curUnitCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                if (string.IsNullOrEmpty(curUnitCode))
                {
                    reJo.msg = "获取项目来源失败!";
                    return(reJo.Value);
                }

                JArray jaData = new JArray();


                #region 获取项目的通信代码
                AttrData data;
                if ((data = prjProject.GetAttrDataByKeyWord("RPO_ONSHORE")) != null)
                {
                    string strData = data.ToString;
                    if (!string.IsNullOrEmpty(strData))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "通信代码"),
                            new JProperty("unitId", data.DefnID),
                            new JProperty("unitCode", data.ToString),
                            new JProperty("unitDesc", "OnShore")
                            );
                        jaData.Add(joData);
                    }
                }
                if ((data = prjProject.GetAttrDataByKeyWord("RPO_OFFSHORE")) != null)
                {
                    string strData = data.ToString;
                    if (!string.IsNullOrEmpty(strData))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "通信代码"),
                            new JProperty("unitId", data.DefnID),
                            new JProperty("unitCode", data.ToString),
                            new JProperty("unitDesc", "OffShore")
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion
                #region 获取所有参建单位
                //获取所有参建单位
                List <DictData> tmpDataList = dbsource.GetDictDataList("Unit");

                List <DictData> dictDataList = new List <DictData>();

                //过滤不是当前项目的参建单位,提高排序速度
                foreach (DictData data6 in tmpDataList)
                {
                    //判断是否符合过滤条件
                    if (data6.O_sValue1 == curUnitCode)
                    {
                        dictDataList.Add(data6);
                    }
                }
                //按代码排序
                dictDataList.Sort(delegate(DictData x, DictData y)
                {
                    return(x.O_Code.CompareTo(y.O_Code));
                });

                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    if (data6.O_sValue1 == curUnitCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "参建单位"),
                            new JProperty("unitId", data6.O_ID.ToString()),
                            new JProperty("unitCode", data6.O_Code),
                            new JProperty("unitDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion



                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curUnitCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("unitType", "项目部门"),
                //            new JProperty("unitId", data6.O_ID.ToString()),
                //            new JProperty("unitCode", data6.O_Code),
                //            new JProperty("unitDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                #region 获取所有项目部门(不区分项目)
                //获取所有项目部门(不区分项目)
                List <DictData> departDdList = dbsource.GetDictDataList("Communication");

                //按代码排序
                departDdList.Sort(delegate(DictData x, DictData y)
                {
                    return(x.O_sValue1.CompareTo(y.O_sValue1));
                });

                foreach (DictData data6 in departDdList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    //if (data6.O_sValue1 == curUnitCode)
                    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "项目部门"),
                            new JProperty("unitId", data6.O_ID.ToString()),
                            new JProperty("unitCode", data6.O_sValue1),
                            new JProperty("unitDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#27
0
        /// <summary>
        /// 处理收文表单
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="DocKeyword"></param>
        /// <returns></returns>
        public static JObject ReceiveDocument(string sid, string DocKeyword, string docAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc m_Doc = dbsource.GetDocByKeyWord(DocKeyword);

                if (m_Doc == null)
                {
                    reJo.msg = "参数错误!文档不存在!";
                    return(reJo.Value);
                }

                #region 获取收文处理表单的属性

                string strProjectCode = "", strProjectDesc = "", strCommUnit = "", strRecDate = "",
                       strRecCode = "", strRecNumber = "", strPages = "",
                       strSendCode = "", strNeedReply = "", strReplyDate = "",
                       strUrgency = "", strRemark = "",
                       strFileCode = "", strTitle = "";

                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(docAttrJson);

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    //获取项目号
                    if (strName == "ProjectCode")
                    {
                        strProjectCode = strValue;
                    }

                    //获取项目名称
                    if (strName == "ProjectDesc")
                    {
                        strProjectDesc = strValue;
                    }

                    //获取来文单位
                    else if (strName == "CommUnit")
                    {
                        strCommUnit = strValue;
                    }

                    //获取来文单位
                    else if (strName == "RecDate")
                    {
                        strRecDate = strValue;
                    }

                    //获取收文编码
                    else if (strName == "RecCode")
                    {
                        strRecCode = strValue;
                    }

                    //获取收文编码
                    else if (strName == "RecNumber")
                    {
                        strRecNumber = strValue;
                    }

                    //获取文件编码
                    else if (strName == "FileCode")
                    {
                        strFileCode = strValue;
                    }



                    //获取文件题名
                    else if (strName == "Title")
                    {
                        strTitle = strValue;
                    }

                    //获取页数
                    else if (strName == "Pages")
                    {
                        strPages = strValue;
                    }

                    //获取我方发文编码
                    else if (strName == "SendCode")
                    {
                        strSendCode = strValue;
                    }

                    //获取是否要求回文
                    else if (strName == "NeedReply")
                    {
                        strNeedReply = strValue;
                    }

                    //获取回文期限
                    else if (strName == "ReplyDate")
                    {
                        strReplyDate = strValue;
                    }

                    //获取紧急程度
                    else if (strName == "Urgency")
                    {
                        strUrgency = strValue;
                    }

                    //获取备注
                    else if (strName == "Remark")
                    {
                        strRemark = strValue;
                    }
                }
                #endregion

                #region 根据收文单模板,生成收文单文档

                //获取立项单文档所在的目录
                //Project m_Project = m_NewProject;

                List <TempDefn> docTempDefnByCode = dbsource.GetTempDefnByCode("RECEIPT");
                TempDefn        docTempDefn       = (docTempDefnByCode != null && docTempDefnByCode.Count > 0)? docTempDefnByCode[0] : null;
                if (docTempDefn == null)
                {
                    reJo.msg = "没有与其相关的模板管理,创建无法正常完成";
                    return(reJo.Value);
                }

                IEnumerable <string> source = from docx in m_Doc.Project.DocList select docx.Code;
                string filename             = strRecCode + " 收文单";
                if (source.Contains <string>(filename))
                {
                    for (int i = 1; i < 0x3e8; i++)
                    {
                        filename = strRecCode + " 收文单" + i.ToString();
                        if (!source.Contains <string>(filename))
                        {
                            break;
                        }
                    }
                }

                //文档名称
                //Doc docItem = m_Doc.Project.NewDoc(filename + ".docx", filename, "", docTempDefn);
                Doc docItem = m_Doc.Project.NewDoc(filename + ".docx", filename, "");
                if (docItem == null)
                {
                    reJo.msg = "新建信函出错!";
                    return(reJo.Value);
                }

                #endregion

                #region 设置收文文档附加属性
                m_Doc.TempDefn = docTempDefn;

                AttrData data;
                //项目名称
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_PRONAME")) != null)
                {
                    data.SetCodeDesc(strProjectDesc);
                }
                //项目代码
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_PROCODE")) != null)
                {
                    data.SetCodeDesc(strProjectCode);
                }
                //来文单位
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_SENDUNIT")) != null)
                {
                    data.SetCodeDesc(strCommUnit);
                }
                //收文日期
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_RECDATE")) != null)
                {
                    data.SetCodeDesc(strRecDate);
                }
                //收文编码
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_RECCODE")) != null)
                {
                    data.SetCodeDesc(strRecCode);
                }
                //收文编号
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_RECNUMBER")) != null)
                {
                    data.SetCodeDesc(strRecNumber);
                }
                //文件编码
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_FILECODE")) != null)
                {
                    data.SetCodeDesc(strFileCode);
                }
                //文件题名
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_FILETITLE")) != null)
                {
                    data.SetCodeDesc(strTitle);
                }
                //页数
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_PAGE")) != null)
                {
                    data.SetCodeDesc(strPages);
                }
                //发文编码
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_SENDCODE")) != null)
                {
                    data.SetCodeDesc(strSendCode);
                }

                //是否回文
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_IFREPLY")) != null)
                {
                    data.SetCodeDesc(strNeedReply);
                }
                //回文日期
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_REPLYDATE")) != null)
                {
                    data.SetCodeDesc(strReplyDate);
                }
                //紧急程度
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_URGENTDEGREE")) != null)
                {
                    data.SetCodeDesc(strUrgency);
                }

                //备注
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_NOTE")) != null)
                {
                    data.SetCodeDesc(strRemark);
                }
                //著录人
                if ((data = m_Doc.GetAttrDataByKeyWord("RE_DESIGN")) != null)
                {
                    data.SetCodeDesc(curUser.ToString);
                }


                ////保存项目属性,存进数据库
                m_Doc.AttrDataList.SaveData();
                //m_Doc.Modify();
                #endregion

                //修改文档编码
                m_Doc.O_itemname = strRecCode; //strRecNumber;
                //m_Doc.O_itemdesc = strTitle;
                m_Doc.Modify();

                #region 录入数据进入word表单
                Hashtable htUserKeyWord = new Hashtable();

                //格式化日期
                DateTime RecDate   = Convert.ToDateTime(strRecDate);
                DateTime ReplyDate = Convert.ToDateTime(strReplyDate);
                string   recDate   = RecDate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");
                string   replyDate = ReplyDate.ToShortDateString().ToString().Replace("-", ".").Replace("/", ".");

                htUserKeyWord.Add("PRONAME", strProjectDesc);     //项目名称
                htUserKeyWord.Add("PROCODE", strProjectCode);     //项目代码
                htUserKeyWord.Add("SENDUNIT", strCommUnit);       //来文单位
                htUserKeyWord.Add("RECDATE", recDate);            //收文日期
                htUserKeyWord.Add("RECCODE", strRecCode);         //收文编码
                htUserKeyWord.Add("RECNUMBER", strRecNumber);     //收文编号
                htUserKeyWord.Add("FILECODE", strFileCode);       //文件编码
                htUserKeyWord.Add("FILETITLE", strTitle);         //文件题名
                htUserKeyWord.Add("PAGE", strPages);              //页数
                htUserKeyWord.Add("SENDCODE", strSendCode);       //发文编码
                htUserKeyWord.Add("IFREPLY", strNeedReply);       //是否回文
                htUserKeyWord.Add("REPLYDATE", replyDate);        //回文日期
                htUserKeyWord.Add("URGENTDEGREE", strUrgency);    //紧急程度
                htUserKeyWord.Add("NOTE", strRemark);             //备注
                htUserKeyWord.Add("DESIGN", curUser.Description); //著录人


                string workingPath = dbsource.LoginUser.WorkingPath;


                try
                {
                    //上传下载文档
                    string exchangfilename = "收文单模板";

                    //获取网站路径
                    string sPath = System.Web.HttpContext.Current.Server.MapPath("/ISO/HXEPC/");

                    //获取模板文件路径
                    string modelFileName = sPath + exchangfilename + ".docx";

                    //获取即将生成的联系单文件路径
                    string locFileName = docItem.FullPathFile;

                    FileInfo info = new FileInfo(locFileName);

                    if (System.IO.File.Exists(modelFileName))
                    {
                        //如果存储子目录不存在,就创建目录
                        if (!Directory.Exists(info.Directory.FullName))
                        {
                            Directory.CreateDirectory(info.Directory.FullName);
                        }

                        //复制模板文件到存储目录,并覆盖同名文件
                        System.IO.File.Copy(modelFileName, locFileName, true);


                        //线程锁
                        muxConsole.WaitOne();
                        try
                        {
                            //把参数直接写进office
                            CDMSWebOffice office = new CDMSWebOffice
                            {
                                CloseApp   = true,
                                VisibleApp = false
                            };
                            office.Release(true);
                            office.WriteDataToDocument(docItem, locFileName, htUserKeyWord, htUserKeyWord);
                        }
                        catch { }
                        finally
                        {
                            //解锁
                            muxConsole.ReleaseMutex();
                        }
                    }


                    int length = (int)info.Length;
                    docItem.O_size = new int?(length);
                    docItem.Modify();
                }
                catch { }
                #endregion

                ////启动流程
                WorkFlow flow = dbsource.NewWorkFlow(new List <Doc> {
                    docItem, m_Doc
                }, "RECEIVED");
                if (flow == null)
                {
                    //AssistFun.PopUpPrompt("自动启动流程失败!请手动启动");
                    reJo.msg = "自动启动流程失败!请手动启动";
                    return(reJo.Value);
                }
                else
                {
                    if ((flow != null) && (flow.CuWorkState != null))
                    {
                        //if (((flow.CuWorkState == null) || (flow.CuWorkState.workStateBranchList == null)) || (flow.CuWorkState.workStateBranchList.Count <= 0))
                        //{
                        //    //MessageBox.Show("新建流程不存在下一状态,提交失败!");
                        //    //doc.dBSource.ProgramRun = false;
                        //    flow.Delete();
                        //    reJo.msg = "新建流程不存在下一状态,提交失败!";
                        //    return reJo.Value;
                        //    //return;
                        //}
                        //WorkStateBranch branch = flow.CuWorkState.workStateBranchList[0];
                        //if (branch == null)
                        //{
                        //    reJo.msg = "获取流程分支失败!";
                        //    return reJo.Value;
                        //}

                        Project rootProj = CommonFunction.getParentProjectByTempDefn(m_Doc.Project, "HXNY_DOCUMENTSYSTEM");
                        if (rootProj == null)
                        {
                            reJo.msg = "获取项目根目录失败!";
                            return(reJo.Value);
                        }

                        string   UserList = "";
                        AttrData secData;
                        //rootProj.GetAttrDataByKeyWord("SECRETARILMAN");
                        if ((secData = rootProj.GetAttrDataByKeyWord("SECRETARILMAN")) != null)
                        {
                            UserList = secData.ToString;
                        }

                        if (string.IsNullOrEmpty(UserList))
                        {
                            reJo.msg = "项目文控未设置!";
                            return(reJo.Value);
                        }

                        //ExReJObject wfReJo = WebWorkFlowEvent.GotoNextStateAndSelectUser(flow.CuWorkState.workStateBranchList[0],userlist);
                        ////if (!WorkFlowEvent.GotoNextStateAndSelectUser(flow.CuWorkState.workStateBranchList[0]))
                        //if (!wfReJo.success)
                        //{
                        //    //doc.dBSource.ProgramRun = false;
                        //    flow.Delete();
                        //    flow.Delete();
                        //    reJo.msg = "自动启动收文流程失败,请手动启动流程!";
                        //    return reJo.Value;
                        //}

                        ////刷新数据源
                        //DBSourceController.RefreshDBSource(sid);

                        #region 获取下一状态用户
                        string[] userArray = (string.IsNullOrEmpty(UserList) ? "" : UserList).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        Server.Group group = new Server.Group();
                        //List<User> m_UserList = new List<User>();
                        //启动工作流程
                        //反转列表
                        //m_UserList.Reverse();
                        foreach (string strObj in userArray)
                        {
                            string strUser = strObj.IndexOf("__") >= 0 ? strObj.Substring(0, strObj.IndexOf("__")) : strObj;
                            object obj     = dbsource.GetUserByName(strUser);

                            if (obj is User)
                            {
                                //m_UserList.Add((User)obj);
                                group.AddUser((User)obj);
                            }
                        }
                        if (group.UserList.Count <= 0)
                        {
                            reJo.msg = "获取下一流程状态用户错误,自动启动流程失败!请手动启动流程";
                            return(reJo.Value);
                        }
                        #endregion

                        //获取下一状态

                        WorkState ws = new WorkState();

                        DefWorkState dws = flow.DefWorkFlow.DefWorkStateList.Find(s => s.KeyWord == "SECRETARILMAN");    // CHECK");
                        ws.DefWorkState = dws;


                        ////启动流程
                        WorkStateBranch branch = flow.CuWorkState.workStateBranchList[0];
                        branch.NextStateAddGroup(group);

                        ExReJObject GotoNextReJo = WebWorkFlowEvent.GotoNextStateAndSelectUser(flow.CuWorkState.workStateBranchList[0]);

                        if (!GotoNextReJo.success)
                        {
                            //  doc.dBSource.ProgramRun = false;
                            flow.Delete();
                            flow.Delete();

                            reJo.msg = "自动启动流程失败!请手动启动流程";
                            return(reJo.Value);
                        }

                        DBSourceController.RefreshDBSource(sid);

                        //return GotoNextReJo.Value;

                        reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", m_Doc.Project.KeyWord),
                                                           new JProperty("DocKeyword", m_Doc.KeyWord)));
                        reJo.success = true;
                        return(reJo.Value);
                    }
                }

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
示例#28
0
        //获取文件类型
        public static JObject GetSelectAreaList(string sid, string ProjectKeyword, string page, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                page = page ?? "1";
                string limit = "50";
                page = (Convert.ToInt32(page) - 1).ToString();
                int CurPage = Convert.ToInt32(page);

                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                Filter = Filter.Trim().ToLower();

                string curAreaCode = "";

                curAreaCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                if (string.IsNullOrEmpty(curAreaCode))
                {
                    reJo.msg = "获取项目来源失败!";
                    return(reJo.Value);
                }

                JArray jaData = new JArray();

                #region 添加厂房
                //获取所有参建单位
                List <DictData> dictDataList = dbsource.GetDictDataList("Factory");
                List <DictData> resultDDList = new List <DictData>();
                ////按代码排序
                //dictDataList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_Code.CompareTo(y.O_Code);
                //});


                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 &&
                        data6.O_Desc.ToLower().IndexOf(Filter) < 0 &&
                        data6.O_sValue1.ToLower().IndexOf(Filter) < 0
                        )
                    {
                        continue;
                    }

                    if (data6.O_sValue2 != curAreaCode)
                    {
                        continue;
                    }
                    resultDDList.Add(data6);
                }

                #endregion


                reJo.total = resultDDList.Count();
                int ShowNum = 50;

                List <DictData> resDDList = resultDDList.Skip(CurPage * ShowNum).Take(ShowNum).ToList();

                foreach (DictData data6 in resDDList)
                {
                    //if (data6.O_sValue1 == curAreaCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("areaType", "厂房"),
                            new JProperty("areaId", data6.O_ID.ToString()),
                            new JProperty("areaCode", data6.O_Code),
                            new JProperty("areaDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }


                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curAreaCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("areaType", "项目部门"),
                //            new JProperty("areaId", data6.O_ID.ToString()),
                //            new JProperty("areaCode", data6.O_Code),
                //            new JProperty("areaDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                ////获取所有项目部门(不区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("Communication");

                ////按代码排序
                //departDdList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_sValue1.CompareTo(y.O_sValue1);
                //});

                //foreach (DictData data6 in departDdList)
                //{
                //    //判断是否符合过滤条件
                //    if (!string.IsNullOrEmpty(Filter) &&
                //        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                //    {
                //        continue;
                //    }

                //    //if (data6.O_sValue1 == curAreaCode)
                //    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("areaType", "项目部门"),
                //            new JProperty("areaId", data6.O_ID.ToString()),
                //            new JProperty("areaCode", data6.O_sValue1),
                //            new JProperty("areaDesc", data6.O_Desc)
                //            );
                //        jaData.Add(joData);
                //    }
                //}

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
示例#29
0
        /// <summary>
        /// 获取创建收文单表单的默认配置
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="DocKeyword"></param>
        /// <returns></returns>
        public static JObject GetReceiveDocumentDefault(string sid, string DocKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc m_Doc = dbsource.GetDocByKeyWord(DocKeyword);

                if (m_Doc == null)
                {
                    reJo.msg = "参数错误!文档不存在!";
                    return(reJo.Value);
                }

                //项目代码
                string RootProjectCode = m_Doc.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_CODE");

                //项目名称
                string RootProjectDesc = m_Doc.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_DESC");

                //来文单位
                string CommUnit     = "";
                string CommUnitCode = "";
                if (m_Doc.Project.TempDefn.KeyWord == "COM_UNIT")
                {
                    CommUnit     = m_Doc.Project.Description;
                    CommUnitCode = m_Doc.Project.Code;
                }


                Project recTypeProject = CommonFunction.getParentProjectByTempDefn(m_Doc.Project, "COM_COMTYPE");

                #region 获取收文编号
                string recType = "";
                if (recTypeProject.Code == "信函" || recTypeProject.Description == "信函")
                {
                    recType = "LET";
                }
                else if (recTypeProject.Code == "文件传递单" || recTypeProject.Description == "文件传递单")
                {
                    recType = "TRA";
                }

                Project recUnitProject = CommonFunction.getParentProjectByTempDefn(m_Doc.Project, "HXNY_DOCUMENTSYSTEM");

                string recUnitCode = "";
                if (recUnitProject != null)
                {
                    recUnitCode = recUnitProject.GetValueByKeyWord("PRO_COMPANY");
                }

                string ONShoreCommCode = "";
                if (recUnitProject != null)
                {
                    ONShoreCommCode = recUnitProject.GetValueByKeyWord("RPO_ONSHORE");
                }

                string OFFShoreCommCode = "";
                if (recUnitProject != null)
                {
                    OFFShoreCommCode = recUnitProject.GetValueByKeyWord("RPO_OFFSHORE");
                }

                //string runNum = getDocNumber(dbsource, RootProjectCode, recType, CommUnitCode, recUnitCode);
                //if (string.IsNullOrEmpty(runNum)) runNum = "001";

                string recNumber = Document.getDocTempNumber(dbsource, RootProjectCode, "R", recType, CommUnitCode, recUnitCode);

                // string recNumber = RootProjectCode + "-" + CommUnitCode + "-" + recUnitCode + "-" + recType + "-" + runNum;
                #endregion

                string recCode = m_Doc.Code;

                //string DocNumber = getDocNumber(m_Doc.Project, RootProjectCode, strCompany);
                string strDesc = m_Doc.O_itemname;

                JObject joRecCompany  = new JObject();
                JObject joSendCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue3) && data6.O_sValue3 == curUser.ToString)
                    {
                        joSendCompany.Add(new JProperty(data6.O_Code, data6.O_Desc));
                    }
                }

                if (!string.IsNullOrEmpty(ONShoreCommCode))
                {
                    joRecCompany.Add(new JProperty(ONShoreCommCode, ONShoreCommCode));
                }

                if (!string.IsNullOrEmpty(OFFShoreCommCode))
                {
                    joRecCompany.Add(new JProperty(OFFShoreCommCode, OFFShoreCommCode));
                }

                JObject joData = new JObject(
                    new JProperty("RootProjectCode", RootProjectCode),
                    new JProperty("RootProjectDesc", RootProjectDesc),
                    //new JProperty("DocNumber", DocNumber),
                    new JProperty("DraftmanCode", curUser.Code),
                    new JProperty("DraftmanDesc", curUser.Description),
                    new JProperty("CommUnit", CommUnit),
                    new JProperty("RecCode", recCode),
                    new JProperty("RecNumber", recNumber),
                    new JProperty("RecCompanyList", joRecCompany),
                    new JProperty("SendCompanyList", joSendCompany),
                    new JProperty("DocType", recType)


                    );

                reJo.data    = new JArray(joData);
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }