示例#1
0
        public Ret OpenCard(string factory, string kmm, string kh, string dqdm)
        {
            String args = "OpenCard";

            Log.Debug(args + " started.");

            args += " " + (String.IsNullOrWhiteSpace(factory) ? "0" : factory);
            args += " " + (String.IsNullOrWhiteSpace(kmm) ? "\"0\"" : "\"" + kmm + "\"");
            args += " " + (String.IsNullOrWhiteSpace(kh) ? "0" : kh);
            args += " " + (String.IsNullOrWhiteSpace(dqdm) ? "0" : dqdm);

            String   result = null;
            WriteRet ret    = new WriteRet();

            try
            {
                if (this.Spawn(args, out result))
                {
                    ret = JsonConvert.DeserializeObject <WriteRet>(result);
                    Log.Debug(args + "=" + result);
                }
                else
                {
                    ret.Err = "调用未返回。";
                    Log.Debug(args + "=" + ret.Err);
                }
            }
            catch (Exception e)
            {
                ret.Exception = e.Message;
                ret.Err       = "调用错误。";
            }
            return(ret);
        }
示例#2
0
        public WriteRet WriteNewCard(Stream param, string factory, string kmm, string kzt, string kh, string dqdm, string yhh, string tm,
                                     string ql, string csql, string ccsql, string cs, string ljgql, string bkcs, string ljyql, string bjql, string czsx, string tzed,
                                     string sqrq, string cssqrq, string oldprice, string newprice, string sxrq, string sxbj, string klx, string meterid)
        {
            String args = "WriteNewCard";

            Log.Debug(args + " started.");
            StreamReader paramReader = new StreamReader(param);
            string       paramStr    = paramReader.ReadToEnd();

            args += " " + (String.IsNullOrWhiteSpace(paramStr) ? "0" : paramStr);
            args += " " + (String.IsNullOrWhiteSpace(factory) ? "0" : factory);
            args += " " + (String.IsNullOrWhiteSpace(kmm) ? "\"0\"" : "\"" + kmm + "\"");
            args += " " + kzt;
            args += " " + (String.IsNullOrWhiteSpace(kh) ? "0" : kh);
            args += " " + (String.IsNullOrWhiteSpace(dqdm) ? "0" : dqdm);
            args += " " + (String.IsNullOrWhiteSpace(yhh) ? "0" : yhh);
            args += " " + (String.IsNullOrWhiteSpace(tm) ? "0" : tm);
            args += " " + ql;
            args += " " + csql;
            args += " " + ccsql;
            args += " " + cs;
            args += " " + ljgql;
            args += " " + bkcs;
            args += " " + ljyql;
            args += " " + bjql;
            args += " " + czsx;
            args += " " + tzed;
            args += " " + (String.IsNullOrWhiteSpace(sqrq) ? "0" : sqrq);
            args += " " + (String.IsNullOrWhiteSpace(cssqrq) ? "0" : cssqrq);
            args += " " + oldprice;
            args += " " + newprice;
            args += " " + (String.IsNullOrWhiteSpace(sxrq) ? "0" : sxrq);
            args += " " + (String.IsNullOrWhiteSpace(sxbj) ? "0" : sxbj);
            args += " " + klx;
            args += " " + (String.IsNullOrWhiteSpace(meterid) ? "0" : meterid);

            String   result = null;
            WriteRet ret    = new WriteRet();

            try
            {
                if (this.Spawn(args, out result))
                {
                    ret = JsonConvert.DeserializeObject <WriteRet>(result);
                    Log.Debug(args + "=" + result);
                }
                else
                {
                    ret.Err = "调用未返回。";
                    Log.Debug(args + "=" + ret.Err);
                }
            }
            catch (Exception e)
            {
                ret.Exception = e.Message;
                ret.Err       = "调用错误。";
            }
            return(ret);
        }
示例#3
0
        public WriteRet WriteNewCard(string factory, string kmm, short kzt, string kh, string dqdm, string yhh, string tm,
                                     int ql, int csql, int ccsql, short cs, int ljgql, short bkcs, int ljyql, int bjql, int czsx, int tzed,
                                     string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj)
        {
            String args = "WriteNewCard";

            Log.Debug(args + " started.");

            args += " " + (String.IsNullOrWhiteSpace(factory) ? "0" : factory);
            args += " " + (String.IsNullOrWhiteSpace(kmm) ? "\"0\"" : "\"" + kmm + "\"");
            args += " " + kzt;
            args += " " + (String.IsNullOrWhiteSpace(kh) ? "0" : kh);
            args += " " + (String.IsNullOrWhiteSpace(dqdm) ? "0" : dqdm);
            args += " " + (String.IsNullOrWhiteSpace(yhh) ? "0" : yhh);
            args += " " + (String.IsNullOrWhiteSpace(tm) ? "0" : tm);
            args += " " + ql;
            args += " " + csql;
            args += " " + ccsql;
            args += " " + cs;
            args += " " + ljgql;
            args += " " + bkcs;
            args += " " + ljyql;
            args += " " + bjql;
            args += " " + czsx;
            args += " " + tzed;
            args += " " + (String.IsNullOrWhiteSpace(sqrq) ? "0" : sqrq);
            args += " " + (String.IsNullOrWhiteSpace(cssqrq) ? "0" : cssqrq);
            args += " " + oldprice;
            args += " " + newprice;
            args += " " + (String.IsNullOrWhiteSpace(sxrq) ? "0" : sxrq);
            args += " " + (String.IsNullOrWhiteSpace(sxbj) ? "0" : sxbj);


            String   result = null;
            WriteRet ret    = new WriteRet();

            try
            {
                if (this.Spawn(args, out result))
                {
                    ret = JsonConvert.DeserializeObject <WriteRet>(result);
                    Log.Debug(args + "=" + result);
                }
                else
                {
                    ret.Err = "调用未返回。";
                    Log.Debug(args + "=" + ret.Err);
                }
            }
            catch (Exception e)
            {
                ret.Exception = e.Message;
                ret.Err       = "调用错误。";
            }
            return(ret);
        }
