Пример #1
0
        public JsonResult Edit(MBR_WashingInfo entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                using (MBREntities db = new MBREntities())
                {
                    WashingInfoService us = new WashingInfoService(db);

                    if (us.Edit(ref errors, entity))
                    {
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WashingInfoID:" + entity.WashingInfoID, Resource.EditSucceed, Resource.Edit, "离线清洗数据管理");
                        return(Json(JsonHandler.CreateMessage(1, Resource.EditSucceed)));
                    }
                    else
                    {
                        string ErrorCol = errors.Error;
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WashingInfoID:" + entity.WashingInfoID, Resource.EditFail, Resource.Edit, "离线清洗数据管理");
                        return(Json(JsonHandler.CreateMessage(0, Resource.EditFail + ErrorCol)));
                    }
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.EditFail)));
            }
        }
Пример #2
0
 public ActionResult Details(int id)
 {
     using (MBREntities db = new MBREntities())
     {
         WashingInfoService us     = new WashingInfoService(db);
         MBR_WashingInfo    entity = us.GetById(id);
         return(View(entity));
     }
 }
Пример #3
0
        public ActionResult Edit(int id)
        {
            MBR_WashingInfo entity = null;

            using (MBREntities db = new MBREntities())
            {
                entity = db.MBR_WashingInfo.Include(m => m.MBR_Info).Include(m => m.MBR_Info.MBR_Pool).Where(m => m.WashingInfoID == id).FirstOrDefault();
            }
            return(View(entity));
        }
Пример #4
0
 public JsonResult Create(MBR_WashingInfo entity)
 {
     using (MBREntities db = new MBREntities())
     {
         WashingInfoService us = new WashingInfoService(db);
         if (us.Create(ref errors, entity))
         {
             LogHandler.WriteServiceLog(LogonUser.RealName, "WashingInfoID:" + entity.WashingInfoID, Resource.InsertSucceed, Resource.Create, "离线清洗数据管理");
             return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed), JsonRequestBehavior.AllowGet));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(LogonUser.RealName, "WashingInfoID:" + entity.WashingInfoID, Resource.InsertFail, Resource.Create, "离线清洗数据管理");
             return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol), JsonRequestBehavior.AllowGet));
         }
     }
 }
