Ejemplo n.º 1
0
            public WF_M_CONNECTOR ToConnector()
            {
                var entity = new WF_M_CONNECTOR();

                if (string.IsNullOrWhiteSpace(this.id))
                {
                    entity.ConnectorId = Guid.NewGuid().ToString();
                }
                else
                {
                    entity.ConnectorId = this.id;
                }

                entity.ConnectorName = this.name;
                entity.FromStepId    = this.from;
                entity.ToStepId      = this.to;
                entity.Script        = Pub.GetHtmlSql(this.strategy);
                entity.ScriptType    = 0;   // 0 表示 sql 语句
                entity.ModelId       = ModelId;

                // 其他属性
                var dict = new Dictionary <string, string>();

                dict.Add("M", string.Format("{0}", this.M));
                dict.Add("type", string.Format("{0}", this.type));
                dict.Add("marked", string.Format("{0}", this.marked));
                entity.Extend01 = JsonSerializeHelper.SerializeObject(dict);

                return(entity);
            }
        public IndexVM PowerAnalyzeDay(HttpContext context)
        {
            var vm = new IndexVM();

            try
            {
                var Position        = context.Request.Params["Position"];
                var CollectDateFrom = context.Request.Params["CollectDateFrom"];
                var CollectDateTo   = context.Request.Params["CollectDateTo"];
                var list            = DataAnalyLoader.PowerAnalyzeDay(Position, CollectDateFrom, CollectDateTo);
                var liste           = new List <VM_ENERGY>();
                var cats            = list.Select(a => a.CollectDate).Distinct().ToList();
                vm.data1 = JsonSerializeHelper.SerializeObject(cats);
                var names = new string[3] {
                    "高峰", "平谷", "低谷"
                };
                for (int i = 0; i < 3; i++)
                {
                    var l1 = new VM_ENERGY();
                    l1.name = names[i];
                    //l1.data = new decimal[cats.Count];
                    l1.data_vm = list.Where(a => a.PeriodName == l1.name).Select(b => new { b.CollectDate, b.CollectValue }).ToArray();

                    liste.Add(l1);
                }
                vm.hasError = false;
                vm.data     = JsonSerializeHelper.SerializeObject(liste);
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = string.Format("获取图表数据遇到异常{0}", ex.Message);
            }
            return(vm);
        }
        public IndexVM PowerAnalyzeYearLineSummary(HttpContext context)
        {
            var vm = new IndexVM();

            try
            {
                var Line            = context.Request.Params["Line"];
                var CollectYearFrom = context.Request.Params["CollectYearFrom"];
                var CollectYearTo   = context.Request.Params["CollectYearTo"];
                var list            = DataAnalyLoader.PowerAnalyzeYearLineSummary(Line, CollectYearFrom, CollectYearTo);
                var liste           = new List <VM_ENERGY>();
                var cats            = list.Select(a => a.CollectDate).Distinct().ToList();
                vm.data2 = JsonSerializeHelper.SerializeObject(cats);
                var names = list.Select(a => a.Line).Distinct().ToList();
                for (int i = 0; i < names.Count; i++)
                {
                    var l1 = new VM_ENERGY();
                    l1.name = names[i];
                    //l1.data = new decimal[cats.Count];
                    //l1.data = list.Where(a => a.Line == l1.name).Select(b => Convert.ToDecimal(b.CollectValue)).ToArray();
                    l1.data_vm = list.Where(a => a.Line == l1.name).Select(b => new { b.CollectDate, b.CollectValue }).ToArray();
                    liste.Add(l1);
                }
                vm.hasError = false;
                vm.data     = JsonSerializeHelper.SerializeObject(liste);
                vm.data1    = JsonSerializeHelper.SerializeObject(names);
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = string.Format("获取图表数据遇到异常{0}", ex.Message);
            }
            return(vm);
        }
        public IndexVM PowerQueryCurrentLine(HttpContext context)
        {
            var vm = new IndexVM();

            vm.hasError = false;
            try
            {
                var Line = context.Request.Params["Line"];
                var list = DataAnalyLoader.PowerQueryCurrentLine(Line);
                var cats = list.Select(a => a.CTime).Distinct().ToList();
                vm.data1 = JsonSerializeHelper.SerializeObject(cats);
                var liste = new List <VM_ENERGY>();

                var l1 = new VM_ENERGY();
                l1.name    = Line;
                l1.data_vm = list.Select(b => new { b.CTime, b.CollectValue }).ToArray();
                liste.Add(l1);
                vm.data = JsonSerializeHelper.SerializeObject(liste);
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = string.Format("获取图表数据遇到异常{0}", ex.Message);
            }
            return(vm);
        }
        public void ProcessRequest(HttpContext context)
        {
            int maxSize = 1024 * 1024 * 1024;

            if (context.Request.Files.Count == 0)
            {
                showError(context, "请选择文件".GetRes());
                return;
            }
            HttpPostedFile imgFile = context.Request.Files[0];

            if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize)
            {
                showError(context, "上传文件大小超过限制".GetRes());
                return;
            }

            try
            {
                var user = Util.GetCurrentUser();


                // 将文件插入到数据库中
                var entity = new XDSW_T_FILE();
                using (var db = Pub.DB)
                {
                    //var sql = "select top 1 FileId from XDSW_T_FILE where FileName=@FileName";
                    //var dbFileId = db.Query<string>(sql, new { FileName = Path.GetFileName(imgFile.FileName) }).FirstOrDefault();
                    //if (!string.IsNullOrWhiteSpace(dbFileId))
                    //{
                    //    showError(context, "文件名已经存在".GetRes());
                    //    return;
                    //}
                    entity.FileId         = Guid.NewGuid().ToString();
                    entity.FileName       = Path.GetFileName(imgFile.FileName);
                    entity.FileData       = StreamHelper.ToBytes(imgFile.InputStream);
                    entity.LastModifyTime = DateTime.Now;
                    entity.LastModifyUser = user.UserName;
                    entity.CreateTime     = DateTime.Now;
                    entity.CreateUser     = user.UserName;
                    entity.Extend01       = "TempFile";
                    db.Insert(entity);
                }
                Hashtable hash = new Hashtable();
                hash["error"]    = 0;
                hash["fileName"] = entity.FileName;
                hash["fileId"]   = entity.FileId;
                hash["message"]  = "上传成功";
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write(JsonSerializeHelper.SerializeObject(hash));
            }
            catch (Exception ex)
            {
                showError(context, ex.Message);
                return;
            }
        }
        private void showError(HttpContext context, string message)
        {
            Hashtable hash = new Hashtable();

            hash["error"]   = 1;
            hash["message"] = message;
            context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            context.Response.Write(JsonSerializeHelper.SerializeObject(hash));
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            var dict        = DFPub.GetDFDictionary(context.Request);
            var action      = dict["action"].ToLower();
            var contentType = context.Request.ContentType;

            if (string.IsNullOrWhiteSpace(contentType))
            {
                contentType = "application/json;charset=utf-8";
            }
            context.Response.ContentType = contentType;
            switch (action)
            {
            case "getpower":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetPower(context)));
                break;

            case "getchunshui":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetChunShui(context)));
                break;

            case "getzilaishui":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetZilaiShui(context)));
                break;

            case "getlinsuan":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetLinSuan(context)));
                break;

            case "getyansuan":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetYanSuan(context)));
                break;

            case "getjian":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetJian(context)));
                break;

            case "gettianranqi":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetTianRanQi(context)));
                break;

            case "gettzhengqi":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetZhengQi(context)));
                break;

            case "getpowerdata":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetPowerData(context)));
                break;

            case "requestenergyalarm":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetEnergyAlarm(context)));
                break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
        public ResultVM GetPowerData(HttpContext context)
        {
            var vm = new ResultVM();

            vm.hasError = false;
            var Line = context.Request.Params["Line"];
            var list = KanbanEnergyLoader.GetPowerData(Line);

            vm.data = JsonSerializeHelper.SerializeObject(list);
            return(vm);
        }
