Esempio n. 1
0
        private bool addReport(List <string> data, List <int> index, string type, List <string> remark)
        {
            try
            {
                if (data != null && data.Count > 0 && type != null)
                {
                    MesWeb.Model.T_AllReport report = new MesWeb.Model.T_AllReport();
                    string dataStr = "";
                    //内容数据
                    data.ForEach(d =>
                    {
                        dataStr = dataStr + spliter + d;
                    });

                    dataStr = dataStr.Substring(spliter.Length);
                    //索引数据
                    string indexStr = "";
                    index.ForEach(i =>
                    {
                        indexStr = indexStr + spliter + data[i];
                    });
                    indexStr = indexStr.Substring(spliter.Length);

                    //备注数据
                    string remarkStr = "";
                    if (remark != null && remark.Count > 0)
                    {
                        remark.ForEach(r =>
                        {
                            remarkStr = remarkStr + spliter + r;
                        });
                    }
                    if (!string.IsNullOrEmpty(remarkStr))
                    {
                        remarkStr = remarkStr.Substring(spliter.Length);
                    }

                    //生成报表
                    report.IndexValue  = indexStr;
                    report.InputDate   = DateTime.Now;
                    report.ReportType  = type;
                    report.ReportValue = dataStr;
                    report.Remark      = remarkStr;
                    //添加报表
                    MesWeb.BLL.T_AllReport bllReport = new MesWeb.BLL.T_AllReport();
                    bllReport.Add(report);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public ActionResult SearchReportAction(List <string> cond, string type)
        {
            var retData = new VM_Result_Data();

            retData.Content = "查询失败";
            var bllAllReport = new MesWeb.BLL.T_AllReport();
            var condStr      = "";

            if (cond != null && cond.Count > 0)
            {
                cond.ForEach(c =>
                {
                    condStr = condStr + spliter + "%" + c + "%";
                });
                condStr = condStr.Substring(spliter.Length);
            }
            var result = bllAllReport.GetModelList("ReportType = '" + type + "' and  IndexValue like '" + condStr + "' ");

            if (result != null && result.Count > 0)
            {
                var repList = new List <VM_GumReportSearchResult>();
                var results = new List <SearchReportResult>();

                result.ForEach(report =>
                {
                    var value  = report.ReportValue.Split(new string[] { spliter }, StringSplitOptions.None).ToList();
                    var remark = report.Remark.Split(new string[] { spliter }, StringSplitOptions.None).ToList();
                    var res    = new SearchReportResult();
                    //通用型结果
                    res.Remark    = remark;
                    res.Report    = value;
                    res.Id        = report.Id;
                    res.InputDate = report.InputDate.HasValue ? report.InputDate.Value.ToString("yyyy-MM-dd") : "--";
                    results.Add(res);

                    var rep = new VM_GumReportSearchResult();
                    //翻译字段
                    rep.BatchNum  = value[2];
                    rep.InputDate = report.InputDate.HasValue ? report.InputDate.Value.ToString("yyyy-MM-dd") : "--";
                    rep.SpecNum   = value[1];
                    rep.Supplier  = value[0];
                    rep.Detail    = "<a reportId='" + report.Id + "' onclick='navToGumDetail(this)'>详细</a>";

                    repList.Add(rep);
                });
                retData.Content  = results;
                retData.Code     = RESULT_CODE.OK;
                retData.Appendix = repList;
            }
            return(Json(retData));
        }
Esempio n. 3
0
        public static int SearchReportId(List <string> cond, string type)
        {
            var bllAllReport = new MesWeb.BLL.T_AllReport();
            var condStr      = "";

            if (cond != null && cond.Count > 0)
            {
                cond.ForEach(c =>
                {
                    condStr = condStr + spliter + c + "%";
                });
                condStr = condStr.Substring(spliter.Length);
            }
            var result = bllAllReport.GetModelList("ReportType = '" + type + "' and  IndexValue like '%" + condStr + "' ").FirstOrDefault();

            return(result.Id);
        }
Esempio n. 4
0
        public JsonResult GetReportDetailAction(int Id)
        {
            var retData = new VM_Result_Data();

            retData.Content = "获取报表详情失败";
            var bllAllReport = new MesWeb.BLL.T_AllReport();
            var report       = bllAllReport.GetModel(Id);
            var reportValue  = new List <String>();
            var remarkValue  = new List <String>();

            if (report != null)
            {
                reportValue = report.ReportValue.Split(new string[] { spliter }, StringSplitOptions.None).ToList();
                remarkValue = report.Remark.Split(new string[] { spliter }, StringSplitOptions.None).ToList();


                retData.Appendix = new { remark = remarkValue, report = reportValue };

                retData.Code    = RESULT_CODE.OK;
                retData.Content = "查询报表成功";
            }
            return(Json(retData));
        }