Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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);
                }
                List<B_OA_FixedAssets_Son> listSon = new List<B_OA_FixedAssets_Son>();
                B_OA_FixedAssets_Son fixedAssetsSon = new B_OA_FixedAssets_Son();
                B_OA_FixedAssets fixedAssets = new B_OA_FixedAssets();
                if (caseId == "")
                {
                    fixedAssets.applyManId = userid;
                    DeptInfoAndUserInfo userinfor = ComClass.GetDeptAndUserByUserId(userid);
                    fixedAssets.applyManName = userinfor.userinfo.CnName;
                    fixedAssets.dpName = userinfor.deptinfo.DPName;
                    fixedAssets.createDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.AppendFormat(@"SELECT a.*,b.CnName as acceptManName  from B_OA_FixedAssets_Son as a
            LEFT JOIN FX_UserInfo as b on b.UserID = a.acceptManId
             where a.caseId ='{0}'", caseId);
                    DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString());
                    string jsonData = JsonConvert.SerializeObject(dataSet.Tables[0]);
                    listSon = (List<B_OA_FixedAssets_Son>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_FixedAssets_Son>));

                    fixedAssets.Condition.Add("caseId= " + caseId);
                    fixedAssets = Utility.Database.QueryObject<B_OA_FixedAssets>(fixedAssets);
                    string applyManId = fixedAssets.applyManId;
                    DeptInfoAndUserInfo userinfor = ComClass.GetDeptAndUserByUserId(applyManId);
                    fixedAssets.applyManName = userinfor.userinfo.CnName;
                    fixedAssets.dpName = userinfor.deptinfo.DPName;
                }
                return new
                {
                    listSon = listSon,
                    fixedAssetsSon = fixedAssetsSon,
                    fixedAssets = fixedAssets
                };
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                throw (new Exception("获取数据失败!", ex));
            }
        }