コード例 #1
0
 public static bool PreMakeInvoice()
 {
     try
     {
         if (taxCard_0.TaxMode != CTaxCardMode.tcmHave)
         {
             return(true);
         }
         byte[] buffer  = new byte[0x10];
         byte[] buffer2 = null;
         ilog_0.Debug("[注册] 调用9Bit接口开始");
         taxCard_0.Get9BitHashTaxCode(out buffer2, 0);
         ilog_0.Debug("[注册] 调用9Bit接口结束");
         if (buffer2 == null)
         {
             ilog_0.Error("调用接口返回的Hash税号为空");
             return(false);
         }
         Xihaa.GenProKey(buffer, buffer2);
         if (buffer.Length < 0x10)
         {
             ilog_0.Error("调用接口返回的过程密钥为空");
             return(false);
         }
         ilog_0.Debug("[注册] 调用Pre接口开始");
         string str = taxCard_0.PreMakeInvoice(buffer, 0);
         ilog_0.DebugFormat("[注册] 调用Pre接口结束,返回值={0}", str);
         if (ToolUtil.GetReturnErrCode(str) == 0)
         {
             return(true);
         }
         ilog_0.Error("调用开票初始化接口失败,错误号=" + errCode);
         return(false);
     }
     catch (Exception exception)
     {
         ilog_0.Error(exception.Message);
         return(false);
     }
 }