Commit 8eb2b377 刘韬

1

1 个父辈 5ef429ac
...@@ -22,7 +22,7 @@ namespace MES ...@@ -22,7 +22,7 @@ namespace MES
public event PrintEvent Printing; public event PrintEvent Printing;
public event SerialNoEvent GetSN; public event SerialNoEvent GetSN;
public string SNPREFIX = "5";
public User(string mesip) public User(string mesip)
{ {
InitializeComponent(); InitializeComponent();
...@@ -316,10 +316,11 @@ namespace MES ...@@ -316,10 +316,11 @@ namespace MES
//string code = _code[findIdx]; //以前 //string code = _code[findIdx]; //以前
string code = string.Format("{0}{3}{1}{3}{2}", s[0], s[1], val1, SPLIT); string code = string.Format("{0}{3}{1}{3}{2}", s[0], s[1], val1, SPLIT);
int sn = GetSN(code,true); int sn = GetSN(code,true);
if (printText.ContainsKey("sn")) if (printText.ContainsKey("sn"))
printText["sn"] = "5"+string.Format("{0:000}", sn); printText["sn"] = SNPREFIX + string.Format("{0:000}", sn);
else else
printText.Add("sn", "5" + string.Format("{0:000}", sn)); printText.Add("sn", SNPREFIX + string.Format("{0:000}", sn));
string temp = Printing?.Invoke(code); string temp = Printing?.Invoke(code);
System.Threading.Thread.Sleep(500); System.Threading.Thread.Sleep(500);
if (surCheck1.Checked) if (surCheck1.Checked)
...@@ -503,7 +504,7 @@ namespace MES ...@@ -503,7 +504,7 @@ namespace MES
bool rtn = result.Status == System.Net.NetworkInformation.IPStatus.Success; bool rtn = result.Status == System.Net.NetworkInformation.IPStatus.Success;
if (rtn) if (rtn)
{ {
string url = "http://" + _ip + "/myproject/rest/api/v2/mes/barcode?codeStr=" + code + "&batch=" + lot; string url = "http://" + _ip + "/rest/api/v2/mes/barcode?codeStr=" + code + "&batch=" + lot;
var client = new RestClient(url); var client = new RestClient(url);
LOG.Info("URL: " + url); LOG.Info("URL: " + url);
client.Timeout = -1; client.Timeout = -1;
......
...@@ -176,6 +176,7 @@ namespace BLL ...@@ -176,6 +176,7 @@ namespace BLL
_doc.Save(path); _doc.Save(path);
} }
} }
public string SNPREFIX;
/// <summary> /// <summary>
/// 识别类型 /// 识别类型
...@@ -374,6 +375,11 @@ namespace BLL ...@@ -374,6 +375,11 @@ namespace BLL
_node = _root.SelectSingleNode("MES"); _node = _root.SelectSingleNode("MES");
MES = _node.InnerText; MES = _node.InnerText;
_node = _root.SelectSingleNode("SNPREFIX");
SNPREFIX = _node.InnerText;
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
this.PicLabel = new System.Windows.Forms.PictureBox(); this.PicLabel = new System.Windows.Forms.PictureBox();
this.surPanel3 = new Asa.Face.SurPanel(); this.surPanel3 = new Asa.Face.SurPanel();
this.PicLogo = new System.Windows.Forms.PictureBox(); this.PicLogo = new System.Windows.Forms.PictureBox();
this.BtnDoScan = new Asa.Face.SurButton();
this.surPanel1.SuspendLayout(); this.surPanel1.SuspendLayout();
this.surPanel2.SuspendLayout(); this.surPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PicLabel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PicLabel)).BeginInit();
...@@ -148,6 +149,7 @@ ...@@ -148,6 +149,7 @@
this.surPanel1.BorderRect = new System.Drawing.Rectangle(1, 1, 198, 718); this.surPanel1.BorderRect = new System.Drawing.Rectangle(1, 1, 198, 718);
this.surPanel1.Controls.Add(this.ChsAdmin); this.surPanel1.Controls.Add(this.ChsAdmin);
this.surPanel1.Controls.Add(this.BtnPrintBatch); this.surPanel1.Controls.Add(this.BtnPrintBatch);
this.surPanel1.Controls.Add(this.BtnDoScan);
this.surPanel1.Controls.Add(this.BtnSet); this.surPanel1.Controls.Add(this.BtnSet);
this.surPanel1.Controls.Add(this.BtnLight); this.surPanel1.Controls.Add(this.BtnLight);
this.surPanel1.Controls.Add(this.BtnTrace); this.surPanel1.Controls.Add(this.BtnTrace);
...@@ -393,6 +395,23 @@ ...@@ -393,6 +395,23 @@
this.PicLogo.TabIndex = 16; this.PicLogo.TabIndex = 16;
this.PicLogo.TabStop = false; this.PicLogo.TabStop = false;
// //
// BtnDoScan
//
this.BtnDoScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BtnDoScan.BorderRect = new System.Drawing.Rectangle(0, 0, 182, 50);
this.BtnDoScan.BorderWidth = 0;
this.BtnDoScan.Font = new System.Drawing.Font("微软雅黑", 14F);
this.BtnDoScan.ImageSize = new System.Drawing.Size(0, 0);
this.BtnDoScan.Inside = false;
this.BtnDoScan.Location = new System.Drawing.Point(9, 605);
this.BtnDoScan.Name = "BtnDoScan";
this.BtnDoScan.Size = new System.Drawing.Size(182, 50);
this.BtnDoScan.StateColor = System.Drawing.Color.Empty;
this.BtnDoScan.TabIndex = 8;
this.BtnDoScan.Text = "启动识别";
this.BtnDoScan.Visible = false;
this.BtnDoScan.Click += new Asa.Face.MyEvent.Click(this.BtnDoScan_Click);
//
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -449,6 +468,7 @@ ...@@ -449,6 +468,7 @@
private Asa.Face.SurPanel surPanel2; private Asa.Face.SurPanel surPanel2;
private Asa.Face.SurPanel surPanel3; private Asa.Face.SurPanel surPanel3;
private System.Windows.Forms.PictureBox PicLogo; private System.Windows.Forms.PictureBox PicLogo;
private Asa.Face.SurButton BtnDoScan;
} }
} }
using System; using BLL;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
...@@ -482,7 +483,9 @@ namespace SmartCode ...@@ -482,7 +483,9 @@ namespace SmartCode
try try
{ {
Common.log.Info($"MES:{Common.Config.MES}"); Common.log.Info($"MES:{Common.Config.MES}");
userControl = new MES.User(Common.Config.MES); var mes =new MES.User(Common.Config.MES);
mes.SNPREFIX = Common.Config.SNPREFIX;
userControl = mes;
Control ctl = userControl.GetControl(); Control ctl = userControl.GetControl();
ctl.Location = new Point(6, PnlUser.TitleHeight + 6); ctl.Location = new Point(6, PnlUser.TitleHeight + 6);
ctl.Size = new Size(PnlUser.Width - 12, PnlUser.Height - PnlUser.TitleHeight - 12); ctl.Size = new Size(PnlUser.Width - 12, PnlUser.Height - PnlUser.TitleHeight - 12);
...@@ -698,8 +701,7 @@ namespace SmartCode ...@@ -698,8 +701,7 @@ namespace SmartCode
private void IO_DI_Changed_Event(BLL.Status[] sta) private void IO_DI_Changed_Event(BLL.Status[] sta)
{ {
//Common.log.Info("sta.Length=" + sta.Length + " sta[0]=" + sta[0].ToString()); Common.log.Info("sta.Length=" + sta.Length + " sta[0]=" + sta[0].ToString()+ ", isRun:" + isRun+ ", isTouch:"+ isTouch);
if (!isRun) return; if (!isRun) return;
if (sta == null) if (sta == null)
...@@ -713,14 +715,32 @@ namespace SmartCode ...@@ -713,14 +715,32 @@ namespace SmartCode
return; return;
} }
if (sta[Common.Config.IOTouch] == BLL.Status.On) if (sta[Common.Config.IOTouch] == BLL.Status.On)
{ {
if (isTouch) return; if (isTouch) return;
isTouch = true;
Common.log.Info("IO触发自动拍照"); Common.log.Info("IO触发自动拍照");
Invoke(new Action(() => Invoke(new Action(() =>
{ {
try
{
DoScan();
}catch (Exception ex) { Common.log.Error("DoScan:" + ex); }
finally {
Common.log.Info("DoScan finish");
isTouch = false;
}
}));
Common.log.Info("IO触发自动拍照完成");
}
else
{
isTouch = false;
}
}
void DoScan() {
bool rtn; bool rtn;
label = null; label = null;
...@@ -754,14 +774,6 @@ namespace SmartCode ...@@ -754,14 +774,6 @@ namespace SmartCode
userControl.Preview(); userControl.Preview();
labelReplace = userControl.GetPrint(); labelReplace = userControl.GetPrint();
PicLabel.Image = Common.Label.PrintLast(labelReplace, out string[] code); PicLabel.Image = Common.Label.PrintLast(labelReplace, out string[] code);
}));
isTouch = true;
Common.log.Info("IO触发自动拍照完成");
}
else
{
isTouch = false;
}
} }
private void ImgShow_ImageChanged(object sender) private void ImgShow_ImageChanged(object sender)
...@@ -898,11 +910,14 @@ namespace SmartCode ...@@ -898,11 +910,14 @@ namespace SmartCode
if (Common.Config.UserLimit[9]) if (Common.Config.UserLimit[9])
BtnSet.Enabled = true; BtnSet.Enabled = true;
ChsAdmin.Enabled = true; ChsAdmin.Enabled = true;
BtnDoScan.Visible = false;
} }
else else
{ {
isRun = true; isRun = true;
isTouch = false; isTouch = false;
BtnDoScan.Visible = true;
bool rtn; bool rtn;
label = null; label = null;
if (Common.Config.CameraSingle) if (Common.Config.CameraSingle)
...@@ -1151,6 +1166,11 @@ namespace SmartCode ...@@ -1151,6 +1166,11 @@ namespace SmartCode
} }
} }
private void BtnDoScan_Click(object sender)
{
DoScan();
}
//private void Button1_Click(object sender, EventArgs e) //private void Button1_Click(object sender, EventArgs e)
//{ //{
// OpenFileDialog dlg = new OpenFileDialog(); // OpenFileDialog dlg = new OpenFileDialog();
......
[2023-05-11 11:06:08,697][1]INFO =====程序开始===== [2023-11-14 16:40:27,277][1]INFO =====程序开始=====
[2023-05-11 11:06:08,708][1]INFO =====debug mode===== [2023-11-14 16:40:27,559][1]INFO =====程序开始1=====
[2023-05-11 11:09:58,256][1]INFO =====程序开始===== [2023-11-14 16:40:27,810][1]INFO MES:10.3.72.247
[2023-05-11 11:09:58,272][1]INFO =====debug mode===== [2023-11-14 16:40:27,867][1]INFO 加载MES面板完成
[2023-05-11 11:11:41,668][1]INFO =====程序开始1===== [2023-11-14 16:40:27,927][1]INFO 相机数量为0
[2023-05-11 11:11:43,396][1]INFO MES:10.3.72.247 [2023-11-14 16:40:27,927][1]INFO 没有连接相机
[2023-05-11 11:11:43,795][1]INFO 加载MES面板完成 [2023-11-14 16:40:29,968][1]INFO 没有IO模块:192.168.113.147
[2023-05-11 11:11:44,178][1]INFO 相机数量为0 [2023-11-14 16:40:34,032][1]INFO =====程序结束=====
[2023-05-11 11:11:44,179][1]INFO 没有连接相机
[2023-05-11 11:11:44,195][1]INFO 没有串口:COM5
[2023-05-11 11:11:49,215][1]INFO Ping 192.168.113.147 请求没有回应
[2023-05-11 11:12:20,571][1]INFO =====程序开始=====
[2023-05-11 11:12:20,587][1]INFO =====debug mode=====
[2023-05-11 11:12:23,605][1]INFO =====程序开始1=====
[2023-05-11 11:12:26,189][1]INFO MES:10.3.72.247
[2023-05-11 11:12:26,538][1]INFO 加载MES面板完成
[2023-05-11 11:12:27,120][1]INFO 相机数量为0
[2023-05-11 11:12:27,121][1]INFO 没有连接相机
[2023-05-11 11:12:27,134][1]INFO 没有串口:COM5
[2023-05-11 11:12:31,715][1]INFO Ping 192.168.113.147 请求没有回应
[2023-05-11 11:12:58,582][1]INFO =====程序结束=====
[2023-05-11 13:36:47,383][1]INFO =====程序开始=====
[2023-05-11 13:36:47,398][1]INFO =====debug mode=====
[2023-05-11 13:36:48,220][1]INFO =====程序开始1=====
[2023-05-11 13:36:50,509][1]INFO MES:10.3.72.247
[2023-05-11 13:36:50,952][1]INFO 加载MES面板完成
[2023-05-11 13:36:51,552][1]INFO 相机数量为0
[2023-05-11 13:36:51,552][1]INFO 没有连接相机
[2023-05-11 13:37:30,122][1]INFO =====程序开始=====
[2023-05-11 13:37:30,138][1]INFO =====debug mode=====
[2023-05-11 13:37:30,733][1]INFO =====程序开始1=====
[2023-05-11 13:37:33,097][1]INFO MES:10.3.72.247
[2023-05-11 13:37:33,448][1]INFO 加载MES面板完成
[2023-05-11 13:37:33,860][1]INFO 相机数量为0
[2023-05-11 13:37:33,861][1]INFO 没有连接相机
[2023-05-11 13:37:35,016][1]INFO
[2023-05-11 13:37:43,881][1]INFO =====程序结束=====
[2023-05-11 13:44:24,946][1]INFO =====程序开始=====
[2023-05-11 13:44:24,965][1]INFO =====debug mode=====
[2023-05-11 13:44:25,717][1]INFO =====程序开始1=====
[2023-05-11 13:44:27,887][1]INFO MES:10.3.72.247
[2023-05-11 13:44:28,208][1]INFO 加载MES面板完成
[2023-05-11 13:44:28,826][1]INFO 相机数量为0
[2023-05-11 13:44:28,827][1]INFO 没有连接相机
[2023-05-11 11:06:08,697][1]INFO =====程序开始=====
[2023-05-11 11:06:08,708][1]INFO =====debug mode=====
[2023-05-11 11:09:58,256][1]INFO =====程序开始=====
[2023-05-11 11:09:58,272][1]INFO =====debug mode=====
[2023-05-11 11:11:41,668][1]INFO =====程序开始1=====
[2023-05-11 11:11:43,396][1]INFO MES:10.3.72.247
[2023-05-11 11:11:43,795][1]INFO 加载MES面板完成
[2023-05-11 11:11:44,178][1]INFO 相机数量为0
[2023-05-11 11:11:44,179][1]INFO 没有连接相机
[2023-05-11 11:11:44,195][1]INFO 没有串口:COM5
[2023-05-11 11:11:49,215][1]INFO Ping 192.168.113.147 请求没有回应
[2023-05-11 11:12:20,571][1]INFO =====程序开始=====
[2023-05-11 11:12:20,587][1]INFO =====debug mode=====
[2023-05-11 11:12:23,605][1]INFO =====程序开始1=====
[2023-05-11 11:12:26,189][1]INFO MES:10.3.72.247
[2023-05-11 11:12:26,538][1]INFO 加载MES面板完成
[2023-05-11 11:12:27,120][1]INFO 相机数量为0
[2023-05-11 11:12:27,121][1]INFO 没有连接相机
[2023-05-11 11:12:27,134][1]INFO 没有串口:COM5
[2023-05-11 11:12:31,715][1]INFO Ping 192.168.113.147 请求没有回应
[2023-05-11 11:12:58,582][1]INFO =====程序结束=====
[2023-05-11 13:36:47,383][1]INFO =====程序开始=====
[2023-05-11 13:36:47,398][1]INFO =====debug mode=====
[2023-05-11 13:36:48,220][1]INFO =====程序开始1=====
[2023-05-11 13:36:50,509][1]INFO MES:10.3.72.247
[2023-05-11 13:36:50,952][1]INFO 加载MES面板完成
[2023-05-11 13:36:51,552][1]INFO 相机数量为0
[2023-05-11 13:36:51,552][1]INFO 没有连接相机
[2023-05-11 13:37:30,122][1]INFO =====程序开始=====
[2023-05-11 13:37:30,138][1]INFO =====debug mode=====
[2023-05-11 13:37:30,733][1]INFO =====程序开始1=====
[2023-05-11 13:37:33,097][1]INFO MES:10.3.72.247
[2023-05-11 13:37:33,448][1]INFO 加载MES面板完成
[2023-05-11 13:37:33,860][1]INFO 相机数量为0
[2023-05-11 13:37:33,861][1]INFO 没有连接相机
[2023-05-11 13:37:35,016][1]INFO
[2023-05-11 13:37:43,881][1]INFO =====程序结束=====
[2023-05-11 13:44:24,946][1]INFO =====程序开始=====
[2023-05-11 13:44:24,965][1]INFO =====debug mode=====
[2023-05-11 13:44:25,717][1]INFO =====程序开始1=====
[2023-05-11 13:44:27,887][1]INFO MES:10.3.72.247
[2023-05-11 13:44:28,208][1]INFO 加载MES面板完成
[2023-05-11 13:44:28,826][1]INFO 相机数量为0
[2023-05-11 13:44:28,827][1]INFO 没有连接相机
[2023-05-17 17:09:05,308][1]INFO =====程序开始=====
[2023-05-17 17:09:05,316][1]INFO =====debug mode=====
[2023-05-17 17:09:12,974][1]INFO =====程序开始1=====
[2023-05-17 17:09:13,633][1]INFO MES:10.3.72.247
[2023-05-17 17:09:13,945][1]INFO 加载MES面板完成
[2023-05-17 17:09:14,223][1]INFO 相机数量为0
[2023-05-17 17:09:14,223][1]INFO 没有连接相机
[2023-05-17 17:09:17,967][1]INFO 没有IO模块:192.168.113.147
[2023-05-17 17:09:31,308][1]INFO 手动点击相机图像菜单
[2023-05-17 17:09:34,822][1]INFO =====程序结束=====
[2023-05-17 17:15:34,702][1]INFO =====程序开始=====
[2023-05-17 17:15:34,712][1]INFO =====debug mode=====
[2023-05-17 17:15:38,237][1]INFO =====程序开始1=====
[2023-05-17 17:15:39,355][1]INFO MES:10.3.72.247
[2023-05-17 17:15:39,796][1]INFO 加载MES面板完成
[2023-05-17 17:15:39,998][1]INFO 相机数量为0
[2023-05-17 17:15:39,998][1]INFO 没有连接相机
[2023-05-17 17:15:43,599][1]INFO 没有IO模块:192.168.113.147
[2023-05-17 17:16:31,585][1]INFO =====程序开始=====
[2023-05-17 17:16:31,598][1]INFO =====debug mode=====
[2023-05-17 17:16:33,683][1]INFO =====程序开始1=====
[2023-05-17 17:16:35,097][1]INFO MES:10.3.72.247
[2023-05-17 17:16:35,332][1]INFO 加载MES面板完成
[2023-05-17 17:16:35,561][1]INFO 相机数量为0
[2023-05-17 17:16:35,561][1]INFO 没有连接相机
[2023-05-17 17:16:39,099][1]INFO 没有IO模块:192.168.113.147
[2023-05-17 17:16:45,521][1]INFO =====程序结束=====
[2023-05-17 17:17:01,820][1]INFO =====程序开始=====
[2023-05-17 17:17:01,843][1]INFO =====debug mode=====
[2023-05-17 17:17:06,537][1]INFO =====程序开始1=====
[2023-05-17 17:17:07,783][1]INFO MES:10.3.72.247
[2023-05-17 17:17:08,143][1]INFO 加载MES面板完成
[2023-05-17 17:17:08,448][1]INFO 相机数量为0
[2023-05-17 17:17:08,448][1]INFO 没有连接相机
[2023-05-17 17:17:12,441][1]INFO 没有IO模块:192.168.113.147
[2023-05-17 17:17:56,074][1]INFO =====程序开始=====
[2023-05-17 17:17:56,088][1]INFO =====debug mode=====
[2023-05-17 17:17:59,138][1]INFO =====程序开始1=====
[2023-05-17 17:18:00,165][1]INFO MES:10.3.72.247
[2023-05-17 17:18:00,396][1]INFO 加载MES面板完成
[2023-05-17 17:18:00,582][1]INFO 相机数量为0
[2023-05-17 17:18:00,582][1]INFO 没有连接相机
[2023-05-17 17:18:03,719][1]INFO 没有IO模块:192.168.113.147
[2023-05-17 17:18:41,596][1]INFO =====程序结束=====
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!