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)
{
int ret = -1;
try
{
byte[] s_companycode = new byte[10];
int cardtype = 0;
byte[] keycode = new byte[20];
byte[] dllpsw = System.Text.Encoding.GetEncoding(1252).GetBytes("20D1DA9B8399C77D"); ;
byte[] userid = System.Text.Encoding.GetEncoding(1252).GetBytes(kh);
byte[] meterid = System.Text.Encoding.GetEncoding(1252).GetBytes("7654321");
byte[] orderid = System.Text.Encoding.GetEncoding(1252).GetBytes("0120141120000013");
byte[] orderlsh = new byte[16];
double price = (double)newprice;
double totalmoney = price * ql;
int readflag = 0;
int css = (int)cs;
Log.Debug("写卡参数:" + "卡号:" + kh + "--本次气量:" + ql);
if (ql > 0)
{
ret = StaticBuyGas(com, dllpsw, s_companycode, 1, userid, meterid, orderid, keycode, price, totalmoney, 0);
Log.Debug("购气结果:" + ret);
}
else
{
ret = StaticBuyGas(com, dllpsw, s_companycode, 1, userid, meterid, orderid, keycode, price, 0, 0);
Log.Debug("退气结果:" + ret);
}
}
catch (Exception e)
{
Log.Debug("购气异常:" + e.Message + "----" + e.StackTrace);
}
return ret;
}