84 lines
2.9 KiB
C#
84 lines
2.9 KiB
C#
using LibReadTetraExcel;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
|
||
namespace TestPackOCR
|
||
{
|
||
public partial class Form1 : Form
|
||
{
|
||
public Form1()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void Form1_Load(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
string order = txt_OrderNum.Text;
|
||
if (string.IsNullOrEmpty(order))
|
||
{
|
||
Console.WriteLine("订单号为空,请输入订单号。");
|
||
return;
|
||
}
|
||
|
||
Console.WriteLine("当前订单号为:" + order);
|
||
var config = ExcelHelper.ReadOCROrder("OCR文件0602.xlsx", order);
|
||
if (config.ParseQSV)
|
||
{
|
||
Console.WriteLine("当前订单QSV:" + config.QSV);
|
||
Console.WriteLine("当前订单Number Of Lanes:" + config.NumberOfLanes);
|
||
|
||
var result = config.OCRDesign
|
||
.GroupBy(kvp => kvp.Value, kvp => kvp.Key)
|
||
.ToDictionary(g => g.Key, g => g.ToList());
|
||
foreach (var kvp in result)
|
||
{
|
||
listBox1.Items.Add(string.Join(",", kvp.Value));
|
||
listBox1.Items.Add(string.Join(",", config.OCRRequest[kvp.Value[0]]));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Console.WriteLine("QSV未找到,请检查订单号是否正确");
|
||
return;
|
||
}
|
||
if (config.ParseProduct)
|
||
{
|
||
Console.WriteLine("当前订单产品编号:" + config.ProductStandard);
|
||
Console.WriteLine("当前订单幅宽:" + config.Width);
|
||
Console.WriteLine ("当前订单幅高:" + config.Height);
|
||
Console.WriteLine("当前订单梯度:" + config.Gradient);
|
||
}
|
||
else
|
||
{
|
||
Console.WriteLine("ProductStandard未找到,请检查订单号是否正确");
|
||
return;
|
||
}
|
||
if (config.ParseArrange)
|
||
{
|
||
Console.WriteLine("当前订单X偏移:" + config.DistX);
|
||
Console.WriteLine("当前订单Y偏移:" + config.DistY);
|
||
Console.WriteLine("当前排布方式:" + config.ColorArray);
|
||
Console.WriteLine("单行最大数量:" + config.ColorMax.ToString());
|
||
}
|
||
else
|
||
{
|
||
Console.WriteLine("DistX,DistY未找到,请检查订单号是否正确");
|
||
return;
|
||
}
|
||
Console.WriteLine("相关数据已获取完成,且已显示在界面中,请查看。");
|
||
}
|
||
}
|
||
}
|