FrmSplicingConfig.cs
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using CodeLibrary;
using HalconDotNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
using Common;
namespace CodeSplicing
{
public partial class FrmSplicingConfig : Form
{
private List<CodeInfo> CodeResult = new List<CodeInfo>();
private String SplicingStr = "";
private HObject Ho_Image = null;
private Stopwatch stopwatch = new Stopwatch();
public FrmSplicingConfig()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
private void FrmMain_Load(object sender, EventArgs e)
{
//RID* PN*MPN * QTY * DATE * LOT
lblText.Text = "拼接格式说明:*为分隔符 " + "\r\nRID表示RealID对应的条码内容"
+ "\r\nPN表示Customer PN 对应的条码内容"
+ "\r\nQTY表示QTY对应的条码内容"
+ "\r\nDATE表示DATE对应的条码内容"
+ "\r\nLOT表示LOT对应的条码内容";
string config = ConfigAppSettings.GetValue(Setting_Init.SplicingStrConfig);
txtConfig.Text = config;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnHalconP_Click(object sender, EventArgs e)
{
string str = txtConfig.Text;
//TODO 验证是否符合规则
ConfigAppSettings.SaveValue(Setting_Init.SplicingStrConfig, str);
MessageBox.Show("保存成功");
}
private Stopwatch createStopWarch = new Stopwatch();
private bool isInProcess = false;
private void btnSplicing_Click(object sender, EventArgs e)
{
string currStr = SplicingStr;
string filePath = Application.StartupPath + @"\codeImage\";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
if (currStr.Equals(""))
{
MessageBox.Show("请先解析条码!", "提示");
return;
}
if (isInProcess)
{
MessageBox.Show("请等待上个二维码生成成功后再操作!", "提示");
return;
}
}
}
}