Commit 3b364888 张东亮

打印机多cid打印

1 个父辈 58dffb44
......@@ -75,14 +75,21 @@ namespace ShelfPrinter
}
void printLabel(Label_LZ label_LZ)
{
print.LoadLabel(labelName);
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("lh", label_LZ.pn);
text.Add("jt", label_LZ.station);
text.Add("xb", label_LZ.line);
text.Add("sj", label_LZ.shijian);
text.Add("zb", label_LZ.slot);
pictureBox1.Image = print.Print(text);
try
{
print.LoadLabel(labelName);
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("lh", label_LZ.pn);
text.Add("jt", label_LZ.station);
text.Add("xb", label_LZ.line);
text.Add("sj", label_LZ.shijian);
text.Add("zb", label_LZ.slot);
pictureBox1.Image = print.Print(text);
}catch(Exception ex)
{
LogUtil.error("printLabel", ex);
}
}
Dictionary<string, string> printview(Label_LZ label_LZ)
{
......@@ -120,6 +127,7 @@ namespace ShelfPrinter
{
printLabel(new Label_LZ(textBox1.Text, textBox3.Text, textBox4.Text, textBox2.Text,textBox5.Text,textBox6.Text));
}
string[] cids = ConfigAppSettings.GetValue("cid", "01#02").Split('#');
object handleObj = new object();
private void timer1_Tick(object sender, EventArgs e)
{
......@@ -127,37 +135,41 @@ namespace ShelfPrinter
{
try
{
Label_LZ labels = SServerManager.GetPrintInfo();
if (labels != null)
foreach (var item in cids)
{
lblLabelInfo.Text = "";
// if (printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle))
Label_LZ labels = SServerManager.GetPrintInfo(item);
if (labels != null)
{
timer1.Enabled = false;
//foreach (var item in labels)
// if (printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle))
{
lblLabelInfo.Text = $"打印任务:{labels.ToStr()}";
printLabel(new Label_LZ(labels.pn, labels.side, labels.station, labels.line));
while (printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Printing)
|| printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Print))
timer1.Enabled = false;
//foreach (var item in labels)
{
Thread.Sleep(300);
}
LogUtil.info($"自动打印[{printerStatus.ToString()}]:{labels.ToStr()}");
while (true)
{
if (SServerManager.FinishPrint())
break;
Thread.Sleep(1000);
lblLabelInfo.Text = $"打印任务[{item}]:{labels.ToStr()}";
printLabel(new Label_LZ(labels.pn, labels.side, labels.station, labels.line));
while (printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Printing)
|| printerStatus.Equals(Asa.PrintLabel.PrinterStatus.Print))
{
Thread.Sleep(300);
}
LogUtil.info($"自动打印[{printerStatus.ToString()}]:{labels.ToStr()}");
while (true)
{
if (SServerManager.FinishPrint(item))
break;
Thread.Sleep(1000);
}
}
timer1.Enabled = true;
}
timer1.Enabled = true;
//else
//{
// lblLabelInfo.Text = "无法打印标签,因打印机不空闲";
//}
}
//else
//{
// lblLabelInfo.Text = "无法打印标签,因打印机不空闲";
//}
lblLabelInfo.Text = "";
}
}
catch (Exception ex)
{
......
......@@ -200,13 +200,13 @@ namespace OnlineStore.DeviceLibrary
}
#region 料架打印机接口
static string Addr_GetPrintInfo = ConfigAppSettings.GetValue("Addr_GetPrintInfo", "/service/store/innerBox/rack/getPrintInfo");
public static Label_LZ GetPrintInfo()
public static Label_LZ GetPrintInfo(string cid)
{
try
{
string msg = "";
Dictionary<string, string> map = new Dictionary<string, string>();
map.Add("cid", ConfigAppSettings.GetValue("cid", "01"));
map.Add("cid", cid);
string server = GetAddr(Addr_GetPrintInfo, map);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
......@@ -219,13 +219,12 @@ namespace OnlineStore.DeviceLibrary
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = $" GetPrintInfo 【{resultStr}】";
LogUtil.error(msg);
return null;
}
else
{
msg = $" GetPrintInfo【{resultStr}】";
LogUtil.debug(msg);
LogUtil.info(msg);
if (string.IsNullOrEmpty(serverResult.data.pn)) return null;
else
return serverResult.data;
......@@ -239,13 +238,13 @@ namespace OnlineStore.DeviceLibrary
}
static string Addr_FinishPrint = ConfigAppSettings.GetValue("Addr_FinishPrint", "/service/store/innerBox/rack/finishPrint");
public static bool FinishPrint()
public static bool FinishPrint(string cid)
{
try
{
string msg = "";
Dictionary<string, string> map = new Dictionary<string, string>();
map.Add("cid", ConfigAppSettings.GetValue("cid","01"));
map.Add("cid", cid);
string server = GetAddr(Addr_FinishPrint, map);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
......@@ -263,7 +262,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
msg = $" GetFeederInfo【{resultStr}】";
msg = $" FinishPrint【{resultStr}】";
LogUtil.debug(msg);
return false;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!