Robin_PC\robin 1 month ago
parent
commit
300ab650aa
7 changed files with 55 additions and 6 deletions
  1. +1
    -0
      ButcherFactory.Form/ButcherFactory.Form.csproj
  2. +1
    -1
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  3. +7
    -5
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  4. +46
    -0
      ButcherFactory.Form/Utils/LogUtil.cs
  5. BIN
      lib/BwpClientPrint.DLL
  6. BIN
      lib/BwpClientPrint.pdb
  7. BIN
      lib/WinFormControl.dll

+ 1
- 0
ButcherFactory.Form/ButcherFactory.Form.csproj View File

@ -275,6 +275,7 @@
<Compile Include="SegmentProduction_\TrunOutDialog.Designer.cs">
<DependentUpon>TrunOutDialog.cs</DependentUpon>
</Compile>
<Compile Include="Utils\LogUtil.cs" />
<Compile Include="Utils\ControlsUtil.cs" />
<Compile Include="WeightCount_\DiscontSetting.cs" />
<Compile Include="WeightCount_\DiscontWeightSetDialog.cs">


+ 1
- 1
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs View File

@ -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
//


+ 7
- 5
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -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);
}


+ 46
- 0
ButcherFactory.Form/Utils/LogUtil.cs View File

@ -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
{
/// <summary>
/// 记录失败日志
/// </summary>
/// <param name="content">内容</param>
/// <param name="type">类型(oa mdg sap)</param>
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();
/// <summary>
/// 记录日志
/// </summary>
/// <param name="fieldName">文件名称</param>
/// <param name="content">内容</param>
static void WriteLog(string fieldName, string content)
{
lock (_lock)
{
try
{
using (StreamWriter file = new StreamWriter(fieldName, true, Encoding.UTF8))
{
file.WriteLine(content);// 直接追加文件末尾,换行
}
}
catch
{
}
}
}
}
}

BIN
lib/BwpClientPrint.DLL View File


BIN
lib/BwpClientPrint.pdb View File


BIN
lib/WinFormControl.dll View File


Loading…
Cancel
Save