Ejemplo n.º 9
0
        public ResultVM GetL03MF(HttpContext context)
        {
            var vm = new ResultVM();

            vm.hasError = false;
            var list = new List <VM_PROCESS>();

            list = KanbanProcessLoader.GetMFGL("L03", "MF");

            vm.data = JsonSerializeHelper.SerializeObject(list);

            return(vm);
        }
Ejemplo n.º 10
0
        public IndexVM GetL04FenQuLY(HttpContext context)
        {
            var vm = new IndexVM();

            vm.hasError = false;
            var list = new List <VM_PROCESS>();

            list = KanbanProcessLoader.GetFenQuLY("L04", "炉子");


            vm.data  = JsonSerializeHelper.SerializeObject(list);
            vm.data1 = KanbanProcessLoader.GetTotal("L04");
            return(vm);
        }
Ejemplo n.º 11
0
        public IndexVM GetL02LW(HttpContext context)
        {
            var vm = new IndexVM();

            vm.hasError = false;
            var list = new List <VM_PROCESS>();

            list = KanbanProcessLoader.GetLW("L02", "炉子");


            vm.data = JsonSerializeHelper.SerializeObject(list);// json 字符串
            var total = KanbanProcessLoader.GetTotal("L02");

            vm.data1 = total + KanbanProcessLoader.GetLWAlarm("L02");
            return(vm);
        }
