Ejemplo n.º 1
0
        /// <summary>
        ///  保存一天的CSV文件
        /// </summary>
        /// <param name="Door">门号</param>
        /// <param name="Way">路径</param>
        public static void PaeserveInfo(int Door, string Way)
        {
            string BeginTime = Convert.ToString(DateTime.Now.AddDays(0).ToString("yyyy-MM-dd 00:00:00"));

            string EndTime = Convert.ToString(DateTime.Now.AddDays(0).ToString("yyyy-MM-dd 23:59:59"));

            try
            {
                string    sql = string.Format(@"select * from [dbo.tb_MachineStatus] where [Door] like '%{0}%'and [WriteTime] >= '{1}' and [WriteTime] <= '{2}'", Door, BeginTime, EndTime);
                DataTable dt  = SqlServerHelp.Query(sql).Tables[0];
                //DataTable dt = new DataTable();
                // dt = SqlServerHelp.Query(sql).Tables[0];
                dt.Columns["id"].ColumnName = "ID";

                dt.Columns["WriteTime"].ColumnName = "采集时间";

                dt.Columns["Door"].ColumnName = "门号";

                dt.Columns["UpperLimitOfTemperature"].ColumnName = "上限温度";

                dt.Columns["LowerTemperatureLimit"].ColumnName = "下限温度";

                dt.Columns["SetValueMonitoringTemperature"].ColumnName = "设定温度";

                dt.Columns["MonitoringTemperature"].ColumnName = "监控温度";

                dt.Columns["RunTime"].ColumnName = "运行时间";

                dt.Columns["SetTime"].ColumnName = "设定时间";
                Common.CSVHelper.SaveCSV(dt, Way);//保存CSV文件
            }
            catch (Exception ex) { }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改MES校验接口配置
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static int UploadCheckoutMES(List <string> list)
        {
            String Sql  = string.Format(@"Update [dbo.tb_MES] set ElectricCore_WSDL='{0}', ElectricCore_TimeOut='{1}', ElectricCore_User='******',
            ElectricCore_Password='******' ,ElectricCore_site='{4}'", list[0], list[1], list[2], list[3], list[4]);
            int    conn = SqlServerHelp.ExecuteSql(Sql);

            return(conn);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 修改系统配置
        /// </summary>
        /// <param name="COM">端口号</param>
        /// <param name="RefreshTime">刷新时间</param>
        /// <param name="SetCSV">CSV保存路径</param>
        /// <returns></returns>
        public static int SysetInfo(List <string> List)
        {
            string Setsql = string.Format(@"Update tb_syset set Prefix='{0}', Plc_ip='{1}',  ComAddress='{2}',
            Renovate='{3}' ,[CSV_log]='{4}',Cancellation='{5}'", List[0], List[1], List[2], List[3], List[4], List[5]);
            int    conn   = SqlServerHelp.ExecuteSql(Setsql);

            return(conn);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 报警日志错误查询
        /// </summary>
        /// <param name="LineNumber"></param>
        /// <param name="timeBegin"></param>
        /// <param name="timeEnd"></param>
        /// <returns></returns>
        public static DataTable InquiryError(string LineNumber, string timeBegin, string timeEnd)
        {
            string sql = string.Format(@"select top {0}*from dbo.[dbo.tb_Error]  where [ErrorTime] >= '{1}' and [ErrorTime] <= '{2}'", LineNumber, timeBegin, timeEnd);

            //sql查询语句,注意查询命令不能加 % 号
            //语法and [SyTime] >= '{2}' and [SyTime] <= '{3}'"
            connError = SqlServerHelp.Query(sql).Tables[0];
            return(connError);
        }
Ejemplo n.º 5
0
        //   string Prefix, string Plc_ip, string COM, string RefreshTime, string SetCSV
        /// <summary>
        /// 修改炉子资源号配置
        /// </summary>
        /// <param name="List"></param>
        public static int ResourceNumberSet(List <string> List)
        {
            string Setsql = string.Format(@"Update [dbo.tb_MES] set ResourceNumberOne='{0}', ResourceNumberTwo='{1}',  ResourceNumberThree='{2}',
            ResourceNumberFour='{3}' ,ResourceNumberFive='{4}',  ResourceNumberSix='{5}' ,ResourceNumberSeven='{6}' ,ResourceNumberEight='{7}'",
                                          List[0], List[1], List[2], List[3], List[4], List[5], List[6], List[7]);
            int conn = SqlServerHelp.ExecuteSql(Setsql);

            return(conn);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 查询采集温度
        /// </summary>
        /// <param name="Door">门号</param>
        /// <param name="LineNumber">查询行数</param>
        /// <param name="timeBegin">查询开始时间</param>
        /// <param name="timeEnd">查询停止时间</param>
        /// <returns></returns>
        public static DataTable Inquiry(string Door, string LineNumber, string timeBegin, string timeEnd)
        {
            string sql = string.Format(@"select top {0}*from dbo.[dbo.tb_MachineStatus] 
        where [Door] like '%{1}%'and  [WriteTime] >= '{2}'
        and [WriteTime] <= '{3}'", LineNumber, Door, timeBegin, timeEnd);

            //sql查询语句,注意查询命令不能加 % 号
            //语法and [SyTime] >= '{2}' and [SyTime] <= '{3}'"
            conn = SqlServerHelp.Query(sql).Tables[0];
            return(conn);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改MES收数接口配置
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static int UploadChargeNumberMES(List <string> list)
        {
            String Sql = string.Format(@"Update [dbo.tb_MES] set ChargeNumber_WSDL='{0}', ChargeNumber_TimeOut='{1}', ChargeNumber_User='******',
            ChargeNumber_Password='******',ChargeNumber_site='{4}',  ChargeNumber_Operation='{5}',ChargeNumber_OperationRevision='{6}',
            ChargeNumber_ActivityId='{7}',ChargeNumber_IsDispositionRequired='{8}',ChargeNumber_DcGroup='{9}',
            ChargeNumber_DcGroupRevision='{10}'", list[0], list[1], list[2], list[3], list[4],
                                       list[5], list[6], list[7], list[8], list[9], list[10]);
            int conn = SqlServerHelp.ExecuteSql(Sql);

            return(conn);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 采集到的温度写入数据库
        /// </summary>
        /// <param name="stove">机器号</param>
        /// <param name="storey">机器层数</param>
        /// <param name="RunStatus">机器运行状态</param>
        /// <param name="data">机器温度集合</param>
        /// <param name="id">数据库id</param>
        public static void UpdateInfo(int stove, int storey, string RunStatus, List <double> data, int id)
        {
            string str = "";

            for (int i = 0; i < data.Count; i++)
            {
                str += "0" + data[i] + ",";
            }
            string sql = string.Format(@"update dbo_Rur set stove='{0}',storey='{1}',RunStatus='{2}',temperature='{3}',UpdateTime='{4}' where id='{5}' ",
                                       stove, storey, RunStatus, str, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), id);

            SqlServerHelp.ExecuteSql(sql);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 查询MES系统配置
        /// </summary>
        /// <returns></returns>
        public static DataSet GetSysConfigMES()
        {
            string sql = string.Format(@"select * from [dbo.tb_MES] ");

            return(SqlServerHelp.DtQuery(sql));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 查询系统配置
        /// </summary>
        /// <returns></returns>
        public static DataSet GetSysConfig()
        {
            string sql = string.Format(@"select * from tb_SySet ");

            return(SqlServerHelp.DtQuery(sql));
        }