public JsonModel Get(string Data)
        {
            string strcx          = ""; //车型
            string strch          = ""; //车号
            string strxcjl        = ""; //行车交路
            string strgh          = ""; //工号字符串
            string strcc          = ""; //车次
            string strcid         = "";
            string remarkTypeName = ""; //站接,库接


            PSpecificOnduty paramModel = TF.CommonUtility.JsonConvert.JsonDeserialize <PSpecificOnduty>(Data);

            strcx          = paramModel.cx;                          //车型
            strch          = paramModel.ch;                          //车号
            strxcjl        = HttpUtility.UrlDecode(paramModel.xcjl); //行车交路
            strcc          = paramModel.cc;                          //车次
            strcid         = paramModel.cid;                         //客户端id
            remarkTypeName = paramModel.remarkTypeName;

            if (string.IsNullOrEmpty(strcid))
            {
                return(FengRunSpecific(strgh, strxcjl, strcid, strcx, strch, strcc, remarkTypeName, paramModel));
            }
            else
            {
                DBSpecificOnDuty ea = new DBSpecificOnDuty();
                string           strWorkShopGUID = ea.getWorkShopGUID(strcid);
                if (strWorkShopGUID == "292be3ca-b357-4386-80dc-eb148e5a595e")
                {
                    return(FengRunSpecific(strgh, strxcjl, strcid, strcx, strch, strcc, remarkTypeName, paramModel));
                }
                else if (strWorkShopGUID == "3b50bf66-dabb-48c0-8b6d-05db80591090")
                {
                    SpecificOnDuty_ts ts = new SpecificOnDuty_ts();
                    return(ts.TangShanSpecific(strgh, strxcjl, strcid, strcx, strch, strcc, paramModel));
                }
                else
                {
                    return(FengRunSpecific(strgh, strxcjl, strcid, strcx, strch, strcc, remarkTypeName, paramModel));
                }
            }
        }
        public JsonModel FengRunSpecific(string strgh, string strxcjl, string strcid, string strcx, string strch, string strcc, string remarkTypeName, PSpecificOnduty paramModel)
        {
            DBSpecificOnDuty ea = new DBSpecificOnDuty();

            strgh = "";//工号字符串
            foreach (gh g in paramModel.gh)
            {
                if (g.ghID.Length == 7)
                {
                    strgh += g.ghID + ",";
                }
                else
                {
                }
            }
            strgh = strgh.Substring(0, strgh.Length - 1);

            //查询完毕后渲染html
            string html = TF.CommonUtility.CommonHelper.RenderHtml("top.htm", "");//头部的html代码

            //获取关键站天气预报信息
            DataTable dtTianQi  = ea.GetAllTianQi(strxcjl);
            string    strTianQi = "";

            for (int t = 0; t < dtTianQi.Rows.Count; t++)
            {
                strTianQi += "<tr><td class='Juleft' style=''>" + dtTianQi.Rows[t]["strCheZhan"].ToString();
                strTianQi += "&nbsp;" + dtTianQi.Rows[t]["strTianQi"].ToString();
                strTianQi += "&nbsp;" + dtTianQi.Rows[t]["strWenDu"].ToString() + "</td></tr>";
            }

            //预警,操作要求,车间要求
            DataTable dtYuJin   = ea.GetYuJing(strxcjl);
            string    strYuJing = "";

            if (dtYuJin.Rows.Count > 0)
            {
                strYuJing += "<tr><td class='Juleft'  style='font-weight:400;line-height:1.5; '>&nbsp;&nbsp;" + dtYuJin.Rows[0]["strChuanDa"].ToString() + "</td></tr>";
            }
            else
            {
                strYuJing = "";
            }
            //事故传达
            DataTable dtShiGu  = ea.GetShiGu();
            string    strShiGu = "";

            if (dtShiGu.Rows.Count > 0)
            {
                strShiGu += "<tr><td class='Juleft' style='font-size:14px;line-height:1.2'>七、事故通报</td></tr>";
                for (int kk = 0; kk < dtShiGu.Rows.Count; kk++)
                {
                    strShiGu += "<tr><td class='Juleft'>" + (kk + 1).ToString() + "、" + dtShiGu.Rows[kk]["strShiGu"].ToString() + "</td></tr>";
                }
            }



            //人员信息,考试情况,两违通报
            string strRenYuan = "<tr><td  align='left'  style='font-weight:400;line-height:1.5;'>";


            DataTable dtRenYuan = ea.GetRenYuan(strgh.Split(',')[0]);

            string strRenYuan1 = "";

            if (dtRenYuan.Rows.Count > 0)
            {
                strRenYuan1 += "&nbsp;司机:" + dtRenYuan.Rows[0]["strTrainmanName1"].ToString() + "&nbsp;";
                strRenYuan1 += "副(换乘)司机:" + dtRenYuan.Rows[0]["strTrainmanName2"].ToString();
            }
            strRenYuan += strRenYuan1;

            strRenYuan += "</td></tr>";

            //机车临碎修
            string strLinSuiXiu = "<tr><td align='left' >" + TF.CommonUtility.CommonHelper.RenderHtml("Tab_SpecificOnDuty_LingSuiXiu.htm", AllLingSuiXiu(strcx, strch)) + "</td></tr>";


            html += "<div style='border:solid 0px #000;padding:5px;'><table style='width:100%; font-size:14px;'>";
            html += "<tr><td class='Juleft' style='font-weight:400;line-height:1.5; '>一、出勤时间:" + DateTime.Now.ToString("yy年MM月dd日HH:mm") + "</td></tr>";

            html += "<tr><td class='Juleft' style='font-weight:400;line-height:1.5;'>二、出勤机班:</td></tr>" + strRenYuan;

            html += "<tr><td align='left' class='Juleft' style='font-weight:400;line-height:1.5; '>三、担当区段&nbsp;车次:" + strxcjl + "&nbsp;" + strcc + "次</td></tr>";
            html += "<tr><td align='left'  style=' font-weight:400; line-height:2'>" + getZhanOrKu(strcx, strch, remarkTypeName) + "</td></tr>";
            html += "<tr><td class='Juleft'>五、使用机车质量信息&nbsp;" + strcx + "&nbsp;-&nbsp;" + strch + "</td></tr>";
            html += strLinSuiXiu;
            html += "<tr><td  class='Juleft'>六、安全提示</td></tr>";
            html += strYuJing;
            html += strShiGu;
            html += "<tr><td class='Juleft' style='font-size:14px;line-height:1.2'>八、天气预报</td></tr>";
            html += strTianQi;
            html += "<tr><td style=' font-weight:400; line-height:1.2;text-align:center;font-size: 20px' ><b>" + ea.GetYanYu() + "</b></td></tr>";
            html += "</table></div>";

            string strfilePath = "/SpecificOnDuty";

            CreatHtmlFile(System.Web.Hosting.HostingEnvironment.MapPath(strfilePath), html, "" + strcid + ".htm");

            CreatPdf(strcid);

            //生成EXCEL
            string strExcelHtml = "";

            strExcelHtml += html;
            strExcelHtml += "</td></tr></table></body></html>";
            CreatHtmlFile(System.Web.Hosting.HostingEnvironment.MapPath(strfilePath), strExcelHtml, "" + strcid + ".xls");
            JsonModel jsonModel = new JsonModel();

            jsonModel.result    = "0";
            jsonModel.resultStr = "返回成功";
            Random r = new Random();

            jsonModel.data             = new ResultData();
            jsonModel.data.strPDFURL   = "http://" + HttpContext.Current.Request.Url.Authority + "/SpecificOnDuty/" + strcid + ".pdf?r=" + r.Next(1, 2000) + "";
            jsonModel.data.strExcelURL = "http://" + HttpContext.Current.Request.Url.Authority + "/SpecificOnDuty/" + strcid + ".xls?r=" + r.Next(1, 2000) + "";
            return(jsonModel);
        }