Ejemplo n.º 12
0
        public IndexVM GetProcessData(HttpContext context)
        {
            var vm = new IndexVM();

            vm.hasError = false;
            var list = new List <VM_SM_T_PROCESS_PRODUCT>();

            list = KanbanProcessLoader.GetProcessData();

            var list1 = KanbanProcessLoader.GetProductQty();

            vm.data  = JsonSerializeHelper.SerializeObject(list);
            vm.data1 = JsonSerializeHelper.SerializeObject(list1);
            vm.data2 = SM_T_ENVIRONMENTLoader.GetEnvironment();

            return(vm);
        }
Ejemplo n.º 13
0
        public IndexVM GetL01MFUA(HttpContext context)

        {
            var vm = new IndexVM();

            vm.hasError = false;
            //var list = KanbanProcessLoader.GetProcessData();
            var list = new List <VM_PROCESS>();

            list = KanbanProcessLoader.GetMFUA("L01", "MF");


            vm.data = JsonSerializeHelper.SerializeObject(list);
            var total = KanbanProcessLoader.GetTotal("L01");

            vm.data1 = total + KanbanProcessLoader.GetMFUAAlarm("L01");
            return(vm);
        }
Ejemplo n.º 14
0
            internal WF_M_STEP ToStep()
            {
                var entity = new WF_M_STEP();

                if (string.IsNullOrWhiteSpace(this.id))
                {
                    entity.StepId = Guid.NewGuid().ToString();
                }
                else
                {
                    entity.StepId = this.id;
                }

                entity.StepName   = this.name;
                entity.Script     = Pub.GetHtmlSql(this.strategy);
                entity.ScriptType = ParseHelper.ParseInt(this.scripttype).GetValueOrDefault();
                entity.ModelId    = ModelId;
                if (this.type == "start")
                {
                    entity.StepType = "Start";
                }
                else if (this.type == "end")
                {
                    entity.StepType = "Stop";
                }
                else
                {
                    entity.StepType = "One Actor";
                }

                // 其他属性
                var dict = new Dictionary <string, string>();

                dict.Add("top", string.Format("{0}", this.top));
                dict.Add("left", string.Format("{0}", this.left));
                dict.Add("width", string.Format("{0}", this.width));
                dict.Add("height", string.Format("{0}", this.height));
                dict.Add("alt", string.Format("{0}", this.alt));
                entity.Extend01 = JsonSerializeHelper.SerializeObject(dict);

                return(entity);
            }
Ejemplo n.º 15
0
        private DFDictionary ClientReport(DFDictionary dict)
        {
            FormM        form   = null;
            DFDictionary entity = null;

            DFPub.SetDBEntity(dict, ref form, ref entity);
            var ret     = new DFDictionary();
            var message = string.Empty;
            var da      = NinjectHelper.Get <IDA>(form.DAImp);

            try
            {
                if (null == da)
                {
                    throw new Exception("Invalid DAImp");
                }
                if (da.Update(form, entity, ref message) != 0)
                {
                    ret.Add("hasError", "true");
                }
                var baseDA = (BaseDA)da;
                ret.Add("Debug", entity["Debug"]);
                ret.Add("ReportName", Path.GetFileName(baseDA.ReportPath));
                ret.Add("UploadFileUrl", baseDA.GetUrlFolder() + "/kindeditor/asp.net/upload_json.ashx");
                ret.Add("ReportUrl", baseDA.GetUrlRoot() + DFPub.PhysicalToRelative(baseDA.ReportPath));
                if (baseDA.ReportDataSource != null)
                {
                    ret.Add("ReportDataSource", Convert.ToBase64String(SerializeHelper.DataSetSerializer(baseDA.ReportDataSource)));
                }
                ret.Add("error", message);
                m_log.Debug(JsonSerializeHelper.SerializeObject(ret));
            }
            catch (Exception ex)
            {
                ret.Add("hasError", "true");
                ret.Add("error", ex.Message);
                m_log.Error(ex.Message, ex);
            }
            return(ret);
        }