示例#4
0
 //写购气卡
 public WriteRet WriteGasCard(
     string factory,     //厂家
     string kmm,     //卡密码,写卡后返回新密码
     string kh,          //卡号
     string dqdm,        //地区代码,从气表管理里取
     Int32 ql,           //气量
     Int32 csql,         //上次购气量,有些表需要传
     Int32 ccsql,        //上上次购气量,有些表需要传
     Int16 cs,           //购气次数
     Int32 ljgql,        //当前表累计购气量
     Int32 bjql,         //报警气量
     Int32 czsx,         //充值上限,可以在气表管理中设置
     Int32 tzed,         //透支额度,可以在气表管理中设置
     string sqrq,        //售气日期,格式为YYYYMMDD
     string cssqrq,      //上次售气日期,格式为YYYYMMDD
     Int32 oldprice,     //旧单价,价格管理中取
     Int32 newprice,     //新单价,价格管理中取
     string sxrq,        //生效日期,价格管理中取
     string sxbj         //生效标记,0不生效,1生效,价格管理中取
     )
 {
     Log.Debug("SellGas start");
     WriteRet ret = new WriteRet();
     try
     {
         ICard card = GetCard(factory);
         int r = card.WriteGasCard(Port, Baud, ref kmm, kh, dqdm, ql, csql, ccsql, cs, ljgql, bjql, czsx,
             tzed, sqrq, cssqrq, oldprice, newprice, sxrq, sxbj);
         Log.Debug("WriteGasCard  r " + r);
         if (r < 0)
         {
             ret.Err = FindErrorInfo(r);
         }
         else
         {
             ret.Kmm = kmm;
         }
         Log.Debug("WriteGasCard  ret " + ret);
         return ret;
     }
     catch (Exception e)
     {
         Log.Debug("SellGas exception: " + e.Message);
         ret.Exception = e.Message;
         return ret;
     }
 }
示例#5
0
 //写新卡
 public WriteRet WriteNewCard(
     string factory,     //厂家代码
     string kmm,     //卡密码,写卡后返回新密码
     Int16 kzt,          //卡状态,0开户卡,1用户卡
     string kh,          //卡号
     string dqdm,        //地区代码,从气表管理里取
     string yhh,         //用户号,档案中自己输入
     string tm,          //条码,传用户档案里的条码
     Int32 ql,           //气量
     Int32 csql,         //上次购气量,有些表需要传
     Int32 ccsql,        //上上次购气量,有些表需要传
     Int16 cs,           //购气次数
     Int32 ljgql,        //当前表累计购气量
     Int16 bkcs,         //补卡次数,用户档案里保存补卡次数
     Int32 ljyql,        //累计用气量,有些表要累加原来用气量
     Int32 bjql,         //报警气量
     Int32 czsx,         //充值上限,可以在气表管理中设置
     Int32 tzed,         //透支额度,可以在气表管理中设置
     string sqrq,        //售气日期,格式为YYYYMMDD
     string cssqrq,      //上次售气日期,格式为YYYYMMDD
     Int32 oldprice,     //旧单价,价格管理中取
     Int32 newprice,     //新单价,价格管理中取
     string sxrq,        //生效日期,价格管理中取
     string sxbj        //生效标记,0不生效,1生效,价格管理中取
     
     )
 {
     Log.Debug("发卡或者补卡 start" + "cardid-" + kh + "sqrq-" + sqrq + "czsx-" + czsx + "bjql-" + bjql + "gmje-" + ql + "buyprice-" + oldprice);
     WriteRet ret = new WriteRet();
     try
     {
         ICard card = GetCard(factory);
         int r = card.WriteNewCard(Port, Baud, ref kmm, kzt, kh, dqdm, yhh, tm, ql, csql, ccsql, cs, ljgql, bkcs,
             ljyql, bjql, czsx, tzed, sqrq, cssqrq, oldprice, newprice, sxrq, sxbj);
         if (r < 0)
         {
             ret.Err = FindErrorInfo(r);
         }
         else
         {
             ret.Kmm = kmm;
         }
         return ret;
     }
     catch (Exception e)
     {
         Log.Debug("发卡 exception: " + e.Message);
         ret.Exception = e.Message;
         return ret;
     }
 }