Commit 3b364888 张东亮

打印机多cid打印

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