Ejemplo n.º 16
0
        public ResultVM GetZhengQi(HttpContext context)
        {
            var vm = new ResultVM();

            vm.hasError = false;
            var Line = context.Request.Params["Line"];
            var list = new List <VM_ENERGY_COLLECT>();

            list = KanbanEnergyLoader.GettZhengQiData(Line, "");
            var data = new List <VM_ENERGY>();

            var dates = list.Select(a => a.CollectDate).Distinct().ToList();

            foreach (var d in dates)
            {
                var item = data.Where(a => a.name == d).FirstOrDefault();
                if (item == null)
                {
                    item      = new VM_ENERGY();
                    item.name = d;

                    var dlist = list.Where(a => a.CollectDate == d).OrderBy(b => b.Line).ToList();
                    item.data = new Decimal[dlist.Count];
                    for (int i = 0; i < dlist.Count; i++)
                    {
                        item.data[i] = dlist[i].DataValue;
                    }
                    data.Add(item);
                }
                else
                {
                }
            }

            vm.data = JsonSerializeHelper.SerializeObject(data);

            return(vm);
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["action"] == "save")
            {
                var data  = Request["data"];
                var title = Request["title"];
                File.WriteAllText(Path.Combine(Server.MapPath(""), "temp", title), data);

                SaveToDB(data, string.Empty);

                this.Response.Write(JsonSerializeHelper.SerializeObject(new ResultVM()
                {
                    hasError = false, error = string.Empty, data = "保存成功"
                }));
                this.Response.End();
            }
            if (Request["action"] == "load")
            {
                var title = Request["title"];
                var data  = LoadFromDB(title);
                this.Response.Write(data);
                this.Response.End();
            }
        }
        public IndexVM EnergyQueryOnly4(HttpContext context)
        {
            var vm = new IndexVM();

            vm.hasError = false;
            var QueryType = context.Request.Params["QueryType"];
            var Category  = context.Request.Params["Category"];

            if (string.IsNullOrWhiteSpace(QueryType) || QueryType == "DAY")
            {
                var CollectDateFrom = context.Request.Params["CollectDateFrom"];
                var CollectDateTo   = context.Request.Params["CollectDateTo"];

                var list = DataAnalyLoader.QueryEnergy4ByDay(CollectDateFrom, CollectDateTo, Category);
                //vm.data = JsonSerializeHelper.SerializeObject(list);
                var cats = list.Select(a => a.CollectDate).Distinct().ToList();
                vm.data1 = JsonSerializeHelper.SerializeObject(cats);
                var liste = new List <VM_ENERGY>();
                if (Category == "TIANRANQI" || Category == "ZHENGQI")
                {
                    var l1 = new VM_ENERGY();
                    l1.name = "L01";
                    l1.data = new decimal[cats.Count];
                    //l1.data = list.Where(a => a.Line == "L01").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l1.data_vm = list.Where(a => a.Line == "L01").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l1);

                    var l2 = new VM_ENERGY();
                    l2.name = "L02";
                    l2.data = new decimal[cats.Count];
                    //l2.data = list.Where(a => a.Line == "L02").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l2.data_vm = list.Where(a => a.Line == "L02").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l2);


                    var l3 = new VM_ENERGY();
                    l3.name = "L03";
                    //l3.data = new decimal[cats.Count];
                    //l3.data = list.Where(a => a.Line == "L03").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l3.data_vm = list.Where(a => a.Line == "L03").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l3);



                    var l4 = new VM_ENERGY();
                    l4.name = "L04";
                    //l4.data = new decimal[cats.Count];
                    //l4.data = list.Where(a => a.Line == "L04").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l4.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l4);
                }
                else
                {
                    var i = 0;
                    vm.data1 = JsonSerializeHelper.SerializeObject(cats);

                    var l = new VM_ENERGY();
                    l.name = "L04";

                    l.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    i         = i = 1;
                    liste.Add(l);
                }


                vm.data = JsonSerializeHelper.SerializeObject(liste);
            }
            else if (QueryType == "MONTH")
            {
                var CollectMonthFrom = context.Request.Params["CollectMonthFrom"];
                var CollectMonthTo   = context.Request.Params["CollectMonthTo"];

                var list = DataAnalyLoader.QueryEnergy4ByMonth(CollectMonthFrom, CollectMonthTo, Category);

                var cats = list.Select(a => a.CollectDate).Distinct().ToList();
                vm.data1 = JsonSerializeHelper.SerializeObject(cats);
                var liste = new List <VM_ENERGY>();
                if (Category == "TIANRANQI" || Category == "ZHENGQI")
                {
                    var l1 = new VM_ENERGY();
                    l1.name = "L01";
                    //l1.data = new decimal[cats.Count];
                    //l1.data = list.Where(a => a.Line == "L01").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l1.data_vm = list.Where(a => a.Line == "L01").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l1);

                    var l2 = new VM_ENERGY();
                    l2.name = "L02";
                    //l2.data = new decimal[cats.Count];
                    //l2.data = list.Where(a => a.Line == "L02").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l2.data_vm = list.Where(a => a.Line == "L02").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l2);


                    var l3 = new VM_ENERGY();
                    l3.name = "L03";
                    //l3.data = new decimal[cats.Count];
                    //l3.data = list.Where(a => a.Line == "L03").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l3.data_vm = list.Where(a => a.Line == "L03").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l3);



                    var l4 = new VM_ENERGY();
                    l4.name = "L04";
                    //l4.data = new decimal[cats.Count];
                    //l4.data = list.Where(a => a.Line == "L04").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l4.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l4);
                }
                else
                {
                    var i = 0;
                    vm.data1 = JsonSerializeHelper.SerializeObject(cats);

                    var l = new VM_ENERGY();
                    l.name = "L04";

                    l.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    i         = i = 1;
                    liste.Add(l);
                }


                vm.data = JsonSerializeHelper.SerializeObject(liste);
            }


            else if (QueryType == "YEAR")
            {
                var CollectYearFrom = context.Request.Params["CollectYearFrom"];
                var CollectYearTo   = context.Request.Params["CollectYearTo"];

                var list = DataAnalyLoader.QueryEnergy4ByYear(CollectYearFrom, CollectYearTo, Category);
                //vm.data = JsonSerializeHelper.SerializeObject(list);
                var cats = list.Select(a => a.CollectDate).Distinct().ToList();
                vm.data1 = JsonSerializeHelper.SerializeObject(cats);
                var liste = new List <VM_ENERGY>();
                if (Category == "TIANRANQI" || Category == "ZHENGQI")
                {
                    var l1 = new VM_ENERGY();
                    l1.name = "L01";
                    //l1.data = new decimal[cats.Count];
                    //l1.data = list.Where(a => a.Line == "L01").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l1.data_vm = list.Where(a => a.Line == "L01").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l1);

                    var l2 = new VM_ENERGY();
                    l2.name = "L02";
                    //l2.data = new decimal[cats.Count];
                    //l2.data = list.Where(a => a.Line == "L02").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l2.data_vm = list.Where(a => a.Line == "L02").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l2);


                    var l3 = new VM_ENERGY();
                    l3.name = "L03";
                    //l3.data = new decimal[cats.Count];
                    //l3.data = list.Where(a => a.Line == "L03").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l3.data_vm = list.Where(a => a.Line == "L03").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l3);



                    var l4 = new VM_ENERGY();
                    l4.name = "L04";
                    //l4.data = new decimal[cats.Count];
                    //l4.data = list.Where(a => a.Line == "L04").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l4.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    liste.Add(l4);
                }
                else
                {
                    var i = 0;
                    vm.data1 = JsonSerializeHelper.SerializeObject(cats);

                    var l = new VM_ENERGY();
                    l.name = "L04";
                    //l.data = new decimal[cats.Count];
                    //l.data = list.Where(a => a.Line == "L04").Select(b => Convert.ToDecimal(b.TotalValue)).ToArray();
                    l.data_vm = list.Where(a => a.Line == "L04").Select(b => new { b.CollectDate, b.TotalValue }).ToArray();
                    i         = i = 1;
                    liste.Add(l);
                }


                vm.data = JsonSerializeHelper.SerializeObject(liste);
            }


            //vm.data = JsonSerializeHelper.SerializeObject(list);

            return(vm);
        }
        public void ProcessRequest(HttpContext context)
        {
            var dict        = DFPub.GetDFDictionary(context.Request);
            var action      = dict["action"].ToLower();
            var contentType = context.Request.ContentType;

            if (string.IsNullOrWhiteSpace(contentType))
            {
                contentType = "application/json;charset=utf-8";
            }
            context.Response.ContentType = contentType;
            switch (action)
            {
            case "energyqueryonly4":
                context.Response.Write(JsonSerializeHelper.SerializeObject(EnergyQueryOnly4(context)));
                break;

            case "poweranalyzeday":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeDay(context)));
                break;

            case "poweranalyzemonth":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeMonth(context)));
                break;

            case "poweranalyzemonthsummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeMonthSummary(context)));
                break;

            case "poweranalyzemonthline":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeMonthLine(context)));
                break;

            case "poweranalyzemonthlinesummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeMonthLineSummary(context)));
                break;

            case "poweranalyzeyear":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeYear(context)));
                break;

            case "poweranalyzeyearline":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeYearLine(context)));
                break;

            case "poweranalyzeyearlinesummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeYearLineSummary(context)));
                break;

            case "poweranalyzeyearsummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeYearSummary(context)));
                break;

            case "poweranalyzedayline":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeDayLine(context)));
                break;

            case "poweranalyzedaysummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeDaySummary(context)));
                break;

            case "poweranalyzedaylinesummary":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerAnalyzeDayLineSummary(context)));
                break;

            case "energyquerycurrent":
                context.Response.Write(JsonSerializeHelper.SerializeObject(EnergyQueryCurrent(context)));
                break;

            case "powerquerycurrent":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerQueryCurrent(context)));
                break;

            case "powerquerycurrentline":
                context.Response.Write(JsonSerializeHelper.SerializeObject(PowerQueryCurrentLine(context)));
                break;

            default:
                break;
            }
        }
