/// <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); }
//获取文件类型 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); }
/// <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); }
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); }
/// <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); }
/// <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); }
/// <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); }
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); }
/// <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); }
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); }
/// <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); }
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); }
/// <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); }
/// <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); }
/// <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); }
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); }