public string GetChargPilePair(HttpContext context)
        {
            var schedulejobsbll = new ScheduleJobsBll();
            var csid            = context.Request.Params["csid"];

            if (string.IsNullOrEmpty(csid))
            {
                return("{\"total\":0,\"rows\":[]}");
            }
            string str;
            var    count = 0;

            try
            {
                var icsid = int.Parse(csid);
                var dt    = schedulejobsbll.FindBy(icsid);
                str = ConvertToJson.DataTableToJson("rows", dt);
                str = str.Substring(1, str.Length - 2);
                str = "{\"total\":\"" + count + "\"," + str + "}";
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
            return(str);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 查询遥信项合理性历史记录
 /// </summary>
 /// <param name="httpRequest"></param>
 /// <param name="httpResponse"></param>
 private void GetYxhlxls(HttpRequest httpRequest, HttpResponse httpResponse)
 {
     try
     {
         string   tmp       = httpRequest["dateBegin"] ?? "";
         DateTime dateBegin = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-1);
         DateTime dateEnd   = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1);
         if (!string.IsNullOrEmpty(tmp))
         {
             dateBegin = DateTime.Parse(tmp);
         }
         tmp = httpRequest["dateEnd"] ?? "";
         if (!string.IsNullOrEmpty(tmp))
         {
             dateEnd = DateTime.Parse(tmp).AddDays(1);
         }
         int       page  = int.Parse(httpRequest["page"] ?? "1");
         int       rows  = int.Parse(httpRequest["rows"] ?? "10");
         int       count = 0;
         DataTable dt    = _wrBll.QueryByPage(Constant.YclxYxhlx, dateBegin, dateEnd, page, rows, ref count);
         var       str   = ConvertToJson.DataTableToJson("rows", dt);
         str = str.Substring(1, str.Length - 2);
         str = "{\"total\":\"" + count + "\"," + str + "}";
         httpResponse.Write(str);
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         httpResponse.Write(ErrorJson);
     }
 }
Ejemplo n.º 3
0
        public void FetchCurrentSeries(JObject requestValue, JToken Data, MESStationReturn StationReturn)
        {
            //BU,CustomerName,SeriesName
            string field = Data["Field"].ToString();
            string value = Data["Value"].ToString();

            OleExec   sfcdb     = null;
            DataTable dataTable = null;

            try
            {
                sfcdb     = this.DBPools["SFCDB"].Borrow();
                dataTable = new T_C_SERIES(sfcdb, DB_TYPE_ENUM.Oracle).GetQueryAll(field, value, sfcdb);

                StationReturn.Status = StationReturnStatusValue.Pass;
                //StationReturn.Message = "獲取成功";
                StationReturn.MessageCode = "MES00000001";
                StationReturn.Data        = ConvertToJson.DataTableToJson(dataTable);
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
            catch (Exception ex)
            {
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 從SN對象中加載RepairFailCode訊息   // 同上一个方法一样,只是传出数据格式变化
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNRepairFailCodeDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession SN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SN_Session == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" }));
            }
            //Repair Action Session
            MESStationSession RepairAction = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (RepairAction == null)
            {
                RepairAction = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY
                };
                Station.StationSession.Add(RepairAction);
            }
            MESStationSession RepairFailCode = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (RepairFailCode == null)
            {
                RepairFailCode = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, SessionKey = Paras[2].SESSION_KEY
                };
                Station.StationSession.Add(RepairFailCode);
            }
            string sn = SN_Session.Value.ToString();

            DataTable           FailCodeInfo = new DataTable();
            T_R_REPAIR_FAILCODE TFailcode    = new T_R_REPAIR_FAILCODE(Station.SFCDB, Station.DBType);

            FailCodeInfo = TFailcode.SelectFailCodeBySN(sn, Station.SFCDB, Station.DBType);
            if (FailCodeInfo.Rows.Count == 0)
            {
                foreach (R_Station_Output output in Station.StationOutputs)
                {
                    Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
                }
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180616102950", new string[] { sn }));
            }
            RepairFailCode.Value = ConvertToJson.DataTableToJson(FailCodeInfo);
            DataTable         RepairActionInfo = new DataTable();
            T_r_repair_action TAction          = new T_r_repair_action(Station.SFCDB, Station.DBType);

            RepairActionInfo   = TAction.SelectRepairActionBySN(sn, Station.SFCDB, Station.DBType);
            RepairAction.Value = ConvertToJson.DataTableToJson(RepairActionInfo);
        }
