using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ChatClient;

/// <summary>
///SendGPRS 的摘要说明
/// </summary>
public static class SendGPRS
{

    private static string GPRShead = "GPRS|WEB|";
    /// <summary>
    ///1.通断器实时数据查询
    ///命令格式：CXTD|通断器编号||！
    /// </summary>
    /// <param name="CJQ"></param>
    /// <param name="TQC"></param>
    public static void SendGPRS_CXTD(string CJQ,string TDQ)
	{
        //"GPRS|WEB|0001|CXTD|0002|!";
        string command = GPRShead + CJQ + "|" + "CXTD|" + TDQ + "||!";
        webChatClient.sentmessage(command);
	}
    /// <summary>
    //2、	热量表实时数据查询
    //命令格式：CXRB|热量表类型|热量表编号|！
    /// </summary>
    public static void SendGPRS_CXRB(string CJQ, string RLBtype, string RLB)
    {
        string command = GPRShead + CJQ +"|" +  "CXRB|" + RLBtype + "|" + RLB + "|!";
        webChatClient.sentmessage(command);
    }
    /// <summary>
    //3、	中心统一校时命令
    //命令格式：TIME|采集器编号|时间(20130805171824)|！
    /// </summary>
    public static void SendGPRS_TIME(string CJQ)
    {
        string time = System.DateTime.Now.ToString("yyyyMMddHHmmss");
        string command = GPRShead + CJQ + "|" + "TIME|" + CJQ + "|" + time + "|!";
        webChatClient.sentmessage(command);
    }
    /// <summary>
    //4,强制关断阀门
    //命令格式：QZGD|通断器编号|ON/OFF|!
    //GPRS收到后回传格式：QZGD |通断器编号|OK|！
    /// </summary>
    public static void SendGPRS_QZGD(string CJQ, string TDQ, string ONorOFF)
    {
        string command = GPRShead + CJQ +"|" +  "QZGD|" + TDQ+"|" + ONorOFF + "|!";
        webChatClient.sentmessage(command);
    }
    /// <summary>
    //5、	设定用户温度 0005   0105
    //命令格式：TEMP|通断器编号|温度|!
    //GPRS收到后回传格式：TEMP |通断器编号|OK|！
    /// </summary>
    public static void SendGPRS_TEMP(string CJQ, string TDQ, string WD)
    {
        if (WD.Length == 1)
        {
            WD = "0" + WD;
        }
        string command = GPRShead +CJQ + "|" +  "TEMP|" + TDQ +"|"+WD+ "|!";
        webChatClient.sentmessage(command);
    }

    /// <summary>
    //7、	遥控器设温使能            00/01
    //命令格式：YKSN|通断器编号|遥控器不可以控制/遥控器可以控制|!
    //GPRS收到后回传格式：YKSN|通断器编号|OK|！
    /// </summary>
    public static void SendGPRS_TEMPControl(string CJQ, string TDQ, string ONOFF)
    {

        if (ONOFF == "ON")
        {
            ONOFF = "01";
        }
        else
        {
            ONOFF = "00";
        }
        string command = GPRShead + CJQ + "|" + "YKSN|" + TDQ + "|" + ONOFF + "|!";
        webChatClient.sentmessage(command);
    }
    /// <summary>
    //6、	配置面积信息
    //命令格式：AREA|通断器编号|面积|！
    //GPRS收到后回传格式：AREA|通断器编号|OK|！
    /// </summary>
    public static void SendGPRS_AREA(string CJQ, string TDQ, string AREA)
    {
        string command = GPRShead + CJQ +"|" +  "AREA|" + TDQ + "|" + AREA + "|!";
        webChatClient.sentmessage(command);
    }

 
     /// <summary>
     ///7 供暖启停
     /// 命令格式：GNQT|采集器编号| ON/OFF|！
     ///GPRS收到后回传格式：GNQT|采集器编号|OK|！
    /// </summary>

    public static void SendGPRS_GNQT(string CJQ,string ONOFF)
    {
        string command = GPRShead + CJQ + "|" + "GNQT|" + CJQ + "|" + ONOFF + "|!";
        webChatClient.sentmessage(command);
    }

    /// <summary>
    ///8更换热表
    /// 命令格式：GHRB|旧热表编号|新热表编号|！
    ///GPRS收到后回传格式：GHRB |新热表编号|OK|！
    /// </summary>

    public static void SendGPRS_GHRB(string CJQ, string OldNum, string NewNum, string newtype)
    {
        string command = GPRShead + CJQ + "|" + "GHRB|" + OldNum + "|" + newtype+"+" + NewNum + "|!";
        webChatClient.sentmessage(command);
    }


    /// <summary>
    ///9更换通断
    /// 命令格式：GHTD|旧通断编号|新通断编号|！
    ///GPRS收到后回传格式：GHTD |新通断编号|OK|！
    /// </summary>

    public static void SendGPRS_GHTD(string CJQ, string OldNum, string NewNum)
    {
        string command = GPRShead + CJQ + "|" + "GHTD|" + OldNum + "|" + NewNum + "|!";
        webChatClient.sentmessage(command);
    }


}