Ejemplo n.º 20
0
        public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
        {
            try
            {
                var dict = new DFDictionary();
                if (!string.IsNullOrWhiteSpace(entity["RoleId"]))
                {
                    using (var db = Pub.DB)
                    {
                        var sql  = "select * from WF_M_ROLE where RoleId=@RoleId";
                        var item = db.Query <WF_M_ROLE>(sql, new { RoleId = entity["RoleId"] }).FirstOrDefault();
                        if (null != item)
                        {
                            dict.Merge(DFDictionary.Create <WF_M_ROLE>(item));
                        }

                        // 载入权限
                        sql = "select * from WF_M_AUTH_MODULE where RoleId=@RoleId";
                        var list1 = db.Query <WF_M_AUTH_MODULE>(sql, new { RoleId = entity["RoleId"] }).ToList();
                        dict.Add("DF_TREE_VIEWSTATE1", Base64StringHelper.ConvertToBase64String(JsonSerializeHelper.SerializeObject(
                                                                                                    list1.Select(a => new WFTreeNode {
                            id = a.ModuleId, _checked = true, expanded = true
                        }))));

                        sql = "select * from WF_M_AUTH_DATA where RoleId=@RoleId";
                        var list2 = db.Query <WF_M_AUTH_DATA>(sql, new { RoleId = entity["RoleId"] }).ToList();
                        dict.Add("DF_TREE_VIEWSTATE2", Base64StringHelper.ConvertToBase64String(JsonSerializeHelper.SerializeObject(
                                                                                                    list2.Select(a => new WFTreeNode {
                            id = a.DeptId, _checked = true, expanded = true
                        }))));
                    }
                }
                return(dict);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(null);
            }
        }