Ejemplo n.º 5
0
        public void GetWoInfoByWo(JObject requestValue, JObject Data, MESStationReturn StationReturn)
        {
            OleExec       oleDB    = null;
            T_R_WO_HEADER t_header = null;
            DataTable     dt       = null;
            string        wo       = Data["WO"].ToString();

            if (string.IsNullOrEmpty(wo))
            {
                //throw new Exception();
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara = new List <object>()
                {
                    "Workorder"
                };
                StationReturn.Data = "";
                return;
            }
            try
            {
                oleDB    = DBPools["SFCDB"].Borrow();
                t_header = new T_R_WO_HEADER(oleDB, DB_TYPE_ENUM.Oracle);
                //dt = t_header.GetConvertWoList(oleDB, DB_TYPE_ENUM.Oracle);
                dt = t_header.GetConvertWoTableByWO(oleDB, DB_TYPE_ENUM.Oracle, wo);
                if (dt == null || dt.Rows.Count == 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                    StationReturn.Data        = ConvertToJson.DataTableToJson(dt);
                }

                if (oleDB != null)
                {
                    DBPools["SFCDB"].Return(oleDB);
                }
            }
            catch (Exception ex)
            {
                if (oleDB != null)
                {
                    DBPools["SFCDB"].Return(oleDB);
                }
                throw ex;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 获取充值方式
 /// </summary>
 /// <param name="httpRequest"></param>
 /// <returns></returns>
 private string GetCzfs(HttpRequest httpRequest)
 {
     try
     {
         IcCardBll icCardBll = new IcCardBll();
         DataTable dt        = icCardBll.QueryPsysDic("充值方式");
         return(ConvertToJson.DataTableToJson("czfs", dt));
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(ErrorJson);
     }
 }
        public string InitTable(HttpContext context)
        {
            var    schedulejobsbll = new ScheduleJobsBll();
            string str;
            var    page      = context.Request.Params["page"];
            var    rows      = context.Request.Params["rows"];
            var    cmdtype   = context.Request.Params["cmdtype"];
            var    pageIndex = 0;
            var    size      = 0;
            var    count     = 0;
            var    result    = "0";

            if (!string.IsNullOrEmpty(page))
            {
                pageIndex = int.Parse(page);
            }

            if (!string.IsNullOrEmpty(rows))
            {
                size = int.Parse(rows);
            }
            try
            {
                var dt = schedulejobsbll.FindBy(pageIndex, size, ref count, cmdtype);
                //TODO:
                dt.Columns.Add("rate", Type.GetType("System.String"));
                foreach (DataRow dr in dt.Rows)
                {
                    var sumcount     = schedulejobsbll.FindBySumCount(dr["ID"].ToString());
                    var successcount = schedulejobsbll.FindBySuccessCount(dr["ID"].ToString());
                    if (successcount != 0)
                    {
                        double rate = successcount / (float)sumcount;
                        rate   = rate * 100;
                        result = String.Format("{0:N2}", rate);
                    }
                    dr["rate"] = result;
                    result     = "0";
                }
                str = ConvertToJson.DataTableToJson("rows", dt);
                str = str.Substring(1, str.Length - 2);
                str = "{\"total\":\"" + count + "\"," + str + "}";
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
            return(str);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 查询充电卡信息
 /// </summary>
 /// <param name="httpRequest"></param>
 /// <returns></returns>
 private string QueryInfo(HttpRequest httpRequest)
 {
     try
     {
         string cardNum   = httpRequest["cardNum"] ?? "",
                name      = httpRequest["name"] ?? "",
                zjmc      = httpRequest["zjmc"] ?? "",
                zjhm      = httpRequest["zjhm"] ?? "",
                kzt       = httpRequest["kzt"] ?? "",
                klx       = httpRequest["klx"] ?? "",
                dateBegin = httpRequest["dateBegin"],
                dateEnd   = httpRequest["dateEnd"];
         int page         = int.Parse(httpRequest["page"] ?? "1"),
             rows         = int.Parse(httpRequest["rows"] ?? "20");
         CardInfo ci      = new CardInfo()
         {
             CardId = cardNum,
             Name   = name,
             Zjmc   = zjmc,
             Zjhm   = zjhm,
             Kzt    = kzt,
             Klx    = klx,
         };
         if (!string.IsNullOrEmpty(dateBegin))
         {
             ci.DateBegin = DateTime.Parse(dateBegin);
         }
         if (!string.IsNullOrEmpty(dateEnd))
         {
             ci.DateEnd = DateTime.Parse(dateEnd);
         }
         IcCardBll icCardBll = new IcCardBll();
         int       count     = 0;
         DataTable dt        = icCardBll.QueryCardInfo(ci, page, rows, ref count);
         var       str       = ConvertToJson.DataTableToJson("rows", dt);
         str = str.Substring(1, str.Length - 2);
         return("{\"total\":\"" + count + "\"," + str + "}");
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(ErrorJson);
     }
 }
        /// <summary>
        /// 获取峰谷平尖价格
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string GetPrice(HttpContext context)
        {
            var    chargpricebll = new ChargPriceBll();
            var    chargprice    = new ChargPrice();
            string str;

            try
            {
                var dt = chargpricebll.Query(chargprice);
                str  = ConvertToJson.DataTableToJson("rows", dt);
                str += "|";
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
            return(str);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 获取卡异常结算数据
 /// </summary>
 /// <param name="httpRequest"></param>
 /// <returns></returns>
 private string QueryExp(HttpRequest httpRequest)
 {
     try
     {
         int page            = int.Parse(httpRequest["page"] ?? "1"),
             rows            = int.Parse(httpRequest["rows"] ?? "20");
         IcCardBll icCardBll = new IcCardBll();
         int       count     = 0;
         DataTable dt        = icCardBll.QueryExp(new CardInfo(), page, rows, ref count);
         var       str       = ConvertToJson.DataTableToJson("rows", dt);
         str = str.Substring(1, str.Length - 2);
         return("{\"total\":\"" + count + "\"," + str + "}");
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(ErrorJson);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取充电站
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public void GetChargStation(HttpContext context)
        {
            var    chargstationbll = new ChargStationBll();
            var    chargstation    = new ChargStation();
            string str             = "";
            var    count           = 0;

            try
            {
                var dt = chargstationbll.Query(chargstation);
                str  = ConvertToJson.DataTableToJson("rows", dt);
                str += "|";
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            context.Response.Write(str);
        }
Ejemplo n.º 12
0
        public string GetChargStation(HttpContext context)
        {
            var    chargstationbll = new ChargStationBll();
            var    chargstation    = new ChargStation();
            string str;
            var    count = 0;

            try
            {
                var dt = chargstationbll.Query(chargstation);
                str  = ConvertToJson.DataTableToJson("rows", dt);
                str += "|";
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
            return(str);
        }
Ejemplo n.º 13
0
        public string GetScheduleDetail(HttpContext context)
        {
            var    scheduledetailbll = new ScheduleJobsBll();
            var    taskid            = context.Request.Params["taskid"];
            string str;
            var    count = 0;

            try
            {
                var dt = scheduledetailbll.FindByDetail(taskid);
                str = ConvertToJson.DataTableToJson("rows", dt);
                str = str.Substring(1, str.Length - 2);
                str = "{\"total\":\"" + count + "\"," + str + "}";
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
            return(str);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取经纬度
        /// </summary>
        /// <param name="context"></param>
        public void GetCoordinates(HttpContext context)
        {
            var chargstationbll = new ChargStationBll();
            var chargstation    = new ChargStation()
            {
                ZhanBh = Int32.Parse(context.Request.Params["id"])
            };
            string str = "";

            try
            {
                var dt = chargstationbll.Query(chargstation);
                str  = ConvertToJson.DataTableToJson("rows", dt);
                str += "|";
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            context.Response.Write(str);
        }
Ejemplo n.º 15
0
        public void GetWoConvertList(JObject requestValue, JObject Data, MESStationReturn StationReturn)
        {
            OleExec       oleDB    = null;
            T_R_WO_HEADER t_header = null;
            DataTable     dt       = null;

            try
            {
                oleDB    = DBPools["SFCDB"].Borrow();
                t_header = new T_R_WO_HEADER(oleDB, DB_TYPE_ENUM.Oracle);
                //dt = t_header.GetConvertWoList(oleDB, DB_TYPE_ENUM.Oracle);
                dt = t_header.GetWoSpecialVar(oleDB, new string[0]);
                if (dt == null || dt.Rows.Count == 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                    //StationReturn.Data = dt;
                    StationReturn.Data = ConvertToJson.DataTableToJson(dt);
                }

                if (oleDB != null)
                {
                    DBPools["SFCDB"].Return(oleDB);
                }
            }
            catch (Exception ex)
            {
                if (oleDB != null)
                {
                    DBPools["SFCDB"].Return(oleDB);
                }
                throw ex;
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 查询充值记录
 /// </summary>
 /// <param name="httpRequest"></param>
 /// <returns></returns>
 private string QueryCzjl(HttpRequest httpRequest)
 {
     try
     {
         string cardNum   = httpRequest["cardNum"] ?? "",
                czy       = httpRequest["czy"] ?? "",
                czwd      = httpRequest["czwd"] ?? "",
                czfs      = httpRequest["czfs"] ?? "",
                dateBegin = httpRequest["dateBegin"],
                dateEnd   = httpRequest["dateEnd"];
         int page         = int.Parse(httpRequest["page"] ?? "1"),
             rows         = int.Parse(httpRequest["rows"] ?? "20");
         CardInfo ci      = new CardInfo()
         {
             CardId = cardNum,
             Czy    = czy,
             Czwd   = czwd,
             Czfs   = czfs,
         };
         if (!string.IsNullOrEmpty(dateBegin))
         {
             ci.DateBegin = DateTime.Parse(dateBegin);
         }
         if (!string.IsNullOrEmpty(dateEnd))
         {
             ci.DateEnd = DateTime.Parse(dateEnd);
         }
         IcCardBll icCardBll = new IcCardBll();
         int       count     = 0;
         DataTable dt        = icCardBll.QueryCzjl(ci, page, rows, ref count);
         var       str       = ConvertToJson.DataTableToJson("rows", dt);
         str = str.Substring(1, str.Length - 2);
         return("{\"total\":\"" + count + "\"," + str + "}");
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(ErrorJson);
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Query Class Time
        /// </summary>
        /// <param name="requestValue"></param>
        /// <param name="Data"></param>
        /// <param name="StationReturn"></param>
        public void QueryClassTime(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            DataTable dt = new DataTable();
            Dictionary <string, string> paras;

            if (string.IsNullOrEmpty(Data["WORK_SECTION"].ToString()) && string.IsNullOrEmpty(Data["DAY_DISTINCT"].ToString()))
            {
                //throw new Exception("Please Input Work Section Or Day Distinct");
                paras = null;
            }
            else
            {
                paras = new Dictionary <string, string>
                {
                    { "WORK_SECTION", Data["WORK_SECTION"].ToString().Trim() },
                    { "DAY_DISTINCT", Data["DAY_DISTINCT"].ToString().Trim() }
                };
            }
            OleExec        sfcdb     = this.DBPools["SFCDB"].Borrow();
            T_C_CLASS_TIME classTime = new T_C_CLASS_TIME(sfcdb, DB_TYPE_ENUM.Oracle);

            dt = classTime.GetShiftInfo(paras, sfcdb);
            if (dt != null && dt.Rows.Count > 0)
            {
                StationReturn.Status  = "PASS";
                StationReturn.Message = "OK";
                ConvertToJson ctj = new ConvertToJson();
                StationReturn.data = ctj.DataTableToJson(dt);
            }
            else
            {
                StationReturn.Status  = "Fail";
                StationReturn.Message = "No Date!";
                StationReturn.data    = "";
            }
            this.DBPools["SFCDB"].Return(sfcdb);
        }