Commit 3adae0d6 刘韬

DC不足6位往右补0

1 个父辈 80cf6d3d
...@@ -27,7 +27,7 @@ C:\Neotel\Program\SmartCode\MES_Interface\obj\Debug\MES_Interface.pdb ...@@ -27,7 +27,7 @@ C:\Neotel\Program\SmartCode\MES_Interface\obj\Debug\MES_Interface.pdb
C:\Neotel\Program\SmartCode\MES_Interface\obj\Debug\MES_Interface.csprojAssemblyReference.cache C:\Neotel\Program\SmartCode\MES_Interface\obj\Debug\MES_Interface.csprojAssemblyReference.cache
D:\rick\vs\SmartCode\MES_Interface\bin\Debug\MES_Interface.dll D:\rick\vs\SmartCode\MES_Interface\bin\Debug\MES_Interface.dll
D:\rick\vs\SmartCode\MES_Interface\bin\Debug\MES_Interface.pdb D:\rick\vs\SmartCode\MES_Interface\bin\Debug\MES_Interface.pdb
D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.csproj.AssemblyReference.cache
D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.csproj.CoreCompileInputs.cache D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.csproj.CoreCompileInputs.cache
D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.dll D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.dll
D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.pdb D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.pdb
D:\rick\vs\SmartCode\MES_Interface\obj\Debug\MES_Interface.csproj.AssemblyReference.cache
...@@ -139,7 +139,7 @@ namespace MES ...@@ -139,7 +139,7 @@ namespace MES
if (dc_code.Length > 6) if (dc_code.Length > 6)
TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6); TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6);
else else
TxtDC.Text = dc_code; TxtDC.Text = dc_code.PadRight(6, '0');
findDC = true; findDC = true;
} }
else if (!findORDER) //订单条码,订单号_物料号_日期_批次号 else if (!findORDER) //订单条码,订单号_物料号_日期_批次号
...@@ -184,7 +184,7 @@ namespace MES ...@@ -184,7 +184,7 @@ namespace MES
if (dc_code.Length > 6) if (dc_code.Length > 6)
TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6); TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6);
else else
TxtDC.Text = dc_code; TxtDC.Text = dc_code.PadRight(6, '0');
findDC = true; findDC = true;
} }
} }
...@@ -204,7 +204,7 @@ namespace MES ...@@ -204,7 +204,7 @@ namespace MES
if (dc_order.Length > 6) if (dc_order.Length > 6)
TxtDC.Text = dc_order.Substring(dc_order.Length - 6, 6); TxtDC.Text = dc_order.Substring(dc_order.Length - 6, 6);
else else
TxtDC.Text = dc_order; TxtDC.Text = dc_order.PadRight(6, '0');
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -15,11 +15,14 @@ namespace SmartCode ...@@ -15,11 +15,14 @@ namespace SmartCode
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
try
{
var scp = Process.GetProcessesByName("SmartCode"); var scp = Process.GetProcessesByName("SmartCode");
foreach (var sp in scp) foreach (var sp in scp)
if (sp.Id!=Process.GetCurrentProcess().Id) if (sp.Id != Process.GetCurrentProcess().Id)
sp.Kill(); sp.Kill();
}
catch { }
Environment.CurrentDirectory = Application.StartupPath; Environment.CurrentDirectory = Application.StartupPath;
......
...@@ -12,7 +12,7 @@ namespace SmartCode.Properties { ...@@ -12,7 +12,7 @@ namespace SmartCode.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
......
using BLL; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Image = System.Drawing.Image;
namespace SmartCode namespace SmartCode
{ {
...@@ -40,7 +36,7 @@ namespace SmartCode ...@@ -40,7 +36,7 @@ namespace SmartCode
/// <summary> /// <summary>
/// 是否接触,用于判断DI触发时上一次是false /// 是否接触,用于判断DI触发时上一次是false
/// </summary> /// </summary>
private bool isTouch; private volatile bool isTouch;
/// <summary> /// <summary>
/// 是否运行 /// 是否运行
/// </summary> /// </summary>
...@@ -367,7 +363,7 @@ namespace SmartCode ...@@ -367,7 +363,7 @@ namespace SmartCode
if (Common.Camera.Count == 0) if (Common.Camera.Count == 0)
{ {
noCamera = true; noCamera = true;
s2 =Common.Lang.Dialog("NoCamera"); s2 = Common.Lang.Dialog("NoCamera");
} }
else else
{ {
...@@ -483,7 +479,7 @@ namespace SmartCode ...@@ -483,7 +479,7 @@ namespace SmartCode
try try
{ {
Common.log.Info($"MES:{Common.Config.MES}"); Common.log.Info($"MES:{Common.Config.MES}");
var mes =new MES.User(Common.Config.MES); var mes = new MES.User(Common.Config.MES);
mes.SNPREFIX = Common.Config.SNPREFIX; mes.SNPREFIX = Common.Config.SNPREFIX;
userControl = mes; userControl = mes;
Control ctl = userControl.GetControl(); Control ctl = userControl.GetControl();
...@@ -694,7 +690,7 @@ namespace SmartCode ...@@ -694,7 +690,7 @@ namespace SmartCode
} }
} }
private int UserControl_GetSN(string key,bool doIncrease) private int UserControl_GetSN(string key, bool doIncrease)
{ {
return Common.Database.GetSN(key, doIncrease); return Common.Database.GetSN(key, doIncrease);
} }
...@@ -720,19 +716,20 @@ namespace SmartCode ...@@ -720,19 +716,20 @@ namespace SmartCode
if (isTouch) return; if (isTouch) return;
isTouch = true; isTouch = true;
Common.log.Info("IO触发自动拍照"); Common.log.Info("IO触发自动拍照");
Invoke(new Action(() => BeginInvoke(new Action(() =>
{ {
try try
{ {
DoScan(); DoScan();
}catch (Exception ex) { Common.log.Error("DoScan:" + ex); } }
finally { catch (Exception ex) { Common.log.Error("DoScan:" + ex); }
finally
{
Common.log.Info("DoScan finish"); Common.log.Info("DoScan finish");
isTouch = false; isTouch = false;
} }
}));
Common.log.Info("IO触发自动拍照完成"); Common.log.Info("IO触发自动拍照完成");
}));
} }
else else
{ {
...@@ -740,13 +737,15 @@ namespace SmartCode ...@@ -740,13 +737,15 @@ namespace SmartCode
} }
} }
void DoScan() { void DoScan()
{
bool rtn; bool rtn;
label = null; label = null;
Common.log.Info("开始拍照");
if (Common.Config.CameraSingle) if (Common.Config.CameraSingle)
{ {
rtn = Common.Camera.GrabOne(); rtn = Common.Camera.GrabOne();
Common.log.Info("图像获取完成:"+rtn);
if (rtn) if (rtn)
{ {
grabImage = new Bitmap(Common.Camera.Image); grabImage = new Bitmap(Common.Camera.Image);
...@@ -756,6 +755,7 @@ namespace SmartCode ...@@ -756,6 +755,7 @@ namespace SmartCode
else else
{ {
Bitmap[] image = new Bitmap[Common.Camera.Count]; Bitmap[] image = new Bitmap[Common.Camera.Count];
Common.log.Info("图像获取完成:" + image.Length);
for (int i = 0; i < Common.Camera.Count; i++) for (int i = 0; i < Common.Camera.Count; i++)
{ {
rtn = Common.Camera.GrabOne(i); rtn = Common.Camera.GrabOne(i);
...@@ -768,11 +768,15 @@ namespace SmartCode ...@@ -768,11 +768,15 @@ namespace SmartCode
//Common.IO.WriteDO(Asa.IOModule.Addr.DO_1, Asa.IOModule.Status.Off); //Common.IO.WriteDO(Asa.IOModule.Addr.DO_1, Asa.IOModule.Status.Off);
//Thread.Sleep(500); //Thread.Sleep(500);
rtn = DiscernCode(); rtn = DiscernCode();
Common.log.Info("图像解码完成:" + rtn);
if (!rtn) return; if (!rtn) return;
if (userControl == null) return; if (userControl == null) return;
if (userControl.Match) MatchTemplate(); if (userControl.Match) MatchTemplate();
Common.log.Info("模板匹配完成");
userControl.Preview(); userControl.Preview();
Common.log.Info("预览完成");
labelReplace = userControl.GetPrint(); labelReplace = userControl.GetPrint();
Common.log.Info("打印完成:" + string.Join(", ", labelReplace.Select(t => $"{t.Key}:{t.Value}").ToArray()));
PicLabel.Image = Common.Label.PrintLast(labelReplace, out string[] code); PicLabel.Image = Common.Label.PrintLast(labelReplace, out string[] code);
} }
...@@ -797,7 +801,7 @@ namespace SmartCode ...@@ -797,7 +801,7 @@ namespace SmartCode
InitMesPanel(); InitMesPanel();
Common.Lang.SetLanguage(this); Common.Lang.SetLanguage(this);
PicLogo.Image = Image.FromFile(Application.StartupPath + PicLogo.Tag.ToString()); PicLogo.Image = Image.FromFile(System.Windows.Forms.Application.StartupPath + PicLogo.Tag.ToString());
//if (!Common.debug) //if (!Common.debug)
// InitSuperDog(); // InitSuperDog();
......
此文件类型无法预览
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
<packages> <packages>
<package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net461" /> <package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net461" />
<package id="Tesseract" version="3.3.0" targetFramework="net46" /> <package id="Tesseract" version="3.3.0" targetFramework="net46" />
<package id="ZXing.Net" version="0.16.5" targetFramework="net461" /> <package id="ZXing.Net" version="0.16.5" targetFramework="net461" requireReinstallation="true" />
</packages> </packages>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!