Ejemplo n.º 21
0
        public void ProcessRequest(HttpContext context)
        {
            InitializeHelper.Init();
            var dict        = DFPub.GetDFDictionary(context.Request);
            var action      = dict["action"].ToLower();
            var contentType = context.Request.ContentType;

            if (string.IsNullOrWhiteSpace(contentType))
            {
                contentType = "application/json;charset=utf-8";
            }
            context.Response.ContentType = contentType;
            switch (action)
            {
            case "queryform":
                if (dict.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT))
                {
                    var vm = QueryForm(dict);
                    if (vm.hasError)
                    {
                        m_log.Error(vm.error);
                    }
                    context.Response.Write(JsonSerializeHelper.SerializeObject(new DataGridVM()
                    {
                        data = DFPub.PhysicalToRelative(vm.data.ToString())
                    }));
                }
                else
                {
                    context.Response.Write(JsonSerializeHelper.SerializeObject(QueryForm(dict)));
                }
                break;

            case "deleteform":
                context.Response.Write(JsonSerializeHelper.SerializeObject(DeleteForm(dict)));
                break;

            case "clientreport":
                context.Response.Write(JsonSerializeHelper.SerializeObject(ClientReport(dict)));
                break;

            case "querylist":
                context.Response.Write(JsonSerializeHelper.SerializeObject(QueryList(dict)));
                break;

            case "saveparameter":
                context.Response.Write(JsonSerializeHelper.SerializeObject(SaveParameter(context, dict)));
                break;

            case "uploadfile":
                context.Response.Write(JsonSerializeHelper.SerializeObject(UploadFile(context, dict)));
                break;

            case "deleteuploadfile":
                context.Response.Write(JsonSerializeHelper.SerializeObject(DeleteUploadFile(context, dict)));
                break;

            //case "kanban":
            //    context.Response.Write(JsonSerializeHelper.SerializeObject(Kanban(context)));
            //    break;
            default:
                context.Response.Write(JsonSerializeHelper.SerializeObject(ExecuteMethod(dict["action"], dict)));
                break;
            }
        }
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            var ycs        = WF_M_PUBLICCODELoader.Query("YCName");
            var palletDict = new DFDictionary();

            foreach (var item in ycs)
            {
                palletDict.Add(item.CodeName, item.CodeValue);
            }
            this.Model.Add("YCName_DataSource", Base64StringHelper.ConvertToBase64String(JsonSerializeHelper.SerializeObject(palletDict)));
        }
