public Dictionary<string, Object> CreateWordSendDocData(string caseid, IDbTransaction tran) { StringBuilder strSql = new StringBuilder(); //采购表 strSql.AppendFormat(@" select CONVERT(VARCHAR(5),row_number() over (order by aName)) as rowid, aName as '名称',paramsData as '规格',convert(varchar(10),getCount) as '需购置数量',techDeman as '技术要求', CONVERT(VARCHAR(10),deliveryDate,120) as'要求交期',useFunction as'用途', (case when CONVERT(VARCHAR(10),prePrice)='0' then '' else CONVERT(VARCHAR(10),prePrice) end) as '计划金额(元)',acceptance as '验收情况' ,b.CnName as '验收人' from B_OA_FixedAssets_Son as a LEFT JOIN FX_UserInfo as b on b.UserID = a.acceptManId WHERE caseId = '{0}';;", caseid); DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran); var tableArray = new OpenXmlHelper.DataTableArray(); DataTable dt = dataSet.Tables[0]; tableArray.dataTable = dt; //将表插入在文档的第4个元素中 tableArray.addIndexNum = 3; //删除表中多余的空行 tableArray.deleteNumber = "4"; Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("tableCotent", tableArray); B_OA_FixedAssets fixedAccess = new B_OA_FixedAssets(); fixedAccess.Condition.Add("caseId =" + caseid); fixedAccess = Utility.Database.QueryObject<B_OA_FixedAssets>(fixedAccess, tran); DeptInfoAndUserInfo userInfor = ComClass.GetDeptAndUserByUserId(fixedAccess.applyManId); if (fixedAccess.totalMoney != 0) { dict.Add("totalMoney", fixedAccess.totalMoney.ToString()); } dict.Add("applyDep", userInfor.deptinfo.DPName); dict.Add("applyMan", userInfor.userinfo.CnName); //获取所有评阅意见 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> officeSugList = new List<B_OA_PrintParagragh>(); int k = 0; //科室主任意见 for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A002") { officeSugList.Add(listPara[k]); } } //科室主任意见 var imgOfficeSugListList = new OpenXmlHelper.ImageTextArray[officeSugList.Count]; for (k = 0; k < officeSugList.Count; k++) { imgOfficeSugListList[k] = new OpenXmlHelper.ImageTextArray(); imgOfficeSugListList[k].Images = officeSugList[k].Image; imgOfficeSugListList[k].Text = officeSugList[k].Text; imgOfficeSugListList[k].Foots = "科室主任:" + officeSugList[k].Foots; imgOfficeSugListList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("officeSug", imgOfficeSugListList); //站长意见 List<B_OA_PrintParagragh> marsterSugList = new List<B_OA_PrintParagragh>(); for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A005") { marsterSugList.Add(listPara[k]); } } //站长意见 var imgMarsterList = new OpenXmlHelper.ImageTextArray[marsterSugList.Count]; for (k = 0; k < marsterSugList.Count; k++) { imgMarsterList[k] = new OpenXmlHelper.ImageTextArray(); imgMarsterList[k].Images = marsterSugList[k].Image; imgMarsterList[k].Text = marsterSugList[k].Text; imgMarsterList[k].Foots = marsterSugList[k].Foots; imgMarsterList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("marsterSug", imgMarsterList); //副站长意见 List<B_OA_PrintParagragh> preMarsterSugList = new List<B_OA_PrintParagragh>(); for (k = 0; k < listPara.Count; k++) { if (listPara[k].ActID == "A009") { preMarsterSugList.Add(listPara[k]); } } //副站长意见 var imgPrMarsterList = new OpenXmlHelper.ImageTextArray[preMarsterSugList.Count]; for (k = 0; k < preMarsterSugList.Count; k++) { imgPrMarsterList[k] = new OpenXmlHelper.ImageTextArray(); imgPrMarsterList[k].Images = preMarsterSugList[k].Image; imgPrMarsterList[k].Text = preMarsterSugList[k].Text; imgPrMarsterList[k].Foots = preMarsterSugList[k].Foots; imgPrMarsterList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("preMasterSug", imgPrMarsterList); return dict; }
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; case "W000102": //采购申请 B_OA_FixedAssets fiexAssets = new B_OA_FixedAssets(); fiexAssets.Condition.Add("caseId ="+caseid); Utility.Database.Delete(fiexAssets, tran); B_OA_FixedAssets_Son fixedAssetsSon = new B_OA_FixedAssets_Son(); fixedAssetsSon.Condition.Add("caseId = "+caseid); Utility.Database.Delete(fixedAssetsSon, 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); //用户和业务关系表 DataRowMap rm = new DataRowMap(); rm.TableName = "B_OA_WorkFlow_UserId_R"; rm.Condition.Add("caseId=" + caseid); Utility.Database.Delete(rm, tran); //业务数据 FX_WorkFlowBusAct workFlowBust = new FX_WorkFlowBusAct(); workFlowBust.Condition.Add("CaseID=" + caseid); Utility.Database.Delete(workFlowBust, tran); } } return true; }
/// <summary> /// 创建一个Word数据 /// </summary> /// <param name="caseid"></param> /// <returns></returns> private Dictionary<string, Object> CreateWordSendDocData(string caseid, IDbTransaction tran, string fwzh) { B_OA_SendDoc_ZhiDui boacd = new B_OA_SendDoc_ZhiDui(); boacd.Condition.Add("caseid = " + caseid);//设置查询条件 boacd = Utility.Database.QueryObject<B_OA_SendDoc_ZhiDui>(boacd); FX_WorkFlowBusAct wfba = new FX_WorkFlowBusAct(); wfba.Condition.Add("CaseID = " + caseid);//设置查询条件 List<FX_WorkFlowBusAct> wfbaList = Utility.Database.QueryList(wfba); var boacdmjsql = @"select a.csz as id, a.mc as mc from Para_BizTypeItem a , Para_BizTypeDictionary b where a.flid = b.id and b.lx = 'mjTypeDic' and a.csz =" + boacd.mj; DataSet boacdmjds = Utility.Database.ExcuteDataSet(boacdmjsql); // 发文 Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("fwzh", fwzh); dict.Add("fwlx", boacd.fwlx == "" ? "" : boacd.fwlx);//发文类型 dict.Add("mj", boacdmjds.Tables.Count > 0 ? (boacdmjds.Tables[0].Rows.Count > 0 ? boacdmjds.Tables[0].Rows[0]["mc"] : "") : ""); //密级 //处理显示名称 dict.Add("ys", boacd.ys == "" ? "" : boacd.ys);//印数 DataSet gkcdgkcdds = new DataSet(); var gkcdgkcdsql = ""; if (boacd.gkcd != null) { gkcdgkcdsql = @"select a.csz as id, a.mc as mc from Para_BizTypeItem a , Para_BizTypeDictionary b where a.flid = b.id and b.lx = 'gkcdTypeDic' and a.csz =" + boacd.gkcd; gkcdgkcdds = Utility.Database.ExcuteDataSet(gkcdgkcdsql); dict.Add("gkcd", gkcdgkcdds.Tables.Count > 0 ? (gkcdgkcdds.Tables[0].Rows.Count > 0 ? gkcdgkcdds.Tables[0].Rows[0]["mc"] : "") : ""); //公开程度 } else { dict.Add("gkcd", ""); //公开程度 } dict.Add("wjbt", boacd.wjbt == "" ? "" : boacd.wjbt);//文件标题 dict.Add("zs", boacd.zs == "" ? "" : boacd.zs);//主送 dict.Add("cb", boacd.cb == "" ? "" : boacd.cb);//抄报 dict.Add("cs", boacd.cs == "" ? "" : boacd.cs);//抄送 dict.Add("ztc", boacd.ztc == "" ? "" : boacd.ztc);// 主题词 dict.Add("zbbm", boacd.zbbm == "" ? "" : boacd.zbbm);//主办部门 dict.Add("jd", boacd.jd == "" ? "" : boacd.jd);//校对 dict.Add("dzy", boacd.dzy == "" ? "" : boacd.dzy);// 打字员 dict.Add("bz", boacd.bz == "" ? "" : boacd.bz);//备注 dict.Add("yx", boacd.yx == "" ? "" : boacd.yx);//一校 dict.Add("ex", boacd.ex == "" ? "" : boacd.ex);//二校 string gklx = boacd.gklx;//公开类型 switch (gklx) { case "1": dict.Add("gklx1", "√"); break; case "2": dict.Add("gklx2", "√"); break; case "3": dict.Add("gklx3", "√"); break; } dict.Add("printTime", DateTime.Now.ToLongDateString());// 打印日期 DataTable dataTable = CommonFunctional.GetUserNameAndDepartNameByActId(caseid, "A002", tran); if (dataTable.Rows.Count > 0) { string name = dataTable.Rows[0][1] + " " + dataTable.Rows[0][0]; dict.Add("ngr", name);// 拟稿人 } #region //获取所有评阅意见 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> ngbmfzrhgList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> bgshgList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> fgldshList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> qfList = new List<B_OA_PrintParagragh>(); for (int i = 0; i < listPara.Count; i++) { // 拟稿部门负责人核稿 if (listPara[i].ActID == "A002") { ngbmfzrhgList.Add(listPara[i]); } //分管领导审核意见 else if (listPara[i].ActID == "A003") { fgldshList.Add(listPara[i]); } //办公室核稿 else if (listPara[i].ActID == "A004") { bgshgList.Add(listPara[i]); }//签发 else if (listPara[i].ActID == "A005") { qfList.Add(listPara[i]); } } int k = 0; //拟稿部门负责人 var imgNgbmfzrhgList = new OpenXmlHelper.ImageTextArray[ngbmfzrhgList.Count]; for (k = 0; k < ngbmfzrhgList.Count; k++) { imgNgbmfzrhgList[k] = new OpenXmlHelper.ImageTextArray(); imgNgbmfzrhgList[k].Images = ngbmfzrhgList[k].Image; imgNgbmfzrhgList[k].Text = ngbmfzrhgList[k].Text; imgNgbmfzrhgList[k].Foots = ngbmfzrhgList[k].Foots; imgNgbmfzrhgList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("ngbmfzrhg", imgNgbmfzrhgList); //分管领导审核意见 var imgFgldshList = new OpenXmlHelper.ImageTextArray[fgldshList.Count]; for (k = 0; k < fgldshList.Count; k++) { imgFgldshList[k] = new OpenXmlHelper.ImageTextArray(); imgFgldshList[k].Images = fgldshList[k].Image; imgFgldshList[k].Text = fgldshList[k].Text; imgFgldshList[k].Foots = fgldshList[k].Foots; imgFgldshList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("fgldsh", imgFgldshList); //办公室核稿 var imgBgshgList = new OpenXmlHelper.ImageTextArray[bgshgList.Count]; for (k = 0; k < fgldshList.Count; k++) { imgBgshgList[k] = new OpenXmlHelper.ImageTextArray(); imgBgshgList[k].Images = bgshgList[k].Image; imgBgshgList[k].Text = bgshgList[k].Text; imgBgshgList[k].Foots = bgshgList[k].Foots; imgBgshgList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("bgshg", imgBgshgList); //签发 var imgQfList = new OpenXmlHelper.ImageTextArray[qfList.Count]; for (k = 0; k < fgldshList.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); #endregion return dict; }