Пример #5
0
        /// <summary>
        /// 透水率预测
        /// </summary>
        /// <param name="InfoID"></param>
        /// <returns></returns>
        public JsonResult GetPermeable(int InfoID = 0)
        {
            AN_HighCurve hc = new AN_HighCurve();
            AN_LowCurve  lc = new AN_LowCurve();

            using (MBREntities db = new MBREntities())
            {
                hc = db.AN_HighCurve.Find(InfoID);
                lc = db.AN_LowCurve.Find(InfoID);
            }
            Dictionary <string, List <ANInfoModel> > dic = new Dictionary <string, List <ANInfoModel> >();

            if (hc != null)
            {
                //高的线的3阶系数
                double hc3     = (double)hc.Coeff_LV3;
                double hc2     = (double)hc.Coeff_LV2;
                double hc1     = (double)hc.Coeff_LV1;
                double hcConst = (double)hc.Const;
                //低线的
                double lc3     = (double)lc.Coeff_LV3;
                double lc2     = (double)lc.Coeff_LV2;
                double lc1     = (double)lc.Coeff_LV1;
                double lcConst = (double)lc.Const;

                List <MBR_WashingInfo> wi = db.MBR_WashingInfo.Where(m => m.InfoID == InfoID).OrderBy(m => m.BeginTime).ToList();

                List <ANInfoModel> highList = new List <ANInfoModel>();

                List <ANInfoModel> lowList = new List <ANInfoModel>();
                for (int i = 0; i < 15; i++)
                {
                    ANInfoModel highAM = new ANInfoModel();
                    //高的线的值
                    double highNumber = hc3 * Math.Pow(i, 3) - hc2 * Math.Pow(i, 2) - hc1 * i + hcConst;//(double)(100 - i)/1.5;//threeSquare + Math.Pow(i, 3) / twoSquare+ Math.Pow(i, 2) + primarySide*i + constant;
                    highAM.XValue = i + 1;
                    highAM.YValue = highNumber;
                    highList.Add(highAM);

                    ANInfoModel lowAM = new ANInfoModel();
                    //低的线的值
                    double lowNumber = lc3 * Math.Pow(i, 3) + lc2 * Math.Pow(i, 2) - lc1 * i + lcConst;//(double)(100 - i)/1.5;//threeSquare + Math.Pow(i, 3) / twoSquare+ Math.Pow(i, 2) + primarySide*i + constant;
                    lowAM.XValue = i + 1;
                    lowAM.YValue = lowNumber;
                    lowList.Add(lowAM);

                    if (lowNumber >= highNumber)
                    {
                        //清洗之后的值如果小于清洗之前的,吧清洗之前的值赋给之后的,并是最后一次
                        highAM.YValue = lowNumber;
                        break;
                    }
                }
                //清洗之后
                dic.Add("after", highList);
                //清洗之前
                dic.Add("befer", lowList);

                List <ANInfoModel> scaHighList = new List <ANInfoModel>();
                List <ANInfoModel> scaLowList  = new List <ANInfoModel>();
                for (int i = 0; i < wi.Count; i++)
                {
                    MBR_WashingInfo rc = wi[i];

                    if (rc.TouShuiL_High == null)
                    {
                        continue;
                    }
                    if (rc.TouShuiL_Low == null)
                    {
                        continue;
                    }


                    ANInfoModel highAM = new ANInfoModel();

                    double highNumber = (double)rc.TouShuiL_High;
                    highAM.XValue = i + 1;
                    highAM.YValue = highNumber;
                    scaHighList.Add(highAM);

                    ANInfoModel lowAM = new ANInfoModel();

                    double lowNumber = (double)rc.TouShuiL_Low;
                    lowAM.XValue = i + 1;
                    lowAM.YValue = lowNumber;
                    scaLowList.Add(lowAM);
                }
                //之后
                dic.Add("afterSca", scaHighList);

                //之前
                dic.Add("beferSca", scaLowList);
            }


            return(Json(dic, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        /// <summary>
        /// 累计氯预测
        /// </summary>
        /// <param name="mbrId"></param>
        /// <returns></returns>
        public JsonResult GetChlorinValue(int InfoID = 0, int clcTarget = 0)
        {
            AN_CLCurve cc = new AN_CLCurve();

            Dictionary <string, Object> dic = new Dictionary <string, Object>();

            using (MBREntities db = new MBREntities())
            {
                cc = db.AN_CLCurve.Find(InfoID);
            }
            if (cc != null)
            {
                //高的线的3阶系数
                double cc3                = (double)cc.Coeff_LV3;
                double cc2                = (double)cc.Coeff_LV2;
                double cc1                = (double)cc.Coeff_LV1;
                double ccConst            = (double)cc.Const;
                List <MBR_WashingInfo> wi = db.MBR_WashingInfo.Where(m => m.InfoID == InfoID).OrderBy(m => m.BeginTime).ToList();

                List <ANInfoModel> clcList = new List <ANInfoModel>();
                for (int i = 0; i < 15; i++)
                {
                    ANInfoModel clcAM = new ANInfoModel();
                    //高的线的值
                    //-0.0005* Math.Pow(i, 3) + 0.2979* Math.Pow(i, 2) + 3.1688*i + 1.7863;
                    double clcNumber = cc3 * Math.Pow(i, 3) + cc2 * Math.Pow(i, 2) + cc1 * i + ccConst;//(double)(100 - i)/1.5;//threeSquare + Math.Pow(i, 3) / twoSquare+ Math.Pow(i, 2) + primarySide*i + constant;
                    clcAM.XValue = i + 1;
                    clcAM.YValue = clcNumber;
                    clcList.Add(clcAM);

                    //if (clcNumber >= maxChlorine)
                    //{
                    //clcAM.YValue = maxChlorine;
                    //break;
                    //}
                }
                dic.Add("lineList", clcList);

                List <ANInfoModel> sacList = new List <ANInfoModel>();
                for (int i = 0; i < wi.Count; i++)
                {
                    MBR_WashingInfo rc = wi[i];
                    if (rc.LvJieCZDC == null)
                    {
                        continue;
                    }



                    ANInfoModel clcAM     = new ANInfoModel();
                    double      clcNumber = (double)rc.LvJieCZDC;
                    clcAM.XValue = i + 1;
                    clcAM.YValue = clcNumber;
                    sacList.Add(clcAM);
                }

                dic.Add("scaList", sacList);

                dic.Add("plotLineValue", clcTarget);
            }
            return(Json(dic, JsonRequestBehavior.AllowGet));
        }