diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index 64b0298..ce7a0c7 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -275,6 +275,7 @@ TrunOutDialog.cs + diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs index 14d5187..d5282f3 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs @@ -307,7 +307,7 @@ this.msglbl.Name = "msglbl"; this.msglbl.Size = new System.Drawing.Size(101, 12); this.msglbl.TabIndex = 24; - this.msglbl.Text = "正在获取基础信息"; + this.msglbl.Text = ""; // // barPrintCheck // diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 16488af..8fdc02e 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -661,7 +661,7 @@ namespace ButcherFactory.SegmentProductionAuto_ { if (netStateWatch1.NetState) { - if (historyList.Any()) + if (historyList!=null && historyList.Any()) { int c = 50; if (historyList.Count() < 50) @@ -754,10 +754,12 @@ namespace ButcherFactory.SegmentProductionAuto_ } catch (Exception ex) { - this.Invoke(new Action(() => - { - msglbl.Text = "ERROR" + ex.Message ?? string.Empty; - })); + this.Invoke(new Action(() => + { + var msg = ex.Message ?? string.Empty; + msglbl.Text = "ERROR:" + msg; + LogUtil.WriteErrorFile(msg, "分割品车间称重计数"); + })); } Thread.Sleep(5000); } diff --git a/ButcherFactory.Form/Utils/LogUtil.cs b/ButcherFactory.Form/Utils/LogUtil.cs new file mode 100644 index 0000000..e696139 --- /dev/null +++ b/ButcherFactory.Form/Utils/LogUtil.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace ButcherFactory.Utils +{ + public static class LogUtil + { + /// + /// 记录失败日志 + /// + /// 内容 + /// 类型(oa mdg sap) + public static void WriteErrorFile(string content, string flag) + { + var fileName = string.Format("Log/{0}{1:yyyy-MM-dd}.txt", flag, DateTime.Today); + + WriteLog(fileName, content); + } + + static object _lock = new object(); + /// + /// 记录日志 + /// + /// 文件名称 + /// 内容 + static void WriteLog(string fieldName, string content) + { + lock (_lock) + { + try + { + using (StreamWriter file = new StreamWriter(fieldName, true, Encoding.UTF8)) + { + file.WriteLine(content);// 直接追加文件末尾,换行 + } + } + catch + { + } + } + } + } +} diff --git a/lib/BwpClientPrint.DLL b/lib/BwpClientPrint.DLL new file mode 100644 index 0000000..6b8f460 Binary files /dev/null and b/lib/BwpClientPrint.DLL differ diff --git a/lib/BwpClientPrint.pdb b/lib/BwpClientPrint.pdb new file mode 100644 index 0000000..3c4ee63 Binary files /dev/null and b/lib/BwpClientPrint.pdb differ diff --git a/lib/WinFormControl.dll b/lib/WinFormControl.dll new file mode 100644 index 0000000..7c46f02 Binary files /dev/null and b/lib/WinFormControl.dll differ