public object DeleteDoc(string caseId, string userid) { IDbTransaction tran = Utility.Database.BeginDbTransaction(); try { //审核记录表 if (!string.IsNullOrEmpty(caseId)) { B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan(); sendDoc.Condition.Add("caseid=" + caseId); Utility.Database.Delete(sendDoc, tran); CommonFunctional.DeleteWorkFlowCase(caseId, userid, tran); Utility.Database.Commit(tran); } else { throw (new Exception("删除数据失败")); } bool b = true; return new { b = b }; } catch (Exception ex) { ComBase.Logger(ex); throw (new Exception("获取数据失败!", ex)); } }
/// <summary> /// 创建一个Word数据 /// </summary> /// <param name="caseid"></param> /// <returns></returns> private Dictionary<string, Object> CreateWordSendDocData(string caseid, IDbTransaction tran) { B_OA_SendDoc_QuZhan boacd = new B_OA_SendDoc_QuZhan(); boacd.Condition.Add("caseid = " + caseid);//设置查询条件 boacd = Utility.Database.QueryObject<B_OA_SendDoc_QuZhan>(boacd, tran); FX_WorkFlowBusAct wfba = new FX_WorkFlowBusAct(); wfba.Condition.Add("CaseID = " + caseid);//设置查询条件 List<FX_WorkFlowBusAct> wfbaList = Utility.Database.QueryList(wfba); Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("title", boacd.title == null ? "" : boacd.title);//标题 dict.Add("printCount", boacd.printCount == null ? "" : boacd.printCount);//页数 dict.Add("zs", boacd.zs == null ? "" : boacd.zs);//主送 dict.Add("cs", boacd.cs == null ? "" : boacd.cs);//抄送 dict.Add("cb", boacd.cb == null ? "" : boacd.cb);//抄报 if (boacd.sendCheckType == "1") { dict.Add("ghz", boacd.guiHuanZhan == null ? "" : boacd.guiHuanZhan);//桂环站 dict.Add("c_ghz", "☑");//桂环站 dict.Add("c_dtnw", "☐");//代厅拟文 dict.Add("c_nbsx", "☐");//内部事项 dict.Add("c_qt", "☐");//其他 } else if (boacd.sendCheckType == "2") { dict.Add("dtnw", boacd.daiTingNiWen == null ? "" : boacd.daiTingNiWen);//代厅拟文 dict.Add("c_ghz", "☐");//桂环站 dict.Add("c_dtnw", "☑");//代厅拟文 dict.Add("c_nbsx", "☐");//内部事项 dict.Add("c_qt", "☐");//其他 } else if (boacd.sendCheckType == "3") { dict.Add("nbsx", boacd.neiBuShiXiang == null ? "" : boacd.neiBuShiXiang);//代厅拟文 dict.Add("c_ghz", "☐");//桂环站 dict.Add("c_dtnw", "☐");//代厅拟文 dict.Add("c_nbsx", "☑");//内部事项 dict.Add("c_qt", "☐");//其他 } else if (boacd.sendCheckType == "4") { dict.Add("qt", boacd.qiTa == null ? "" : boacd.qiTa);//代厅拟文 dict.Add("c_ghz", "☐");//桂环站 dict.Add("c_dtnw", "☐");//代厅拟文 dict.Add("c_nbsx", "☐");//内部事项 dict.Add("c_qt", "☑");//其他 } //密级 DataTable mjTable = CommonFunctional.GetParamItem("mjTypeDic", boacd.mj, tran); if (mjTable != null) { dict.Add("mj", mjTable.Rows[0]["mc"]);//密级 } //紧急 DataTable emergencyTable = CommonFunctional.GetParamItem("emergencyLevelDic", boacd.mj, tran); if (emergencyTable != null) { dict.Add("emergency", emergencyTable.Rows[0]["mc"]);//密级 } //获取所有评阅意见 FX_WorkFlowBusAct work = new FX_WorkFlowBusAct(); work.Condition.Add("CaseID = " + caseid); work.OrderInfo = "ReceDate asc"; List<FX_WorkFlowBusAct> listWork = Utility.Database.QueryList<FX_WorkFlowBusAct>(work, tran); //将所有工作流信息格式化 List<B_OA_PrintParagragh> listPara = CommonFunctional.ChangeListToMatch(listWork); //承办科室负责人 List<B_OA_PrintParagragh> cbksfzrList = new List<B_OA_PrintParagragh>(); //办公室核稿意见 List<B_OA_PrintParagragh> bgshgyjList = new List<B_OA_PrintParagragh>(); //校对人 List<B_OA_PrintParagragh> jdrList = new List<B_OA_PrintParagragh>(); //承办科室拟稿人 List<B_OA_PrintParagragh> cbksngrList = new List<B_OA_PrintParagragh>(); //承办科室拟稿人 List<B_OA_PrintParagragh> qfList = new List<B_OA_PrintParagragh>(); int k = 0; //承办科室负责人 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A002") { cbksfzrList.Add(listPara[k]); } } //办公室核稿意见 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A003" || listPara[k].ActID == "A004") { bgshgyjList.Add(listPara[k]); } } //校对人 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A009") { jdrList.Add(listPara[k]); } } //承办科室拟稿人 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A001") { cbksngrList.Add(listPara[k]); } } //签发 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A005" || listPara[k].ActID == "A007") { qfList.Add(listPara[k]); } } //承办科室负责人 var imgCbksfzrList = new OpenXmlHelper.ImageTextArray[cbksfzrList.Count]; for (k = 0; k < cbksfzrList.Count; k++) { imgCbksfzrList[k] = new OpenXmlHelper.ImageTextArray(); imgCbksfzrList[k].Images = cbksfzrList[k].Image; imgCbksfzrList[k].Text = cbksfzrList[k].Text; imgCbksfzrList[k].Foots = cbksfzrList[k].Foots; imgCbksfzrList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("cbksfzr", imgCbksfzrList); //办公室核稿意见 var imgBgshgyjList = new OpenXmlHelper.ImageTextArray[bgshgyjList.Count]; for (k = 0; k < bgshgyjList.Count; k++) { imgBgshgyjList[k] = new OpenXmlHelper.ImageTextArray(); imgBgshgyjList[k].Images = bgshgyjList[k].Image; imgBgshgyjList[k].Text = bgshgyjList[k].Text; imgBgshgyjList[k].Foots = bgshgyjList[k].Foots; imgBgshgyjList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("bgshgyj", imgBgshgyjList); //校对人 var imgJdrList = new OpenXmlHelper.ImageTextArray[jdrList.Count]; for (k = 0; k < jdrList.Count; k++) { imgJdrList[k] = new OpenXmlHelper.ImageTextArray(); imgJdrList[k].Images = jdrList[k].Image; imgJdrList[k].Text = jdrList[k].Text; imgJdrList[k].Foots = jdrList[k].Foots; imgJdrList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("jdr", imgJdrList); //承办科室拟稿人 var imgCbksngrList = new OpenXmlHelper.ImageTextArray[cbksngrList.Count]; for (k = 0; k < cbksngrList.Count; k++) { imgCbksngrList[k] = new OpenXmlHelper.ImageTextArray(); imgCbksngrList[k].Images = cbksngrList[k].Image; imgCbksngrList[k].Text = cbksngrList[k].Text; imgCbksngrList[k].Foots = cbksngrList[k].Foots; imgCbksngrList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("cbksngr", imgCbksngrList); //签发 var imgQfList = new OpenXmlHelper.ImageTextArray[qfList.Count]; for (k = 0; k < qfList.Count; k++) { imgQfList[k] = new OpenXmlHelper.ImageTextArray(); imgQfList[k].Images = qfList[k].Image; imgQfList[k].Text = qfList[k].Text; imgQfList[k].Foots = qfList[k].Foots; imgQfList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("qf", imgQfList); return dict; }
//合并正文 private Dictionary<string, Object> CombindMainBody(string caseid, IDbTransaction tran) { B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan(); sendDoc.Condition.Add("caseid = " + caseid); sendDoc = Utility.Database.QueryObject<B_OA_SendDoc_QuZhan>(sendDoc, tran); var title = sendDoc.title; var mainBody = sendDoc.mainBody; Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("title", title);//业务ID dict.Add("content", mainBody);//业务ID return dict; }
public string PrintSendDocContent(string content, string userid) { IDbTransaction tran = Utility.Database.BeginDbTransaction(); SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran); try { dynamic jdata = JValue.Parse(content); string fwrqString = jdata["fwrqString"];//fwrqString string printType = jdata["printType"];//printType string caseid = jdata["caseid"]; string strFileName = "发文正文_"; strFileName += DateTime.Now.ToString("yyyyMMddHHmmss") + "_temporary"; strFileName += ".docx"; string sendContentPath = CommonFunctional.GetDocumentPathByName("SendDocContent", "FileDir"); string targetPath = sendContentPath + strFileName; string savePath = "SendDocContent#" + strFileName; string realFileName = ""; switch (printType) { case "1": realFileName = "红头示例.docx"; break; } string modelPath = CommonFunctional.GetDocumentPathByName("Send", "FileModelDir"); //选择模版,将模版复制出一份 //通过caseid查找发文,并将字号贴上 B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan(); sendDoc.Condition.Add("caseid=" + caseid); sendDoc = Utility.Database.QueryObject(sendDoc, tran); Dictionary<string, Object> dict = new Dictionary<string, Object>(); realFileName = modelPath + realFileName; dict.Add("fwzh", "文号测试");//发文字号 //将字号赋到文档的相应位置 IWorkFlow.OfficeService.IWorkFlowOfficeHandler.ProduceWord2007UP(realFileName, targetPath, dict); //获取正文的路径 B_Common_CreateDoc createDoc = new B_Common_CreateDoc(); createDoc.Condition.Add("caseid=" + caseid); createDoc.Condition.Add("docType=" + "mainBody"); createDoc = Utility.Database.QueryObject(createDoc, tran); if (createDoc == null) { throw (new Exception("选择模版失败:此发文未生成过正文,请编辑正文后再选择模版!")); } string fileName = createDoc.filename.Replace("#", "/"); string filePath = CommonFunctional.GetDocumentPathByName("", "") + fileName; if (!File.Exists(filePath)) { developer.RollBack(); return Utility.JsonMsg(false, "此正文路径不存在,无法套红"); } //删除旧的套红过的源数据 B_Common_CreateDoc delDoc = new B_Common_CreateDoc(); delDoc.Condition.Add("caseid = " + caseid); delDoc.Condition.Add("type = " + "SendDocQuZhan"); delDoc.Condition.Add("docType = " + "redCover"); delDoc = Utility.Database.QueryObject<B_Common_CreateDoc>(delDoc); if (delDoc != null) { delDoc.Condition.Add("id =" + delDoc.id); Utility.Database.Delete(delDoc, tran); } //存入新的套红模版路径 B_Common_CreateDoc redCover = new B_Common_CreateDoc(); redCover.caseid = caseid; redCover.type = "SendDocQuZhan"; redCover.filename = savePath; redCover.createdate = DateTime.Now; redCover.createman = userid; redCover.docType = "redCover"; Utility.Database.Insert(redCover, tran); //将发文的正文路径 GetDataModel dataModel = new GetDataModel(); dataModel.mainBodyPath = filePath; dataModel.redCoverPath = targetPath; Utility.Database.Commit(tran); return JsonConvert.SerializeObject(dataModel); } catch (Exception ex) { developer.RollBack(); ComBase.Logger(ex); return Utility.JsonMsg(false, "选择模版失败:" + ex.Message.Replace(":", " ")); } }
public object GetData(string userid, string caseId, string baid, string actid) { try { //只有待办箱才有设置为已读 if (!String.IsNullOrEmpty(actid)) { //只有待办箱才有设置为已读 if (!String.IsNullOrEmpty(baid)) engineAPI.SetIsReaded(caseId, baid, userid); } GetDataModel data = new GetDataModel(); B_OA_SendDoc_QuZhan en = new B_OA_SendDoc_QuZhan(); en.Condition.Add("caseid=" + caseId); data.sendDocBaseInfo = Utility.Database.QueryObject<B_OA_SendDoc_QuZhan>(en); if (data.sendDocBaseInfo == null) { var baseInfo = new B_OA_SendDoc_QuZhan(); baseInfo.fwrq = DateTime.Now; //baseInfo.gklx = "1";//公开类型默认为主动公开 data.sendDocBaseInfo = baseInfo; UserInfo userInfor = ComClass.GetUserInfo(userid); data.sendDocBaseInfo.createMan = userInfor.CnName; data.sendDocBaseInfo.createManId = userInfor.UserID; } return data; } catch (Exception ex) { ComBase.Logger(ex); throw (new Exception("获取数据失败!", ex)); } }
public bool DeleteCase(string caseid, string userid, Object obj) { IDbTransaction tran = (IDbTransaction)obj; //加入针对不同的业务的删除前处理 FX_WorkFlowCase workFlow = new FX_WorkFlowCase(); workFlow.Condition.Add("ID =" + caseid); workFlow = Utility.Database.QueryObject<FX_WorkFlowCase>(workFlow, tran); if (workFlow != null) { string flowId = workFlow.FlowID; switch (flowId) { case "W000098": //发文 B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan(); sendDoc.Condition.Add("caseid=" + caseid); Utility.Database.Delete(sendDoc, tran); break; case "W000099": //收文 B_OA_ReceiveDoc_QuZhan receiveDoc = new B_OA_ReceiveDoc_QuZhan(); receiveDoc.Condition.Add("caseid=" + caseid); Utility.Database.Delete(receiveDoc, tran); break; case "W000100": //内部事项 B_OA_SendDoc_Inner_QuZhan innderDoc = new B_OA_SendDoc_Inner_QuZhan(); innderDoc.Condition.Add("caseId=" + caseid); Utility.Database.Delete(innderDoc, tran); break; case "W000070": //车辆申请 B_OA_Car car = new B_OA_Car(); car.Condition.Add("workflowcaseid=" + caseid); Utility.Database.Delete(car, tran); break; case "W000071": //会议申请 B_OA_Meeting data = new B_OA_Meeting(); data.Condition.Add("CaseID=" + caseid); Utility.Database.Delete(data, tran); break; case "W000079": //请假申请 B_OA_LeaveList leave = new B_OA_LeaveList(); leave.Condition.Add("caseId=" + caseid); Utility.Database.Delete(leave, tran); break; case "W000080": //出差申请 B_OA_TravelList travel = new B_OA_TravelList(); travel.Condition.Add("caseId=" + caseid); Utility.Database.Delete(travel, tran); break; case "W000089": //通知公告 B_OA_Notice notice = new B_OA_Notice(); notice.Condition.Add("caseid=" + caseid); Utility.Database.Delete(notice, tran); break; } if (!string.IsNullOrEmpty(caseid)) { //删除正文路径 B_Common_CreateDoc createDoc = new B_Common_CreateDoc(); createDoc.Condition.Add("caseid=" + caseid); Utility.Database.Delete(createDoc, tran); //删除附件 FX_AttachMent attach = new FX_AttachMent(); attach.Condition.Add("CaseID="+caseid); Utility.Database.Delete(attach, tran); } } return true; }