Commit aac3d48b LN

增加RGBLED

1 个父辈 81cd6d0a
...@@ -162,6 +162,11 @@ namespace TSA_V.Common ...@@ -162,6 +162,11 @@ namespace TSA_V.Common
[MyConfigComment("最后一次校准信息,保存后作为新板子的基准")] [MyConfigComment("最后一次校准信息,保存后作为新板子的基准")]
public static MyConfig<string> Data_LastCalibrateInfo =""; public static MyConfig<string> Data_LastCalibrateInfo ="";
[MyConfigComment("RGB灯带端口号")]
public static MyConfig<string> RGBLed_PortName = "";
public static void ChangeConfig() public static void ChangeConfig()
{ {
try try
......
...@@ -108,6 +108,8 @@ ...@@ -108,6 +108,8 @@
<Compile Include="deviceLibrary\IO\NiRenIO.cs" /> <Compile Include="deviceLibrary\IO\NiRenIO.cs" />
<Compile Include="deviceLibrary\ledLabel\LedLabelController.cs" /> <Compile Include="deviceLibrary\ledLabel\LedLabelController.cs" />
<Compile Include="deviceLibrary\ledLabel\LabelInfo.cs" /> <Compile Include="deviceLibrary\ledLabel\LabelInfo.cs" />
<Compile Include="deviceLibrary\rgbLed\flyelectronicControl\Flyelectronic_485_RGB_Controller.cs" />
<Compile Include="deviceLibrary\rgbLed\RgbLedController.cs" />
<Compile Include="manager\ImageUtilM.cs" /> <Compile Include="manager\ImageUtilM.cs" />
<Compile Include="manager\PTipSoundProcess.cs" /> <Compile Include="manager\PTipSoundProcess.cs" />
<Compile Include="deviceLibrary\led\LedManager.cs" /> <Compile Include="deviceLibrary\led\LedManager.cs" />
......
...@@ -79,13 +79,60 @@ namespace DAL ...@@ -79,13 +79,60 @@ namespace DAL
return rtn; return rtn;
} }
//public bool AddHistory(TSA_V.DeviceLibrary.OpInfo info, out int id)
//{
// string sql;
// bool rtn;
// id = info.ID;
// //查询可写入的ID
// if (info.ID == 0)
// {
// sql = "SELECT MAX(ID) FROM PointInfo";
// rtn = Select(sql, out string[][] data);
// if (!rtn) return false;
// int.TryParse(data[0][0], out id);
// id++;
// }
// //添加操作信息记录
// string createDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
// sql = "INSERT INTO OperateInfo(ID,ProName,ProType,BarCode,BoardWidth,BoardLength,AoiResult,UserName,CreateDate) " +
// "VALUES(" + id + ",'" + info.ProName + "','" + info.ProType + "','" + info.BarCode + "'," + info.BoardWidth + "," +
// info.BoardLength + ",'" + info.AoiResult + "','" + TSA_V.DeviceLibrary.DB.userName + "','" + createDate + "')";
// rtn = Execute(sql);
// if (!rtn) return false;
// //添加操作点信息
// if (info.ID == 0)
// {
// SQLiteTransaction tr = _con.BeginTransaction();
// for (int i = 0; i < info.pointList.Count; i++)
// {
// sql = "INSERT INTO PointInfo(ID,PartNum,PointName,CreateDate) " +
// "VALUES(" + id + ",'" + info.pointList[i].PartNum + "','" + info.pointList[i].PointName + "','" + createDate + "')";
// rtn = Execute(sql);
// if (!rtn) break;
// }
// LogUtil.info("数据库Commit");
// if (rtn)
// tr.Commit();
// else
// tr.Rollback();
// LogUtil.info("数据库 完成");
// }
// return rtn;
//}
public bool AddHistory(TSA_V.DeviceLibrary.OpInfo info, out int id) public bool AddHistory(TSA_V.DeviceLibrary.OpInfo info, out int id)
{ {
string sql; string sql;
bool rtn; bool rtn;
id = info.ID; id = info.ID;
//查询可写入的ID // 查询可写入的ID
if (info.ID == 0) if (info.ID == 0)
{ {
sql = "SELECT MAX(ID) FROM PointInfo"; sql = "SELECT MAX(ID) FROM PointInfo";
...@@ -95,31 +142,37 @@ namespace DAL ...@@ -95,31 +142,37 @@ namespace DAL
id++; id++;
} }
//添加操作信息记录 // 添加操作信息记录
string createDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); string createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
sql = "INSERT INTO OperateInfo(ID,ProName,ProType,BarCode,BoardWidth,BoardLength,AoiResult,UserName,CreateDate) " + sql = $"INSERT INTO OperateInfo(ID, ProName, ProType, BarCode, BoardWidth, BoardLength, AoiResult, UserName, CreateDate) " +
"VALUES(" + id + ",'" + info.ProName + "','" + info.ProType + "','" + info.BarCode + "'," + info.BoardWidth + "," + $"VALUES({id}, '{info.ProName}', '{info.ProType}', '{info.BarCode}', {info.BoardWidth}, {info.BoardLength}, " +
info.BoardLength + ",'" + info.AoiResult + "','" + TSA_V.DeviceLibrary.DB.userName + "','" + createDate + "')"; $"'{info.AoiResult}', '{TSA_V.DeviceLibrary.DB.userName}', '{createDate}')";
rtn = Execute(sql); rtn = Execute(sql);
if (!rtn) return false; if (!rtn) return false;
//添加操作点信息 // 添加操作点信息
if (info.ID == 0) if (info.ID == 0)
{ {
SQLiteTransaction tr = _con.BeginTransaction(); using (SQLiteTransaction tr = _con.BeginTransaction())
for (int i = 0; i < info.pointList.Count; i++)
{ {
sql = "INSERT INTO PointInfo(ID,PartNum,PointName,CreateDate) " + try
"VALUES(" + id + ",'" + info.pointList[i].PartNum + "','" + info.pointList[i].PointName + "','" + createDate + "')"; {
rtn = Execute(sql); foreach (var point in info.pointList)
if (!rtn) break; {
sql = $"INSERT INTO PointInfo(ID, PartNum, PointName, CreateDate) " +
$"VALUES({id}, '{point.PartNum}', '{point.PointName}', '{createDate}')";
rtn = Execute(sql);
if (!rtn) break;
}
LogUtil.info("数据库Commit");
tr.Commit();
}
catch
{
tr.Rollback();
return false;
}
} }
LogUtil.info("数据库Commit");
if (rtn)
tr.Commit();
else
tr.Rollback();
LogUtil.info("数据库 完成"); LogUtil.info("数据库 完成");
} }
...@@ -129,7 +182,6 @@ namespace DAL ...@@ -129,7 +182,6 @@ namespace DAL
private bool Select(string sql, out string[][] data) private bool Select(string sql, out string[][] data)
{ {
data = null; data = null;
......
...@@ -106,3 +106,20 @@ ...@@ -106,3 +106,20 @@
10_8,98,1,2_5_8,14160,0, 10_8,98,1,2_5_8,14160,0,
10_9,99,1,2_5_9,8940,0, 10_9,99,1,2_5_9,8940,0,
10_10,100,1,2_5_10,3720,0, 10_10,100,1,2_5_10,3720,0,
,,,,,,
20_1,101,3,COM3,0,1#2#3#4#5,
20_2,102,3,COM3,1,6#7#8#9#10,
20_3,103,3,COM3,2,1#2#3#4#6,
20_4,104,3,COM3,3,6#7#8#9#11,
20_5,105,3,COM3,4,1#2#3#4#7,
20_6,106,3,COM3,5,6#7#8#9#12,
20_7,107,3,COM3,6,1#2#3#4#8,
20_8,108,3,COM3,7,6#7#8#9#13,
20_9,109,3,COM3,8,1#2#3#4#9,
20_10,110,3,COM3,9,6#7#8#9#14,
20_11,111,3,COM3,10,1#2#3#4#10,
20_12,112,3,COM3,11,6#7#8#9#15,
20_13,113,3,COM3,12,1#2#3#4#11,
20_14,114,3,COM3,13,6#7#8#9#16,
20_15,115,3,COM3,14,1#2#3#4#12,
20_16,116,3,COM3,15,6#7#8#9#17,
...@@ -14,7 +14,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -14,7 +14,7 @@ namespace TSA_V.LoadCSVLibrary
[CSVAttribute("节点名称")] [CSVAttribute("节点名称")]
public string PositionName { get; set; } public string PositionName { get; set; }
/// <summary> /// <summary>
///类型,1=转盘。2= ///类型,1=转盘。2=led标签灯。3=rgb灯带
/// </summary> /// </summary>
[CSVAttribute("类型")] [CSVAttribute("类型")]
public int PositionType { get; set; } public int PositionType { get; set; }
......
...@@ -41,58 +41,92 @@ namespace TSA_V.LoadCSVLibrary ...@@ -41,58 +41,92 @@ namespace TSA_V.LoadCSVLibrary
} return null; } return null;
} }
private List<int> list = null; private List<int> ledList = null;
public List<int> getLedList() public List<int> getLedList(string text = "")
{ {
if (list == null) if (text == "")
{ {
list = new List<int>(); if (ledList == null)
if (Leds.IndexOf('#') >= 0)
{ {
string[] str = Leds.Split('#'); ledList = TextToIndexs(Leds);
foreach (string s in str)
{
try
{
int value = Convert.ToInt32(s);
list.Add(value);
}
catch (Exception e)
{
}
}
} }
else if (Leds.IndexOf('-') >= 0) return ledList;
}
else
{
return TextToIndexs(text);
}
}
private List<int> TextToIndexs(string text)
{
List<int> list = new List<int>();
if (text.IndexOf('#') >= 0)
{
string[] str = text.Split('#');
foreach (string s in str)
{ {
string[] str = Leds.Split('-');
try try
{ {
int min = Convert.ToInt32(str[0]); int value = Convert.ToInt32(s);
int max = Convert.ToInt32(str[str.Length - 1]); list.Add(value);
for (int i = min; i <= max; i++)
{
list.Add(i);
}
} }
catch (Exception ex) catch (Exception e)
{ {
} }
} }
else }
else if (text.IndexOf('-') >= 0)
{
string[] str = text.Split('-');
try
{ {
try int min = Convert.ToInt32(str[0]);
{ int max = Convert.ToInt32(str[str.Length - 1]);
int value = Convert.ToInt32(Leds); for (int i = min; i <= max; i++)
list.Add(value);
}
catch (Exception e)
{ {
list.Add(i);
} }
} }
catch (Exception ex)
{
}
}
else
{
try
{
int value = Convert.ToInt32(text);
list.Add(value);
}
catch (Exception e)
{
}
} }
return list; return list;
} }
public bool IsRgbLed()
{
return PositionType.Equals(3);
}
public bool IsLedLabel()
{
return PositionType.Equals(2);
}
public bool IsNodePos()
{
if(PositionType.Equals(2))
{
return false;
}
if (PositionType.Equals(3))
{
return false;
}
return true;
}
} }
} }
...@@ -27,7 +27,7 @@ namespace TSA_V.DeviceLibrary ...@@ -27,7 +27,7 @@ namespace TSA_V.DeviceLibrary
string ip = ""; string ip = "";
foreach (var pos in positions) foreach (var pos in positions)
{ {
if (pos.PositionType.Equals(2)) if (pos.IsLedLabel())
{ {
ip = pos.DeviceIP; ip = pos.DeviceIP;
macs.Add(pos.Leds); macs.Add(pos.Leds);
...@@ -51,7 +51,7 @@ namespace TSA_V.DeviceLibrary ...@@ -51,7 +51,7 @@ namespace TSA_V.DeviceLibrary
{ {
position = new TSAVPosition(); position = new TSAVPosition();
} }
if (!position.PositionType.Equals(2)) if (!position.IsLedLabel())
{ {
return new LabelInfo(); return new LabelInfo();
} }
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSA_V.Common;
using TSA_V.LoadCSVLibrary;
namespace TSA_V.DeviceLibrary
{
public class RgbLedController
{
public static Flyelectronic_485_RGB_Controller rGB_Controller = null;
public static bool Init()
{
if (Setting_NInit.RGBLed_PortName == "")
{
LogUtil.error("未配置RGBLED端口号");
return false;
}
rGB_Controller = new Flyelectronic_485_RGB_Controller("LED");
rGB_Controller.OpenPort(Setting_NInit.RGBLed_PortName, out string errmsg);
if (errmsg != null)
{
LogUtil.error("初始化RgbLed灯失败:" + errmsg);
return false;
}
return true;
}
private static Color defColor = Color.Green;
public static void OpenPosLed(TSAVPosition position)
{
if (position.IsRgbLed())
{
List<int> leds = position.getLedList();
OpenPosLed(leds);
}
}
public static void OpenPosLed(List<int> leds)
{
if (rGB_Controller == null)
{
return;
}
rGB_Controller.ShowLedColor(defColor, leds);
}
public static void CloseAll()
{
if (rGB_Controller == null)
{
return;
}
rGB_Controller.ShowColor(Color.Black);
}
public static void OpenAll()
{
if (rGB_Controller == null)
{
return;
}
rGB_Controller.ShowColor(defColor);
}
}
}
...@@ -126,13 +126,18 @@ namespace TSA_V.DeviceLibrary ...@@ -126,13 +126,18 @@ namespace TSA_V.DeviceLibrary
result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止"); result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止");
break; break;
} }
else if (!IOManager.ShuddenOK())
{
result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止");
break;
}
else if (stopwatch.ElapsedMilliseconds / 1000 > timeOutSeconds) else if (stopwatch.ElapsedMilliseconds / 1000 > timeOutSeconds)
{ {
result = ResourceControl.GetString(ResourceControl.HomeMoveTimeout, "等待原点完成超时"); result = ResourceControl.GetString(ResourceControl.HomeMoveTimeout, "等待原点完成超时");
break; break;
} }
else if (PUSICANControl.IsHomeEnd(LWidthManager.Line_NodeAddr)) else if (PUSICANControl.IsHomeEnd(LWidthManager.Line_NodeAddr))
{ {
result = ""; result = "";
break; break;
} }
...@@ -160,6 +165,12 @@ namespace TSA_V.DeviceLibrary ...@@ -160,6 +165,12 @@ namespace TSA_V.DeviceLibrary
IsStop = true; IsStop = true;
result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止"); result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止");
break; break;
}
else if (!IOManager.ShuddenOK())
{
IsStop = true;
result = ResourceControl.GetString(ResourceControl.UserStop, "用户中止");
break;
} }
else if (stopwatch.ElapsedMilliseconds / 1000 > timeOutSeconds) else if (stopwatch.ElapsedMilliseconds / 1000 > timeOutSeconds)
{ {
......
...@@ -70,7 +70,8 @@ namespace TSA_V.DeviceLibrary ...@@ -70,7 +70,8 @@ namespace TSA_V.DeviceLibrary
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300); Thread.Sleep(300);
} }
if (position.PositionType.Equals(1))
if (position.IsNodePos())
{ {
NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap); NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap);
if (moveNode != null) if (moveNode != null)
...@@ -92,13 +93,18 @@ namespace TSA_V.DeviceLibrary ...@@ -92,13 +93,18 @@ namespace TSA_V.DeviceLibrary
LogUtil.error("positionNum=" + position.PositionNum + ",未找到对应的运动轴!"); LogUtil.error("positionNum=" + position.PositionNum + ",未找到对应的运动轴!");
} }
} }
else if (position.PositionType.Equals(2)) else if (position.IsLedLabel())
{ {
if (PreNodeId > 0)
{
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
PreNodeId = 0;
LabelInfo label = LedLabelController.GetLabel(position, componet, true); LabelInfo label = LedLabelController.GetLabel(position, componet, true);
LedLabelController.UpdateScreen(label); LedLabelController.UpdateScreen(label);
PreLabel = label; PreLabel = label;
} }
else else if(position.IsRgbLed())
{ {
if (PreNodeId > 0) if (PreNodeId > 0)
{ {
......
...@@ -947,6 +947,9 @@ namespace TSA_V.DeviceLibrary ...@@ -947,6 +947,9 @@ namespace TSA_V.DeviceLibrary
} }
} }
} }
//调宽也停止
} }
//LedLabelController.CloseAll(); //LedLabelController.CloseAll();
......
...@@ -33,6 +33,7 @@ namespace TSA_V.DeviceLibrary ...@@ -33,6 +33,7 @@ namespace TSA_V.DeviceLibrary
public DateTime LastSetpTime = DateTime.Now; public DateTime LastSetpTime = DateTime.Now;
public uint PreNodeId = 0; public uint PreNodeId = 0;
public LabelInfo PreLabel = null ; public LabelInfo PreLabel = null ;
public List<int> PreRgbLed = new List<int>();
public List<SMTPointInfo> needWorkSmtList = new List<SMTPointInfo>(); public List<SMTPointInfo> needWorkSmtList = new List<SMTPointInfo>();
//开始工作后共工作了几块电路板`````` //开始工作后共工作了几块电路板``````
public int BoardCount = 0; public int BoardCount = 0;
...@@ -125,6 +126,11 @@ namespace TSA_V.DeviceLibrary ...@@ -125,6 +126,11 @@ namespace TSA_V.DeviceLibrary
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
PreLabel = null; PreLabel = null;
} }
if(PreRgbLed.Count>0)
{
RgbLedController.CloseAll();
PreRgbLed = new List<int>();
}
//把上次的旋转轴转回待机点 //把上次的旋转轴转回待机点
if (this.WorkType.Equals(1) && PreNodeId > 0) if (this.WorkType.Equals(1) && PreNodeId > 0)
{ {
...@@ -199,17 +205,8 @@ namespace TSA_V.DeviceLibrary ...@@ -199,17 +205,8 @@ namespace TSA_V.DeviceLibrary
{ {
if (WorkType.Equals(1)) if (WorkType.Equals(1))
{ {
LogUtil.info(" 程序【" + currBoard.boardName + "】所有位置已走完 "); LogUtil.info(" 程序【" + currBoard.boardName + "】所有位置已走完 ");
if (PreNodeId > 0) ClosePrePos();
{
//上一个节点返回原点
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
if (PreLabel != null)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
}
//if (TSAVBean.IsNeedSoldering) //if (TSAVBean.IsNeedSoldering)
//{ //{
// LogUtil.info(" 程序【" + currBoard.boardName + "】需要焊接,打开烙铁灯 "); // LogUtil.info(" 程序【" + currBoard.boardName + "】需要焊接,打开烙铁灯 ");
...@@ -309,14 +306,37 @@ namespace TSA_V.DeviceLibrary ...@@ -309,14 +306,37 @@ namespace TSA_V.DeviceLibrary
} }
} }
public void ClosePrePos()
{
if (PreNodeId > 0)
{
//上一个节点返回原点
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
if (PreLabel != null)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
}
if (PreRgbLed.Count > 0)
{
RgbLedController.CloseAll();
PreRgbLed = new List<int>();
}
}
public void MoveToBag(TSAVPosition position) public void MoveToBag(TSAVPosition position)
{ {
if (PreLabel != null) if (PreLabel != null)
{ {
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300); Thread.Sleep(300);
} }
if (position.PositionType.Equals(1)) if (PreRgbLed.Count > 0)
{
RgbLedController.CloseAll();
PreRgbLed = new List<int>();
}
if (position.IsNodePos())
{ {
//转盘转动 //转盘转动
NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap); NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap);
...@@ -338,8 +358,12 @@ namespace TSA_V.DeviceLibrary ...@@ -338,8 +358,12 @@ namespace TSA_V.DeviceLibrary
} }
} }
#region 2023-09-22 添加 控制便签功能 #region 2023-09-22 添加 控制便签功能
else if (position.PositionType.Equals(2)) else if (position.IsLedLabel())
{ {
if (PreNodeId > 0)
{
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
var smtPoint=TSAVBean.Work.currPoint; var smtPoint=TSAVBean.Work.currPoint;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint); ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint);
LabelInfo label = LedLabelController.GetLabel(position, com, true); LabelInfo label = LedLabelController.GetLabel(position, com, true);
...@@ -348,6 +372,14 @@ namespace TSA_V.DeviceLibrary ...@@ -348,6 +372,14 @@ namespace TSA_V.DeviceLibrary
PTipSoundProcess.PlayFile(Setting_NInit.Set_PointChangeSound); PTipSoundProcess.PlayFile(Setting_NInit.Set_PointChangeSound);
} }
#endregion #endregion
else if (position.IsRgbLed())
{
if (PreNodeId > 0)
{
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
RgbLedController.OpenPosLed(position);
}
else else
{ {
if (PreNodeId > 0) if (PreNodeId > 0)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmComponentList)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmComponentList));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnImport = new System.Windows.Forms.Button();
this.btnExport = new System.Windows.Forms.Button(); this.btnExport = new System.Windows.Forms.Button();
this.btnDel = new System.Windows.Forms.Button(); this.btnDel = new System.Windows.Forms.Button();
this.btnBeiLiao = new System.Windows.Forms.Button(); this.btnBeiLiao = new System.Windows.Forms.Button();
...@@ -70,8 +71,8 @@ ...@@ -70,8 +71,8 @@
this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn(); this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn();
this.btnBack = new System.Windows.Forms.Button(); this.btnBack = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button(); this.btnNew = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.txtLedIndex = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupInfo.SuspendLayout(); this.groupInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
...@@ -101,6 +102,18 @@ ...@@ -101,6 +102,18 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "元器件库管理"; this.groupBox1.Text = "元器件库管理";
// //
// btnImport
//
this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(842, 21);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(130, 45);
this.btnImport.TabIndex = 74;
this.btnImport.Text = "导入";
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// btnExport // btnExport
// //
this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
...@@ -175,6 +188,7 @@ ...@@ -175,6 +188,7 @@
// //
this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupInfo.Controls.Add(this.txtLedIndex);
this.groupInfo.Controls.Add(this.linkCloseAll); this.groupInfo.Controls.Add(this.linkCloseAll);
this.groupInfo.Controls.Add(this.linkOpenAll); this.groupInfo.Controls.Add(this.linkOpenAll);
this.groupInfo.Controls.Add(this.linkUpdate); this.groupInfo.Controls.Add(this.linkUpdate);
...@@ -552,22 +566,19 @@ ...@@ -552,22 +566,19 @@
this.btnNew.Visible = false; this.btnNew.Visible = false;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click); this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
// //
// btnImport
//
this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(842, 21);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(130, 45);
this.btnImport.TabIndex = 74;
this.btnImport.Text = "导入";
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// openFileDialog1 // openFileDialog1
// //
this.openFileDialog1.FileName = "openFileDialog1"; this.openFileDialog1.FileName = "openFileDialog1";
// //
// txtLedIndex
//
this.txtLedIndex.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtLedIndex.Location = new System.Drawing.Point(246, 302);
this.txtLedIndex.MaxLength = 30;
this.txtLedIndex.Name = "txtLedIndex";
this.txtLedIndex.Size = new System.Drawing.Size(151, 29);
this.txtLedIndex.TabIndex = 83;
//
// FrmComponentList // FrmComponentList
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -635,5 +646,6 @@ ...@@ -635,5 +646,6 @@
private System.Windows.Forms.LinkLabel linkOpenAll; private System.Windows.Forms.LinkLabel linkOpenAll;
private System.Windows.Forms.Button btnImport; private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.TextBox txtLedIndex;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -579,32 +579,35 @@ namespace TSA_V ...@@ -579,32 +579,35 @@ namespace TSA_V
LanguagePro(); LanguagePro();
} }
} }
private TSAVPosition position = null;
private void cmbPositionNumList_SelectedIndexChanged(object sender, EventArgs e) private void cmbPositionNumList_SelectedIndexChanged(object sender, EventArgs e)
{ {
string pNum = cmbPositionNumList.Text; string pNum = cmbPositionNumList.Text;
if (pNum.Equals("")) if (pNum.Equals(""))
{ {
position = null;
return; return;
} }
TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum); position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.PositionType.Equals(2)) if (position != null && (position.IsLedLabel() ||position.IsRgbLed() ))
{ {
LinkVisible(true ); LinkVisible(true,position.PositionType );
txtLedIndex.Text = position.Leds;
} }
else else
{ {
LinkVisible(false); LinkVisible(false);
} }
} }
private void LinkVisible(bool show) private void LinkVisible(bool show,int type=0)
{ {
linkLabel1.Visible = show; linkLabel1.Visible = show;
linkLabel2.Visible = show; linkLabel2.Visible = show;
linkCloseAll.Visible = show; linkCloseAll.Visible = show;
linkOpenAll.Visible = show; linkOpenAll.Visible = show;
linkUpdate.Visible = show; linkUpdate.Visible = show&&type==2;
txtLedIndex.Visible = show && type == 3;
} }
private LabelInfo PreLabel = null; private LabelInfo PreLabel = null;
private void CloseLed(string pPnum) private void CloseLed(string pPnum)
...@@ -618,28 +621,44 @@ namespace TSA_V ...@@ -618,28 +621,44 @@ namespace TSA_V
} }
} }
} }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
string pNum = cmbPositionNumList.Text; if (position != null && position.IsRgbLed())
CloseLed(pNum);
TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.PositionType.Equals(2))
{ {
PreLabel = LedLabelController.GetLabel(position, selCom, true); List<int> leds=position.getLedList(txtLedIndex.Text);
LedLabelController.OpenLed(position.DeviceIP, position.Leds); RgbLedController.OpenPosLed(leds);
//LedLabelController.UpdateScreen(PreLabel); }
else
{
string pNum = cmbPositionNumList.Text;
CloseLed(pNum);
//TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.IsLedLabel())
{
PreLabel = LedLabelController.GetLabel(position, selCom, true);
LedLabelController.OpenLed(position.DeviceIP, position.Leds);
//LedLabelController.UpdateScreen(PreLabel);
}
} }
} }
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
CloseLed(""); if (position != null && position.IsRgbLed())
string pNum = cmbPositionNumList.Text; {
TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum); RgbLedController.CloseAll();
if (position != null && position.PositionType.Equals(2)) }
else
{ {
PreLabel = LedLabelController.GetLabel(position, selCom, true); CloseLed("");
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); string pNum = cmbPositionNumList.Text;
//TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.IsLedLabel())
{
PreLabel = LedLabelController.GetLabel(position, selCom, true);
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
}
} }
} }
...@@ -721,25 +740,42 @@ namespace TSA_V ...@@ -721,25 +740,42 @@ namespace TSA_V
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
string pNum = cmbPositionNumList.Text; if (position != null && position.IsLedLabel())
CloseLed(pNum);
TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.PositionType.Equals(2))
{ {
PreLabel = LedLabelController.GetLabel(position, selCom, true); string pNum = cmbPositionNumList.Text;
LedLabelController.UpdateScreen(PreLabel); CloseLed(pNum);
//TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.IsLedLabel())
{
PreLabel = LedLabelController.GetLabel(position, selCom, true);
LedLabelController.UpdateScreen(PreLabel);
}
} }
} }
private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
LedLabelController.OpenAll(); if (position != null && position.IsRgbLed())
{
RgbLedController.OpenAll();
}
else
{
LedLabelController.OpenAll();
}
} }
private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
LedLabelController.CloseAll(); if (position != null && position.IsRgbLed())
{
RgbLedController.CloseAll();
}
else
{
LedLabelController.CloseAll();
}
} }
private void btnImport_Click(object sender, EventArgs e) private void btnImport_Click(object sender, EventArgs e)
......
...@@ -147,36 +147,6 @@ ...@@ -147,36 +147,6 @@
<metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_partNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_PN.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Position.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Notes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_description.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
......
...@@ -156,18 +156,6 @@ ...@@ -156,18 +156,6 @@
<metadata name="col_CreateDate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="col_CreateDate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="pcol_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pcol_PartNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pcol_PointName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pcol_CreateDate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="col_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
......
...@@ -913,7 +913,7 @@ ...@@ -913,7 +913,7 @@
// //
this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.linkLabel1.AutoSize = true; this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(570, 583); this.linkLabel1.Location = new System.Drawing.Point(484, 578);
this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(65, 12); this.linkLabel1.Size = new System.Drawing.Size(65, 12);
this.linkLabel1.TabIndex = 281; this.linkLabel1.TabIndex = 281;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!