Usuário com melhor resposta
espelho mfd que não faz nada

Pergunta
-
ola estou tetando fazendo o espelho mfd porem simplesmente não acontece nada, estou usando esse codigo:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Bematech;
using Bematech.Fiscal.ECF;
using Bematech.Fiscal.ECF.CupomFiscal;
using Bematech.Fiscal.ECF.OperacoesNaoFiscais;
using Bematech.Fiscal.ECF.RelatoriosFiscais;
using Bematech.Fiscal.ECF.Informacoes;
using System.Runtime.InteropServices;
using System.IO;
using Bematech.Fiscal.GerenciamentoDados;
namespace Loja.UIWindows
{
public partial class EspelhoMFDFomr : Form
{
public EspelhoMFDFomr()
{
InitializeComponent();
}
[DllImport("BemaFi32.dll")]
public static extern void Bematech_FI_EspelhoMFD(string cNomeArquivoDestino, string cDadoInicial, string cDadoFinal, string cTipoDownload, string cUsuario, string cChavePublica, string cChavePrivada);
[DllImport("sign_bema.DLL", EntryPoint = "setLibType", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 setLibType(Int32 type);
[DllImport("sign_bema.DLL", EntryPoint = "genkkey", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 genkkey([MarshalAs(UnmanagedType.VBByRefStr)] ref string pubkey,
[MarshalAs(UnmanagedType.VBByRefStr)] ref string privatekey);
[DllImport("sign_bema.DLL", EntryPoint = "generateEAD", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 generateEAD(string filename, string publicKey, string privateKey,
[MarshalAs(UnmanagedType.VBByRefStr)] ref string ead,
Int32 sign);
[DllImport("sign_bema.DLL", EntryPoint = "validateFile", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 validateFile(string filename, string publicKey, string privateKey);
public void gerar()
{
string pubKey = "D0DDC7FAE1D4B9C9BF233F7C85AE3470DD93C342C96A670514EA98B84198D77FCCFB3F4ACBEDB5C993A272C74CB34F25EE235C45480924121DD77E620BE48ECB674E320C85A31EE8DCE2B332565A2F8F4B1932B2ACD9C8A6702EF95897B6A1ACB94068D8AB56B74DDB15BFFBEC3D45742EBF9825F0F9464C51A7ED05B13C7ED5";
string privKey = "EF152BD8DC29E3DBB63685C25CEDCA47464754404264E7EDCCA72718E1D64F1EEE44940E239043DEB129FEA0EB423CAEC4F8C2D7B18A84790D553C2AE2D38B7FDFA5428955469832A82F8A945421B74C871581043CE1E231ABBDF04F3FA9233D70E4F9D0863554AB88F5C04543AABF187E0B248623B96DBE631603BCF9AE2FAB";
if (escolha == true)
{
Bematech_FI_EspelhoMFD("C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", data_ini_text.Text, data_final_text.Text, "D", usuario_text.Text,"D0DDC7FAE1D4B9C9BF233F7C85AE3470DD93C342C96A670514EA98B84198D77FCCFB3F4ACBEDB5C993A272C74CB34F25EE235C45480924121DD77E620BE48ECB674E320C85A31EE8DCE2B332565A2F8F4B1932B2ACD9C8A6702EF95897B6A1ACB94068D8AB56B74DDB15BFFBEC3D45742EBF9825F0F9464C51A7ED05B13C7ED5","EF152BD8DC29E3DBB63685C25CEDCA47464754404264E7EDCCA72718E1D64F1EEE44940E239043DEB129FEA0EB423CAEC4F8C2D7B18A84790D553C2AE2D38B7FDFA5428955469832A82F8A945421B74C871581043CE1E231ABBDF04F3FA9233D70E4F9D0863554AB88F5C04543AABF187E0B248623B96DBE631603BCF9AE2FAB");
}
else
{
Bematech_FI_EspelhoMFD("C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", coo_ini_txtcoo_ini_txt.Text, coo_final_text.Text, "C", usuario_text.Text, pubKey, privKey);
}
}
private void EspelhoMFDFomr_Load(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
public Boolean escolha;
private void escolha_data_CheckedChanged(object sender, EventArgs e)
{
escolha = true;
}
private void escolha_coo_CheckedChanged(object sender, EventArgs e)
{
escolha = false;
}
private void button1_Click(object sender, EventArgs e)
{
gerar();
}
public string SetLength(int Tamanho)
{
int i;
string Retorno = "";
for (i = 0; i < Tamanho; i++)
Retorno = Retorno + " ";
return (Retorno);
}
}
}
Software Lagos Automação Comercial Cabo Frio - RJ
Respostas
-
Boa tarde!
Tenho um software que roda em qualquer impressora Bematech, entre outras.
Fiz o teste no emulador e deu o mesmo erro. Troquei o emulador por uma Bematech Térmica MP-4000 TH FI e executei o espelho e rodou de primeira. Ou seja, no meu caso o problema foi o Emulador. Inclusive retorna o mesmo código de erro da função Bematech_FI_DownloadMFDPorCOO: 3
T+
- Marcado como Resposta thiago pires pereira quarta-feira, 9 de fevereiro de 2011 16:58
Todas as Respostas
-
Boa tarde!
O método Bematech_FI_EspelhoMFD tem o retorno da execução. Armazene este retorno e poste aqui pra gente ver.... outra coisa, ative o log da bematech e poste também o arquivo de configuração BemaFI32.ini.
http://partners.bematech.com.br/bemacast/2010/02/edicao-50-arquivo-mfd-e-espelho-mfd-novas-funcoes/
T+
-
;----------------------------------------------------------------------------;; ;; BEMAFI32.INI ;; Ver 5.10.6.5 - Janeiro/2010 ;; ;; Arquivo de inicializacao da dll BemaFI32 para as impressoras fiscais ;; MP-20 FI II, MP-40 FI II, MP-2000 FI TH, MP-2100 TH FI, MP-3000 TH FI ;; MP-4000 TH FI, MP-6000 FI TH, MP-6100 TH FI, MP-7000 TH FI, MP-25 FI e ;; MP-50 FI ;; ;;----------------------------------------------------------------------------;
[Sistema]Porta=COM3Path=C:\Status=0Retorno=0StatusFuncao=0ControlePorta=1ModeloImp=BEMATECHConfigRede=0ModoGaveta=0Log=0LogDiario=0CrLfVinculado=0CrLfGerencial=0TimeOutGerencial=40EmulMFD=0StatusCheque=CalculoIcmsCupom=0ForceWTSClient=1RetriesWTSCmd=3HabilitaRFDImpMFD=0GerarRFD=0
[ModoRemoto]IP=Porta=
[MFD]Impressora=0StatusErro=1TimeOutZ=99
[Opcional]Favorecido=Cidade=
[SoftwareHouse]COO=NumeroAplicativo=CNPJ=IE=IM=RazaoSocial=NomeAplicativo=Versao=Linha1=Linha2=
[ECF]IM=UF=
[Formato];; +------------------------------------- coluna do valor numerico; | +---------------------------------- coluna extenso 1; | | +------------------------------- coluna extenso 2; | | | +---------------------------- coluna favorecido; | | | | +------------------------- coluna da cidade; | | | | | +---------------------- coluna do dia; | | | | | | +------------------- coluna do mes; | | | | | | | +---------------- coluna do ano; | | | | | | | | +------------- linha do valor numerico; | | | | | | | | | +---------- linha do extenso 1; | | | | | | | | | | +------- linha do extenso 2; | | | | | | | | | | | +---- linha do favorecido; | | | | | | | | | | | | +- linha da cidade/data; | | | | | | | | | | | | |000=51,04,01,05,06,60,65,81,01,06,08,11,14001=51,10,01,06,18,50,54,71,02,05,08,10,12003=49,08,01,05,18,52,55,72,01,05,07,09,12004=52,09,01,05,18,50,53,72,02,06,09,11,13006=56,10,01,05,15,43,48,72,01,06,08,10,13008=56,17,01,07,18,50,55,71,03,06,09,11,13021=52,12,01,04,18,49,53,71,02,07,09,11,13022=52,07,01,04,15,44,49,71,02,06,08,10,13024=51,07,01,05,18,48,52,72,01,05,07,09,12027=51,10,01,06,18,50,54,71,02,05,08,10,12028=55,06,01,05,18,50,53,71,01,05,08,10,12029=55,12,01,04,18,50,55,72,01,06,08,10,13031=51,10,01,06,18,50,54,71,02,05,08,10,12032=51,10,01,06,18,50,54,71,02,05,08,10,12033=48,17,01,06,18,46,50,71,02,06,08,11,13034=49,14,01,04,15,45,57,71,01,05,07,09,11035=51,10,01,06,18,50,54,71,02,05,08,10,12036=51,10,01,06,18,50,54,71,02,05,08,10,12037=51,10,01,06,18,50,54,71,02,05,08,10,12038=56,10,01,04,18,51,56,72,02,07,10,12,14039=51,10,01,06,18,50,54,71,02,05,08,10,12041=56,09,01,04,18,54,61,72,03,07,09,12,14047=52,08,01,05,18,47,50,72,01,05,07,10,12048=51,10,01,06,18,50,54,71,02,05,08,10,12059=50,15,01,05,18,55,59,72,01,05,07,09,11070=54,05,01,05,18,48,52,72,02,06,08,10,12104=56,13,01,04,18,48,53,72,01,04,07,10,12106=52,12,01,05,18,52,55,71,02,07,09,11,13151=54,06,01,04,18,47,52,71,01,05,07,10,12153=51,09,01,05,18,51,55,72,01,05,08,10,13168=53,05,01,05,18,54,57,71,02,06,08,11,13200=52,06,01,05,18,47,52,71,01,05,07,10,12201=52,11,01,04,18,47,51,71,01,05,07,09,11206=56,14,01,06,18,53,56,72,01,06,08,10,13207=50,04,01,05,18,48,52,71,02,06,08,11,13211=48,11,01,05,18,52,56,71,03,07,09,12,14215=55,06,01,05,18,51,54,71,02,05,08,10,13220=56,09,01,05,18,49,53,71,02,05,08,10,12230=50,12,01,05,18,54,58,71,02,05,08,10,13231=52,12,01,05,18,53,58,72,02,06,08,10,12237=50,01,01,04,18,50,54,71,02,06,09,11,14244=48,14,01,04,18,49,53,71,03,06,09,11,13254=51,09,01,05,18,53,56,71,01,05,08,11,14275=51,07,01,04,18,46,52,68,03,08,10,12,14282=56,12,01,05,18,50,54,71,02,06,08,10,13291=51,10,01,06,18,50,54,71,02,05,08,10,12294=51,10,01,06,18,50,54,71,02,05,08,10,12302=51,07,01,05,18,47,51,71,02,06,08,10,13308=51,10,01,06,18,50,54,71,02,05,08,10,12320=54,06,01,04,18,48,51,72,02,05,08,10,13334=54,06,01,04,18,54,57,71,02,06,08,10,12341=54,08,01,05,18,50,54,72,02,06,09,12,15346=54,12,01,05,18,54,57,71,02,05,08,10,12347=53,15,01,04,18,47,51,72,02,06,09,11,14351=52,14,01,05,18,55,58,72,01,05,07,10,12353=52,07,01,05,18,53,58,71,02,05,07,10,12356=51,10,01,06,18,50,54,71,02,05,08,10,12369=47,07,01,05,18,51,55,71,02,06,08,10,12370=52,06,01,05,18,47,50,71,01,05,07,10,12372=51,07,01,04,18,46,49,71,02,06,08,11,13376=54,07,01,04,18,54,58,72,02,06,08,10,12388=46,09,01,06,18,48,52,72,02,06,09,11,14389=52,06,01,05,18,53,58,72,02,07,09,12,14392=49,12,01,05,18,54,58,72,02,05,07,11,13394=51,05,01,05,18,51,55,71,01,05,07,09,13399=54,12,01,04,18,52,57,72,01,05,07,10,12409=55,12,01,04,23,52,58,71,04,07,09,11,13415=54,12,01,06,18,50,54,72,03,07,10,12,14420=54,08,01,04,18,50,54,72,02,06,08,10,13422=51,10,01,06,18,50,54,71,02,05,08,10,12424=51,10,01,06,18,50,54,71,02,05,08,10,12434=56,08,01,05,18,50,54,72,02,06,09,11,13453=54,12,01,05,18,51,56,72,03,07,10,12,14456=48,11,01,05,18,47,50,71,02,06,08,10,12464=51,10,01,06,18,50,54,71,02,05,08,10,12472=53,12,01,05,18,50,53,71,02,06,09,10,14477=55,08,01,05,18,52,57,72,03,07,09,11,14479=53,07,01,05,18,50,53,71,02,06,08,10,12483=52,08,01,05,18,47,50,71,02,05,07,09,11487=58,17,01,05,18,48,52,72,02,06,08,11,13494=51,09,01,05,18,50,53,71,02,06,08,10,13602=56,10,01,03,18,47,52,66,02,05,07,10,13603=51,10,01,06,18,50,54,71,02,05,08,10,12607=51,09,01,05,18,53,56,72,02,05,08,10,12610=55,15,01,05,18,53,58,71,01,06,08,10,12630=49,05,01,05,18,47,52,71,01,06,08,10,13718=51,07,01,05,18,48,53,71,01,06,08,10,13756=51,10,01,06,18,50,54,71,02,05,08,10,12995=51,10,01,06,18,50,54,71,02,05,08,10,12996=51,10,01,06,18,50,54,71,02,05,08,10,12998=80,03,01,04,22,54,60,80,03,05,06,08,10
[FormatoYanco]999=61,12,02,03,23,50,61,78,04,09,13,18,22,10000=38,03,03,03,00,11,35,78,12,17,22,26,31,05001=61,12,02,03,23,50,61,78,04,09,13,18,22,10003=60,14,02,04,26,54,63,78,12,22,31,44,53,05004=62,10,00,01,19,47,60,78,08,22,35,44,53,05006=62,10,00,01,20,47,60,78,07,22,35,44,53,05007=61,10,01,02,19,47,60,76,04,09,14,18,22,10008=59,17,05,06,25,53,62,78,07,11,16,20,24,10020=62,10,00,01,20,47,60,78,07,22,35,44,53,05021=62,10,00,01,19,47,60,78,08,22,35,44,53,05022=61,15,03,06,25,53,61,78,07,21,30,39,52,05024=62,10,00,01,19,47,60,78,08,22,35,44,53,05026=62,10,00,01,20,47,60,78,07,22,35,44,53,05027=61,10,00,01,20,47,60,78,04,09,15,18,22,10028=61,10,01,01,20,47,60,78,04,09,15,18,22,10029=63,13,01,03,26,53,62,78,07,25,35,44,56,05030=62,10,00,01,19,47,60,78,03,09,14,18,21,10031=61,17,03,05,22,50,60,78,13,23,37,46,54,05032=62,11,00,01,20,47,60,78,07,21,35,44,53,05033=56,15,02,04,22,49,59,78,05,11,14,18,23,10034=62,10,00,01,20,47,60,78,07,23,36,45,54,05035=62,10,00,00,22,49,60,78,04,09,15,18,22,10036=62,12,02,03,23,50,61,78,07,16,29,39,48,05037=62,10,00,01,20,47,60,78,07,22,35,44,54,05038=60,11,01,02,22,50,60,78,12,26,39,49,58,05039=62,10,00,01,20,47,60,78,07,22,35,44,53,05041=60,11,02,04,26,53,63,77,07,11,16,20,24,20043=62,10,00,01,20,47,60,78,07,22,35,44,53,05047=62,10,00,01,20,47,60,78,07,22,35,44,54,05048=59,10,01,02,22,49,59,78,11,26,35,44,57,05059=62,10,00,01,20,47,60,78,07,22,35,44,54,05070=62,10,00,01,20,47,60,78,07,21,35,44,53,05104=59,17,02,03,27,54,64,78,04,09,13,17,20,10106=63,13,02,03,25,53,62,78,08,26,34,49,57,05109=62,10,00,01,19,47,60,78,08,22,35,44,53,05111=62,10,00,01,20,47,60,78,07,22,35,44,53,05113=62,10,00,01,20,47,60,78,07,22,35,44,53,05116=62,10,00,01,20,47,60,78,07,22,35,44,53,05148=62,10,00,01,20,47,60,78,07,22,35,44,53,05150=62,11,00,01,20,47,60,78,07,21,35,44,53,05151=61,12,02,02,23,50,60,78,07,21,30,39,48,05152=63,11,00,01,20,47,60,78,04,09,15,18,22,10153=64,13,02,04,25,52,62,78,04,09,15,18,22,10164=62,10,00,01,20,47,60,78,07,22,35,44,53,05165=62,10,00,01,20,47,60,78,07,22,35,44,53,05166=62,10,00,01,20,47,60,78,07,22,35,44,53,05168=59,11,01,02,24,51,62,78,12,26,35,44,53,05171=62,10,00,01,20,47,60,78,07,22,35,44,53,05175=62,10,00,01,20,47,60,78,07,22,35,44,53,05184=62,10,00,01,20,47,60,78,07,22,35,44,53,05200=58,12,01,02,24,52,59,78,08,25,39,52,65,05201=59,14,02,03,21,48,60,78,12,21,30,39,52,05202=62,10,00,01,20,47,60,78,07,22,35,44,53,05204=62,10,00,01,20,47,60,78,07,22,35,44,53,05205=61,10,00,01,18,47,60,78,08,24,38,47,55,05206=59,17,02,03,26,54,64,78,11,21,30,39,52,05207=62,11,01,02,20,47,61,78,04,09,14,18,22,10208=62,07,10,00,01,20,47,60,78,22,35,44,53,05209=62,10,00,01,20,47,60,78,07,22,35,44,53,05210=62,10,00,01,20,47,60,78,07,22,35,44,53,05211=62,10,00,01,20,47,60,78,07,22,35,44,53,05212=61,10,01,02,20,47,60,78,04,10,15,19,22,10213=62,10,00,01,20,47,60,56,78,07,22,35,44,05214=62,10,00,01,20,47,60,78,07,22,35,44,53,05215=57,16,02,04,22,49,60,78,12,26,35,44,52,05216=62,10,00,01,20,47,60,78,07,22,35,44,53,05217=62,10,00,01,20,47,60,78,07,22,35,44,53,05219=62,10,00,01,19,47,60,78,08,22,35,44,53,05220=62,10,00,01,20,47,60,78,07,22,35,44,53,05221=62,10,00,01,20,47,60,78,07,22,35,44,53,05222=62,10,00,01,20,47,60,78,07,22,35,44,53,05223=62,10,00,01,19,47,60,78,08,22,35,44,53,05224=62,10,00,01,20,47,60,78,07,22,35,44,53,05225=62,10,00,01,20,47,60,78,07,22,35,44,53,05226=61,10,00,01,19,47,60,78,08,22,35,44,53,05229=62,10,00,01,19,47,60,78,08,22,35,44,53,05230=60,14,01,02,26,53,63,78,11,26,35,44,57,05233=62,10,00,01,19,47,60,78,08,22,35,44,53,05237=58,13,00,02,22,50,61,78,06,11,16,20,23,10239=62,10,00,01,19,47,60,78,08,22,35,44,53,05242=62,10,00,01,19,47,60,78,08,22,35,44,53,05251=62,10,00,01,19,47,60,78,08,22,35,44,53,05252=62,10,00,01,19,47,60,78,08,22,35,44,53,05254=62,10,00,01,19,47,60,78,07,22,35,44,53,05267=62,10,00,01,20,47,60,78,03,09,15,18,21,10275=59,11,04,03,23,51,60,78,05,13,18,22,25,20291=57,16,03,04,23,49,59,78,06,11,15,18,22,10294=60,14,02,04,27,54,63,78,12,21,31,44,53,05334=61,13,02,03,24,54,64,78,04,09,13,16,20,10341=58,11,03,04,25,53,62,78,04,11,16,20,25,10347=59,14,01,03,26,53,63,78,10,25,35,44,56,05351=62,16,01,03,26,53,62,78,07,21,32,40,52,05353=70,01,01,01,36,54,63,80,02,06,10,14,17,10361=62,10,00,01,20,47,60,78,07,22,35,44,53,05366=59,15,02,02,23,50,61,78,12,25,39,48,57,05369=61,12,02,03,23,50,62,78,08,21,35,44,53,05389=61,13,04,04,26,54,63,78,13,30,40,53,61,05392=60,14,02,03,21,48,60,78,11,25,34,43,56,05399=62,21,05,06,26,53,63,78,04,09,13,18,22,10409=57,19,04,06,23,51,61,78,07,13,16,20,23,10412=62,11,00,01,20,47,60,78,09,21,34,44,54,05415=61,16,03,04,25,53,62,77,05,11,16,20,23,10434=61,14,03,09,24,51,61,78,05,09,14,18,23,10477=62,13,03,06,26,53,61,78,07,12,16,22,25,10479=61,13,01,03,22,50,60,78,04,09,13,17,22,10605=60,13,02,04,26,54,63,78,12,21,30,44,53,05
[Copia]Banco=Valor=Favorecido=Cidade=Data=ImpressaoVerso=Linhas=Mensagem=
[RelatorioTipo60]COOInicial=COOFinal=GTInicial=GTFinal=
[TEF]REQ=C:\TEF_DIAL\REQRESP=C:\TEF_DIAL\RESPSTATUS=0LINHAS=74BYTES=0VIAS=1
[CONFIG]InicioDia=0DATARED=TOTSUPR=MOEDASING=RealMOEDAPLU=Reais
[ReducaoYanco]GT=COO=CANC=ACRE=DESC=ALIQ=SANG=SUPR=TOTPARC=TOTNSUJ=CONTNSU=CONTOPN=NUMALIQ=DATAMOV=
[Info]StampVinculado=StampGerencial=
ps estou suando o emulador da impressora fsical
falou
Software Lagos Automação Comercial Cabo Frio - RJ -
-
-
mudei meu codigo para esse:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Bematech;
using Bematech.Fiscal.ECF;
using Bematech.Fiscal.ECF.CupomFiscal;
using Bematech.Fiscal.ECF.OperacoesNaoFiscais;
using Bematech.Fiscal.ECF.RelatoriosFiscais;
using Bematech.Fiscal.ECF.Informacoes;
using System.Runtime.InteropServices;
using System.IO;
using Bematech.Fiscal.GerenciamentoDados;
namespace Loja.UIWindows
{
public partial class EspelhoMFDFomr : Form
{
public EspelhoMFDFomr()
{
InitializeComponent();
}
[DllImport("BemaFi32.dll")]
public static extern void Bematech_FI_EspelhoMFD(string cNomeArquivoDestino, string cDadoInicial, string cDadoFinal, string cTipoDownload, string cUsuario, string cChavePublica, string cChavePrivada);
[DllImport("sign_bema.DLL", EntryPoint = "setLibType", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 setLibType(Int32 type);
[DllImport("sign_bema.DLL", EntryPoint = "genkkey", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 genkkey([MarshalAs(UnmanagedType.VBByRefStr)] ref string pubkey,
[MarshalAs(UnmanagedType.VBByRefStr)] ref string privatekey);
[DllImport("sign_bema.DLL", EntryPoint = "generateEAD", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 generateEAD(string filename, string publicKey, string privateKey,
[MarshalAs(UnmanagedType.VBByRefStr)] ref string ead,
Int32 sign);
[DllImport("sign_bema.DLL", EntryPoint = "validateFile", SetLastError = false,
CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 validateFile(string filename, string publicKey, string privateKey);
public void gerar()
{
string pubKey = "D0DDC7FAE1D4B9C9BF233F7C85AE3470DD93C342C96A670514EA98B84198D77FCCFB3F4ACBEDB5C993A272C74CB34F25EE235C45480924121DD77E620BE48ECB674E320C85A31EE8DCE2B332565A2F8F4B1932B2ACD9C8A6702EF95897B6A1ACB94068D8AB56B74DDB15BFFBEC3D45742EBF9825F0F9464C51A7ED05B13C7ED5";
string privKey = "EF152BD8DC29E3DBB63685C25CEDCA47464754404264E7EDCCA72718E1D64F1EEE44940E239043DEB129FEA0EB423CAEC4F8C2D7B18A84790D553C2AE2D38B7FDFA5428955469832A82F8A945421B74C871581043CE1E231ABBDF04F3FA9233D70E4F9D0863554AB88F5C04543AABF187E0B248623B96DBE631603BCF9AE2FAB";
// if (escolha == true)
// {
// int iRetorno = BemaFI32.Bematech_FI_EspelhoMFD(@"C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", data_ini_text.Text, data_final_text.Text, "D", usuario_text.Text,pubKey,privKey);
int iRetorno = BemaFI32.Bematech_FI_EspelhoMFD(@"C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", "000100", "000200", "c", "1", pubKey, privKey);
BemaFI32.Analisa_iRetorno(iRetorno);
if (iRetorno == 1)
{
MessageBox.Show("Arquivo gerado!");
}
else
{
MessageBox.Show("erro");
}
// Bematech_FI_EspelhoMFD("C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", Convert.ToString(data_ini_text.Text), Convert.ToString(data_final_text.Text), "D", Convert.ToString(usuario_text.Text),"D0DDC7FAE1D4B9C9BF233F7C85AE3470DD93C342C96A670514EA98B84198D77FCCFB3F4ACBEDB5C993A272C74CB34F25EE235C45480924121DD77E620BE48ECB674E320C85A31EE8DCE2B332565A2F8F4B1932B2ACD9C8A6702EF95897B6A1ACB94068D8AB56B74DDB15BFFBEC3D45742EBF9825F0F9464C51A7ED05B13C7ED5","EF152BD8DC29E3DBB63685C25CEDCA47464754404264E7EDCCA72718E1D64F1EEE44940E239043DEB129FEA0EB423CAEC4F8C2D7B18A84790D553C2AE2D38B7FDFA5428955469832A82F8A945421B74C871581043CE1E231ABBDF04F3FA9233D70E4F9D0863554AB88F5C04543AABF187E0B248623B96DBE631603BCF9AE2FAB");
/* else
{
Bematech_FI_EspelhoMFD("C:\\Users\\Thiago\\Desktop\\ESPELHOMFD.txt", coo_ini_txt.Text, coo_final_text.Text, "C", usuario_text.Text, pubKey, privKey);
}*/
}
private void EspelhoMFDFomr_Load(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
public Boolean escolha;
private void escolha_data_CheckedChanged(object sender, EventArgs e)
{
escolha = true;
}
private void escolha_coo_CheckedChanged(object sender, EventArgs e)
{
escolha = false;
}
private void button1_Click(object sender, EventArgs e)
{
gerar();
}
public string SetLength(int Tamanho)
{
int i;
string Retorno = "";
for (i = 0; i < Tamanho; i++)
Retorno = Retorno + " ";
return (Retorno);
}
}
}
porem agora ele fala que tem erro de execussão.
Software Lagos Automação Comercial Cabo Frio - RJ -
-
Bom dia!
O log fica no C:\ de acordo com seu arquivo de configuração.
Execute somente este comando e coloca o log aqui pra gente ver.
Quanto a ser o Emulador, vc teria que ligar no suporte da Bematech pra verificar se funciona este comando com o emulador.
T+
-
Olá Thiago,
Sim, estas operações tbm funcionam com o Emulador e percebi no seu arquivo .ini que a chave EmulMFD está desativada. É assim mesmo que esta chave precisa ficar quando realiza operações com a MFD do Emulador e a comunicação com ele é realizada via cabo serial com pinagem específica ou através de porta virtual. Nosso pessoal de suporte usa nos testes com o Emulador o programa VirtualSerialPort que vc baixa na WEB.
Se desejar, entre em contato com nosso suporte exclusivo via 0800 644 7277 ou por email suporte@bematech.com.br para que o pessoal possa lhe orientar.
Ats,
André Munhoz -
o log não esta aparecendo, deve ser algo na configuração, porque o mesmo erro ocorre no meu codigo e no codigo de exemplo da bematech, se alguem puder me ajudar vou ficar grato
obrigado a todos que estao me ajudando aki.
Software Lagos Automação Comercial Cabo Frio - RJ -
Oi Thiago,
O log é ativado pelas chaves Log e LogDiario iguais a 1.
Entre em contato com nosso suporte ou me passe seu telefone de contato em PVT para que possamos verificar melhor o que está ocorrendo.
Ats,
André Munhoz
andre.munhoz@bematech.com.br -
2011-02-09 13:36:04 - -----------------------------------------------------------------------
2011-02-09 13:36:04 - Bematech_FI_LeInformacoesConfiguracao
2011-02-09 13:36:04 - Versão BemaFI32.Dll: 5,10,8,0
2011-02-09 13:36:04 - Versão BemaMFD.dll: 1,0,2,0
2011-02-09 13:36:04 - Versão BemaMFD2.dll: 1,0,3,0
2011-02-09 13:36:04 - path: C:\Users\Thiago\Desktop
2011-02-09 13:36:04 - Log: 1
2011-02-09 13:36:04 - LogDiario: 1
2011-02-09 13:36:04 - Status: 0
2011-02-09 13:36:04 - Retorno: 0
2011-02-09 13:36:04 - ControlePorta: 1
2011-02-09 13:36:04 - StatusFuncao: 0
2011-02-09 13:36:04 - ModeloImp: BEMATECH
2011-02-09 13:36:04 - ModoGaveta: 0
2011-02-09 13:36:04 - EmulMFD: 1
2011-02-09 13:36:04 - StatusCheque: 0
2011-02-09 13:36:04 - Porta: DEFAULT
2011-02-09 13:36:04 - StatusErro: 1
2011-02-09 13:36:04 - TimeOutZ: 99
2011-02-09 13:36:04 - Impressora: 1
2011-02-09 13:36:04 - TimeOutGerencial: 40
2011-02-09 13:36:04 - CrLfVinculado: 0
2011-02-09 13:36:04 - Gerencial: 0
2011-02-09 13:36:04 - ForceWTSClient: 1
2011-02-09 13:36:04 - RetriesWTSCmd: 3
2011-02-09 13:36:04 - Software House - COO: 0
2011-02-09 13:36:04 - Software House - NumeroAplicativo: 0
2011-02-09 13:36:04 - Software House - CNPJ: 0
2011-02-09 13:36:04 - Software House - IE: 0
2011-02-09 13:36:04 - Software House - IM: 0
2011-02-09 13:36:04 - Software House - RazaoSocial: 0
2011-02-09 13:36:04 - Software House - NomeAplicativo: 0
2011-02-09 13:36:04 - Software House - Versao: 0
2011-02-09 13:36:04 - Software House - Linha1: 0
2011-02-09 13:36:04 - Software House - Linha2: 0
2011-02-09 13:36:04 - ECF - IM: 0
2011-02-09 13:36:04 - ECF - UF: 0
2011-02-09 13:36:04 - GerarRFD: 1
2011-02-09 13:36:04 - CalculoIcmsCupom: 0
2011-02-09 13:36:04 - HabilitaRFDImpMFD: 1
2011-02-09 13:36:04 - Retorno Bematech_FI_LeInformacoesConfiguracao: OK
2011-02-09 13:36:04 - -----------------------------------------------------------------------
2011-02-09 13:36:04 - Bematech_FI_EspelhoMFD
2011-02-09 13:36:04 - Parâmetros: C:\Users\Thiago\Desktop\ESPELHOMFD.txt|000003|000003|C|1|||
2011-02-09 13:36:04 - Bematech_FI_DownloadMFD
2011-02-09 13:36:04 - Parâmetros: 2|000003|000003|C:\Users\Thiago\Desktop\Download.MFD|1
2011-02-09 13:36:04 - Bematech_FI_DownloadMFDPorCOO
2011-02-09 13:36:04 - Retorno Bematech_FI_DownloadMFDPorCOO: 3
2011-02-09 13:36:04 - Retorno Bematech_FI_DownloadMFD: 3
2011-02-09 13:36:04 - Retorno Bematech_FI_EspelhoMFD: -1 - Erro de execucao na funcao Bematech_FI_DownloadMFD:
Software Lagos Automação Comercial Cabo Frio - RJ -
Boa tarde!
Tenho um software que roda em qualquer impressora Bematech, entre outras.
Fiz o teste no emulador e deu o mesmo erro. Troquei o emulador por uma Bematech Térmica MP-4000 TH FI e executei o espelho e rodou de primeira. Ou seja, no meu caso o problema foi o Emulador. Inclusive retorna o mesmo código de erro da função Bematech_FI_DownloadMFDPorCOO: 3
T+
- Marcado como Resposta thiago pires pereira quarta-feira, 9 de fevereiro de 2011 16:58
-
confirmaram comigo que o emulador nao faz essa função, valeu e obrigado por tudo
Software Lagos Automação Comercial Cabo Frio - RJ- Sugerido como Resposta João Marlon quinta-feira, 27 de dezembro de 2012 19:42
-