Beispiel #3
0
        public override string QueryResult()
        {
            TF.RunSafty.DAL.ExcelAdd ea = new TF.RunSafty.DAL.ExcelAdd();
            string strcx   = ""; //车型
            string strch   = ""; //车号
            string strxcjl = ""; //行车交路
            string strgh   = ""; //工号字符串
            string strcc   = ""; //车次
            string strcid  = "";


            PSpecificOnduty paramModel = TF.CommonUtility.JsonConvert.JsonDeserialize <PSpecificOnduty>(this.Data);

            strcx   = paramModel.cx;                          //车型
            strch   = paramModel.ch;                          //车号
            strxcjl = HttpUtility.UrlDecode(paramModel.xcjl); //行车交路
            strcc   = paramModel.cc;                          //车次
            strcid  = paramModel.cid;                         //客户端id



            strgh = "";//工号字符串

            foreach (gh g in paramModel.gh)
            {
                if (g.ghID.Length == 7)
                {
                    strgh += g.ghID.Substring(2, 5) + ",";
                }
            }
            strgh = strgh.Substring(0, strgh.Length - 1);

            //查询完毕后渲染html
            string html = TF.CommonUtility.CommonHelper.RenderHtml("top.htm", "");//头部的html代码


            //获取关键站天气预报信息
            DataTable dtTianQi  = ea.GetAllTianQi(strxcjl);
            string    strTianQi = "";

            for (int t = 0; t < dtTianQi.Rows.Count; t++)
            {
                strTianQi += "&nbsp;" + dtTianQi.Rows[t]["strCheZhan"].ToString();
                strTianQi += "&nbsp;" + dtTianQi.Rows[t]["strTianQi"].ToString();
                strTianQi += "&nbsp;" + dtTianQi.Rows[t]["strWenDu"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            }

            //预警,操作要求,车间要求
            DataTable dtYuJin   = ea.GetYuJing(strxcjl);
            string    strYuJing = "";

            if (dtYuJin.Rows.Count > 0)
            {
                strYuJing += "<tr><td>关键站:" + dtYuJin.Rows[0]["strGuanJianZhan"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;操纵要求:" + dtYuJin.Rows[0]["strCaoZongYaoQiu"].ToString() + "</td></tr>";
                strYuJing += "<tr><td>预警:" + dtYuJin.Rows[0]["strYuJin"].ToString() + "</td></tr>";
            }
            else
            {
                strYuJing = "";
            }
            //人员信息,考试情况,两违通报
            string strRenYuan = "";

            for (int sp = 0; sp < strgh.Split(',').Length; sp++)
            {
                DataTable dtRenYuan   = ea.GetRenYuan(strgh.Split(',')[sp]);
                string    strRenYuan1 = "";
                string    strRenYuan2 = "";
                string    strRenYuan3 = "";
                string    strRenYuan4 = "";
                if (dtRenYuan.Rows.Count > 0)
                {
                    strRenYuan1 = "<tr><td>姓名:" + dtRenYuan.Rows[0]["strName"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;";
                    strRenYuan2 = "重点人:" + dtRenYuan.Rows[0]["strZhongDianPerple"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;";
                    strRenYuan3 = "车间要求:" + dtRenYuan.Rows[0]["strCheJianYaoQiu"].ToString() + "</td></tr>";
                    strRenYuan4 = "<tr><td>人性化提示:" + dtRenYuan.Rows[0]["strJianKang"].ToString() + "</td></tr>";
                }
                strRenYuan += strRenYuan1;
                strRenYuan += strRenYuan2;
                strRenYuan += strRenYuan3;
                strRenYuan += "<tr><td>" + TF.CommonUtility.CommonHelper.RenderHtml("Tab_Test.htm", AllTasts(strgh.Split(',')[sp])) + "</td></tr>";
                strRenYuan += "<tr><td>" + TF.CommonUtility.CommonHelper.RenderHtml("Tab_SpecificOnDuty_LiangWei.htm", ea.GetAllLiangWei(strgh.Split(',')[sp]).Rows) + "</td></tr>";
                strRenYuan += strRenYuan4;
                strRenYuan += "<tr><td>&nbsp;</td></tr>";
            }
            //机车临碎修

            //DataTable dtLinSuiXiu = ea.GetLinSuixiu(strcx, strch);
            //string strLinSuiXiu = "<tr><td>" + TF.CommonUtility.CommonHelper.RenderHtml("Tab_SpecificOnDuty_LingSuiXiu.htm", dtLinSuiXiu.Rows) + "</td></tr>";

            string strLinSuiXiu = "<tr><td>" + TF.CommonUtility.CommonHelper.RenderHtml("Tab_SpecificOnDuty_LingSuiXiu.htm", AllLingSuiXiu(strcx, strch)) + "</td></tr>";

            html += "<div style='border:solid 1px #000'><table><tr><td><table  style='width:100%; font-size:12px;text-decoration:underline'><tr><td align='center'><b>个性提示</b></td></tr></table></td></tr>";
            html += "<tr><td align='left'>" + strxcjl + "&nbsp;&nbsp;&nbsp;&nbsp;车次:" + strcc + "</td></tr>";

            html += "<tr><td>天气预报:" + strTianQi + "</td></tr>";
            html += strRenYuan;
            html += "<tr><td><table style='width:100%; font-size:12px;text-decoration:underline; line-height:1.2'><tr><td align='center'><b>机车状态</b></td></tr></table></td></tr>";
            html += strLinSuiXiu;
            html += "<tr><td><table style='width:100%; font-size:12px;text-decoration:underline; line-height:1.2'><tr><td align='center'><b>预警提示</b></td></tr></table></td></tr>";
            html += strYuJing;
            html += "</table></div>";

            string strfilePath = "/SpecificOnDuty";

            CreatHtmlFile(System.Web.Hosting.HostingEnvironment.MapPath(strfilePath), html, "" + strcid + ".htm");

            CreatPdf(strcid);

            //生成EXCEL
            string strExcelHtml = TF.CommonUtility.CommonHelper.RenderHtml("Excel.htm", "");

            strExcelHtml += "<img alt='' src='http://" + HttpContext.Current.Request.Url.Authority + "/SpecificOnDuty/" + strcid + ".bmp' width='80%' height='145%'  />";
            strExcelHtml += "</div></body></html>";
            CreatHtmlFile(System.Web.Hosting.HostingEnvironment.MapPath(strfilePath), strExcelHtml, "" + strcid + ".xls");
            JsonModel jsonModel = new JsonModel();

            jsonModel.result    = "0";
            jsonModel.resultStr = "返回成功";
            Random r = new Random();

            jsonModel.strPDFURL   = "http://" + HttpContext.Current.Request.Url.Authority + "/SpecificOnDuty/" + strcid + ".pdf?r=" + r.Next(1, 2000) + "";
            jsonModel.strExcelURL = "http://" + HttpContext.Current.Request.Url.Authority + "/SpecificOnDuty/" + strcid + ".xls?r=" + r.Next(1, 2000) + "";
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel);

            return(result);
        }