Commit 3adae0d6 刘韬

DC不足6位往右补0

1 个父辈 80cf6d3d
......@@ -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
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\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.dll
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
if (dc_code.Length > 6)
TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6);
else
TxtDC.Text = dc_code;
TxtDC.Text = dc_code.PadRight(6, '0');
findDC = true;
}
else if (!findORDER) //订单条码,订单号_物料号_日期_批次号
......@@ -184,7 +184,7 @@ namespace MES
if (dc_code.Length > 6)
TxtDC.Text = dc_code.Substring(dc_code.Length - 6, 6);
else
TxtDC.Text = dc_code;
TxtDC.Text = dc_code.PadRight(6, '0');
findDC = true;
}
}
......@@ -204,7 +204,7 @@ namespace MES
if (dc_order.Length > 6)
TxtDC.Text = dc_order.Substring(dc_order.Length - 6, 6);
else
TxtDC.Text = dc_order;
TxtDC.Text = dc_order.PadRight(6, '0');
}
}
catch (Exception ex)
......
......@@ -15,11 +15,14 @@ namespace SmartCode
[STAThread]
static void Main(string[] args)
{
try
{
var scp = Process.GetProcessesByName("SmartCode");
foreach (var sp in scp)
if (sp.Id!=Process.GetCurrentProcess().Id)
if (sp.Id != Process.GetCurrentProcess().Id)
sp.Kill();
}
catch { }
Environment.CurrentDirectory = Application.StartupPath;
......
......@@ -12,7 +12,7 @@ namespace SmartCode.Properties {
[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 {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -17,7 +17,7 @@
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
......
using BLL;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Image = System.Drawing.Image;
namespace SmartCode
{
......@@ -40,7 +36,7 @@ namespace SmartCode
/// <summary>
/// 是否接触,用于判断DI触发时上一次是false
/// </summary>
private bool isTouch;
private volatile bool isTouch;
/// <summary>
/// 是否运行
/// </summary>
......@@ -367,7 +363,7 @@ namespace SmartCode
if (Common.Camera.Count == 0)
{
noCamera = true;
s2 =Common.Lang.Dialog("NoCamera");
s2 = Common.Lang.Dialog("NoCamera");
}
else
{
......@@ -483,7 +479,7 @@ namespace SmartCode
try
{
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;
userControl = mes;
Control ctl = userControl.GetControl();
......@@ -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);
}
......@@ -720,19 +716,20 @@ namespace SmartCode
if (isTouch) return;
isTouch = true;
Common.log.Info("IO触发自动拍照");
Invoke(new Action(() =>
BeginInvoke(new Action(() =>
{
try
{
DoScan();
}catch (Exception ex) { Common.log.Error("DoScan:" + ex); }
finally {
}
catch (Exception ex) { Common.log.Error("DoScan:" + ex); }
finally
{
Common.log.Info("DoScan finish");
isTouch = false;
}
}));
Common.log.Info("IO触发自动拍照完成");
}));
}
else
{
......@@ -740,13 +737,15 @@ namespace SmartCode
}
}
void DoScan() {
void DoScan()
{
bool rtn;
label = null;
Common.log.Info("开始拍照");
if (Common.Config.CameraSingle)
{
rtn = Common.Camera.GrabOne();
Common.log.Info("图像获取完成:"+rtn);
if (rtn)
{
grabImage = new Bitmap(Common.Camera.Image);
......@@ -756,6 +755,7 @@ namespace SmartCode
else
{
Bitmap[] image = new Bitmap[Common.Camera.Count];
Common.log.Info("图像获取完成:" + image.Length);
for (int i = 0; i < Common.Camera.Count; i++)
{
rtn = Common.Camera.GrabOne(i);
......@@ -768,11 +768,15 @@ namespace SmartCode
//Common.IO.WriteDO(Asa.IOModule.Addr.DO_1, Asa.IOModule.Status.Off);
//Thread.Sleep(500);
rtn = DiscernCode();
Common.log.Info("图像解码完成:" + rtn);
if (!rtn) return;
if (userControl == null) return;
if (userControl.Match) MatchTemplate();
Common.log.Info("模板匹配完成");
userControl.Preview();
Common.log.Info("预览完成");
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);
}
......@@ -797,7 +801,7 @@ namespace SmartCode
InitMesPanel();
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)
// InitSuperDog();
......
此文件类型无法预览
......@@ -2,5 +2,5 @@
<packages>
<package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net461" />
<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>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!