Commit b0fa6453 刘韬

完善翻译

1 个父辈 e81e9bdf
正在显示 51 个修改的文件 包含 1954 行增加539 行删除
......@@ -12,6 +12,8 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -43,6 +45,9 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.114.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
......@@ -56,6 +61,7 @@
<Compile Include="CodeResourceControl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="SQLiteHelper.cs" />
<Compile Include="util\ConfigAppSettings.cs" />
<Compile Include="util\FormUtil.cs" />
<Compile Include="util\JsonHelper.cs" />
......@@ -73,7 +79,17 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;
namespace OnlineStore.Common
{
public class SQLiteHelper
{
private static string connectionString = string.Empty;
/// <summary>
/// 根据数据源、密码、版本号设置连接字符串。
/// </summary>
/// <param name="datasource">数据源。</param>
/// <param name="password">密码。</param>
/// <param name="version">版本号(缺省为3)。</param>
public static void SetConnectionString(string datasource, int version = 3)
{
connectionString = string.Format("Data Source={0};Version={1};",
datasource, version);
}
/// <summary>
/// 创建一个数据库文件。如果存在同名数据库文件,则会覆盖。
/// </summary>
/// <param name="dbName">数据库文件名。为null或空串时不创建。</param>
/// <param name="password">(可选)数据库密码,默认为空。</param>
/// <exception cref="Exception"></exception>
public static void CreateDB(string dbName)
{
if (!string.IsNullOrEmpty(dbName))
{
try { SQLiteConnection.CreateFile(dbName); }
catch (Exception) { throw; }
}
}
/// <summary>
/// 对SQLite数据库执行增删改操作,返回受影响的行数。
/// </summary>
/// <param name="sql">要执行的增删改的SQL语句。</param>
/// <param name="parameters">执行增删改语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public int ExecuteNonQuery(string sql, params SQLiteParameter[] parameters)
{
int affectedRows = 0;
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
using (SQLiteCommand command = new SQLiteCommand(connection))
{
try
{
connection.Open();
command.CommandText = sql;
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
affectedRows = command.ExecuteNonQuery();
}
catch (Exception) { throw; }
}
}
return affectedRows;
}
/// <summary>
/// 批量处理数据操作语句。
/// </summary>
/// <param name="list">SQL语句集合。</param>
/// <exception cref="Exception"></exception>
public void ExecuteNonQueryBatch(List<KeyValuePair<string, SQLiteParameter[]>> list)
{
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
try { conn.Open(); }
catch { throw; }
using (SQLiteTransaction tran = conn.BeginTransaction())
{
using (SQLiteCommand cmd = new SQLiteCommand(conn))
{
try
{
foreach (var item in list)
{
cmd.CommandText = item.Key;
if (item.Value != null)
{
cmd.Parameters.AddRange(item.Value);
}
cmd.ExecuteNonQuery();
}
tran.Commit();
}
catch (Exception) { tran.Rollback(); throw; }
}
}
}
}
/// <summary>
/// 执行查询语句,并返回第一个结果。
/// </summary>
/// <param name="sql">查询语句。</param>
/// <returns>查询结果。</returns>
/// <exception cref="Exception"></exception>
public object ExecuteScalar(string sql, params SQLiteParameter[] parameters)
{
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
using (SQLiteCommand cmd = new SQLiteCommand(conn))
{
try
{
conn.Open();
cmd.CommandText = sql;
if (parameters.Length != 0)
{
cmd.Parameters.AddRange(parameters);
}
return cmd.ExecuteScalar();
}
catch (Exception) { throw; }
}
}
}
/// <summary>
/// 执行一个查询语句,返回一个包含查询结果的DataTable。
/// </summary>
/// <param name="sql">要执行的查询语句。</param>
/// <param name="parameters">执行SQL查询语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public DataTable ExecuteQuery(string sql, params SQLiteParameter[] parameters)
{
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
{
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
DataTable data = new DataTable();
try { adapter.Fill(data); }
catch (Exception) { throw; }
return data;
}
}
}
/// <summary>
/// 执行一个查询语句,返回一个关联的SQLiteDataReader实例。
/// </summary>
/// <param name="sql">要执行的查询语句。</param>
/// <param name="parameters">执行SQL查询语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public SQLiteDataReader ExecuteReader(string sql, params SQLiteParameter[] parameters)
{
SQLiteConnection connection = new SQLiteConnection(connectionString);
SQLiteCommand command = new SQLiteCommand(sql, connection);
try
{
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
connection.Open();
return command.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (Exception) { throw; }
}
/// <summary>
/// 查询数据库中的所有数据类型信息。
/// </summary>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public DataTable GetSchema()
{
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
try
{
connection.Open();
return connection.GetSchema("TABLES");
}
catch (Exception) { throw; }
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.114.0" targetFramework="net461" />
<package id="System.Data.SQLite.Core" version="1.0.114.3" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -9,6 +9,8 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class FilterMachine : MachineBase, IRobot
{
private Config_Filter _config;
......@@ -21,7 +23,7 @@ namespace DeviceLibrary
_config = value;
}
}
public override string DeviceName { get; set; } = "分盘线";
public override string DeviceName { get; } = "分盘线";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
......@@ -105,22 +107,22 @@ namespace DeviceLibrary
bool ok = true;
if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.warning);
Msg.add(crc.GetString("system_need_reset","系统需要重置"), MsgLevel.warning);
ok = false;
}
if (NGBox_Count >= Config.NG_BOX_MAXCOUNT) {
Msg.add("NG箱已满", MsgLevel.warning);
Msg.add(crc.GetString("ng_box_full", "NG箱已满"), MsgLevel.warning);
ok = false;
}
if (MSDBox_Count >= Config.MSD_BOX_MAXCOUNT)
{
Msg.add("MSD箱已满", MsgLevel.warning);
Msg.add(crc.GetString("msd_box_full", "MSD箱已满"), MsgLevel.warning);
ok = false;
}
if (PaperBox_Count >= Config.PAPER_BOX_MAXCOUNT)
{
Msg.add("Paper箱已满", MsgLevel.warning);
Msg.add(crc.GetString("paper_box_full", "Paper箱已满"), MsgLevel.warning);
ok = false;
}
......@@ -134,7 +136,7 @@ namespace DeviceLibrary
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add($"{configMoveAxis.DeviceName}:运动报警", MsgLevel.warning);
Msg.add(crc.GetString("axis_run_alert","{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
}
}
......
......@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class FilterMachine
{
public bool isWaitReel { get => MoveInfo.MoveStep == MoveStep.Filter_01_WaitReel; }
......@@ -34,6 +35,7 @@ namespace DeviceLibrary
//MoveInfo.ReelParam.ReelDest = ReelDest.String;
if (MoveInfo.ReelParam.ReelDest == ReelDest.NG || MoveInfo.ReelParam.ReelDest == ReelDest.Unknow)
{
RobotManage.DefectiveCount++;
MoveInfo.NextMoveStep(MoveStep.Filter_10_NGReel_PushOut);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
......@@ -53,11 +55,11 @@ namespace DeviceLibrary
}
else if (IOValue(IO_Filter_Type.NG_TaryStop_Check).Equals(IO_VALUE.HIGH) && preReelParam == null)
{
Msg.add("分盘线等待料盘信息", MsgLevel.warning);
Msg.add(crc.GetString("wait_reelinfo", "{0}等待料盘信息", DeviceName), MsgLevel.warning);
}
else
{
Msg.add($"等待进入料盘", MsgLevel.info);
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceName), MsgLevel.info);
}
break;
///NG料送出
......@@ -146,7 +148,7 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
}
else if (MoveInfo.IsTimeOut(10)) {
Msg.add("等待T1机构空闲", MsgLevel.warning);
Msg.add(crc.GetString("wait_xx_free","等待{0}空闲", RobotManage.t1Machine.DeviceName), MsgLevel.warning);
}
break;
case MoveStep.Filter_42_Reel_through_Wait:
......
......@@ -143,7 +143,7 @@ namespace DeviceLibrary
Point qrcenter = Label_Pix_Point;
//string file = @"D:\853string\Image_20210604173619489.bmp";
//图像剪切范围矩形
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 450, 450);
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 510, 510);
//计算剪切后的二维码中心坐标点
qrcenter.X = qrcenter.X - orgCrop.X;
qrcenter.Y = qrcenter.Y - orgCrop.Y;
......@@ -174,6 +174,13 @@ namespace DeviceLibrary
newlist.Add(t);
MoveInfo.log($"s1:{s1}, s2:{s2} , {t.Text}");
}
if (s1 > 0.9)
{
newlist.Clear();
newlist.Add(t);
MoveInfo.log($"s1:{s1}>0.93 , {t.Text}");
break;
}
}
//List<Point> RightPoint
Point labelPoint = Point.Empty;
......
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine : MachineBase, IRobot
{
private Config_Label _config;
......@@ -20,7 +21,7 @@ namespace DeviceLibrary
_config = value;
}
}
public override string DeviceName { get; set; } = "贴标机构";
public override string DeviceName { get; } = "贴标机构";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
......@@ -121,16 +122,16 @@ namespace DeviceLibrary
public bool DeviceCheck()
{
bool ok = true;
if (IOValue(IO_Label_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
if (IOManager.GetDIValue("", 0, 45).Equals(IO_VALUE.LOW))
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Msg.add(crc.GetString("emergency_stop", "急停中"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.warning);
Msg.add(crc.GetString("system_need_reset", "系统需要重置"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
......@@ -147,7 +148,7 @@ namespace DeviceLibrary
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add($"{configMoveAxis.Explain}:运动报警", MsgLevel.warning);
Msg.add(crc.GetString("axis_run_alert", "{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
}
}
......
......@@ -10,6 +10,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine
{
//保存贴标位置调试图像
......@@ -77,18 +78,18 @@ namespace DeviceLibrary
// MoveInfo.log("检测到料盘 超时NG:没有等到料盘信息");
//}
else if (Tray_Check.Equals(IO_VALUE.HIGH)) {
Msg.add($"已检测到料盘, 等待料盘数据信息到位", MsgLevel.info);
Msg.add(crc.GetString("label_detect_reel_wait_reelinfo", "已检测到料盘, 等待料盘数据信息到位"), MsgLevel.info);
}
else if (Label_TaryStop_Check.Equals(IO_VALUE.HIGH))
{
Msg.add("贴标区有料未送出", MsgLevel.warning);
Msg.add(crc.GetString("label_has_reel", "贴标区有料未送出"), MsgLevel.warning);
MoveInfo.log("贴标区有料未送出");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
}
else
{
Msg.add($"等待上料区进入料盘", MsgLevel.info);
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceNameShow), MsgLevel.info);
MoveInfo.log("等待上料区进入料盘");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
}
......@@ -101,6 +102,7 @@ namespace DeviceLibrary
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.log("NG盘直接通过");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
return;
}
......@@ -163,7 +165,7 @@ namespace DeviceLibrary
MoveInfo.log("线体1,2开始运行");
RobotManage.Line1.LineRun("label", 999, "Lbl_03_LineRun");
RobotManage.Line2.LineRun("label", 999, "Lbl_03_LineRun");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.Lbl_03_StopDown_and_wait:
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStopWait);
......@@ -188,8 +190,9 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.Lbl05);
WaitCheckLabeltype = WaitCheckLabeltypeE.None;
ScanTask2 = ScanCode2();
Task.Delay(1000).Wait();
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.Lbl05:
if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_end)
......@@ -245,18 +248,20 @@ namespace DeviceLibrary
case MoveStep.Lbl13:
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
Label_Z_Axis.AbsMove(null, Config.Label_Z_P2, Config.Label_Z_P2_speed);
MoveInfo.ReelParam.LabelState = "Ok";
MoveInfo.log("取标气缸上升.");
break;
case MoveStep.Lbl_WaitCheckLabel:
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_QRCode_Fail) == WaitCheckLabeltypeE.Scan_QRCode_Fail)
Msg.add("未识别到有效二维码", MsgLevel.warning);
Msg.add(crc.GetString("label_scan_qrcode_fail","未识别到有效二维码"), MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_Code_And_Print_are_different) == WaitCheckLabeltypeE.Scan_Code_And_Print_are_different)
Msg.add("扫描到的Reelid与发出打印的可能不一致", MsgLevel.warning);
Msg.add(crc.GetString("label_qrcode_different", "扫描到的Reelid与发出打印的可能不一致"), MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Failed_to_extract_label) == WaitCheckLabeltypeE.Failed_to_extract_label)
Msg.add("标签吸取失败", MsgLevel.warning);
Msg.add(crc.GetString("label_extract_fail", "标签吸取失败"), MsgLevel.warning);
MoveInfo.log("Lbl_WaitCheckLabel:"+ WaitCheckLabeltype.ToString());
if (IOValue(IO_Label_Type.Reset_BTN).Equals(IO_VALUE.HIGH)) {
MoveInfo.ReelParam.LabelState = WaitCheckLabeltype.ToString();
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
RobotManage.Line2.LineRun("label", 999, "Lbl_WaitCheckLabel");
......@@ -299,7 +304,7 @@ namespace DeviceLibrary
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add($"等待分盘线超时{MoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
Msg.add(crc.GetString("wait_xx_timeout", "等待{0}超时{1}秒",RobotManage.filterMachine.DeviceName, MoveInfo.TimeOutSeconds), MsgLevel.warning);
MoveInfo.log($"等待分盘线超时,SendOutMoveInfo:{SendOutMoveInfo.MoveStep}");
}
break;
......@@ -333,11 +338,12 @@ namespace DeviceLibrary
{
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
RobotManage.filterMachine.preReelParam = null;
SendOutMoveInfo.log("等待料盘到达分盘线超时.完成贴标.");
}
else if (MoveInfo.IsTimeOut(5))
{
Msg.add($"等待到达分盘线", MsgLevel.warning);
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.filterMachine.DeviceName), MsgLevel.warning);
SendOutMoveInfo.log("等待到达分盘线");
}
break;
......@@ -363,16 +369,16 @@ namespace DeviceLibrary
}
else if (VacuumMoveInfo.IsTimeOut(25))
{
Msg.add($"标签打印超时{VacuumMoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
Msg.add(crc.GetString("label_print_timeout","标签打印超时{0}秒", VacuumMoveInfo.TimeOutSeconds), MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时, 放弃贴标NG处理");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "标签打印超时";
MoveInfo.ReelParam.NgMsg = "Label Print Timeout";
MoveInfo.ReelParam.logresult();
}
else if (VacuumMoveInfo.IsTimeOut(15))
{
Msg.add($"标签打印超时{VacuumMoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
Msg.add(crc.GetString("label_print_timeout", "标签打印超时{0}秒", VacuumMoveInfo.TimeOutSeconds), MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时");
}
break;
......
......@@ -10,6 +10,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine
{
public void InitPrint()
......@@ -117,11 +118,12 @@ namespace DeviceLibrary
try
{
Bitmap bitmap;
Task.Delay(700).Wait();
List<CodeInfo> LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }, out bitmap);
if (LastCodeList.Count <= 0)
{
Task.Delay(500).Wait();
LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName });
//Task.Delay(500).Wait();
//LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName });
}
if (LastCodeList.Count == 0)
......@@ -135,7 +137,7 @@ namespace DeviceLibrary
if (MoveInfo.ReelParam.WareCode != LastCodeList[0].CodeStr)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
Msg.add($"扫描到的Reelid与发出打印的不一致,系统:{MoveInfo.ReelParam.WareCode},实际:{LastCodeList[0].CodeStr}", MsgLevel.warning);
Msg.add(crc.GetString("label_qrcode_different", "扫描到的Reelid与发出打印的可能不一致"), MsgLevel.warning);
MoveInfo.log($"扫描到的Reelid与发出打印的不一致,系统:{MoveInfo.ReelParam.WareCode},实际:{LastCodeList[0].CodeStr}");
WaitCheckLabeltype = WaitCheckLabeltypeE.Scan_Code_And_Print_are_different;
//MoveInfo.ReelParam.IsNg = true;
......
......@@ -7,10 +7,12 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public class MachineBase
{
public virtual DeviceConfig Config { get; set; }
public virtual string DeviceName { get; set; }
public virtual string DeviceName { get; }
public virtual string DeviceNameShow { get=>crc.GetString(DeviceName, DeviceName); }
public virtual bool UserPause { get; set; }
public RunStatus runStatus { get; set; } = RunStatus.Stop;
protected MoveInfo ResetMoveInfo;
......@@ -62,12 +64,39 @@ namespace DeviceLibrary
}
public bool SafeCheck()
{
bool ok = true;
if (UserPause) {
Msg.add("用户暂停设备", MsgLevel.warning);
return false;
Msg.add(crc.GetString("device_user_pause","用户暂停设备"), MsgLevel.warning);
DeviceSuddenStop();
ok = false;
}
if (IOManager.GetDIValue("",0,16).Equals(IO_VALUE.LOW))
{
ok = false;
DeviceSuddenStop();
Msg.add(crc.GetString("device_safedoor_open", "贴标或出料机构门禁被打开"), MsgLevel.warning);
}
lastSafeCheckStatus = ok;
return ok;
}
bool lastSafeCheckStatus = true;
void DeviceSuddenStop()
{
if (lastSafeCheckStatus)
{
//lastSafeCheckStatus = false;
var al = new Dictionary<string, List<AxisBean>>(AxisBean.List);
return true;
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.labelMachine.DeviceName]);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.t1Machine.DeviceName]);
//AxisBean.StopMultiAxis();
MoveInfo.List.ForEach((m) => { m.CanWhileCount = 5; });
if (runStatus == RunStatus.HomeReset)
{
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
}
}
}
protected void ProcessMsgEventFire(List<Msg> msg) {
ProcessMsgEvent?.Invoke(this,msg);
......@@ -199,7 +228,7 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
ConfigIO io = Config.getWaitIO(wait.IoType);
NotOkMsg = " 等待【" + io.DisplayStr + "】=【" + wait.IoValue + "】";
NotOkMsg = $" {crc.GetString("wait","等待")}【" + io.DisplayStr + "】=【" + wait.IoValue + "】";
wait.IsEnd = IOManager.IOValue(wait.IoType,Config).Equals(wait.IoValue);
if (!wait.IsEnd)
{
......@@ -207,7 +236,7 @@ namespace DeviceLibrary
if (span.TotalMilliseconds > timeOutMs)// && NoAlarm())
{
WarnMsg = DeviceName + "[" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
WarnMsg = DeviceNameShow + "[" + MoveInfo.MoveStep + $"] {crc.GetString("wait", "等待")}(" + io.DisplayStr + "=" + wait.IoValue + $"){crc.GetString("timeout","超时")}";
Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning);
LogUtil.error(WarnMsg, logType + 14);
......@@ -244,21 +273,30 @@ namespace DeviceLibrary
{
LogUtil.debug(DeviceName + "CheckWaitResult 检测到" + axisBean.TargetIoType + "=" + axisBean.TargetIoValue + ",停止运行");
axisBean.StopAxisCheckMove();
if (AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{
//if (AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
//{
axisBean.SuddenStop();
}
//}
wait.IsEnd = true;
}
else
{
bool _isOk = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
if (_isOk)
bool isbusy = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1);
if (!isbusy)
{
int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (errorCount <= wait.AxisInfo.CanErrorCountMax)
{
//TODO 判断是否达到高度,如果未达到,继续上升
axisBean.StopAxisCheckMove();
wait.IsEnd = true;
}
else
{
axisBean.AbsMove(null, wait.TargetPosition, wait.TargetSpeed);
wait.IsEnd = false;
}
}
}
}
if (wait.IsEnd)
......@@ -285,7 +323,7 @@ namespace DeviceLibrary
}
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{
WarnMsg = DeviceName + "[" + MoveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
WarnMsg = DeviceNameShow + "[" + MoveInfo.MoveStep + $"]{crc.GetString("wait","等待")}" + NotOkMsg + $"{crc.GetString("timeout","超时")}[" + Math.Round(span.TotalSeconds, 1) + "s]";
int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
if (second > 120)
......
......@@ -128,6 +128,11 @@ namespace DeviceLibrary
LblVacuum_end,
LblVacuum_failure,
LblVacuum_printfail,
T1_08_UpReelFail,
T1_09_ReleaseReel_Fail,
T1_09_ReleaseReel_Test,
Shelf_19_LocationString,
Shelf_19_LocationString_wait,
}
......
......@@ -13,6 +13,7 @@ using System.Windows.Forms;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public static class RobotManage
{
public static XRayMachine xrayMachine;
......@@ -40,8 +41,8 @@ namespace DeviceLibrary
public static ReelLocation offlinereelLocation = new ReelLocation();
public static LineRunMonitor Line1;
public static LineRunMonitor Line2;
public static Stopwatch ProductivityStopwatch = new Stopwatch();
public static List<float> Productivity = new List<float>();
public static int ProductivityCount = 0;
public static int DefectiveCount = 0;
//static string baseDir = Application.StartupPath;
public static void Init() {
try
......@@ -62,7 +63,7 @@ namespace DeviceLibrary
if (!device.Init(out string msg))
{
IsLoadOk = false;
msgs += $"{device.DeviceName} Init Failed\n";
msgs += $"{device.DeviceNameShow} Init Failed\n";
}
LogUtil.info(device.DeviceName + " init end");
});
......@@ -72,7 +73,7 @@ namespace DeviceLibrary
labelMachine.InitPrint();
if (!XRay.Open(ConfigHelper.Config.Get("XRay_Port"), string.Format("{0:yyyy-MM-dd}", DateTime.Now)))
{
msgs += $"X光管通讯失败:{ConfigHelper.Config.Get("XRay_Port")}\n";
msgs += crc.GetString("device_xray_open_failed","X光管通讯失败:{0}\n", ConfigHelper.Config.Get("XRay_Port"));
IsLoadOk = false;
}
else
......@@ -82,14 +83,14 @@ namespace DeviceLibrary
if (!XRay.SetVC(ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current")))
{
msgs += $"X光电压电流设置失败:{ConfigHelper.Config.Get("XRay_Voltage")},{ConfigHelper.Config.Get("XRay_Current")}\n";
msgs += crc.GetString("device_xray_setvc_failed", "X光电压电流设置失败:{0},{1}\n", ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current"));
IsLoadOk = false;
}
else
LogUtil.info($"xray V:{ConfigHelper.Config.Get("XRay_Voltage")} ,C:{ConfigHelper.Config.Get("XRay_Current")} set ok");
if (!xrayImage.Open()) {
msgs += $"图像平板打开失败\n";
msgs += crc.GetString("device_xrayimage_open_failed", $"图像平板打开失败\n");
IsLoadOk = false;
}
//xrayImage.Close();
......@@ -97,7 +98,7 @@ namespace DeviceLibrary
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper = new ElectricGripper(ElectricGripperPort);
if (!electricGripper.OpenPort()) {
msgs += $"电夹爪通讯失败:{ElectricGripperPort}\n";
msgs += crc.GetString("device_electricGripper_open_failed", "电夹爪通讯失败:{0}\n", ElectricGripperPort);
IsLoadOk = false;
}
electricGripper.HomeReset();
......@@ -105,7 +106,7 @@ namespace DeviceLibrary
if (!IOManager.ConnectionIO())
{
IsLoadOk = false;
msgs += "IO板卡初始化失败\n";
msgs += crc.GetString("device_io_open_failed", "IO板卡初始化失败\n");
}
Line1 = new LineRunMonitor("line1", labelMachine.Config.DOList[IO_Label_Type.Line1_Run].GetIOAddr());
Line2 = new LineRunMonitor("line2", labelMachine.Config.DOList[IO_Label_Type.Line2_Run].GetIOAddr());
......@@ -117,7 +118,7 @@ namespace DeviceLibrary
}
}
public static void LoadDebug() {
LoadFinishEvent?.Invoke(true, "打开调试模式");
LoadFinishEvent?.Invoke(true, crc.GetString("open_debugmode","打开调试模式"));
}
public static void Start()
{
......
......@@ -37,8 +37,10 @@ namespace DeviceLibrary
RunningLed.LedState = LedState.off;
}
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_18_EmptyIn_WaitManCheck) {
AlarmLed.LedState = LedState.on;
if (ShelfInMoveInfo.MoveStep == MoveStep.T1_08_UpReelFail
|| ShelfInMoveInfo.MoveStep == MoveStep.T1_09_ReleaseReel_Fail) {
//AlarmLed.LedState = LedState.on;
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (runStatus == RunStatus.HomeReset)
......
......@@ -10,6 +10,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class T1Machine : MachineBase, IRobot
{
private Config_T1 _config;
......@@ -21,7 +22,7 @@ namespace DeviceLibrary
_config = value;
}
}
public override string DeviceName { get; set; } = "出料机构";
public override string DeviceName { get; } = "出料机构";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
......@@ -146,13 +147,13 @@ namespace DeviceLibrary
if (IOValue(IO_T1_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Msg.add(crc.GetString("emergency_stop", "急停中"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.info);
Msg.add(crc.GetString("system_need_reset", "系统需要重置"), MsgLevel.info);
Thread.Sleep(1000);
ok = false;
}
......@@ -167,7 +168,7 @@ namespace DeviceLibrary
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add($"{configMoveAxis.Explain}:运动报警", MsgLevel.warning);
Msg.add(crc.GetString("axis_run_alert", "{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
}
}
......
......@@ -17,6 +17,7 @@ using static DeviceLibrary.eyemlib;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
partial class T1Machine
{
public IO_VALUE End_Line_Tray_Check { get => IOValue(IO_T1_Type.End_Line_Tray_Check); }
......@@ -48,7 +49,7 @@ namespace DeviceLibrary
}
else
{
Msg.add("等待上料区进入料盘", MsgLevel.info);
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceName), MsgLevel.info);
}
break;
case MoveStep.T1_02_WaitReelInpos:
......@@ -95,17 +96,31 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.T1_07_PanToOut);
MoveInfo.log($"升降轴上升, 料盘提升下降");
T_Updown_Axis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1_speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.LOW));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.LOW));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_07_PanToOut:
if (IOValue(IO_T1_Type.End_Lift_Tray_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(MoveStep.T1_08_DownToShelf);
MoveInfo.log($"横移到料串");
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P2, Config.Pan_P2_speed);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(2))
{
MoveInfo.NextMoveStep(MoveStep.T1_08_UpReelFail);
}
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_08_UpReelFail:
Msg.add(crc.GetString("T1_grip_fail","出料机构抓料失败,请人工处理"), MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
}
break;
case MoveStep.T1_08_DownToShelf:
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
......@@ -114,7 +129,7 @@ namespace DeviceLibrary
var offset_x = LastStringCenter.X - CenterPos.X;
var offset_y = LastStringCenter.Y - CenterPos.Y;
var Y= Config.Y_P2 + offset_y * Config.Cam_Pixel_Y_Ratio;
var Y = Config.Y_P2 + offset_y * Config.Cam_Pixel_Y_Ratio;
var Pan_X = Config.Pan_P2 + offset_x * Config.Cam_Pixel_X_Ratio;
......@@ -126,23 +141,33 @@ namespace DeviceLibrary
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add("等待料串准备完成", MsgLevel.warning);
Msg.add(crc.GetString("wait_shelf_ready", "等待料串准备完成"), MsgLevel.warning);
}
break;
case MoveStep.T1_09_ReleaseReel:
//if (RobotManage.electricGripper.Release())
//{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Test);
RobotManage.electricGripper.Release();
MoveInfo.log($"夹爪放松");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Tray_Check, IO_VALUE.HIGH));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Tray_Check, IO_VALUE.HIGH));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_09_ReleaseReel_Test:
if (IOValue(IO_T1_Type.T1_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
}
else if (MoveInfo.IsTimeOut(2))
{
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Fail);
}
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//}
// else
//{
// Msg.add("夹爪忙碌中...", MsgLevel.warning);
// MoveInfo.log($"夹爪忙碌中...");
//}
break;
case MoveStep.T1_09_ReleaseReel_Fail:
Msg.add(crc.GetString("T1_put_fail", "出料机构放失败,请人工处理"), MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
}
break;
case MoveStep.T1_10_PutReelFinish:
ShelfInMoveInfo.ReelParam = MoveInfo.ReelParam;
......@@ -179,7 +204,14 @@ namespace DeviceLibrary
switch (ShelfInMoveInfo.MoveStep)
{
case MoveStep.Shelf_EmptyIn_WaitWorkLeave:
Msg.add("等待空料串进入线体", MsgLevel.info);
if (ShelfOutMoveInfo.MoveStep == MoveStep.Wait)
{
Msg.add(crc.GetString("T1_wait_empty", "等待空料串进入线体"), MsgLevel.info);
}
else {
Msg.add(crc.GetString("T1_wait_release", "等待料串释放中"), MsgLevel.info);
return;
}
if (IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_15_EmptyIn_LocationUp);
......@@ -187,12 +219,12 @@ namespace DeviceLibrary
}
else if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_StopDown);
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown);
ShelfInMoveInfo.log("工位无料,入口等待位有料,开始进入");
}
else if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown);
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_StopDown);
ShelfInMoveInfo.log("工位无料,入口位有料,开始进入");
}
break;
......@@ -254,61 +286,29 @@ namespace DeviceLibrary
IOMove(IO_T1_Type.T1String_Sliding_Run, IO_VALUE.LOW);
break;
case MoveStep.Shelf_19_EmptyIn_BatchUp:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_LocationString);
ShelfInMoveInfo.log("T1 批量轴上升到P2");
TrayStringFixTimes = 0;
BatchAxisToP2(ShelfInMoveInfo, false);
break;
case MoveStep.Shelf_17_EmptyIn_CheckLocation:
/*
var aclpos = T_Batch_Axis.GetAclPosition();
ShelfInMoveInfo.log($"计算料串中心位置 P2:{Config.BatchAxis_P2}, AclPos:{aclpos}");
bool isFirst = true;
if (Math.Abs(Config.BatchAxis_P2 - aclpos) > Config.BatchAxis_ChangeValue*4)
isFirst = false;
var t = Task.Run(()=> {
(Bitmap Bitmap, Point CurrentPoint, string debugstring) = GetStringCenter(isFirst);
var distance = (int)Common.distance(CenterPos, CurrentPoint);
TrayStringLocation?.Invoke(this, Bitmap);
if (isFirst)
case MoveStep.Shelf_19_LocationString:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_LocationString_wait);
LocationString();
break;
case MoveStep.Shelf_19_LocationString_wait:
if (CheckLocationTask.IsCompleted)
{
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 First LastStringCenter:{LastStringCenter}");
///Lastdistance = distance;
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
}
else if ((int)Common.distance(LastStringCenter, CurrentPoint) < 70)
else if (ShelfInMoveInfo.IsTimeOut(5))
{
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 LastStringCenter:{LastStringCenter}");
}
else {
ShelfInMoveInfo.log($"计算料串中心位置 失败");
LastStringCenter = CenterPos;
}
});
if (isFirst)
t.Wait();
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
*/
//if (Lastdistance > Config.String_Offset_Range_Px)
//{
// ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_18_EmptyIn_WaitManCheck);
//}
//else
//{
// ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
//}
break;
case MoveStep.Shelf_18_EmptyIn_WaitManCheck:
Msg.add("料串中心位置偏移, 请手动调整.", MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_17_EmptyIn_CheckLocation);
}
break;
case MoveStep.Shelf_20_EmptyIn_ShelfReady: //等待料盘放入
Msg.add("料串准备完毕,等待放入料盘", MsgLevel.info);
Msg.add(crc.GetString("T1_ShelfReady", "料串准备完毕,等待放入料盘"), MsgLevel.info);
break;
case MoveStep.Shelf_21_EmptyIn_TrayDown: //料盘放入后调用
var Height = ShelfInMoveInfo.ReelParam.PlateH + 3;
......@@ -339,7 +339,7 @@ namespace DeviceLibrary
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_EmptyIn_WaitWorkLeave);
}
Msg.add("料串已满等待空料串", MsgLevel.info);
Msg.add(crc.GetString("T1_Shelffull_waitempty", "料串已满等待空料串"), MsgLevel.info);
break;
}
......@@ -381,7 +381,7 @@ namespace DeviceLibrary
}
public bool ReleaseShelf()
{
if (MoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady)
if (ShelfInMoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
return false;
}
......@@ -447,15 +447,21 @@ namespace DeviceLibrary
}
void EmptyStringIN()
{
this.loginfo($"T1空料串入口感应到料串,EmptyString_In_Check:{IOValue(IO_T1_Type.EmptyString_In_Check)}");
//if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
// return;
this.loginfo($"T1空料串入口感应到料串,Empty_LineIn_Check:{IOValue(IO_T1_Type.Empty_LineIn_Check)}");
if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
{
this.loginfo($"T1等待位有料不允许进入");
return;
}
//if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.HIGH))
// return;
ShelfInLine.LineRun("EmptyStringIN", 30);
WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 10);
Thread.Sleep(2000);
IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 2000);
WaitIo(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH, 10);
Thread.Sleep(1000);
ShelfInLine.LineStop("EmptyStringIN");
this.loginfo($"T1等待位进入完成");
}
......
......@@ -9,6 +9,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class XRayMachine
{
......@@ -79,7 +80,7 @@ namespace DeviceLibrary
else if (MoveInfo.IsTimeOut(10))
{
FeedingMoveinfo.log($"等待Xray可以进入");
Msg.add("等待Xray可以进入", MsgLevel.info);
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", RobotManage.xrayMachine.DeviceName), MsgLevel.info);
}
break;
case MoveStep.Feeding_05_Wait_Man_Check:
......@@ -87,7 +88,7 @@ namespace DeviceLibrary
{
if (IOValue(IO_XRay_Type.Tray_Check).Equals(IO_VALUE.HIGH))
{
Msg.add("未识别出料盘, 请取走", MsgLevel.warning);
Msg.add(crc.GetString("scancode_fail_takeout","未识别出料盘, 请取走"), MsgLevel.warning);
}
else if (IOMonitor.IODebound(IO_XRay_Type.Tray_Check, Config, IO_VALUE.LOW, 1000))
{
......
......@@ -14,6 +14,7 @@ using System.Windows.Forms;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
partial class XRayMachine
{
const string xraydir = @"\Image\Xray";
......@@ -28,6 +29,7 @@ namespace DeviceLibrary
case MoveStep.XRay_01_LocationDown:
MoveInfo.StopwatchReset();
MoveInfo.NextMoveStep(MoveStep.XRay_02_RunIn);
RobotManage.ProductivityCount++;
MoveInfo.log($"定位气缸下降,打开点料机入口门");
CylinderMove(MoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up, IO_VALUE.LOW);
CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH);
......@@ -92,7 +94,7 @@ namespace DeviceLibrary
}
else if (MoveInfo.IsTimeOut(30)) {
Msg.add("等待贴标机构入口空闲", MsgLevel.warning);
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
MoveInfo.log("等待贴标机构入口空闲");
}
break;
......@@ -109,7 +111,7 @@ namespace DeviceLibrary
}
else if (MoveInfo.IsTimeOut(10))
{
Msg.add("等待料盘到达贴标线入口", MsgLevel.warning);
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
MoveInfo.log("等待料盘到达贴标线入口");
}
break;
......@@ -206,7 +208,7 @@ namespace DeviceLibrary
//tpDstImg = new API.EyemImage();
try
{
string countStr = "";
int[] countStr = new int[4];
int result = 0;
int ShrinkOffset = ConfigHelper.Config.Get<int>("ShrinkOffset",100);
var type = Pn_Algo_Match.MatchPN(MoveInfo.ReelParam.PN);
......@@ -219,10 +221,11 @@ namespace DeviceLibrary
type = "auto";
}
}
Bitmap dst=null;
if (type == "auto")
{
result = XrayImage.GetLocalCount(xrayImagePath, ShrinkOffset, out countStr, out _);
MoveInfo.log("GetCountResult " + type + " 调用 GetLocalCount 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + countStr + "】");
result = XrayImage.GetLocalCount(xrayImagePath, ShrinkOffset, out countStr, out dst);
MoveInfo.log("GetCountResult " + type + " 调用 GetLocalCount 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + string.Join(",",countStr) + "】");
}
else if (type.StartsWith("IP_Template_PARTS"))
{
......@@ -231,19 +234,20 @@ namespace DeviceLibrary
{
template = type.Substring(17 + 1);
}
result = XrayImage.GetLocalCountTemplate(xrayImagePath, ShrinkOffset, template, out countStr, out Bitmap dst);
MoveInfo.log("GetCountResult " + template + " 调用 GetLocalCountTemplate 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + countStr + "】");
result = XrayImage.GetLocalCountTemplate(xrayImagePath, ShrinkOffset, template, out countStr, out dst);
MoveInfo.log("GetCountResult " + template + " 调用 GetLocalCountTemplate 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】");
}
else
{
result = XrayImage.GetLocalCountIrregular(xrayImagePath, ShrinkOffset, type.ToString(), out countStr, out dst);
MoveInfo.log("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】");
}
if (dst != null)
{
dst.Save("ResOut\\" + Path.GetFileNameWithoutExtension(xrayImagePath) + "-Mark.png");
dst.Dispose();
}
}
else
{
result = XrayImage.GetLocalCountIrregular(xrayImagePath, ShrinkOffset, type.ToString(), out countStr, out _);
MoveInfo.log("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + xrayImagePath + "】,返回【" + result + "】,结果【" + countStr + "】");
}
if (result != 0)
{
MoveInfo.ReelParam.IsNg = true;
......@@ -254,8 +258,8 @@ namespace DeviceLibrary
if (countStr != null)
{
string[] array = countStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
count = (from a in array where int.TryParse(a, out _) && int.Parse(a) > 0 select int.Parse(a)).FirstOrDefault();
//string[] array = countStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
count = (from a in countStr where a > 0 select a).FirstOrDefault();
}
else
{
......
......@@ -10,6 +10,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class XRayMachine : MachineBase, IRobot
{
private Config_XRay _config;
......@@ -22,7 +23,7 @@ namespace DeviceLibrary
_config = value;
}
}
public override string DeviceName { get; set; } = "点料";
public override string DeviceName { get; } = "点料";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
......@@ -135,14 +136,14 @@ namespace DeviceLibrary
if (IOValue(IO_XRay_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Msg.add(crc.GetString("emergency_stop", "急停中"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.info);
Msg.add(crc.GetString("system_need_reset", "系统需要重置"), MsgLevel.info);
Thread.Sleep(1000);
ok = false;
}
......@@ -155,7 +156,7 @@ namespace DeviceLibrary
if (span.TotalSeconds > Config.AirCheckSeconds)
{
ok = false;
Msg.add("气压不足", MsgLevel.warning);
Msg.add(crc.GetString("air_pressure_fail", "气压不足"), MsgLevel.warning);
}
}
else
......@@ -172,7 +173,7 @@ namespace DeviceLibrary
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add($"{configMoveAxis.Explain}:运动报警", MsgLevel.warning);
Msg.add(crc.GetString("axis_run_alert", "{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
}
}
......
......@@ -9,9 +9,10 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public class AxisBean
{
static readonly Dictionary<string, List<AxisBean>> List = new Dictionary<string, List<AxisBean>>();
public static readonly Dictionary<string, List<AxisBean>> List = new Dictionary<string, List<AxisBean>>();
public ConfigMoveAxis Config = null;
public static int TimeoutInterval = 500;
......@@ -189,7 +190,7 @@ namespace DeviceLibrary
}
else
{
msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr},目标位置{targetPosition},当前位置{outCount},误差过大,需要报警";
msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} "+crc.GetString("axis_absmove_error", "{0}:目标位置{1},当前位置{2},误差过大,需要报警", axis.DisplayStr, targetPosition, outCount);
LogUtil.error(msg, 600);
}
}
......@@ -252,7 +253,7 @@ namespace DeviceLibrary
}
else
{
msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
msg = MoveInfo.Name + " " + MoveInfo.MoveStep + crc.GetString("axis_homeback_error", "{0}:收到原点完成信号,当前位置[{1}],误差过大,需要报警", axis.DisplayStr, outCount);
LogUtil.error(msg);
}
}
......@@ -343,7 +344,7 @@ namespace DeviceLibrary
private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimeSpan pan = DateTime.Now - lastOkTime;
if (IsInProcess && pan.TotalMilliseconds < 100) { return; }
if (IsInProcess && pan.TotalMilliseconds < 50) { return; }
try
{
......@@ -351,9 +352,10 @@ namespace DeviceLibrary
lastOkTime = DateTime.Now;
if (IOManager.IOValue(TargetIoType, IOConfig).Equals(TargetIoValue))
{
SuddenStop();
StopAxisCheckMove();
LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动");
SuddenStop();
}
}
catch (Exception ex)
......
......@@ -10,7 +10,8 @@ namespace DeviceLibrary
{
//List<ConfigMoveAxis> moveAxisList { get; set; }
DeviceConfig Config { get; set; }
string DeviceName { get; set; }
string DeviceName { get; }
string DeviceNameShow { get; }
bool canRunning { get; set; }
bool isBusy { get; set; }
......
......@@ -11,7 +11,6 @@ namespace DeviceLibrary
{
public class ReelParam
{
public static long uid = 0;
/// <summary>
/// 创建新出入库信息
/// </summary>
......@@ -22,8 +21,7 @@ namespace DeviceLibrary
/// <param name="ngMsg">NG消息</param>
public ReelParam(string wareNo = "", int platew = 0, int plateh = 0, bool _IsNg = false, string ngMsg = "")
{
uid++;
UID = uid.ToString();
UID = databaseProc.Current.GetID();
ReeID = WareCode;
WareCode = wareNo;
PlateW = platew;
......@@ -34,7 +32,7 @@ namespace DeviceLibrary
PN = "PN";
ReelDest = ReelDest.Unknow;
}
public string UID = "0";
public long UID = 0;
string _WareCode;
/// <summary>
/// 物品二维码信息
......@@ -84,6 +82,12 @@ namespace DeviceLibrary
/// 入料NG消息
/// </summary>
public string NgMsg = "";
/// <summary>
/// 贴标状态
/// </summary>
public string LabelState = "None";
/// <summary>
/// 料盘出口
/// </summary>
......@@ -115,7 +119,7 @@ namespace DeviceLibrary
string countfile = $"CountResult-{DateTime.Now:yyyy-MM-dd}.txt";
if (!File.Exists(countfile)) {
var sw1 = File.AppendText(countfile);
sw1.WriteLine($"Date,ReeID,PN,WxH,ReelDest,NgMsg,QTY,2D_Barcode");
sw1.WriteLine($"Date,ReeID,PN,WxH,ReelDest,NgMsg,QTY,LabelState,2D_Barcode");
sw1.Close();
sw1.Dispose();
}
......@@ -125,10 +129,11 @@ namespace DeviceLibrary
// string s = $"\r\n{ReeID},{PN},{PlateW}x{PlateH},{ReelDest},{NgMsg},{QTY},{WareCode}";
//var b = Encoding.GetEncoding("gb2312").GetBytes(s);
//sw.Write(b, 0, b.Length);
sw.WriteLine($"{DateTime.Now:HH:mm:ss},{ReeID},{PN},{PlateW}x{PlateH},{ReelDest},{NgMsg},{QTY},{WareCode}");
sw.WriteLine($"{DateTime.Now:HH:mm:ss},{ReeID},{PN},{PlateW}x{PlateH},{ReelDest},{NgMsg},{QTY},{LabelState},{WareCode}");
sw.Close();
sw.Dispose();
}
databaseProc.Current.InsertOrUpdateRI(UID, PN, ReeID, IsNg, NgMsg, QTY, LabelState, ReelDest.ToString(), WareCode);
}
public string GetImgName()
{
......
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public class MoveInfo
{
......@@ -21,12 +22,12 @@ namespace DeviceLibrary
ReelParam = new ReelParam();
this.moveStep = MoveStep.Wait;
IsInWait = false;
this.Name = name;
this.name = name;
List.Add(this);
}
public string Name { get; set; }
string name="";
public string Name { get => crc.GetString(this.name, this.name); set => name = value; }
public DateTime LastSetpTime { get; set; }
public bool OneWaitCanEndStep = false;
......@@ -250,7 +251,7 @@ namespace DeviceLibrary
}
else if (WaitType.Equals(WaitEnum.W002_IOValue))
{
return "等待【" + IoType + "】=【" + IoValue + "】";
return $"{crc.GetString("wait", "等待")}【" + IoType + "】=【" + IoValue + "】";
}
else if (WaitType.Equals(WaitEnum.W003_Time))
{
......
......@@ -9,11 +9,15 @@ namespace DeviceLibrary
{
public class ServerConn
{
const string host = "http://10.69.221.80";
static string inputCounterDataByXRayMachine_URL;
static string DetermineReelStorageLocation_URL;
static ServerConn()
{
inputCounterDataByXRayMachine_URL = ConfigAppSettings.GetValue("inputCounterDataByXRayMachine");
DetermineReelStorageLocation_URL = ConfigAppSettings.GetValue("DetermineReelStorageLocation");
}
public static CountResult inputCounterDataByXRayMachine(string TwoDBarcode, int qty)
{
//string url = host + "/api/inputCounterDataByXRayMachine";
string url = host + "/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine";
var wc = new MyWebClient(15000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
......@@ -33,7 +37,7 @@ namespace DeviceLibrary
retry:
try
{
result = wc.UploadString(url, "POST", json);
result = wc.UploadString(inputCounterDataByXRayMachine_URL, "POST", json);
return JsonHelper.DeserializeJsonToObject<CountResult>(result);
}
catch (Exception e)
......@@ -53,8 +57,6 @@ namespace DeviceLibrary
public static ReelLocation DetermineReelStorageLocation(string TwoDBarcode)
{
//string url = host + "/api/RLC/DetermineReelStorageLocation";
string url = host + "/SCTARLC001/api/RLC/DetermineReelStorageLocation";
var wc = new MyWebClient(15000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
......@@ -74,7 +76,7 @@ namespace DeviceLibrary
retry:
try
{
result = wc.UploadString(url, "POST", json);
result = wc.UploadString(DetermineReelStorageLocation_URL, "POST", json);
return JsonHelper.DeserializeJsonToObject<ReelLocation>(result);
}
catch (Exception e)
......
<?xml version="1.0" encoding="UTF-8"?>
<config ver="10">
<item key="EnableBuzzer" ver="10" value="True" />
<item key="App_AutoRun" ver="10" value="True" />
</config>
\ No newline at end of file
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,取料机构旋转轴,Take_Middle_Axis,0,HC,,500,1000,1000,100,200,1000,10,100,0,0
AXIS,,取料机构上下轴,Take_UpDown_Axis,1,HC,,1000,1000,1000,200,500,500,10,100,0,0
AXIS,,左轨道提升轴,Left_Batch_Axis,2,HC,,3000,1000,1000,200,1000,200,10,100,0,0
AXIS,,右轨道提升轴,Right_Batch_Axis,3,HC,,3000,1000,1000,200,1000,200,10,100,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,100,700,700,50,250,500,10,100,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,100,800,800,50,150,500,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,10,2000,2000,1,5,200,500,100,0,0
,,,,,,,,,,,,,,,,
PRO,30,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,30,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,20,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,20,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,30,右侧相机名称,RightCameraName,123123,,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
PRO,30,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
PRO,30,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,10,取料旋转轴待机点P1,Take_Middle_P1,1,,,99,,,,,,,,,
PRO,10,取料旋转轴右取料点P2,Take_Middle_P2,2,,,99,,,,,,,,,
PRO,10,取料旋转轴左取料点P3,Take_Middle_P3,3,,,99,,,,,,,,,
PRO,10,取料旋转轴NG放料点P5,Take_Middle_P5,4,,,99,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,11,取料上下轴待机点P1,Take_UpDown_P1,6,,,88,,,,,,,,,
PRO,11,取料上下轴取料高点P2,Take_UpDown_P2,7,,,88,,,,,,,,,
PRO,11,取料上下轴取右料低点P3,Take_UpDown_P3,8,,,88,,,,,,,,,
PRO,11,取料上下轴取左料低点P4,Take_UpDown_P4,9,,,88,,,,,,,,,
PRO,11,取料上下轴NG放料点P5,Take_UpDown_P5,10,,,88,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,12,右提升轴低点P1,Right_Batch_P1,12,,,66,,,,,,,,,
PRO,12,右提升轴高点P2,Right_Batch_P2,13,,,66,,,,,,,,,
PRO,12,左提升轴低点P1,Left_Batch_P1,14,,,66,,,,,,,,,
PRO,12,左提升轴高点P2,Left_Batch_P2,15,,,66,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,,
PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,,
PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,进料口确认按钮,Right_BTN,1,HC,X01,,,,,,,,,,
DI,0,出料口确认按钮,Left_BTN,2,HC,X02,,,,,,,,,,
DI,0,后门左门禁,LeftBackDoor_Check,3,HC,X03,,,,,,,,,,
DI,0,后门右门禁,RightBackDoor_Check,4,HC,X04,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,5,HC,X05,,,,,,,,,,
DI,0,光栅信号,GratingSignal_Check,6,HC,X06,,,,,,,,,,
DI,0,NG料箱检测,HasNgBox,7,HC,X07,,,,,,,,,,
DI,0,打印机到位检测,HasPrinter,8,HC,X08,,,,,,,,,,
DI,0,旋转臂进料侧检测,RightArm_Check,9,HC,X09,,,,,,,,,,
DI,0,旋转臂出料侧检测,LeftArm_Check,10,HC,X10,,,,,,,,,,
DI,0,进料口料车检测,RightCar_Check,11,HC,X11,,,,,,,,,,
DI,0,进料口前端料串检测,RightFornt_Check,12,HC,X12,,,,,,,,,,
DI,0,进料口料串到位检测,RightEnd_Check,13,HC,X13,,,,,,,,,,
DI,0,进料口阻挡气缸上升端,RightStopUP,14,HC,X14,,,,,,,,,,
DI,0,进料口阻挡气缸下降端,RightStopDown,15,HC,X15,,,,,,,,,,
DI,0,出料口料车检测,LeftCar_Check,16,HC,X16,,,,,,,,,,
DI,0,出料口前端料串检测,LeftFornt_Check,17,HC,X17,,,,,,,,,,
DI,0,出料口料串到位检测,LeftEnd_Check,18,HC,X18,,,,,,,,,,
DI,0,出料口阻挡气缸上升端,LeftStopUP,19,HC,X19,,,,,,,,,,
DI,0,出料口阻挡气缸下降端,LeftStopDown,20,HC,X20,,,,,,,,,,
DI,0,进料定位料盘检测,RightTop_Check,21,HC,X21,,,,,,,,,,
DI,0,进料定位料盘超限检测,RightOverHead_Check,22,HC,X22,,,,,,,,,,
DI,0,出料定位料盘检测,LeftTop_Check,23,HC,X23,,,,,,,,,,
DI,0,出料定位料盘超限检测,LeftOverHead_Check,24,HC,X24,,,,,,,,,,
DI,0,吸嘴气缸前进端,LabelCylinder_Fwd,25,HC,X25,,,,,,,,,,
DI,0,吸嘴气缸后退端,LabelCylinder_Bck,26,HC,X26,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,,
DO,0,故障指示灯,Alarm_HddLed,1,HC,Y01,,,,,,,,,,
DO,0,待机指示灯,RunSign_HddLed,2,HC,Y02,,,,,,,,,,
DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y03,,,,,,,,,,
DO,0,进料口状态指示灯,RightState_Led,4,HC,Y04,,,,,,,,,,
DO,0,出料口状态指示灯,LeftState_Led,5,HC,Y05,,,,,,,,,,
DO,0,设备照明,Device_Led,6,HC,Y06,,,,,,,,,,
DO,0,相机照明,Camera_Led,7,HC,Y07,,,,,,,,,,
DO,0,进料口电机启动,RightMoto_Run,8,HC,Y08,,,,,,,,,,
DO,0,进料口电机反转指令,RightMoto_Reverse,9,HC,Y09,,,,,,,,,,
DO,0,出料口电机启动,LeftMoto_Run,10,HC,Y10,,,,,,,,,,
DO,0,出料口电机反转指令,LeftMoto_Reverse,11,HC,Y11,,,,,,,,,,
DO,0,进料口阻挡气缸上升,RightStopUP,12,HC,Y12,,,,,,,,,,
DO,0,进料口阻挡气缸下降,RightStopDown,13,HC,Y13,,,,,,,,,,
DO,0,出料口阻挡气缸上升,LeftStopUP,14,HC,Y14,,,,,,,,,,
DO,0,出料口阻挡气缸下降,LeftStopDown,15,HC,Y15,,,,,,,,,,
DO,0,吸嘴气缸前进,LabelCylinder_Fwd,16,HC,Y16,,,,,,,,,,
DO,0,吸嘴气缸后退,LabelCylinder_Bck,17,HC,Y17,,,,,,,,,,
DO,0,吸嘴取标,LabelCylinder_Work,18,HC,Y18,,,,,,,,,,
,,,,,,,,,,,,,,,,
......@@ -2,7 +2,6 @@
PRO,30,NG料盒最大容量,NG_BOX_MAXCOUNT,50,,,,,,,,,,,,
PRO,30,MSD料盒最大容量,MSD_BOX_MAXCOUNT,50,,,,,,,,,,,,
PRO,30,Paper料盒最大容量,PAPER_BOX_MAXCOUNT,50,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,NG料阻挡料盘检测,NG_TaryStop_Check,26,HC,X26,,,,,,,,,,
DI,0,NG料阻挡上升端,NG_TaryStop_Up,27,HC,X27,,,,,,,,,,
DI,0,NG料阻挡下降端,NG_TaryStop_Down,28,HC,X28,,,,,,,,,,
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,贴标移栽机构X轴,Label_X_Axis,3,HC,,20000,30000,30000,500,8000,25000,10,100,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,2,HC,,20000,30000,30000,500,8000,25000,10,100,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,4,HC,,35000,60000,60000,1000,5000,20000,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,5,HC,,200,600,600,20,50,300,500,100,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,3,HC,,90000,3000000,3000000,500,17000,50000,10,1000,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,2,HC,,90000,3000000,3000000,500,17000,50000,10,1000,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,4,HC,,90000,3000000,3000000,1000,13000,40000,10,1000,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,5,HC,,700,8100,8100,20,50,300,500,100,0,0
,,,,,,,,,,,,,,,,
PRO,30,相机名称,CameraName,GigE:MV-CE200-10GC (00E78064892),,,,,,,,,,,,
PRO,30,图像料盘中心坐标X,Right_Batch_X,3201,,,,,,,,,,,,
PRO,30,图像料盘中心坐标Y,Right_Batch_Y,1892,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,180,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,147,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,147,,,,,,,,,,,,
PRO,30,图像料盘中心坐标X,Right_Batch_X,3205,,,,,,,,,,,,
PRO,30,图像料盘中心坐标Y,Right_Batch_Y,1889,,,,,,,,,,,,
PRO,0,贴标R轴0位角度差,Label_R_Angle_Diff,0,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,141,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,141,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,0,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,-564,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,-595,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,0,,,,,,,,,,,,
PRO,30,贴标R轴原点角度,Label_R_Zero_Angle,0,,,,,,,,,,,,
PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,10000,,,,,,,,,,,,
PRO,30,贴标标签偏移X像素,Label_Offset_X,170,,,,,,,,,,,,
PRO,30,贴标标签偏移Y像素,Label_Offset_Y,210,,,,,,,,,,,,
PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,70,,,,,,,,,,,,
PRO,0,贴标R轴原点角度,Label_R_Zero_Angle,0,,,,,,,,,,,,
PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,128,,,,,,,,,,,,
PRO,30,贴标标签偏移X像素,Label_Offset_X,250,,,,,,,,,,,,
PRO,30,贴标标签偏移Y像素,Label_Offset_Y,230,,,,,,,,,,,,
PRO,30,贴标R轴最大角度,Label_R_MaxAngle,330,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,12,贴标X轴待机点P1,Label_X_P1,90407,,,14000,,,,,,,,,
PRO,12,贴标X轴取标点P2,Label_X_P2,56163,,,14000,,,,,,,,,
PRO,12,贴标X轴料盘中心基准点,Label_X_Base,367195,,,14000,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,244500,,,700000,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,244500,,,700000,,,,,,,,,
PRO,13,贴标X轴料盘中心基准点,Label_X_Base,359627,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,13,贴标Y轴待机点P1,Label_Y_P1,246005,,,14000,,,,,,,,,
PRO,13,贴标Y轴取标点P2,Label_Y_P2,246005,,,14000,,,,,,,,,
PRO,13,贴标Y轴料盘中心基准点,Label_Y_Base,358598,,,14000,,,,,,,,,
PRO,12,贴标Y轴待机点P1,Label_Y_P1,111830,,,700000,,,,,,,,,
PRO,12,贴标Y轴取标点P2,Label_Y_P2,49563,,,700000,,,,,,,,,
PRO,12,贴标Y轴料盘中心基准点,Label_Y_Base,367433,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,贴标Z轴待机点P1,Label_Z_P1,78338,,,2000,,,,,,,,,
PRO,14,贴标Z轴取标前点P2,Label_Z_P2,78338,,,2000,,,,,,,,,
PRO,14,贴标Z轴取标点P3,Label_Z_P3,96504,,,2000,,,,,,,,,
PRO,14,贴标Z轴贴标前点P4,Label_Z_P4,85226,,,2000,,,,,,,,,
PRO,14,贴标Z轴贴标点P5,Label_Z_P5,131924,,,2000,,,,,,,,,
PRO,14,贴标Z轴待机点P1,Label_Z_P1,78338,,,700000,,,,,,,,,
PRO,14,贴标Z轴取标前点P2,Label_Z_P2,41000,,,700000,,,,,,,,,
PRO,14,贴标Z轴取标点P3,Label_Z_P3,99900,,,700000,,,,,,,,,
PRO,14,贴标Z轴贴标前点P4,Label_Z_P4,85226,,,700000,,,,,,,,,
PRO,14,贴标Z轴贴标点P5,Label_Z_P5,132000,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,贴标R轴待机点P1,Label_R_P1,560,,,20,,,,,,,,,
PRO,15,贴标R轴取标点P2,Label_R_P2,562,,,20,,,,,,,,,
PRO,15,贴标R轴360度脉冲,Label_R_360,681,,,20,,,,,,,,,
PRO,15,贴标R轴待机点P1,Label_R_P1,560,,,1200,,,,,,,,,
PRO,15,贴标R轴取标点P2,Label_R_P2,562,,,1200,,,,,,,,,
PRO,15,贴标R轴360度脉冲,Label_R_360,681,,,900,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停(贴标设备),SuddenStop_BTN,16,HC,X16,,,,,,,,,,
DI,0,贴标机构复位,Reset_BTN,17,HC,X17,,,,,,,,,,
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,出料提升轴,T_Batch_Axis,6,HC,,8000,15000,15000,500,4000,15000,10,100,0,0
AXIS,,出料移栽轴,T_Pan_Axis,7,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
AXIS,,出料升降轴,T_Updown_Axis,8,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
AXIS,,皮带线出口定位,T_TrayPos_Axis,9,HC,,35000,60000,60000,1000,5000,20000,500,100,0,0
AXIS,,出料提升轴,T_Batch_Axis,6,HC,,8000,30000,30000,500,4000,15000,10,1000,0,0
AXIS,,出料移栽轴,T_Pan_Axis,7,HC,,20000,200000,200000,500,4000,15000,10,1000,0,0
AXIS,,出料升降轴,T_Updown_Axis,8,HC,,20000,200000,200000,500,4000,15000,10,1000,0,0
AXIS,,皮带线出口定位,T_TrayPos_Axis,9,HC,,35000,100000,100000,1000,5000,20000,500,100,0,0
AXIS,,出料移栽Y轴,T_Y_Axis,10,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
,,,,,,,,,,,,,,,,
PRO,16,提升轴待机点 P1,BatchAxis_P1,500,,,8000,,,,,,,,,
PRO,16,提升轴上升目标点_P2,BatchAxis_P2,77756,,,8000,,,,,,,,,
PRO,16,提升轴上升目标点_P2,BatchAxis_P2,78451,,,8000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,17,横移待机取料点P1,Pan_P1,5700,,,20000,,,,,,,,,
PRO,17,横移放料基准点P2,Pan_P2,77614,,,20000,,,,,,,,,
PRO,17,横移待机取料点P1,Pan_P1,5326,,,100000,,,,,,,,,
PRO,17,横移放料点P2,Pan_P2,75933,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,20,Y轴待机取料点P1,Y_P1,5700,,,20000,,,,,,,,,
PRO,20,Y轴放料基准点P2,Y_P2,77614,,,20000,,,,,,,,,
PRO,20,Y轴待机取料点P1,Y_P1,51136,,,100000,,,,,,,,,
PRO,20,Y轴放料基准点P2,Y_P2,51136,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,18,升降轴待机点P1,UpdownAxis_P1,7,,,20000,,,,,,,,,
PRO,18,升降轴取料点P2,UpdownAxis_P2,38420,,,20000,,,,,,,,,
PRO,18,升降轴放料点P3,UpdownAxis_P3,6699,,,20000,,,,,,,,,
PRO,18,升降轴待机点P1,UpdownAxis_P1,7,,,100000,,,,,,,,,
PRO,18,升降轴取料点P2,UpdownAxis_P2,36905,,,100000,,,,,,,,,
PRO,18,升降轴放料点P3,UpdownAxis_P3,6800,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,19,料盘定位待机点P1,TrayPos_P1,0,,,35000,,,,,,,,,
PRO,19,料盘定位待机点P1,TrayPos_P1,0,,,50000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,30,提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,1000,,,,,,,,,,,,
PRO,30,升降轴高度转换系数(1mm对应的脉冲),UpdownAxis_ChangeValue,1000,,,,,,,,,,,,
PRO,30,入口阻挡定位列表,TrayPos_List,7=18164;13=5994;15=2347;,,,,,,,,,,,,
PRO,30,料串定位相机,String_Camera,GigE:MV-CE200-10GC (00F98806639),,,,,,,,,,,,
PRO,30,料串中心点X坐标,String_Center_X,1000,,,,,,,,,,,,
PRO,30,料串中心点Y坐标,String_Center_Y,1000,,,,,,,,,,,,
PRO,30,料串允许偏离像素值,String_Offset_Range_Px,1000,,,,,,,,,,,,
PRO,30,料串图像/X轴比值,Cam_Pixel_X_Ratio,147,,,,,,,,,,,,
PRO,30,料串图像/Y轴比值,Cam_Pixel_Y_Ratio,147,,,,,,,,,,,,
PRO,30,提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,128,,,,,,,,,,,,
PRO,30,升降轴高度转换系数(1mm对应的脉冲),UpdownAxis_ChangeValue,128,,,,,,,,,,,,
PRO,30,入口阻挡定位列表,TrayPos_List,7=18164;13=5400;15=1600;,,,,,,,,,,,,
PRO,30,料串定位相机,String_Camera,GigE:MV-CE200-10GC (00E78064926),,,,,,,,,,,,
PRO,30,料串中心点X坐标,String_Center_X,721,,,,,,,,,,,,
PRO,30,料串中心点Y坐标,String_Center_Y,800,,,,,,,,,,,,
PRO,30,料串允许偏离像素值,String_Offset_Range_Px,60,,,,,,,,,,,,
PRO,30,料串图像/X轴比值,Cam_Pixel_X_Ratio,19,,,,,,,,,,,,
PRO,30,料串图像/Y轴比值,Cam_Pixel_Y_Ratio,143,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,皮带线出口料盘检测,End_Line_Tray_Check,41,HC,X41,,,,,,,,,,
DI,0,皮带线出口顶升料盘检测,End_Lift_Tray_Check,42,HC,X42,,,,,,,,,,
......
......@@ -2,8 +2,8 @@
AXIS,,入口皮带线,Line_Entry_Axis,0,HC,,500,2000,2000,50,100,500,10,100,0,0
AXIS,,中间皮带线,Line_In_Axis,1,HC,,500,2000,2000,50,100,500,10,100,0,0
,,,,,,,,,,,,,,,,
PRO,10,入口伺服相对运动量,Line_Entry_Relative,4000,,,1000,,,,,,,,,
PRO,10,机内伺服相对运动量,Line_In_Relative,7000,,,1000,,,,,,,,,
PRO,10,入口伺服相对运动量,Line_Entry_Relative,4000,,,2000,,,,,,,,,
PRO,10,机内伺服相对运动量,Line_In_Relative,6300,,,2000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,30,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,30,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
......
{"20.K0767.008":"IP_Template_PARTS,CountTemplate\\4b47088a-e49a-439e-b5f5-01f01d041d8e.tpl","062.10007.0371":"IP_Template_PARTS,CountTemplate\\d548ffae-f6b4-40b4-8124-d767400241c9.tpl","66.22236.A4L":"IP_Template_PARTS,CountTemplate\\d548ffae-f6b4-40b4-8124-d767400241c9.tpl","78.10510.5SL":"auto"}
\ No newline at end of file
......@@ -6,10 +6,11 @@
<item key="AngleChange " ver="10" value="83" />
<item key="ElectricGripperPort" ver="10" value="COM11" />
<item key="XRay_Port" ver="10" value="COM5" />
<item key="XRay_Voltage" ver="10" value="060.0" />
<item key="XRay_Voltage" ver="10" value="60.0" />
<item key="XRay_Current" ver="10" value="0500" />
<item key="ShrinkOffset" ver="10" value="150" />
<item key="upload_Counter" ver="10" value="X_RAY1" />
<item key="upload_labelPrinter" ver="10" value="X_RAY1" />
<item key="upload_labelPrinter" ver="10" value="1" />
<item key="WistonAgvServerIP" ver="10" value="127.0.0.1" />
<item key="WistonAgvServerPort" ver="10" value="6065" />
</config>
\ No newline at end of file
......@@ -12,6 +12,8 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -58,6 +60,9 @@
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.114.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
......@@ -102,6 +107,7 @@
<Compile Include="DeviceLibrary\CodeManager.cs" />
<Compile Include="AutoScan\RobotManage.cs" />
<Compile Include="AutoScan\common\IRobot.cs" />
<Compile Include="DeviceLibrary\databaseProc.cs" />
<Compile Include="DeviceLibrary\ElectricGripper.cs" />
<Compile Include="DeviceLibrary\eyemlib.cs" />
<Compile Include="DeviceLibrary\IAxisManager.cs" />
......@@ -174,4 +180,11 @@
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.114.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
</Project>
\ No newline at end of file
......@@ -53,7 +53,7 @@ namespace DeviceLibrary
}
if (!IsBusy)
{
axis.Push(50, 5.5f, 5);
axis.Push(50, 5.5f, 50);
clampTimes++;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
......@@ -81,7 +81,7 @@ namespace DeviceLibrary
}
if (!IsBusy)
{
axis.MoveAbsolute(0.2f, 5, 15, 15, 1f);
axis.MoveAbsolute(0.2f, 50, 150, 150, 1f);
clampTimes = 0;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class databaseProc
{
SQLiteHelper sh = new SQLiteHelper();
IdWorker id = new IdWorker(1, 1);
static databaseProc _databaseProc;
public static databaseProc Current
{
get
{
if (_databaseProc == null)
{
_databaseProc = new databaseProc();
}
return _databaseProc;
}
}
public long GetID() {
return id.nextId();
}
private databaseProc()
{
SQLiteHelper.SetConnectionString("sys.db");
string sql;
//添加MaterialQuantity表
sql = "SELECT COUNT(*) FROM sqlite_master where type='table' and name='ReelInfo';";
int hastable = (int)(long)sh.ExecuteScalar(sql);
if (hastable == 0)
{
sql = @"
CREATE TABLE ""ReelInfo"" (
""ID"" integer NOT NULL COLLATE BINARY,
""PN"" text,
""RI"" TEXT,
""ISNG"" integer,
""NGMSG"" TEXT,
""QTY"" integer,
""LBLState"" TEXT,
""OMSG"" TEXT,
""2D_Barcode"" TEXT,
""DateTime"" date,
PRIMARY KEY (""ID"")
);
";
sh.ExecuteNonQuery(sql);
}
else
{
//添加后期添加的字段
sql = "select sql from sqlite_master where name='ReelInfo';";
string sc = (string)sh.ExecuteScalar(sql);
sc = sc.Replace("\"", "");
if (!sc.Contains("Slot integer"))
{
sql = "alter table ReelInfo add column Slot integer;";
//sh.ExecuteNonQuery(sql);
}
if (!sc.Contains("imgfileid varchar(80)"))
{
sql = "alter table MaterialQuantity add column imgfileid varchar(80);";
//sh.ExecuteNonQuery(sql);
}
}
}
public void InsertOrUpdateRI(long uid,string PN,string RI,bool isng ,string ngmsg, int quantity, string lblstate, string OMSG, string tdbarcode)
{
string sql = "SELECT COUNT(*) FROM ReelInfo WHERE ID = "+ uid.ToString();
long sc = (long)sh.ExecuteScalar(sql);
if (sc == 0)
{
sql = "INSERT INTO ReelInfo VALUES(@id, @PN, @RI, @isng, @ngmsg,@quantity,@lblstate,@OMSG,@tdbarcode,@datetime)";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@id",uid),
new SQLiteParameter("@PN",PN),
new SQLiteParameter("@RI",RI),
new SQLiteParameter("@isng",isng),
new SQLiteParameter("@ngmsg",ngmsg),
new SQLiteParameter("@quantity",quantity),
new SQLiteParameter("@lblstate",lblstate),
new SQLiteParameter("@OMSG",OMSG),
new SQLiteParameter("@tdbarcode",tdbarcode),
new SQLiteParameter("@datetime",DateTime.Now)
};
sh.ExecuteNonQuery(sql, para);
}
else {
sql = @"
UPDATE ReelInfo
SET
ISNG=@ISNG,
NGMSG=@NGMSG,
QTY=@QTY,
LBLState=@LBLState,
OMSG=@OMSG
WHERE
id =@id";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@id",uid),
new SQLiteParameter("@ISNG",isng),
new SQLiteParameter("@NGMSG",ngmsg),
new SQLiteParameter("@QTY",quantity),
new SQLiteParameter("@LBLState",lblstate),
new SQLiteParameter("@OMSG",OMSG),
};
sh.ExecuteNonQuery(sql, para);
}
}
public void InsertLog(string device, string action, object state, string log = "")
{
string sql = "INSERT INTO ReelInfo VALUES(NULL, @device,@action, @state, @log,@datetime,NULL)";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@device",device),
new SQLiteParameter("@action",action),
new SQLiteParameter("@state",state.ToString()),
new SQLiteParameter("@log",log),
new SQLiteParameter("@datetime",DateTime.Now)
};
sh.ExecuteNonQuery(sql, para);
}
public long insertImage(byte[] b)
{
long ids = id.nextId();
string sql = "INSERT INTO img VALUES(@id, @imgblob, @datetime)";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@id",ids),
new SQLiteParameter("@imgblob",b),
new SQLiteParameter("@datetime",DateTime.Now)
};
sh.ExecuteNonQuery(sql, para);
return ids;
}
public Image getImg(long ids)
{
string sql = @"SELECT imgblob FROM img WHERE id = @id LIMIT 1";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@id",ids)
};
byte[] buffer = (byte[])sh.ExecuteScalar(sql, para);
MemoryStream ms = new MemoryStream(buffer);
Image i = Image.FromStream(ms);
ms.Close();
return i;
}
public DataTable GetDatabydate(DateTime startData, DateTime endDate)
{
string where = "";
string sql = @"SELECT * FROM ReelInfo WHERE
(datetime BETWEEN @startData AND @endDate) " + where + " ORDER BY datetime ASC";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@startData",startData),
new SQLiteParameter("@endDate",endDate)
};
DataTable dt = sh.ExecuteQuery(sql, para);
return dt;
}
public DataTable GetLogbydate(DateTime startData, DateTime endDate)
{
string sql = @"select device,action,state,log,datetime from logs WHERE datetime BETWEEN @startData AND @endDate ORDER BY datetime desc";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@startData",startData),
new SQLiteParameter("@endDate",endDate)
};
DataTable dt = sh.ExecuteQuery(sql, para);
return dt;
}
public DataTable GetDaySUM(string user)
{
string sql = "SELECT count(id) as count,substr(datetime,1,10) as date FROM MaterialQuantity GROUP BY date ORDER BY datetime desc";
if (!string.IsNullOrEmpty(user))
sql = "SELECT count(id) as count,substr(datetime,1,10) as date FROM MaterialQuantity where JobNumber=@JobNumber GROUP BY date ORDER BY datetime desc";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@JobNumber",user)
};
DataTable dt = sh.ExecuteQuery(sql, para);
return dt;
}
public bool AddUser(string username, string jobnumber, string password, int role)
{
if (string.IsNullOrEmpty(username))
username = jobnumber;
string sql = "INSERT INTO Users VALUES(@username, @jobnumber, @password,@role,@createdate,@lastlogindate)";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@username",username),
new SQLiteParameter("@jobnumber",jobnumber),
new SQLiteParameter("@password",password),
new SQLiteParameter("@role",role),
new SQLiteParameter("@createdate",DateTime.Now),
new SQLiteParameter("@lastlogindate",DateTime.Now)
};
int c = sh.ExecuteNonQuery(sql, para);
if (c == 1)
{
return true;
}
else
return false;
}
public bool TestUser(string username, string jobnumber, string password, out int role)
{
role = 0;
string sqlpart = " jobnumber = @jobnumber ";
if (string.IsNullOrEmpty(jobnumber))
sqlpart = " username = @username ";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@username",username),
new SQLiteParameter("@jobnumber",jobnumber),
new SQLiteParameter("@password",password),
};
string sql = @"select username,jobnumber,role from users WHERE " + sqlpart + " and password=@password";
var dt = sh.ExecuteQuery(sql, para);
if (dt.Rows.Count == 0)
{
return false;
}
else
{
role = (int)(long)dt.Rows[0]["role"];
sql = @"update users set lastlogindate = @lastlogindate WHERE " + sqlpart;
para = new SQLiteParameter[] {
new SQLiteParameter("@username",username),
new SQLiteParameter("@jobnumber",jobnumber),
new SQLiteParameter("@lastlogindate",DateTime.Now),
};
sh.ExecuteNonQuery(sql, para);
return true;
}
}
public void ModifyUser(string username, string jobnumber, string password, int role)
{
string sqlpart = " jobnumber = @jobnumber ";
if (string.IsNullOrEmpty(jobnumber))
sqlpart = " username = @username ";
string sql = @"update users set password = @password,jobnumber=@jobnumber,role=@role WHERE " + sqlpart;
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@username",username),
new SQLiteParameter("@jobnumber",jobnumber),
new SQLiteParameter("@password",password),
new SQLiteParameter("@role",role)
};
sh.ExecuteNonQuery(sql, para);
}
public void DeleteUser(string username)
{
string sql = @"delete from Users WHERE username = @username";
SQLiteParameter[] para = new SQLiteParameter[] {
new SQLiteParameter("@username",username),
};
sh.ExecuteNonQuery(sql, para);
}
public DataTable GetUserList()
{
string sql = @"select * from users";
return sh.ExecuteQuery(sql);
}
public void backup()
{
Directory.CreateDirectory("dbbackup");
var n = DateTime.Now.Month - 1;
var bckfile = "dbbackup\\Sys-" + n + ".bck";
if (File.Exists(bckfile))
{
return;
}
File.Copy("sys.db", bckfile);
var d = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-01");
//string sql = "delete FROM MaterialQuantity WHERE datetime < '"+ d + "';delete FROM logs WHERE datetime < '" + d + "';";
//sh.ExecuteNonQuery(sql);
}
}
public class IdWorker
{
private long workerId;
private long datacenterId;
private long sequence = 0L;
private static long twepoch = 1288834974657L;
private static long workerIdBits = 5L;
private static long datacenterIdBits = 5L;
private static long maxWorkerId = -1L ^ (-1L << (int)workerIdBits);
private static long maxDatacenterId = -1L ^ (-1L << (int)datacenterIdBits);
private static long sequenceBits = 12L;
private long workerIdShift = sequenceBits;
private long datacenterIdShift = sequenceBits + workerIdBits;
private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private long sequenceMask = -1L ^ (-1L << (int)sequenceBits);
private long lastTimestamp = -1L;
private static object syncRoot = new object();
public IdWorker(long workerId, long datacenterId)
{
// sanity check for workerId
if (workerId > maxWorkerId || workerId < 0)
{
throw new ArgumentException(string.Format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0)
{
throw new ArgumentException(string.Format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
public long nextId()
{
lock (syncRoot)
{
long timestamp = timeGen();
if (timestamp < lastTimestamp)
{
throw new ApplicationException(string.Format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp)
{
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0)
{
timestamp = tilNextMillis(lastTimestamp);
}
}
else
{
sequence = 0L;
}
lastTimestamp = timestamp;
return ((timestamp - twepoch) << (int)timestampLeftShift) | (datacenterId << (int)datacenterIdShift) | (workerId << (int)workerIdShift) | sequence;
}
}
protected long tilNextMillis(long lastTimestamp)
{
long timestamp = timeGen();
while (timestamp <= lastTimestamp)
{
timestamp = timeGen();
}
return timestamp;
}
protected long timeGen()
{
return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.114.0" targetFramework="net461" />
<package id="System.Data.SQLite.Core" version="1.0.114.3" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -2,10 +2,10 @@
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
......@@ -20,6 +20,8 @@
<add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" />
<add key="Code_Block_Size_List" value="11" />
<add key="inputCounterDataByXRayMachine" value="http://10.69.221.80/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine" />
<add key="DetermineReelStorageLocation" value="http://10.69.221.80/SCTARLC001/api/RLC/DetermineReelStorageLocation" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -43,8 +43,13 @@ namespace AutoCountMachine
this.操作员ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.工程师ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.语言ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label_Productivity = new System.Windows.Forms.Label();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.boxResetControl1 = new AutoCountMachine.BoxResetControl();
this.cmb_runmode = new System.Windows.Forms.ComboBox();
......@@ -54,24 +59,16 @@ namespace AutoCountMachine
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.stateView = new System.Windows.Forms.ListView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.settingControl1 = new AutoCountMachine.SettingControl();
this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.语言ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
......@@ -161,23 +158,55 @@ namespace AutoCountMachine
//
this.操作员ToolStripMenuItem.Name = "操作员ToolStripMenuItem";
this.操作员ToolStripMenuItem.ShortcutKeyDisplayString = "√";
this.操作员ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.操作员ToolStripMenuItem.Size = new System.Drawing.Size(149, 26);
this.操作员ToolStripMenuItem.Text = "操作员";
this.操作员ToolStripMenuItem.Click += new System.EventHandler(this.操作员ToolStripMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(146, 6);
//
// 工程师ToolStripMenuItem
//
this.工程师ToolStripMenuItem.Name = "工程师ToolStripMenuItem";
this.工程师ToolStripMenuItem.ShortcutKeyDisplayString = "";
this.工程师ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.工程师ToolStripMenuItem.Size = new System.Drawing.Size(149, 26);
this.工程师ToolStripMenuItem.Text = "工程师";
this.工程师ToolStripMenuItem.Click += new System.EventHandler(this.工程师ToolStripMenuItem_Click);
//
// 语言ToolStripMenuItem
//
this.语言ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.简体中文ToolStripMenuItem,
this.toolStripSeparator5,
this.englishToolStripMenuItem});
this.语言ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.语言ToolStripMenuItem.Name = "语言ToolStripMenuItem";
this.语言ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言ToolStripMenuItem.Text = "语言";
//
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6);
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
......@@ -194,6 +223,7 @@ namespace AutoCountMachine
//
// tabPage1
//
this.tabPage1.Controls.Add(this.label_Productivity);
this.tabPage1.Controls.Add(this.btn_PauseBuzzer);
this.tabPage1.Controls.Add(this.boxResetControl1);
this.tabPage1.Controls.Add(this.cmb_runmode);
......@@ -207,6 +237,15 @@ namespace AutoCountMachine
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// label_Productivity
//
this.label_Productivity.Location = new System.Drawing.Point(743, 195);
this.label_Productivity.Name = "label_Productivity";
this.label_Productivity.Size = new System.Drawing.Size(228, 53);
this.label_Productivity.TabIndex = 8;
this.label_Productivity.Tag = "not";
this.label_Productivity.Text = "产量";
//
// btn_PauseBuzzer
//
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
......@@ -222,10 +261,10 @@ namespace AutoCountMachine
// boxResetControl1
//
this.boxResetControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.boxResetControl1.Location = new System.Drawing.Point(731, 202);
this.boxResetControl1.Location = new System.Drawing.Point(731, 253);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5);
this.boxResetControl1.Name = "boxResetControl1";
this.boxResetControl1.Size = new System.Drawing.Size(264, 353);
this.boxResetControl1.Size = new System.Drawing.Size(264, 279);
this.boxResetControl1.TabIndex = 5;
//
// cmb_runmode
......@@ -302,7 +341,7 @@ namespace AutoCountMachine
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Controls.Add(this.settingControl1);
this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
......@@ -311,47 +350,14 @@ namespace AutoCountMachine
this.tabPage2.Text = "设置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.btn_setadminpassword);
this.panel1.Controls.Add(this.cb_autorun);
this.panel1.Controls.Add(this.cb_EnableBuzzer);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(994, 559);
this.panel1.TabIndex = 7;
//
// btn_setadminpassword
//
this.btn_setadminpassword.Location = new System.Drawing.Point(28, 100);
this.btn_setadminpassword.Name = "btn_setadminpassword";
this.btn_setadminpassword.Size = new System.Drawing.Size(141, 33);
this.btn_setadminpassword.TabIndex = 7;
this.btn_setadminpassword.Text = "设置工程师密码";
this.btn_setadminpassword.UseVisualStyleBackColor = true;
this.btn_setadminpassword.Click += new System.EventHandler(this.btn_setadminpassword_Click);
//
// cb_autorun
//
this.cb_autorun.AutoSize = true;
this.cb_autorun.Location = new System.Drawing.Point(28, 25);
this.cb_autorun.Name = "cb_autorun";
this.cb_autorun.Size = new System.Drawing.Size(109, 25);
this.cb_autorun.TabIndex = 6;
this.cb_autorun.Text = "开机自启动";
this.cb_autorun.UseVisualStyleBackColor = true;
//
// cb_EnableBuzzer
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(28, 56);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 6;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
// settingControl1
//
this.settingControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingControl1.Location = new System.Drawing.Point(3, 3);
this.settingControl1.Margin = new System.Windows.Forms.Padding(5);
this.settingControl1.Name = "settingControl1";
this.settingControl1.Size = new System.Drawing.Size(994, 559);
this.settingControl1.TabIndex = 0;
//
// btn_stop
//
......@@ -390,38 +396,6 @@ namespace AutoCountMachine
this.listView1.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// 语言ToolStripMenuItem
//
this.语言ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.简体中文ToolStripMenuItem,
this.toolStripSeparator5,
this.englishToolStripMenuItem});
this.语言ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.语言ToolStripMenuItem.Name = "语言ToolStripMenuItem";
this.语言ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言ToolStripMenuItem.Text = "语言";
//
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -437,7 +411,7 @@ namespace AutoCountMachine
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "在线点料贴标机";
this.Text = "Neo Counter X800";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
......@@ -446,8 +420,6 @@ namespace AutoCountMachine
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -478,18 +450,16 @@ namespace AutoCountMachine
private BoxResetControl boxResetControl1;
private System.Windows.Forms.Button btn_PauseBuzzer;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.CheckBox cb_EnableBuzzer;
private System.Windows.Forms.CheckBox cb_autorun;
private System.Windows.Forms.ToolStripMenuItem 操作权限ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 操作员ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem 工程师ToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btn_setadminpassword;
private System.Windows.Forms.ToolStripMenuItem 语言ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 简体中文ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem englishToolStripMenuItem;
private System.Windows.Forms.Label label_Productivity;
private SettingControl settingControl1;
}
}
......@@ -43,6 +43,14 @@ namespace AutoCountMachine
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
if (tabControl1.TabPages["device_xray_name"]!=null)
tabControl1.TabPages["device_xray_name"].Text = crc.GetString("device_xray_name", "点料机");
if (tabControl1.TabPages["device_label_name"] != null)
tabControl1.TabPages["device_label_name"].Text = crc.GetString("device_label_name", "贴标机");
if (tabControl1.TabPages["device_filter_name"] != null)
tabControl1.TabPages["device_filter_name"].Text = crc.GetString("device_filter_name", "分料线");
if (tabControl1.TabPages["device_t1_name"] != null)
tabControl1.TabPages["device_t1_name"].Text = crc.GetString("device_t1_name", "出料线");
LanguageProcess();
}
......@@ -58,14 +66,25 @@ namespace AutoCountMachine
void LanguageProcess() {
crc.LanguageProcess(this, this.GetType().Name);
crc.ProcessListItem(menuStrip1.Items, "menuStrip1");
listView1.Columns[1].Text = crc.GetString("table_device", "设备");
listView1.Columns[2].Text = crc.GetString("table_info", "信息");
listView1.Columns[3].Text = crc.GetString("table_datetime", "时间");
stateView.Columns[1].Text = crc.GetString("table_module", "模块");
stateView.Columns[2].Text = crc.GetString("table_step", "步骤");
stateView.Columns[3].Text = crc.GetString("table_info", "信息");
listView_reelnfo.Columns[0].Text = crc.GetString("table_datetime", "时间");
listView_reelnfo.Columns[2].Text = crc.GetString("table_info", "信息");
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
//tabPage2.Controls[0].Enabled = false;
//if (e != Role.Admin)
// return;
//tabPage2.Controls[0].Enabled = true;
}
bool cancelcloseapp = true;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
......@@ -123,18 +142,20 @@ namespace AutoCountMachine
if (string.IsNullOrEmpty(moveInfo.ReelParam.ReeID))
continue;
if (listView_reelnfo.Items[moveInfo.ReelParam.UID] == null)
if (listView_reelnfo.Items[moveInfo.ReelParam.UID.ToString()] == null)
{
ListViewItem lvia = new ListViewItem(new string[] { DateTime.Now.ToLongTimeString(), moveInfo.ReelParam.ReeID, moveInfo.ReelParam.ToSortStr() });
lvia.Name = moveInfo.ReelParam.UID;
lvia.Name = moveInfo.ReelParam.UID.ToString();
listView_reelnfo.Items.Insert(0,lvia);
}
else
{
listView_reelnfo.Items[moveInfo.ReelParam.UID].SubItems[2].Text = moveInfo.ReelParam.ToSortStr();
listView_reelnfo.Items[moveInfo.ReelParam.UID.ToString()].SubItems[2].Text = moveInfo.ReelParam.ToSortStr();
}
}
this.ResumeLayout(true);
label_Productivity.Text = string.Format(crc.GetString("label_Productivity", "产量:{0}\r\n不良数:{1}, 不良率:{2}%").Replace("\\r\\n","\n"),
RobotManage.ProductivityCount, RobotManage.DefectiveCount, (RobotManage.ProductivityCount == 0 ? 0 : (RobotManage.DefectiveCount / RobotManage.ProductivityCount) * 100));
Application.DoEvents();
}
......@@ -149,13 +170,13 @@ namespace AutoCountMachine
emptycol.Text = "";
emptycol.Width = 0;
ColumnHeader namecol = new ColumnHeader();
namecol.Text = "设备";
namecol.Text = crc.GetString("table_device", "设备");
namecol.Width = 60;
ColumnHeader msgcol = new ColumnHeader();
msgcol.Text = "信息";
msgcol.Text = crc.GetString("table_info", "信息");
msgcol.Width = 480;
ColumnHeader timecol = new ColumnHeader();
timecol.Text = "时间";
timecol.Text = crc.GetString("table_datetime", "时间");
timecol.Width = 90;
listView1.Columns.Add(emptycol);
listView1.Columns.Add(namecol);
......@@ -170,13 +191,13 @@ namespace AutoCountMachine
c1.Text = "";
c1.Width = 0;
ColumnHeader c2 = new ColumnHeader();
c2.Text = "模块";
c2.Text = crc.GetString("table_module", "模块");
c2.Width = 100;
ColumnHeader c3 = new ColumnHeader();
c3.Text = "步骤";
c3.Text = crc.GetString("table_step", "步骤");
c3.Width = 200;
ColumnHeader c4 = new ColumnHeader();
c4.Text = "信息";
c4.Text = crc.GetString("table_info", "信息");
c4.Width = 400;
stateView.Columns.Add(c1);
......@@ -189,13 +210,13 @@ namespace AutoCountMachine
//$"ReeID,PN,WxH,ReelDest,NgMsg,QTY,2D_Barcode"
listView_reelnfo.View = View.Details;
ColumnHeader d1 = new ColumnHeader();
d1.Text = "时间";
d1.Text = crc.GetString("table_datetime", "时间");
d1.Width = 110;
ColumnHeader d2 = new ColumnHeader();
d2.Text = "ReelID";
d2.Width = 100;
ColumnHeader d3 = new ColumnHeader();
d3.Text = "信息";
d3.Text = crc.GetString("table_info", "信息");
d3.Width = 800;
listView_reelnfo.Columns.Add(d1);
listView_reelnfo.Columns.Add(d2);
......@@ -204,21 +225,15 @@ namespace AutoCountMachine
LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Config.Get("EnableBuzzer", true);
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
cb_autorun.Checked = Config.Get("App_AutoRun", false);
this.cb_autorun.CheckedChanged += new System.EventHandler(this.cb_autorun_CheckedChanged);
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//RobotManage.Init();
Task.Run(() => RobotManage.Init());
var lm = new List<Msg>();
var m = new Msg();
m.datetime = DateTime.Now;
m.msgtxt = "设备初始化中,请稍后";
m.msgtxt = crc.GetString("device_init","设备初始化中,请稍后");
m.msgLevel = MsgLevel.info;
lm.Add(m);
Device_ProcessMsgEvent(null, lm);
......@@ -261,6 +276,7 @@ namespace AutoCountMachine
});
}
var lm = new List<Msg>();
msg = msg.Replace("\\n", "\n");
foreach (string ms in msg.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
{
var m = new Msg();
......@@ -297,17 +313,17 @@ namespace AutoCountMachine
void addTablePage()
{
xrayControl.Config = RobotManage.xrayMachine.Config;
AddForm("点料机", xrayControl);
AddForm("device_xray_name",crc.GetString("device_xray_name", "点料机"), xrayControl);
labelControl.Config = RobotManage.labelMachine.Config;
AddForm("贴标机", labelControl);
AddForm("device_label_name", crc.GetString("device_label_name", "贴标机"), labelControl);
filterControl.Config = RobotManage.filterMachine.Config;
AddForm("分料线", filterControl);
AddForm("device_filter_name", crc.GetString("device_filter_name", "分料线"), filterControl);
t1Control.Config = RobotManage.t1Machine.Config;
AddForm("出料线", t1Control);
AddForm("device_t1_name", crc.GetString("device_t1_name", "出料线"), t1Control);
RoleManger.SetRole(Role.User);
LanguageProcess();
}
private void AddForm(string text, UserControl form)
private void AddForm(string id,string text, UserControl form)
{
foreach (TabPage tp in tabControl1.TabPages) {
if (tp.Text == text)
......@@ -315,6 +331,7 @@ namespace AutoCountMachine
}
TabPage lineTabPage = new TabPage(text);
lineTabPage.Name = id;
Panel linePan = new Panel();
linePan.Dock = DockStyle.Fill;
linePan.AutoScroll = true;
......@@ -331,7 +348,7 @@ namespace AutoCountMachine
{
RobotManage.IsDebug = RobotManage.IsDebug ? false : true;
(sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? "启用调试模式" : "停用调试模式";
(sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? crc.GetString("enable_debug", "启用调试模式") : crc.GetString("disable_debug", "停用调试模式");
//RobotManage.Init();
......@@ -342,7 +359,7 @@ namespace AutoCountMachine
}
else
{
for (int i = tabControl1.TabPages.Count - 1; i > 0; i--)
for (int i = tabControl1.TabPages.Count - 2; i > 0; i--)
{
tabControl1.TabPages[i].Parent = null;
}
......@@ -365,25 +382,25 @@ namespace AutoCountMachine
RobotManage.Start();
userpause = false;
if (RobotManage.isRunning)
(sender as Button).Text = "暂停运行";
(sender as Button).Text = crc.GetString("run_pause", "暂停运行");
}
else if (!userpause)
{
userpause = true;
RobotManage.UserPause(userpause);
(sender as Button).Text = "恢复运行";
(sender as Button).Text = crc.GetString("run_resume", "恢复运行");
}
else if (userpause)
{
userpause = false;
RobotManage.UserPause(userpause);
(sender as Button).Text = "暂停运行";
(sender as Button).Text = crc.GetString("run_pause", "暂停运行");
}
}
private void btn_stop_Click(object sender, EventArgs e)
{
btn_run.Text = "启动";
btn_run.Text = crc.GetString("device_start", "启动");
RobotManage.Stop();
userpause = false;
}
......@@ -415,10 +432,19 @@ namespace AutoCountMachine
private void btn_releaseshelf_Click(object sender, EventArgs e)
{
if (RobotManage.t1Machine.ReleaseShelf()) {
MessageBox.Show("料架开始释放");
} else {
MessageBox.Show("料架释放失败");
if (!RobotManage.isRunning)
{
MessageBox.Show(crc.GetString("device_shelf_cantrelease", "系统未启动,不能释放"));
return;
}
if (RobotManage.t1Machine.ReleaseShelf())
{
MessageBox.Show(crc.GetString("device_shelf_release_success", "料架开始释放"));
}
else
{
MessageBox.Show(crc.GetString("device_shelf_release_failed", "料架释放失败"));
}
}
......@@ -448,51 +474,14 @@ namespace AutoCountMachine
}
private void cb_EnableBuzzer_CheckedChanged(object sender, EventArgs e)
{
Config.Set("EnableBuzzer", cb_EnableBuzzer.Checked);
Config.SaveChange();
AlarmBuzzer.Enable = cb_EnableBuzzer.Checked;
}
private void btn_PauseBuzzer_Click(object sender, EventArgs e)
{
AlarmBuzzer.MuteOnce();
}
private void cb_autorun_CheckedChanged(object sender, EventArgs e)
{
if (cb_autorun.Checked)
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false);
}
}
public static void AutoRun(string strName, bool value)
{
try
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
//设置运行文件
startInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\AuToRunManager.exe";
//设置启动参数
startInfo.Arguments = String.Join(" ", new string[2] { strName, value.ToString() });
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
//如果不是管理员,则启动UAC
System.Diagnostics.Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void 操作员ToolStripMenuItem_Click(object sender, EventArgs e)
{
......
......@@ -27,6 +27,8 @@ namespace AutoCountMachine
//OcrProcess.Run();
//ServerConn.inputCounterDataByXRayMachine("20.K0784.008-615313|1KQ-2111|5000|A2061531315212446|PANASONIC", 9);
//return;
databaseProc.Current.InsertOrUpdateRI(1, "123", "234", true, "abc", 345, "asd", "fgh", "try");
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
......
......@@ -95,6 +95,12 @@
<DependentUpon>FrmPassword.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\Role.cs" />
<Compile Include="SettingControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SettingControl.Designer.cs">
<DependentUpon>SettingControl.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\VerticalProgressBar.cs">
<SubType>Component</SubType>
</Compile>
......@@ -179,6 +185,9 @@
<EmbeddedResource Include="LabelControl.resx">
<DependentUpon>LabelControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="XrayControl.resx">
<DependentUpon>XrayControl.cs</DependentUpon>
</EmbeddedResource>
......

namespace AutoCountMachine
{
partial class SettingControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.dateTimePicker_end = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker_start = new System.Windows.Forms.DateTimePicker();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.rb_datafilter_custom = new System.Windows.Forms.RadioButton();
this.rb_datafilter_last30 = new System.Windows.Forms.RadioButton();
this.rb_datafilter_today = new System.Windows.Forms.RadioButton();
this.rb_datafilter_lastMonth = new System.Windows.Forms.RadioButton();
this.rb_datafilter_thismonth = new System.Windows.Forms.RadioButton();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.label_count = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(772, 561);
this.tabControl1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(764, 535);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "点料记录";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.label_count);
this.panel1.Controls.Add(this.dateTimePicker_end);
this.panel1.Controls.Add(this.dateTimePicker_start);
this.panel1.Controls.Add(this.dataGridView1);
this.panel1.Controls.Add(this.rb_datafilter_custom);
this.panel1.Controls.Add(this.rb_datafilter_last30);
this.panel1.Controls.Add(this.rb_datafilter_today);
this.panel1.Controls.Add(this.rb_datafilter_lastMonth);
this.panel1.Controls.Add(this.rb_datafilter_thismonth);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(758, 529);
this.panel1.TabIndex = 2;
//
// dateTimePicker_end
//
this.dateTimePicker_end.CustomFormat = "yyyy/MM/dd HH:mm";
this.dateTimePicker_end.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker_end.Location = new System.Drawing.Point(144, 476);
this.dateTimePicker_end.Name = "dateTimePicker_end";
this.dateTimePicker_end.Size = new System.Drawing.Size(182, 21);
this.dateTimePicker_end.TabIndex = 2;
this.dateTimePicker_end.Tag = "not";
this.dateTimePicker_end.ValueChanged += new System.EventHandler(this.dateTimePicker_end_ValueChanged);
//
// dateTimePicker_start
//
this.dateTimePicker_start.CustomFormat = "yyyy/MM/dd HH:mm";
this.dateTimePicker_start.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker_start.Location = new System.Drawing.Point(144, 449);
this.dateTimePicker_start.Name = "dateTimePicker_start";
this.dateTimePicker_start.Size = new System.Drawing.Size(182, 21);
this.dateTimePicker_start.TabIndex = 2;
this.dateTimePicker_start.Tag = "not";
this.dateTimePicker_start.ValueChanged += new System.EventHandler(this.dateTimePicker_start_ValueChanged);
//
// dataGridView1
//
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Top;
this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(758, 394);
this.dataGridView1.TabIndex = 0;
//
// rb_datafilter_custom
//
this.rb_datafilter_custom.AutoSize = true;
this.rb_datafilter_custom.Location = new System.Drawing.Point(144, 427);
this.rb_datafilter_custom.Name = "rb_datafilter_custom";
this.rb_datafilter_custom.Size = new System.Drawing.Size(83, 16);
this.rb_datafilter_custom.TabIndex = 1;
this.rb_datafilter_custom.TabStop = true;
this.rb_datafilter_custom.Text = "自定义区间";
this.rb_datafilter_custom.UseVisualStyleBackColor = true;
this.rb_datafilter_custom.CheckedChanged += new System.EventHandler(this.rb_datafilter_custom_CheckedChanged);
//
// rb_datafilter_last30
//
this.rb_datafilter_last30.AutoSize = true;
this.rb_datafilter_last30.Location = new System.Drawing.Point(17, 493);
this.rb_datafilter_last30.Name = "rb_datafilter_last30";
this.rb_datafilter_last30.Size = new System.Drawing.Size(71, 16);
this.rb_datafilter_last30.TabIndex = 1;
this.rb_datafilter_last30.TabStop = true;
this.rb_datafilter_last30.Text = "最近30天";
this.rb_datafilter_last30.UseVisualStyleBackColor = true;
this.rb_datafilter_last30.CheckedChanged += new System.EventHandler(this.rb_datafilter_last30_CheckedChanged);
//
// rb_datafilter_today
//
this.rb_datafilter_today.AutoSize = true;
this.rb_datafilter_today.Location = new System.Drawing.Point(17, 427);
this.rb_datafilter_today.Name = "rb_datafilter_today";
this.rb_datafilter_today.Size = new System.Drawing.Size(47, 16);
this.rb_datafilter_today.TabIndex = 1;
this.rb_datafilter_today.TabStop = true;
this.rb_datafilter_today.Text = "今天";
this.rb_datafilter_today.UseVisualStyleBackColor = true;
this.rb_datafilter_today.CheckedChanged += new System.EventHandler(this.rb_datafilter_today_CheckedChanged);
//
// rb_datafilter_lastMonth
//
this.rb_datafilter_lastMonth.AutoSize = true;
this.rb_datafilter_lastMonth.Location = new System.Drawing.Point(17, 471);
this.rb_datafilter_lastMonth.Name = "rb_datafilter_lastMonth";
this.rb_datafilter_lastMonth.Size = new System.Drawing.Size(47, 16);
this.rb_datafilter_lastMonth.TabIndex = 1;
this.rb_datafilter_lastMonth.TabStop = true;
this.rb_datafilter_lastMonth.Text = "上月";
this.rb_datafilter_lastMonth.UseVisualStyleBackColor = true;
this.rb_datafilter_lastMonth.CheckedChanged += new System.EventHandler(this.rb_datafilter_lastMonth_CheckedChanged);
//
// rb_datafilter_thismonth
//
this.rb_datafilter_thismonth.AutoSize = true;
this.rb_datafilter_thismonth.Location = new System.Drawing.Point(17, 449);
this.rb_datafilter_thismonth.Name = "rb_datafilter_thismonth";
this.rb_datafilter_thismonth.Size = new System.Drawing.Size(47, 16);
this.rb_datafilter_thismonth.TabIndex = 1;
this.rb_datafilter_thismonth.TabStop = true;
this.rb_datafilter_thismonth.Text = "本月";
this.rb_datafilter_thismonth.UseVisualStyleBackColor = true;
this.rb_datafilter_thismonth.CheckedChanged += new System.EventHandler(this.rb_datafilter_thismonth_CheckedChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btn_setadminpassword);
this.tabPage1.Controls.Add(this.cb_autorun);
this.tabPage1.Controls.Add(this.cb_EnableBuzzer);
this.tabPage1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(764, 430);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "设置";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_setadminpassword
//
this.btn_setadminpassword.Location = new System.Drawing.Point(32, 100);
this.btn_setadminpassword.Name = "btn_setadminpassword";
this.btn_setadminpassword.Size = new System.Drawing.Size(141, 33);
this.btn_setadminpassword.TabIndex = 10;
this.btn_setadminpassword.Text = "设置工程师密码";
this.btn_setadminpassword.UseVisualStyleBackColor = true;
this.btn_setadminpassword.Click += new System.EventHandler(this.btn_setadminpassword_Click);
//
// cb_autorun
//
this.cb_autorun.AutoSize = true;
this.cb_autorun.Location = new System.Drawing.Point(32, 25);
this.cb_autorun.Name = "cb_autorun";
this.cb_autorun.Size = new System.Drawing.Size(96, 18);
this.cb_autorun.TabIndex = 8;
this.cb_autorun.Text = "开机自启动";
this.cb_autorun.UseVisualStyleBackColor = true;
//
// cb_EnableBuzzer
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(32, 56);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(96, 18);
this.cb_EnableBuzzer.TabIndex = 9;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
//
// label_count
//
this.label_count.AutoSize = true;
this.label_count.Location = new System.Drawing.Point(15, 406);
this.label_count.Name = "label_count";
this.label_count.Size = new System.Drawing.Size(41, 12);
this.label_count.TabIndex = 3;
this.label_count.Tag = "not";
this.label_count.Text = "label1";
//
// SettingControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.tabControl1);
this.Name = "SettingControl";
this.Size = new System.Drawing.Size(772, 561);
this.Load += new System.EventHandler(this.SettingControl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button btn_setadminpassword;
private System.Windows.Forms.CheckBox cb_autorun;
private System.Windows.Forms.CheckBox cb_EnableBuzzer;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.RadioButton rb_datafilter_thismonth;
private System.Windows.Forms.RadioButton rb_datafilter_today;
private System.Windows.Forms.RadioButton rb_datafilter_last30;
private System.Windows.Forms.RadioButton rb_datafilter_lastMonth;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.DateTimePicker dateTimePicker_end;
private System.Windows.Forms.DateTimePicker dateTimePicker_start;
private System.Windows.Forms.RadioButton rb_datafilter_custom;
private System.Windows.Forms.Label label_count;
}
}
using ConfigHelper;
using DeviceLibrary;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoCountMachine
{
using crc = OnlineStore.CodeResourceControl;
public partial class SettingControl : UserControl
{
public SettingControl()
{
InitializeComponent();
RoleManger.RoleChange += RoleManger_RoleChange;
this.VisibleChanged += SettingControl_VisibleChanged;
label_count.Text = "";
}
private void SettingControl_VisibleChanged(object sender, EventArgs e)
{
var t = DateTime.Now;
DateTime d = new DateTime(t.Year, t.Month, t.Day, 0, 0, 0);
dateTimePicker_start.Value = d;
dateTimePicker_end.Value = DateTime.Now;
}
private void cb_EnableBuzzer_CheckedChanged(object sender, EventArgs e)
{
Config.Set("EnableBuzzer", cb_EnableBuzzer.Checked);
Config.SaveChange();
AlarmBuzzer.Enable = cb_EnableBuzzer.Checked;
}
private void btn_setadminpassword_Click(object sender, EventArgs e)
{
FrmPassword frmPassword = new FrmPassword();
crc.LanguageProcess(frmPassword);
frmPassword.EditMode = true;
frmPassword.ShowDialog();
}
private void cb_autorun_CheckedChanged(object sender, EventArgs e)
{
if (cb_autorun.Checked)
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false);
}
}
public static void AutoRun(string strName, bool value)
{
try
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
//设置运行文件
startInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\AuToRunManager.exe";
//设置启动参数
startInfo.Arguments = String.Join(" ", new string[2] { strName, value.ToString() });
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
//如果不是管理员,则启动UAC
System.Diagnostics.Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void SettingControl_Load(object sender, EventArgs e)
{
if (DesignMode)
return;
cb_EnableBuzzer.Checked = Config.Get("EnableBuzzer", true);
cb_autorun.Checked = Config.Get("App_AutoRun", false);
this.cb_autorun.CheckedChanged += new System.EventHandler(this.cb_autorun_CheckedChanged);
rb_datafilter_today.Checked = true;
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage1.Enabled = false;
if (e != Role.Admin)
return;
tabPage1.Enabled = true;
}
private void rb_datafilter_today_CheckedChanged(object sender, EventArgs e)
{
var t = DateTime.Now;
DateTime d = new DateTime(t.Year, t.Month, t.Day, 0, 0, 0);
setData(d, DateTime.Now);
}
private void rb_datafilter_thismonth_CheckedChanged(object sender, EventArgs e)
{
var t = DateTime.Now;
DateTime d = new DateTime(t.Year, t.Month, 1, 0, 0, 0);
setData(d, DateTime.Now);
}
private void rb_datafilter_lastMonth_CheckedChanged(object sender, EventArgs e)
{
var t = DateTime.Now;
DateTime d = new DateTime(t.Year, t.Month, 1, 0, 0, 0);
DateTime ed = new DateTime(t.Year, t.Month, 1, 0, 0, 0);
setData(d, ed.AddMonths(1));
}
private void rb_datafilter_last30_CheckedChanged(object sender, EventArgs e)
{
setData(DateTime.Now.AddDays(-30), DateTime.Now);
}
void setData(DateTime startData, DateTime endDate)
{
DataTable dt = databaseProc.Current.GetDatabydate(startData, endDate);
dataGridView1.DataSource = dt;
dataGridView1.Columns[0].HeaderText = "";//crc.GetString("dataGrid_ID", "条码");
dataGridView1.Columns[1].HeaderText = "PN";//crc.GetString("dataGrid_Qty", "数量");
dataGridView1.Columns[2].HeaderText = "Reel ID"; //crc.GetString("dataGrid_Slot", "盘位");
dataGridView1.Columns[3].HeaderText = "Is NG"; //crc.GetString("dataGrid_DateTime", "时间");
dataGridView1.Columns[4].HeaderText = "Ng Msg";
dataGridView1.Columns[5].HeaderText = "QTY";
dataGridView1.Columns[6].HeaderText = "Label";
dataGridView1.Columns[7].HeaderText = "Orther Msg";
dataGridView1.Columns[8].HeaderText = "2D BarCode";
dataGridView1.Columns[9].HeaderText = "Date";
dataGridView1.Columns[9].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
dataGridView1.Columns[8].DisplayIndex = 9;
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[6].Visible = false;
dataGridView1.Columns[7].Visible = false;
label_count.Text = crc.GetString("query_count","查询到{0}条结果.",dt.Rows.Count);
}
private void dateTimePicker_start_ValueChanged(object sender, EventArgs e)
{
if (rb_datafilter_custom.Checked && dateTimePicker_end.Value> dateTimePicker_start.Value)
setData(dateTimePicker_start.Value, dateTimePicker_end.Value);
}
private void dateTimePicker_end_ValueChanged(object sender, EventArgs e)
{
if (rb_datafilter_custom.Checked && dateTimePicker_end.Value > dateTimePicker_start.Value)
setData(dateTimePicker_start.Value, dateTimePicker_end.Value);
}
private void rb_datafilter_custom_CheckedChanged(object sender, EventArgs e)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -69,7 +69,7 @@ namespace AutoCountMachine
//
// btn_NGClear
//
this.btn_NGClear.Location = new System.Drawing.Point(143, 157);
this.btn_NGClear.Location = new System.Drawing.Point(143, 121);
this.btn_NGClear.Name = "btn_NGClear";
this.btn_NGClear.Size = new System.Drawing.Size(45, 40);
this.btn_NGClear.TabIndex = 2;
......@@ -79,7 +79,7 @@ namespace AutoCountMachine
//
// btn_MSDClear
//
this.btn_MSDClear.Location = new System.Drawing.Point(77, 157);
this.btn_MSDClear.Location = new System.Drawing.Point(77, 121);
this.btn_MSDClear.Name = "btn_MSDClear";
this.btn_MSDClear.Size = new System.Drawing.Size(45, 40);
this.btn_MSDClear.TabIndex = 2;
......@@ -89,7 +89,7 @@ namespace AutoCountMachine
//
// btn_PaperClear
//
this.btn_PaperClear.Location = new System.Drawing.Point(13, 157);
this.btn_PaperClear.Location = new System.Drawing.Point(13, 121);
this.btn_PaperClear.Name = "btn_PaperClear";
this.btn_PaperClear.Size = new System.Drawing.Size(45, 40);
this.btn_PaperClear.TabIndex = 2;
......@@ -101,14 +101,14 @@ namespace AutoCountMachine
//
this.PaperCountBar.Location = new System.Drawing.Point(13, 21);
this.PaperCountBar.Name = "PaperCountBar";
this.PaperCountBar.Size = new System.Drawing.Size(45, 130);
this.PaperCountBar.Size = new System.Drawing.Size(45, 94);
this.PaperCountBar.TabIndex = 0;
//
// MsdCountBar
//
this.MsdCountBar.Location = new System.Drawing.Point(77, 21);
this.MsdCountBar.Name = "MsdCountBar";
this.MsdCountBar.Size = new System.Drawing.Size(45, 130);
this.MsdCountBar.Size = new System.Drawing.Size(45, 94);
this.MsdCountBar.TabIndex = 0;
//
// NgCountBar
......@@ -117,7 +117,7 @@ namespace AutoCountMachine
this.NgCountBar.Location = new System.Drawing.Point(143, 21);
this.NgCountBar.MarqueeAnimationSpeed = 0;
this.NgCountBar.Name = "NgCountBar";
this.NgCountBar.Size = new System.Drawing.Size(45, 130);
this.NgCountBar.Size = new System.Drawing.Size(45, 94);
this.NgCountBar.TabIndex = 0;
//
// BoxResetControl
......
......@@ -215,6 +215,9 @@ namespace AutoCountMachine
PropertyInfo pi = Config.GetType().GetProperty(textBox.Name);
if (pi != null)
{
var cc = Config.configList.Find(new Predicate<ConfigBase>((c) => { return c.ProName == textBox.Name; }));
if (cc != null)
cc.ProValue = textBox.Text;
if (pi.PropertyType.Name == "Int32")
pi.SetValue(Config, int.Parse(textBox.Text));
else if (pi.PropertyType.Name == "Double")
......
......@@ -13,6 +13,7 @@ using System.Windows.Forms;
namespace AutoCountMachine
{
using crc = OnlineStore.CodeResourceControl;
public class CylinderButton : Button
{
Timer timer;
......@@ -38,6 +39,7 @@ namespace AutoCountMachine
private void Timer_Tick(object sender, EventArgs e)
{
if(Visible)
StateUpdate();
}
private void RobotManage_LoadFinishEvent(bool state, string msg)
......@@ -114,12 +116,12 @@ namespace AutoCountMachine
{
if (io_state.Equals(IO_VALUE.LOW))
{
this.Text = configio_high.ElectricalDefinition+" "+configio_high.Explain;
this.Text = configio_high.ElectricalDefinition+" "+crc.GetString(configio_high.ProName,configio_high.Explain);
this.BackColor = Color.White;
}
else
{
this.Text = configio_low.ElectricalDefinition + " "+configio_low.Explain;
this.Text = configio_low.ElectricalDefinition + " "+ crc.GetString(configio_low.ProName,configio_low.Explain);
this.BackColor = Color.LightGreen;
}
}
......@@ -127,13 +129,13 @@ namespace AutoCountMachine
{
if (io_state.Equals(IO_VALUE.LOW))
{
this.Text = "(ON) " + configio_high.ElectricalDefinition + " " + configio_high.Explain;
this.Text = "(ON) " + configio_high.ElectricalDefinition + " " + crc.GetString(configio_high.ProName, configio_high.Explain);
this.BackColor = Color.White;
}
else if (configio_low == null)
{
this.Text = "(OFF) " + configio_high.ElectricalDefinition + " " + configio_high.Explain;
this.Text = "(OFF) " + configio_high.ElectricalDefinition + " " + crc.GetString(configio_high.ProName, configio_high.Explain);
this.BackColor = Color.LightGreen;
}
}
......
......@@ -31,39 +31,38 @@ namespace AutoCountMachine
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_Reset = new System.Windows.Forms.Button();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.listView_adio = new System.Windows.Forms.ListView();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_getXrayimage = new System.Windows.Forms.Button();
this.btn_closeXray = new System.Windows.Forms.Button();
this.btn_openXray = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_closeXray = new System.Windows.Forms.Button();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.label_tips_scancode = new System.Windows.Forms.Label();
this.label_countstate = new System.Windows.Forms.Label();
this.textBox_scancode = new System.Windows.Forms.TextBox();
this.btn_ManualCount = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tabPage5.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
......@@ -82,7 +81,6 @@ namespace AutoCountMachine
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btn_Reset);
this.tabPage1.Controls.Add(this.cylinderButton3);
this.tabPage1.Controls.Add(this.cylinderButton2);
this.tabPage1.Controls.Add(this.cylinderButton1);
......@@ -96,15 +94,58 @@ namespace AutoCountMachine
this.tabPage1.Text = "I/O控制";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_Reset
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Exit_Open";
this.cylinderButton3.IO_LOW = "Exit_Close";
this.cylinderButton3.Location = new System.Drawing.Point(550, 241);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(261, 35);
this.cylinderButton3.TabIndex = 288;
this.cylinderButton3.Tag = "not";
this.cylinderButton3.Text = "Exit_Open";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.btn_Reset.Location = new System.Drawing.Point(550, 456);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(85, 38);
this.btn_Reset.TabIndex = 289;
this.btn_Reset.Text = "重置";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Entry_Open";
this.cylinderButton2.IO_LOW = "Entry_Close";
this.cylinderButton2.Location = new System.Drawing.Point(550, 200);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(261, 35);
this.cylinderButton2.TabIndex = 288;
this.cylinderButton2.Tag = "not";
this.cylinderButton2.Text = "Entry_Open";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "Location_Cylinder_Up";
this.cylinderButton1.IO_LOW = "Location_Cylinder_Down";
this.cylinderButton1.Location = new System.Drawing.Point(550, 159);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(261, 35);
this.cylinderButton1.TabIndex = 288;
this.cylinderButton1.Tag = "not";
this.cylinderButton1.Text = "Location_Cylinder_Up";
this.cylinderButton1.UseVisualStyleBackColor = false;
//
// ioControl1
//
this.ioControl1.Config = null;
this.ioControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ioControl1.Location = new System.Drawing.Point(3, 3);
this.ioControl1.Margin = new System.Windows.Forms.Padding(4);
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1010, 510);
this.ioControl1.TabIndex = 0;
this.ioControl1.Tag = "not";
//
// tabPage2
//
......@@ -118,12 +159,32 @@ namespace AutoCountMachine
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1010, 510);
this.panel1.TabIndex = 2;
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(558, 402);
this.axisMoveControl1.TabIndex = 1;
this.axisMoveControl1.Tag = "not";
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(559, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(653, 504);
this.configControl1.TabIndex = 0;
this.configControl1.Tag = "not";
//
// tabPage3
//
......@@ -156,6 +217,26 @@ namespace AutoCountMachine
this.tabPage4.Text = "XRay";
this.tabPage4.UseVisualStyleBackColor = true;
//
// panel2
//
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Controls.Add(this.btn_getXrayimage);
this.panel2.Controls.Add(this.btn_openXray);
this.panel2.Controls.Add(this.btn_closeXray);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1010, 510);
this.panel2.TabIndex = 2;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(33, 42);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(426, 415);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// btn_getXrayimage
//
this.btn_getXrayimage.Location = new System.Drawing.Point(510, 133);
......@@ -166,16 +247,6 @@ namespace AutoCountMachine
this.btn_getXrayimage.UseVisualStyleBackColor = true;
this.btn_getXrayimage.Click += new System.EventHandler(this.btn_getXrayimage_Click);
//
// btn_closeXray
//
this.btn_closeXray.Location = new System.Drawing.Point(510, 94);
this.btn_closeXray.Name = "btn_closeXray";
this.btn_closeXray.Size = new System.Drawing.Size(129, 33);
this.btn_closeXray.TabIndex = 1;
this.btn_closeXray.Text = "关闭X光";
this.btn_closeXray.UseVisualStyleBackColor = true;
this.btn_closeXray.Click += new System.EventHandler(this.btn_closeXray_Click);
//
// btn_openXray
//
this.btn_openXray.Location = new System.Drawing.Point(510, 55);
......@@ -186,13 +257,15 @@ namespace AutoCountMachine
this.btn_openXray.UseVisualStyleBackColor = true;
this.btn_openXray.Click += new System.EventHandler(this.btn_openXray_Click);
//
// pictureBox1
// btn_closeXray
//
this.pictureBox1.Location = new System.Drawing.Point(33, 42);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(426, 415);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.btn_closeXray.Location = new System.Drawing.Point(510, 94);
this.btn_closeXray.Name = "btn_closeXray";
this.btn_closeXray.Size = new System.Drawing.Size(129, 33);
this.btn_closeXray.TabIndex = 1;
this.btn_closeXray.Text = "关闭X光";
this.btn_closeXray.UseVisualStyleBackColor = true;
this.btn_closeXray.Click += new System.EventHandler(this.btn_closeXray_Click);
//
// tabPage5
//
......@@ -248,73 +321,6 @@ namespace AutoCountMachine
this.btn_ManualCount.UseVisualStyleBackColor = true;
this.btn_ManualCount.Click += new System.EventHandler(this.btn_ManualCount_Click);
//
// panel1
//
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1010, 510);
this.panel1.TabIndex = 2;
//
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Exit_Open";
this.cylinderButton3.IO_LOW = "Exit_Close";
this.cylinderButton3.Location = new System.Drawing.Point(550, 241);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(261, 35);
this.cylinderButton3.TabIndex = 288;
this.cylinderButton3.Text = "Exit_Open";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Entry_Open";
this.cylinderButton2.IO_LOW = "Entry_Close";
this.cylinderButton2.Location = new System.Drawing.Point(550, 200);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(261, 35);
this.cylinderButton2.TabIndex = 288;
this.cylinderButton2.Text = "Entry_Open";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "Location_Cylinder_Up";
this.cylinderButton1.IO_LOW = "Location_Cylinder_Down";
this.cylinderButton1.Location = new System.Drawing.Point(550, 159);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(261, 35);
this.cylinderButton1.TabIndex = 288;
this.cylinderButton1.Text = "Location_Cylinder_Up";
this.cylinderButton1.UseVisualStyleBackColor = false;
//
// ioControl1
//
this.ioControl1.Config = null;
this.ioControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ioControl1.Location = new System.Drawing.Point(3, 3);
this.ioControl1.Margin = new System.Windows.Forms.Padding(4);
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1010, 510);
this.ioControl1.TabIndex = 0;
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(559, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(653, 504);
this.configControl1.TabIndex = 0;
//
// cylinderButton4
//
this.cylinderButton4.BackColor = System.Drawing.Color.White;
......@@ -325,6 +331,7 @@ namespace AutoCountMachine
this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(261, 35);
this.cylinderButton4.TabIndex = 289;
this.cylinderButton4.Tag = "not";
this.cylinderButton4.Text = "Exit_Open";
this.cylinderButton4.UseVisualStyleBackColor = false;
//
......@@ -338,21 +345,10 @@ namespace AutoCountMachine
this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(261, 35);
this.cylinderButton5.TabIndex = 290;
this.cylinderButton5.Tag = "not";
this.cylinderButton5.Text = "Entry_Open";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// panel2
//
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Controls.Add(this.btn_getXrayimage);
this.panel2.Controls.Add(this.btn_openXray);
this.panel2.Controls.Add(this.btn_closeXray);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1010, 510);
this.panel2.TabIndex = 2;
//
// XrayControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -363,13 +359,13 @@ namespace AutoCountMachine
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -392,7 +388,6 @@ namespace AutoCountMachine
private System.Windows.Forms.Button btn_closeXray;
private System.Windows.Forms.Button btn_openXray;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_Reset;
private System.Windows.Forms.TabPage tabPage5;
private CylinderButton cylinderButton4;
private CylinderButton cylinderButton5;
......
......@@ -118,11 +118,11 @@ namespace AutoCountMachine
private void LoadADIOList()
{
//ListViewItem lvi = new ListViewItem(new string[] { "", msg.datetime.ToString(), msg.msgtxt });
listView_adio.Columns.Add("名称",200);
listView_adio.Columns.Add("定义", 150);
listView_adio.Columns.Add("");
listView_adio.Columns.Add("基准");
listView_adio.Columns.Add("计算结果");
//listView_adio.Columns.Add("名称",200);
listView_adio.Columns.Add("Define", 150);
listView_adio.Columns.Add("Value");
listView_adio.Columns.Add("Base");
listView_adio.Columns.Add("Result");
t1.Start();
}
......@@ -138,7 +138,7 @@ namespace AutoCountMachine
var v = IOManager.GetADIOValue("HC", 0, ushort.Parse(ioValue.ProValue));
var Tray_ADIO_Value = ((Config_XRay)Config).Tray_ADIO_Value;
var c = ((int)v- basevalue) / Tray_ADIO_Value;
ListViewItem lvi = new ListViewItem(new string[] { ioValue.Explain, ioValue.ProName, v.ToString(), basevalue.ToString(), c.ToString() });
ListViewItem lvi = new ListViewItem(new string[] { /*ioValue.Explain,*/ioValue.ProName, v.ToString(), basevalue.ToString(), c.ToString() });
listView_adio.Items.Add(lvi);
}
this.ResumeLayout(true);
......
evt_type: "byereal",
evt_dt: 1501546994645,
evt_pubBy: "nifi",
Site: "WKS",
Plant: "F230",
Dept: "FA",
Line: "CA3B",
MachineName: "Screwmachine inline",
MachineModel: "LN600D",
MachineSN: "LNSC000001",
MachineN0: "NO.0001",
MechineIP: "172.0.47.110",
Model: "LV115",
Program: "V115",
OperatorID: "K0312187",
Status: "Run",
Errcode: "SCR-C01001"
evt_type: "bypcs",
evt_dt: 1501546994645,
evt_pubBy: "nifi",
Site: "WKS",
Plant: "F230",
Dept: "FA",
Line: "CA3B",
MachineName: "Screwmachine inline",
MachineModel: "LN600D",
MachineSN: "LNSC000001",
MachineN0: "NO.0001",
MechineIP: "172.0.47.110",
Model: "LV115",
Program: "V115",
OperatorID: null,
USN:null,
StartTime:null,
EndTime:null,
CycleTime:null,
IsOK:"OK/NG"
Status: "Run",
Errcode: "SCR-C01001"
NGPICNO:USN+UTC
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!