c# 编写的sato条码打印程序,打印时会跳纸,少出来几个条码
c# 编写的sato条码打印程序,有时在打印时会跳纸,少出来几个条码,有时是连续几个不出来,有时是少出来第一个或中间的几个条码,请帮忙看看这程序有什么问题,或者哪里可以改进避免这类问题发生。for (int i = 0; i <= printcount - 1; i++)C# sato --------------------编程问答-------------------- 顶上去,不要沉 --------------------编程问答-------------------- 两次发送之间延迟100毫秒试试 --------------------编程问答--------------------
{
string seqNo = GetSeq().ToString("d4");
string reelNo = textBox2.Text + YM + day + seqNo;
textBox7.Text = reelNo;
string ReelNo = receiveDate + seqNo;
string ipAddress = "10.3.14.42";
int hPort = 9100;
String c, stx, etx;
c = ((char)27).ToString();
stx = ((char)2).ToString();
etx = ((char)3).ToString();
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
client.Connect(ipAddress, hPort);
System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream());
StringBuilder SEND = new StringBuilder();
SEND.Append(stx + c + "A");
SEND.Append(c + "H600" + c + "V0005" + c + "L0102" + c + "XM" + textBox2.Text);
SEND.Append(c + "H600" + c + "V0050" + c + "L0102" + c + "XMINT Qty: " + textBox3.Text);
SEND.Append(c + "H600" + c + "V0100" + c + "L0102" + c + "XMBox Qty: " + textBox5.Text);
SEND.Append(c + "H600" + c + "V0155" + c + "L0102" + c + "XMLot: " + textBox1.Text);
SEND.Append(c + "H600" + c + "V0205" + c + "L0102" + c + "XMPrinted: " + DateTime.Now.ToString());
SEND.Append(c + "H600" + c + "V0260" + c + "L0102" + c + "XMSeq: " + seqNo);
SEND.Append(c + "H900" + c + "V0260" + c + "L0102" + c + "XMRecDate: " + receiveDate);
SEND.Append(c + "H600" + c + "V0315" + c + "L0102" + c + "XMExp: " + firstExpire);
SEND.Append(c + "H347" + c + "V0260" + c + "L0203" + c + "XM" + marking);
SEND.Append(c + "H1000" + c + "V0005" + c + "L0203" + c + "XM" + textBox8.Text);
SEND.Append(c + "H1100" + c + "V0100" + c + "L0408" + c + "XM" + MM);
string strqr = "," + textBox2.Text + "," + textBox5.Text + "," + DateTime.Now.ToString() + "," + ReelNo;
SEND.Append(c + "H347" + c + "V0040" + c + "BQ1005,0" + strqr);
SEND.Append(c + "Q1" + c + "Z" + etx);
//Open connection;
writer.Write(SEND);
writer.Flush();
writer.Close();
client.Close();
是在结尾添加一句 System.Threading.Thread.Sleep(1000); 吗
--------------------编程问答-------------------- 求其他答案。。。还是会发生跳纸现象 --------------------编程问答--------------------
Socket .。。。发送太快造成丢包了吧
补充:.NET技术 , C#