MVP!
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using MesWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesDataFunction
|
||||
{
|
||||
public class PrinterCommandCenter
|
||||
{
|
||||
|
||||
public static bool PrintToPrinter(string opName, string code)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
Print_Sql.Select_Print_Template_Def(out string templateStr);
|
||||
|
||||
CallWebService.Call_getAllLabelContents(opName, code, out string res_code, out string res_message, out LabelContent labelContent);
|
||||
|
||||
List<LabelField> LabelFields = labelContent.LabelFields;
|
||||
var printContent = Template_Make_Zpl(templateStr, code);
|
||||
string LeftTop = "", RightTop = "", LeftBottom = "";
|
||||
|
||||
for (int i = 0; i < LabelFields.Count; i++)
|
||||
{
|
||||
if (LabelFields[i].Field == "TEXT1")
|
||||
{
|
||||
printContent = printContent.Replace("@LeftTop", LabelFields[i].Value);
|
||||
LeftTop = LabelFields[i].Value;
|
||||
}
|
||||
if (LabelFields[i].Field == "TEXT2")
|
||||
{
|
||||
printContent = printContent.Replace("@RightTop", LabelFields[i].Value);
|
||||
RightTop = LabelFields[i].Value;
|
||||
}
|
||||
if (LabelFields[i].Field == "TEXT3")
|
||||
{
|
||||
printContent = printContent.Replace("@LeftBottom", LabelFields[i].Value);
|
||||
LeftBottom = LabelFields[i].Value;
|
||||
}
|
||||
}
|
||||
if (LeftTop == "" || RightTop == "" || LeftBottom == "") return false;
|
||||
|
||||
MisDataFun.OpPrintBarCodeRecord_Add(opName, code, LeftTop, RightTop, LeftBottom);
|
||||
//PrintTo.Print(true, PP.PrintURL, new string[] { printContent });
|
||||
PrintTo.PrintByMqtt(opName, LeftTop, RightTop, LeftBottom, code);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string Template_Make_Zpl(string templateStr,string TowCode)
|
||||
{
|
||||
return templateStr.Replace("@TowCode", TowCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user