Ejemplo n.º 23
0
        public void ProcessRequest(HttpContext context)
        {
            var dict        = DFPub.GetDFDictionary(context.Request);
            var action      = dict["action"].ToLower();
            var contentType = context.Request.ContentType;

            if (string.IsNullOrWhiteSpace(contentType))
            {
                contentType = "application/json;charset=utf-8";
            }
            context.Response.ContentType = contentType;
            switch (action)
            {
            case "l01mf":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL01MF(context)));
                break;

            case "l01lw":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL01LW(context)));
                break;

            case "l01productspeed":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL01ProductSpeed(context)));
                break;

            case "l01ly":    //1号线炉压
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL01LY(context)));
                break;

            case "l01ua":    //1号线MFUA
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL01MFUA(context)));
                break;

            case "l02ua":    //2号线MFUA
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL02MFUA(context)));
                break;

            case "l03ua":    //3号线MFUA
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL03MFUA(context)));
                break;

            case "l04ua":    //4号线MFUA
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL04MFUA(context)));
                break;

            case "l02mf":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL02MF(context)));
                break;

            case "l02lw":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL02LW(context)));
                break;

            case "l02ly":    //2号线炉压
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL02LY(context)));
                break;

            case "l02productspeed":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL02ProductSpeed(context)));
                break;

            case "l03mf":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL03MF(context)));
                break;

            case "l03lw":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL03LW(context)));
                break;

            case "l03ly":    //3号线炉压
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL03LY(context)));
                break;

            case "l04fenquly":    //4号线炉压
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL04FenQuLY(context)));
                break;

            case "l03productspeed":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL03ProductSpeed(context)));
                break;

            case "l04mf":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL04MF(context)));
                break;

            case "l04lw":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL04LW(context)));
                break;

            case "l04productspeed":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetL04ProductSpeed(context)));
                break;

            case "process":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetProcessData(context)));
                break;

            case "gettotal":
                context.Response.Write(JsonSerializeHelper.SerializeObject(GetTotal(context)));
                break;

            default:
                break;
            }
        }