Commit 16b526af LN

增加软件编号显示

1 个父辈 ed527de1
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<add key="LineServerIp" value="192.168.200.69"/> <add key="LineServerIp" value="192.168.200.69"/>
<add key="LineServerPort" value="1234"/> <add key="LineServerPort" value="1234"/>
<!--解码方式,0=halcon 解码,1=西安料仓 使用zxing解码,2=成都料仓--> <!--解码方式,0=halcon 解码,1=西安料仓 使用zxing解码,2=成都料仓-->
<add key="DeCodeType" value="1"/> <add key="DeCodeType" value="2"/>
<add key ="DefaultPWD" value ="123456"/> <add key ="DefaultPWD" value ="123456"/>
</appSettings> </appSettings>
<log4net> <log4net>
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.btnNext = new System.Windows.Forms.Button(); this.btnNext = new System.Windows.Forms.Button();
this.lblVersion = new System.Windows.Forms.Label(); this.btnCopy = new System.Windows.Forms.Button();
this.lblCodeName = new System.Windows.Forms.Label();
this.lblTime = new System.Windows.Forms.Label(); this.lblTime = new System.Windows.Forms.Label();
this.lblVersion = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnNext // btnNext
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
this.btnNext.Anchor = System.Windows.Forms.AnchorStyles.Top; this.btnNext.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNext.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnNext.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNext.Location = new System.Drawing.Point(152, 113); this.btnNext.Location = new System.Drawing.Point(210, 175);
this.btnNext.Name = "btnNext"; this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(120, 45); this.btnNext.Size = new System.Drawing.Size(120, 45);
this.btnNext.TabIndex = 275; this.btnNext.TabIndex = 275;
...@@ -46,33 +48,56 @@ ...@@ -46,33 +48,56 @@
this.btnNext.UseVisualStyleBackColor = false; this.btnNext.UseVisualStyleBackColor = false;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click); this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
// //
// lblVersion // btnCopy
// //
this.lblVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.btnCopy.Location = new System.Drawing.Point(465, 78);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(75, 25);
this.btnCopy.TabIndex = 283;
this.btnCopy.Text = "复制编号";
this.btnCopy.UseVisualStyleBackColor = true;
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// lblCodeName
//
this.lblCodeName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lblVersion.Location = new System.Drawing.Point(12, 33); this.lblCodeName.Location = new System.Drawing.Point(11, 114);
this.lblVersion.Name = "lblVersion"; this.lblCodeName.Name = "lblCodeName";
this.lblVersion.Size = new System.Drawing.Size(413, 23); this.lblCodeName.Size = new System.Drawing.Size(529, 23);
this.lblVersion.TabIndex = 276; this.lblCodeName.TabIndex = 282;
this.lblVersion.Text = "版本号:1.1.0000.0000"; this.lblCodeName.Text = "编号:43 6F 64 65 4C 69 62 72 61 72 79 50 72 6F 6A 65 63 74 ";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblCodeName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// lblTime // lblTime
// //
this.lblTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lblTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lblTime.Location = new System.Drawing.Point(12, 63); this.lblTime.Location = new System.Drawing.Point(80, 80);
this.lblTime.Name = "lblTime"; this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(413, 23); this.lblTime.Size = new System.Drawing.Size(379, 23);
this.lblTime.TabIndex = 277; this.lblTime.TabIndex = 281;
this.lblTime.Text = "更新时间:0000-00-00 00:00:00"; this.lblTime.Text = "更新时间:0000-00-00 00:00:00";
this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// lblVersion
//
this.lblVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblVersion.Location = new System.Drawing.Point(11, 50);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(529, 23);
this.lblVersion.TabIndex = 280;
this.lblVersion.Text = "版本号:1.1.0000.0000";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FrmAbout // FrmAbout
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(437, 186); this.ClientSize = new System.Drawing.Size(564, 250);
this.Controls.Add(this.btnCopy);
this.Controls.Add(this.lblCodeName);
this.Controls.Add(this.lblTime); this.Controls.Add(this.lblTime);
this.Controls.Add(this.lblVersion); this.Controls.Add(this.lblVersion);
this.Controls.Add(this.btnNext); this.Controls.Add(this.btnNext);
...@@ -87,7 +112,9 @@ ...@@ -87,7 +112,9 @@
#endregion #endregion
private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Label lblVersion; private System.Windows.Forms.Button btnCopy;
private System.Windows.Forms.Label lblCodeName;
private System.Windows.Forms.Label lblTime; private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.Label lblVersion;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -24,11 +24,17 @@ namespace OnlineStore.ACSingleStore ...@@ -24,11 +24,17 @@ namespace OnlineStore.ACSingleStore
this.DialogResult = DialogResult.None; this.DialogResult = DialogResult.None;
lblTime.Text = "更新时间:" + GetVersion(); lblTime.Text = "更新时间:" + GetVersion();
lblVersion.Text = "版本号:"+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); lblVersion.Text = "版本号:"+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
lblCodeName.Text ="软件编号:"+ GetCodeNum();
} }
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(GetCodeNum(), true);
}
} }
} }
...@@ -13,14 +13,14 @@ namespace OnlineStore.ACSingleStore ...@@ -13,14 +13,14 @@ namespace OnlineStore.ACSingleStore
{ {
public partial class FrmBase : Form public partial class FrmBase : Form
{ {
public static string GetVersion() internal static string GetVersion()
{ {
string str = ""; string str = "";
string version = ""; string version = "";
DateTime newData = DateTime.Parse("2000-01-01"); DateTime newData = DateTime.Parse("2000-01-01");
try try
{ {
System.Reflection.AssemblyName assemblyName= System.Reflection.Assembly.GetExecutingAssembly().GetName(); System.Reflection.AssemblyName assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName();
version = assemblyName.Version.ToString(); version = assemblyName.Version.ToString();
string[] strArray = version.Split('.'); string[] strArray = version.Split('.');
if (strArray.Length.Equals(4)) if (strArray.Length.Equals(4))
...@@ -38,9 +38,16 @@ namespace OnlineStore.ACSingleStore ...@@ -38,9 +38,16 @@ namespace OnlineStore.ACSingleStore
str = version; str = version;
LogUtil.error("解析版本号【" + str + "】出错:" + ex.ToString()); LogUtil.error("解析版本号【" + str + "】出错:" + ex.ToString());
} }
LogUtil.info("版本号[" + version + "][" + str + "]"); LogUtil.info("版本号[" + version + "][" + str + "][" + GetCodeNum() + "]");
return str; return str;
} }
internal static string GetCodeNum(string codeName = "RC-29-32-ACSingleStore")
{
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName);
string result = "";
result = AcSerialBean.ByteToString(byteArray);
return result;
}
public FrmBase() public FrmBase()
{ {
InitializeComponent(); InitializeComponent();
......
...@@ -166,13 +166,14 @@ namespace OnlineStore.ACSingleStore ...@@ -166,13 +166,14 @@ namespace OnlineStore.ACSingleStore
{ {
groupHistory.Visible = false; groupHistory.Visible = false;
} }
if (CodeManager.DeCodeType.Equals(0)) if (CodeManager.DeCodeType.Equals(1))
{ {
groupCode.Visible = false; groupCode.Visible = true;
;
} }
else else
{ {
groupCode.Visible = true; groupCode.Visible = false;
} }
} }
private DateTime preReadModblsTime = DateTime.Now; private DateTime preReadModblsTime = DateTime.Now;
......
...@@ -207,7 +207,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -207,7 +207,12 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成"); LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成");
System.Threading.Thread.Sleep(1); System.Threading.Thread.Sleep(1);
if (DeCodeType.Equals(0)) if (DeCodeType.Equals(1))
{
List<string> result = CodeLibrary.ZXingCodeHelper.DecodeQRCodes(bitmap);
return result;
}
else
{ {
HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码"); LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
...@@ -234,11 +239,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -234,11 +239,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(" 【" + cameraName + "】【" + codeType + "】扫码完成:" + r); LogUtil.info(" 【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
} }
} }
}
else
{
List<string> result = CodeLibrary.ZXingCodeHelper.DecodeQRCodes(bitmap);
return result;
} }
} }
} }
...@@ -347,7 +348,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,7 +348,12 @@ namespace OnlineStore.DeviceLibrary
List<string> pCode = (from m in codeList where m.StartsWith(start) select m).ToList<string>(); List<string> pCode = (from m in codeList where m.StartsWith(start) select m).ToList<string>();
if (pCode.Count > 0) if (pCode.Count > 0)
{ {
return pCode[0].Substring(1, pCode[0].Length - 1); int subCount = start.Length;
if (pCode[0].Substring(start.Length, 1).Equals(":"))
{
subCount = start.Length + 1;
}
return pCode[0].Substring(subCount, pCode[0].Length - subCount);
} }
return ""; return "";
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!