Card.KeLuoMuMZ.WriteGasCard C# (CSharp) Метод

WriteGasCard() публичный Метод

售气写卡
public WriteGasCard ( short com, int baud, string &kmm, string kh, string dqdm, int ql, int csql, int ccsql, short cs, int ljgql, int bjql, int czsx, int tzed, string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj ) : int
com short 串口号,0代表串口1
baud int
kmm string 卡密码
kh string 卡号
dqdm string 地区代码
ql int 气量,小于或等于0,表示退气,大于0表示购气。
csql int 上次气量
ccsql int 上上次气量
cs short 次数
ljgql int 累购气量
bjql int 报警气量
czsx int 充值上限
tzed int 透支额度
sqrq string 售气日期
cssqrq string 上次售气日期
oldprice int 老价格
newprice int 新价格
sxrq string 售气日期
sxbj string 生效标记
Результат int
        public int WriteGasCard(short com, int baud, ref string kmm, string kh, string dqdm, int ql, int csql, int ccsql, short cs, int ljgql, int bjql, int czsx, int tzed, string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj)
        {
            String buf;
            Log.Debug("买气前读卡格式:");
            MingHua.GetSnapShot(com, baud, out buf);

            byte[] cardNo = System.Text.Encoding.GetEncoding(1252).GetBytes(kh);
           
            Int32 syql = 0;//当前表剩余气量
            Int32 klx = 0; //卡类型
            Int32 orderamount = 0;
            Int32 orderNum = 0;

            byte[] cardid = new byte[20];
            byte[] customeid = new byte[20];
            Log.Debug("WriteGasCard(short com, int baud, ref string kmm, string kh, string dqdm, int ql, int csql, int ccsql, short cs, int ljgql, int bjql, int czsx, int tzed, string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj)=("
             + com + "," + baud + "," + kmm + "," + kh
             + dqdm + "," + ql + "," + csql + "," + ccsql
             + cs + "," + ljgql + "," + bjql + "," + czsx
             + tzed + "," + sqrq + "," + cssqrq + "," + oldprice
             + newprice + "," + sxrq + "," + sxbj
             + ")");
            int readresult = ReadGasCard(com, cardid, customeid, ref orderamount, ref orderNum, ref ljgql, ref syql, ref klx);
            Log.Debug("WriteGasCard(short com, int baud, ref string kmm, string kh, string dqdm, int ql, int csql, int ccsql, short cs, int ljgql, int bjql, int czsx, int tzed, string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj)=("
                       + com + "," + baud + "," + kmm + "," + kh
                       + dqdm + "," + ql + "," + csql + "," + ccsql
                       + cs + "," + ljgql + "," + bjql + "," + czsx
                       + tzed + "," + sqrq + "," + cssqrq + "," + oldprice
                       + newprice + "," + sxrq + "," + sxbj
                       + ")=" + readresult);
            byte[] customeNo = customeid;
            string khq = Encoding.ASCII.GetString(cardNo, 0, 8);
            string yhhq = Encoding.ASCII.GetString(customeNo, 0, 10);
            Log.Debug("sell gas start:"+"kh:"+khq+"--yhh:"+yhhq+"--cs:"+cs+"--ql:"+ql);
            int result = StaticWriteGasCard(com, cardNo, customeNo, cs, ql);

             Log.Debug("write gas card result=" + result);
             Log.Debug("买气后读卡格式:");
             String buf2;
             MingHua.GetSnapShot(com, baud, out buf2);
             Log.Debug(buf);
             Log.Debug(buf2);
             return result;
    
        }
        public int FormatGasCard(short com, int baud, string kmm, string kh, string dqdm)