Commit 57adacc3 LN

匈牙利料仓增加文件条码读取功能

1 个父辈 e2bf183f
......@@ -46,6 +46,10 @@
<add key="DIMS" value="20" />
<add key="DOMS" value="200" />
<add key="SinglePosId" value="1#AC2_1_1_6" />
<!--是否使用文件条码 ,1=使用文件二维码,不需要扫码,0=使用相机扫码-->
<add key ="UseFileCode" value ="1"/>
<!--条码文件的位置,绝对路径-->
<add key ="CodeFilePath" value ="D:\CodeFile.txt"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -53,6 +53,8 @@
this.lblOutInfo = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.btnGetCode = new System.Windows.Forms.Button();
this.btnLoadFile = new System.Windows.Forms.Button();
this.btnClearBuzzer = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.btnClearLog = new System.Windows.Forms.Button();
......@@ -135,10 +137,14 @@
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblAxisStatus = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.axis_5_Alarm = new UserFromControl.IOStatusControl();
this.txtBatchTarget = new System.Windows.Forms.TextBox();
this.lblCountPulse5 = new System.Windows.Forms.TextBox();
this.lblOutPulse5 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.label38 = new System.Windows.Forms.Label();
this.txtMiddleTarget = new System.Windows.Forms.TextBox();
this.txtInoutTarget = new System.Windows.Forms.TextBox();
......@@ -256,10 +262,6 @@
this.清理日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.英文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.axis_5_Alarm = new UserFromControl.IOStatusControl();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.contextMenuStrip1.SuspendLayout();
this.groupAuto.SuspendLayout();
this.groupBox6.SuspendLayout();
......@@ -608,6 +610,8 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btnGetCode);
this.tabPage4.Controls.Add(this.btnLoadFile);
this.tabPage4.Controls.Add(this.btnClearBuzzer);
this.tabPage4.Controls.Add(this.richTextBox1);
this.tabPage4.Controls.Add(this.btnClearLog);
......@@ -618,6 +622,30 @@
this.tabPage4.Text = "日志";
this.tabPage4.UseVisualStyleBackColor = true;
//
// btnGetCode
//
this.btnGetCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnGetCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetCode.Location = new System.Drawing.Point(324, 390);
this.btnGetCode.Name = "btnGetCode";
this.btnGetCode.Size = new System.Drawing.Size(151, 38);
this.btnGetCode.TabIndex = 259;
this.btnGetCode.Text = "获取下一个条码";
this.btnGetCode.UseVisualStyleBackColor = true;
this.btnGetCode.Click += new System.EventHandler(this.btnGetCode_Click);
//
// btnLoadFile
//
this.btnLoadFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnLoadFile.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLoadFile.Location = new System.Drawing.Point(168, 390);
this.btnLoadFile.Name = "btnLoadFile";
this.btnLoadFile.Size = new System.Drawing.Size(151, 38);
this.btnLoadFile.TabIndex = 258;
this.btnLoadFile.Text = "加载文件条码";
this.btnLoadFile.UseVisualStyleBackColor = true;
this.btnLoadFile.Click += new System.EventHandler(this.button1_Click_2);
//
// btnClearBuzzer
//
this.btnClearBuzzer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
......@@ -1597,6 +1625,16 @@
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// axis_5_Alarm
//
this.axis_5_Alarm.IOName = "";
this.axis_5_Alarm.IOValue = 0;
this.axis_5_Alarm.isCanClick = false;
this.axis_5_Alarm.Location = new System.Drawing.Point(457, 54);
this.axis_5_Alarm.Name = "axis_5_Alarm";
this.axis_5_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_5_Alarm.TabIndex = 271;
//
// txtBatchTarget
//
this.txtBatchTarget.Location = new System.Drawing.Point(434, 156);
......@@ -1631,6 +1669,36 @@
this.label20.Text = "批量出入料轴";
this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(155, 54);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(357, 54);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(252, 54);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// label38
//
this.label38.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
......@@ -2842,43 +2910,43 @@
// 轴卡点动ToolStripMenuItem
//
this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem";
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.轴卡点动ToolStripMenuItem.Text = "轴卡点动";
this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(157, 6);
//
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(157, 6);
//
// 摄像机调试ToolStripMenuItem
//
this.摄像机调试ToolStripMenuItem.Name = "摄像机调试ToolStripMenuItem";
this.摄像机调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.摄像机调试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.摄像机调试ToolStripMenuItem.Text = "二维码学习";
this.摄像机调试ToolStripMenuItem.Click += new System.EventHandler(this.摄像机调试ToolStripMenuItem_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator11.Size = new System.Drawing.Size(157, 6);
//
// 出入库调试ToolStripMenuItem
//
this.出入库调试ToolStripMenuItem.Name = "出入库调试ToolStripMenuItem";
this.出入库调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.出入库调试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.出入库调试ToolStripMenuItem.Text = "启用调试";
this.出入库调试ToolStripMenuItem.Click += new System.EventHandler(this.出入库调试ToolStripMenuItem_Click);
//
......@@ -2911,46 +2979,6 @@
this.英文ToolStripMenuItem.Text = "英文";
this.英文ToolStripMenuItem.Click += new System.EventHandler(this.开启DEBUGToolStripMenuItem_Click);
//
// axis_5_Alarm
//
this.axis_5_Alarm.IOName = "";
this.axis_5_Alarm.IOValue = 0;
this.axis_5_Alarm.isCanClick = false;
this.axis_5_Alarm.Location = new System.Drawing.Point(457, 54);
this.axis_5_Alarm.Name = "axis_5_Alarm";
this.axis_5_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_5_Alarm.TabIndex = 271;
//
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(155, 54);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(357, 54);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(252, 54);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -3242,6 +3270,8 @@
private System.Windows.Forms.GroupBox groupAuto;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button btnSingleTrayIn;
private System.Windows.Forms.Button btnLoadFile;
private System.Windows.Forms.Button btnGetCode;
}
}
......@@ -1775,5 +1775,16 @@ namespace OnlineStore.AutoInOutStore
}
}
private void button1_Click_2(object sender, EventArgs e)
{
FileCodeController.ReloadFileCode();
}
private void btnGetCode_Click(object sender, EventArgs e)
{
string code = FileCodeController.NextCode();
MessageBox.Show(code);
}
}
}
......@@ -222,5 +222,23 @@ DI9 不要,只判断DI10
20190814修改:
匈牙利条码拼接修改,如果有2T475则拼接,没有的话按原来的方式返回。
// p/n 的码是P打头,SKID码是2T475打头
// RI;PN;QTY
\ No newline at end of file
//p/n 的码是P打头,SKID码是2T475打头
// RI;PN;QTY
20190816匈牙利料仓增加文件条码读取功能:
AutoInOutStore.exe.config增加配置:
<!--是否使用文件条码 ,1=使用文件二维码,不需要扫码,0=使用相机扫码-->
<add key ="UseFileCode" value ="1"/>
<!--条码文件的位置,绝对路径-->
<add key ="CodeFilePath" value ="D:\CodeFile.txt"/>
文件格式(PN1和RI1为最下面料盘的条码,以此类推):
PN1
RI1
PN2
RI2
PN3
RI3
PN4
RI4
\ No newline at end of file
......@@ -93,5 +93,15 @@ namespace OnlineStore.Common
/// 单盘入库默认PosID
/// </summary>
public static string SinglePosId = "SinglePosId";
/// <summary>
/// 是否使用远程文件条码 ,1=使用文件二维码,不需要扫码
/// </summary>
public static string UseFileCode = "UseFileCode";
/// <summary>
/// 条码文件的位置,绝对路径
/// </summary>
public static string CodeFilePath = "CodeFilePath";
}
}
......@@ -59,6 +59,7 @@
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\AutomaticBaiting_Partial.cs" />
<Compile Include="acSingleStore\FileCodeController.cs" />
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="acSingleStore\AutomaticBaiting.cs" />
<Compile Include="DeviceLibrary\IO\AIOBOX\BLL2.cs" />
......
......@@ -311,6 +311,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NewMove(StoreMoveType.InStore);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I01_Wait);
LogUtil.info(Name + "启动入料");
FileCodeController.ReloadFileCode();
return true;
}
else
......@@ -629,12 +630,28 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_ScanCode);
if (FileCodeController.UseFileCode)
{
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
string code = FileCodeController.NextCode();
LogUtil.info(Name + "入料: 开始扫码,获取下一个文件二维码 : "+code);
LastCodeList = new List<string> { code };
LastCode = code;
if (LastCode.Equals(""))
{
StoreManager.Store.CodeOrInoutMsg = ResourceControl.GetString(ResourceControl.InStoreNoCode, "未扫到二维码,需要将料盘送出");
LogUtil.error("未扫到二维码,需要将料盘送出");
}
}
else
{
LogUtil.info(Name + "入料: 开始扫码,最多等待6000 ");
StoreMove.OneWaitCanEndStep = true;
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(6000));
GetCameraCode();
}
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I11_BatchAxisHome);
......
......@@ -380,6 +380,11 @@ namespace OnlineStore.DeviceLibrary
// RI;PN;QTY
string split = ";";
string result = "";
//如果使用文件条码,直接返回
if (FileCodeController.UseFileCode)
{
return result;
}
try
{
List<string> rCodes = new List<string>();
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 文件条码操作类
/// </summary>
public class FileCodeController
{
public static bool UseFileCode = false;
public static string FilePath = "";
public static List<string> CurrCodeList = new List<string>();
public static int CurrCodeIndex = -1;
static FileCodeController()
{
int isuse = ConfigAppSettings.GetIntValue(Setting_Init.UseFileCode);
if (isuse.Equals(1))
{
FilePath = ConfigAppSettings.GetValue(Setting_Init.CodeFilePath);
if (!FilePath.Equals(""))
{
UseFileCode = true;
}
}
}
/// <summary>
/// 点击开始批量入库,开始读取文件并把条码放入内存
/// </summary>
/// <returns></returns>
public static bool ReloadFileCode()
{
if (!UseFileCode)
{
return false ;
}
try
{
CurrCodeList = new List<string>();
CurrCodeIndex = -1;
List<string> Data = new List<string>();
if (File.Exists(FilePath))
{
string[] allLines = File.ReadAllLines(FilePath);
foreach (string str in allLines)
{
string code = str.Trim();
if (String.IsNullOrEmpty(code))
{
continue;
}
Data.Add(str);
}
//清理文件内容
File.WriteAllLines(FilePath, new string[] { });
}
else
{
LogUtil.error("文件【" + FilePath + "】不存在");
return false;
}
//文件格式,需要拼接成:RI:PN:Q
//PN1
//RI1
//PN2
//RI2
//倒叙拼接二维码
if (Data.Count > 0)
{
string codeMsg = "";
for (int i = Data.Count - 1; i >= 1; i -= 2)
{
string ri = Data[i];
string pn = Data[i - 1];
string code = ri + ";" + pn + ";1";
CurrCodeList.Add(code);
codeMsg += code + "\r\n";
}
LogUtil.info("文件【" + FilePath + "】解析到条码=\r\n" + codeMsg);
}
else
{
LogUtil.error("文件【" + FilePath + "】未读取到条码");
}
}
catch (Exception ex)
{
LogUtil.error("ReloadFileCode出错:" + ex.ToString());
}
return false;
}
public static string NextCode()
{
if (UseFileCode&&CurrCodeList.Count > 0)
{
CurrCodeIndex++;
if (CurrCodeList.Count > CurrCodeIndex)
{
return CurrCodeList[CurrCodeIndex];
}
}
return "";
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!