Commit d10e5256 LN

Merge branch '无轨道开发' of http://106.15.194.121:8083/lina/Line-Smart-Workstation into 无轨道开发

2 个父辈 75f52895 842be756
正在显示 37 个修改的文件 包含 297 行增加73 行删除
...@@ -175,5 +175,15 @@ namespace TSA_V.Common ...@@ -175,5 +175,15 @@ namespace TSA_V.Common
public static string OfflineMode = "OfflineMode"; public static string OfflineMode = "OfflineMode";
public static string PointDisplayType = "PointDisplayType"; public static string PointDisplayType = "PointDisplayType";
/// <summary>
/// 运行中断程序名称
/// </summary>
public static string ProcedureName = "ProcedureName";
/// <summary>
/// 位号
/// </summary>
public static string TagNumber = "TagNumber";
} }
} }
...@@ -242,5 +242,13 @@ namespace TSA_V.Common ...@@ -242,5 +242,13 @@ namespace TSA_V.Common
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace); LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
} }
} }
public static void UpdateAppSetting(string key, string value)
{
Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
configuration.AppSettings.Settings[key].Value = value;
configuration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
} }
} }
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference> </Reference>
<Reference Include="ExcelDataReader, Version=3.6.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDataReader.3.6.0\lib\net45\ExcelDataReader.dll</HintPath>
</Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\dll\halcondotnet.dll</HintPath> <HintPath>..\dll\halcondotnet.dll</HintPath>
</Reference> </Reference>
...@@ -65,6 +68,8 @@ ...@@ -65,6 +68,8 @@
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll</HintPath> <HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceModel" /> <Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" /> <Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
...@@ -103,6 +108,7 @@ ...@@ -103,6 +108,7 @@
<Compile Include="manager\LedManager.cs" /> <Compile Include="manager\LedManager.cs" />
<Compile Include="manager\LineWidthManager.cs" /> <Compile Include="manager\LineWidthManager.cs" />
<Compile Include="manager\ResourceControl.cs" /> <Compile Include="manager\ResourceControl.cs" />
<Compile Include="manager\ScanRequestLabel.cs" />
<Compile Include="manager\StockInfo.cs" /> <Compile Include="manager\StockInfo.cs" />
<Compile Include="manager\TSAVBean.cs" /> <Compile Include="manager\TSAVBean.cs" />
<Compile Include="manager\TSAVBean_Partial.cs" /> <Compile Include="manager\TSAVBean_Partial.cs" />
......
...@@ -181,18 +181,54 @@ namespace TSA_V.LoadCSVLibrary ...@@ -181,18 +181,54 @@ namespace TSA_V.LoadCSVLibrary
Dictionary<string, string> pnposlist = new Dictionary<string, string>(); Dictionary<string, string> pnposlist = new Dictionary<string, string>();
HashSet<string> usedposlist = new HashSet<string>(); HashSet<string> usedposlist = new HashSet<string>();
List< ComponetInfo > componetlist = new List< ComponetInfo >();
foreach (var com in comList) { foreach (var com in comList) {
if (string.IsNullOrWhiteSpace(com.PositionNum)) if (string.IsNullOrWhiteSpace(com.PositionNum))
continue; continue;
com.PositionNum = GetPositionNum(com.PositionNum);
if (!string.IsNullOrEmpty(com.PositionNum)) string[] strarr= GetPositionNum(com.PositionNum);
string[] intarr = com.ComCount.Split(';');
if (strarr.Length!=+intarr.Length)
{
MessageBox.Show($"{com.PN}的数量分组{intarr.Length}和位置分组{strarr.Length},不统一!");
break;
}
int i = index;
int j = 0;
foreach (var item in strarr)
{ {
usedposlist.Add(com.PositionNum); ComponetInfo componet = new ComponetInfo();
pnposlist[com.PN] = com.PositionNum; componet.Id = comList.Count + i;
componet.PositionX=com.PositionX;
componet.PositionNum = item;
componet.PN=com.PN;
componet.Text=com.Text;
componet.ComCount= intarr[j];
componet.ComponentDes=com.ComponentDes;
componet.Notes=com.Notes;
componet.TagNo=com.TagNo;
componetlist.Add(componet);
i++;
j++;
if (!string.IsNullOrEmpty(com.PositionNum))
{
usedposlist.Add(com.PositionNum);
pnposlist[com.PN] = com.PositionNum;
}
} }
//com.PositionNum = GetPositionNum(com.PositionNum);
//if (!string.IsNullOrEmpty(com.PositionNum))
//{
// usedposlist.Add(com.PositionNum);
// pnposlist[com.PN] = com.PositionNum;
//}
} }
foreach (var com in comList) { comList.AddRange(componetlist);
List<ComponetInfo> componedate = comList.Where(m => !m.PositionNum.Contains(";")).ToList();
foreach (var com in componedate)
{
if (string.IsNullOrWhiteSpace(com.PositionNum) && !string.IsNullOrWhiteSpace(com.PN)) if (string.IsNullOrWhiteSpace(com.PositionNum) && !string.IsNullOrWhiteSpace(com.PN))
{ {
...@@ -218,17 +254,28 @@ namespace TSA_V.LoadCSVLibrary ...@@ -218,17 +254,28 @@ namespace TSA_V.LoadCSVLibrary
//} //}
} }
return componedate;
return comList;
} }
public static string GetPositionNum(string configPosition ) public static string[] GetPositionNum(string configPosition )
{ {
TSAVPosition p = CSVPositionReader<TSAVPosition>.GetPositonByNum(configPosition); string[] strings=configPosition.Split(';');
if (p != null) string[] strarr=new string[strings.Length];
int i = 0;
foreach (var item in strings)
{ {
return p.PositionNum; TSAVPosition p = CSVPositionReader<TSAVPosition>.GetPositonByNum(item);
if (p != null)
{
// return p.PositionNum;
strarr[i] = p.PositionNum;
}
else
{
strarr[i] = "";
}
i++;
} }
return ""; return strarr;
} }
...@@ -495,7 +542,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -495,7 +542,7 @@ namespace TSA_V.LoadCSVLibrary
{ {
if (comList[i].IsSameCom(smtPoint)) if (comList[i].IsSameCom(smtPoint))
{ {
comList[i].ComCount = count; comList[i].ComCount = count.ToString();
updateOk = true; updateOk = true;
break; break;
} }
...@@ -507,7 +554,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -507,7 +554,7 @@ namespace TSA_V.LoadCSVLibrary
{ {
if (comList[i].PN.Equals(smtPoint.PN)) if (comList[i].PN.Equals(smtPoint.PN))
{ {
comList[i].ComCount = count; comList[i].ComCount = count.ToString();
updateOk = true; updateOk = true;
break; break;
} }
...@@ -557,10 +604,10 @@ namespace TSA_V.LoadCSVLibrary ...@@ -557,10 +604,10 @@ namespace TSA_V.LoadCSVLibrary
List<ComponetInfo> list = (from m in useComponets where m.Id.Equals(obj.Id) select m).ToList(); List<ComponetInfo> list = (from m in useComponets where m.Id.Equals(obj.Id) select m).ToList();
if (list.Count > 0) if (list.Count > 0)
{ {
obj.ComCount = obj.ComCount - list.Count; obj.ComCount = (int.Parse(obj.ComCount) - list.Count).ToString();
if (obj.ComCount < 0) if (int.Parse(obj.ComCount) < 0)
{ {
obj.ComCount = 0; obj.ComCount = "0";
} }
} }
newList.Add(obj); newList.Add(obj);
......
...@@ -24,48 +24,48 @@ namespace TSA_V.LoadCSVLibrary ...@@ -24,48 +24,48 @@ namespace TSA_V.LoadCSVLibrary
/// <summary> /// <summary>
///位号/编号 ///位号/编号
/// </summary> /// </summary>
[CSVAttribute("Num", true,"位号", "编号")] [CSVAttribute("Num", true,"位号", "编号", "Part Number")]
public string TagNo { get; set; } public string TagNo { get; set; }
/// <summary> /// <summary>
/// 物料编码/元器件名称 /// 物料编码/元器件名称
/// </summary> /// </summary>
[CSVAttribute("Code", true, "物料编码", "元器件名称", "Name")] [CSVAttribute("Code", true, "物料编码", "元器件名称", "Name", "Material Code")]
public string PN { get; set; } public string PN { get; set; }
/// <summary> /// <summary>
///元器件描述 ///元器件描述
/// </summary> /// </summary>
[CSVAttribute("Describe", "元器件描述", false )] [CSVAttribute("Describe", false, "元器件描述", "Description")]
public string ComponentDes { get; set; } public string ComponentDes { get; set; }
/// <summary> /// <summary>
///数量 ///数量
/// </summary> /// </summary>
[CSVAttribute("Count", "数量", true)] [CSVAttribute("Count", true,"数量", "Quantity")]
public int ComCount { get; set; } public string ComCount { get; set; }
/// <summary> /// <summary>
///位置 ///位置
/// </summary> /// </summary>
[CSVAttribute("PNum", true, "料盘位置", "位置", "PositionNum")] [CSVAttribute("PNum", true, "料盘位置", "位置", "PositionNum", "Lot")]
public string PositionNum { get; set; } public string PositionNum { get; set; }
/// <summary> /// <summary>
///X坐标 ///X坐标
/// </summary> /// </summary>
[CSVAttribute("PositionX", "X坐标", false)] [CSVAttribute("PositionX", false,"X坐标", "X")]
public double PositionX { get; set; } public double PositionX { get; set; }
/// <summary> /// <summary>
///Y坐标 ///Y坐标
/// </summary> /// </summary>
[CSVAttribute("PositionY", "Y坐标", false)] [CSVAttribute("PositionY", false,"Y坐标", "Y")]
public double PositionY { get; set; } public double PositionY { get; set; }
/// <summary> /// <summary>
///注意事项 ///注意事项
/// </summary> /// </summary>
[CSVAttribute("Notes", "注意事项", false)] [CSVAttribute("Notes",false, "注意事项", "Note")]
public string Notes { get; set; } public string Notes { get; set; }
/// <summary> /// <summary>
///投影文字 ///投影文字
...@@ -116,7 +116,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -116,7 +116,7 @@ namespace TSA_V.LoadCSVLibrary
return true; return true;
} }
} }
else if (this.TagNo.Equals(point.TagNo)) else if (this.TagNo.Equals(point.TagNo)&&this.PositionNum.Equals(point.PositionNum))
{ {
return true; return true;
} }
......
using PUSICANLibrary; using PUSICANLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary.manager;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
namespace TSA_V.DeviceLibrary namespace TSA_V.DeviceLibrary
...@@ -35,7 +33,7 @@ namespace TSA_V.DeviceLibrary ...@@ -35,7 +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 List<SMTPointInfo> needWorkSmtList = new List<SMTPointInfo>(); public List<SMTPointInfo> needWorkSmtList = new List<SMTPointInfo>();
//开始工作后共工作了几块电路板 //开始工作后共工作了几块电路板``````
public int BoardCount = 0; public int BoardCount = 0;
public DateTime beginWorkTime = DateTime.Now; public DateTime beginWorkTime = DateTime.Now;
public bool IsShowAOI = false; public bool IsShowAOI = false;
...@@ -131,8 +129,7 @@ namespace TSA_V.DeviceLibrary ...@@ -131,8 +129,7 @@ namespace TSA_V.DeviceLibrary
endWorkTime = DateTime.Now; endWorkTime = DateTime.Now;
IsWaitMove = false; IsWaitMove = false;
waitList = new List<WaitResultInfo>(); waitList = new List<WaitResultInfo>();
} }
public bool MoveToNextPoint(bool isNext) public bool MoveToNextPoint(bool isNext)
{ {
return MoveToNextPoint(isNext, false); return MoveToNextPoint(isNext, false);
...@@ -204,7 +201,41 @@ namespace TSA_V.DeviceLibrary ...@@ -204,7 +201,41 @@ namespace TSA_V.DeviceLibrary
TSAVPosition position = null; TSAVPosition position = null;
if (com != null) if (com != null)
{ {
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum); #region 2023-10-31添加
//如果当前位置元器件数量为空时,查询当前元器件库相同物料编号的元器件使用
if (int.Parse(com.ComCount) <= 0)
{
var smtpoint = needWorkSmtList.Where(a => a.PN == com.PN).ToList();
foreach (var item in smtpoint)
{
var componeinfo = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, item);
if (componeinfo != null && int.Parse(componeinfo.ComCount) > 0)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(componeinfo.PositionNum);
if (position != null)
{
com = componeinfo;
currPoint = item;
break;
}
}
}
}
else
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
}
//记录运行过程的位号
ConfigAppSettings.UpdateAppSetting(Setting_Init.ProcedureName, currBoard.boardName);
ConfigAppSettings.UpdateAppSetting(Setting_Init.TagNumber, currIndex.ToString());
if (currPoint.pointNum == 1)//第一个位号不需要记录
{
ConfigAppSettings.UpdateAppSetting(Setting_Init.ProcedureName, "");
ConfigAppSettings.UpdateAppSetting(Setting_Init.TagNumber, "");
}
#endregion
//position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
useComponets.Add(com); useComponets.Add(com);
} }
else else
...@@ -216,7 +247,7 @@ namespace TSA_V.DeviceLibrary ...@@ -216,7 +247,7 @@ namespace TSA_V.DeviceLibrary
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】未找到对应的元器件"); LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】未找到对应的元器件");
} }
else else
{ {
this.currPosition = position; this.currPosition = position;
XYMove(); XYMove();
//插件机工作 //插件机工作
...@@ -276,6 +307,14 @@ namespace TSA_V.DeviceLibrary ...@@ -276,6 +307,14 @@ namespace TSA_V.DeviceLibrary
} }
public void MoveToBag(TSAVPosition position) public void MoveToBag(TSAVPosition position)
{ {
Dictionary<string,string> pairs = new Dictionary<string,string>();
if (pairs.Count!=0)
{
//关灯
LogUtil.info($"{pairs.ToString()}");
ScanRequestLabel.Turnoffthelights(pairs);
pairs.Clear();
}
//LedManager.LedOFFALL(); //LedManager.LedOFFALL();
if (position.PositionType.Equals(1)) if (position.PositionType.Equals(1))
{ {
...@@ -288,7 +327,7 @@ namespace TSA_V.DeviceLibrary ...@@ -288,7 +327,7 @@ namespace TSA_V.DeviceLibrary
//上一个节点返回原点 //上一个节点返回原点
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition); PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
Thread.Sleep(50); Thread.Sleep(50);
} }
PUSICANControl.AbsMove(moveNode.NodeId, position.RotatePosition); PUSICANControl.AbsMove(moveNode.NodeId, position.RotatePosition);
waitList.Add(WaitResultInfo.WaitNode(moveNode, position.RotatePosition)); waitList.Add(WaitResultInfo.WaitNode(moveNode, position.RotatePosition));
PreNodeId = moveNode.NodeId; PreNodeId = moveNode.NodeId;
...@@ -298,6 +337,24 @@ namespace TSA_V.DeviceLibrary ...@@ -298,6 +337,24 @@ namespace TSA_V.DeviceLibrary
LogUtil.error("positionNum=" + position.PositionNum + ",未找到对应的运动轴!"); LogUtil.error("positionNum=" + position.PositionNum + ",未找到对应的运动轴!");
} }
} }
#region 2023-09-22 添加 控制便签功能
else if (position.PositionType.Equals(2))
{
LogUtil.info("电子屏闪烁!");
var smtPoint=TSAVBean.Work.currPoint;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint);
string count=null;
string pnname = null;
string ComponentDes=null;
if (com!=null)
{
count = com.ComCount.ToString();
pnname=com.PN.ToString();
ComponentDes=com.ComponentDes.ToString();
}
ScanRequestLabel.RequestPost(position, count, pnname, ComponentDes ,out pairs);
}
#endregion
else else
{ {
if (PreNodeId > 0) if (PreNodeId > 0)
...@@ -305,12 +362,11 @@ namespace TSA_V.DeviceLibrary ...@@ -305,12 +362,11 @@ namespace TSA_V.DeviceLibrary
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition); PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
} }
PreNodeId = 0; PreNodeId = 0;
LEDModule module = LedManager.GetLEDModule(position.DeviceIP); LEDModule module = LedManager.GetLEDModule(position.DeviceIP);
LedManager.LightOn(position.DeviceIP, position.getLedList()); LedManager.LightOn(position.DeviceIP, position.getLedList());
waitList.Add(WaitResultInfo.WaitTime(500)); waitList.Add(WaitResultInfo.WaitTime(500));
} }
} }
public bool IsLastP() public bool IsLastP()
{ {
if (IsWorking) if (IsWorking)
......
...@@ -124,6 +124,9 @@ ...@@ -124,6 +124,9 @@
<add key="DisableBottomCylinder" value="1" /> <add key="DisableBottomCylinder" value="1" />
<add key="SMF_Serverurl" value ="http://localhost:8800/"/> <add key="SMF_Serverurl" value ="http://localhost:8800/"/>
<add key="SMF_CID" value ="NEOSTATION001"/> <add key="SMF_CID" value ="NEOSTATION001"/>
<!--记录程序运行步骤-->
<add key="ProcedureName" value="12343" />
<add key="TagNumber" value ="3"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="defaultAppender" type="log4net.Appender.RollingFileAppender"> <appender name="defaultAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -160,7 +160,7 @@ namespace TSA_V ...@@ -160,7 +160,7 @@ namespace TSA_V
int newCount = (int)numCount.Value; int newCount = (int)numCount.Value;
ComponetInfo com = comList[currIndex]; ComponetInfo com = comList[currIndex];
com.ComCount = newCount; com.ComCount = newCount.ToString();
CSVBomManager.UpdateComponet(bomName, com); CSVBomManager.UpdateComponet(bomName, com);
} }
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
......
...@@ -159,7 +159,7 @@ namespace TSA_V ...@@ -159,7 +159,7 @@ namespace TSA_V
obj.PN = FormUtil.getValue(txtName); obj.PN = FormUtil.getValue(txtName);
obj.ComponentDes = FormUtil.getValue(txtDes); obj.ComponentDes = FormUtil.getValue(txtDes);
obj.ComCount = FormUtil.GetIntValue(txtCount); obj.ComCount = FormUtil.GetIntValue(txtCount).ToString();
obj.Notes = FormUtil.getValue(txtNotes); obj.Notes = FormUtil.getValue(txtNotes);
obj.TagNo = FormUtil.getValue(txtPartNum); obj.TagNo = FormUtil.getValue(txtPartNum);
obj.Id = FormUtil.GetIntValue(txtId); obj.Id = FormUtil.GetIntValue(txtId);
...@@ -173,7 +173,7 @@ namespace TSA_V ...@@ -173,7 +173,7 @@ namespace TSA_V
return; return;
} }
if (obj.ComCount<=0) if (int.Parse(obj.ComCount)<=0)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComNum,"请输入元器件数量!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComNum,"请输入元器件数量!"));
txtCount.Focus(); txtCount.Focus();
...@@ -226,7 +226,7 @@ namespace TSA_V ...@@ -226,7 +226,7 @@ namespace TSA_V
obj.TagNo = FormUtil.getValue(txtPartNum); obj.TagNo = FormUtil.getValue(txtPartNum);
obj.PN = FormUtil.getValue(txtName); obj.PN = FormUtil.getValue(txtName);
obj.ComponentDes = FormUtil.getValue(txtDes); obj.ComponentDes = FormUtil.getValue(txtDes);
obj.ComCount = FormUtil.GetIntValue(txtCount); obj.ComCount = FormUtil.GetIntValue(txtCount).ToString();
obj.Notes = FormUtil.getValue(txtNotes); obj.Notes = FormUtil.getValue(txtNotes);
obj.PositionNum = position.PositionNum; obj.PositionNum = position.PositionNum;
//if (obj.TagNo.Equals("")) //if (obj.TagNo.Equals(""))
...@@ -258,7 +258,7 @@ namespace TSA_V ...@@ -258,7 +258,7 @@ namespace TSA_V
return; return;
} }
if (obj.ComCount <= 0) if (int.Parse(obj.ComCount) <= 0)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComNum, "请输入元器件数量!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComNum, "请输入元器件数量!"));
txtCount.Focus(); txtCount.Focus();
...@@ -316,7 +316,7 @@ namespace TSA_V ...@@ -316,7 +316,7 @@ namespace TSA_V
point.ComponentDes = row.Cells[this.Column_description.Name].Value.ToString(); point.ComponentDes = row.Cells[this.Column_description.Name].Value.ToString();
point.Notes = row.Cells[this.Column_Notes.Name].Value.ToString(); point.Notes = row.Cells[this.Column_Notes.Name].Value.ToString();
point.PositionNum = row.Cells[this.Column_Position.Name].Value.ToString(); point.PositionNum = row.Cells[this.Column_Position.Name].Value.ToString();
point.ComCount = Convert.ToInt32(row.Cells[this.Column_Count.Name].Value.ToString()); point.ComCount = row.Cells[this.Column_Count.Name].Value.ToString();
point.Id = Convert.ToInt32(row.Cells[this.Column_ID.Name].Value.ToString()); point.Id = Convert.ToInt32(row.Cells[this.Column_ID.Name].Value.ToString());
} }
...@@ -373,11 +373,11 @@ namespace TSA_V ...@@ -373,11 +373,11 @@ namespace TSA_V
int selPosIndex = -1; int selPosIndex = -1;
int index = -1; int index = -1;
string posNum = CSVBomManager.GetPositionNum(obj.PositionNum); string[] posNum = CSVBomManager.GetPositionNum(obj.PositionNum);
foreach (TSAVPosition p in allPosition) foreach (TSAVPosition p in allPosition)
{ {
index++; index++;
if (p.PositionNum.Equals(posNum)) if (p.PositionNum.Equals(posNum[0]))
{ {
selPosIndex = index; selPosIndex = index;
break; break;
......
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
this.chbISDebug.TabIndex = 19; this.chbISDebug.TabIndex = 19;
this.chbISDebug.Text = "是否调试模式,会自动下一步"; this.chbISDebug.Text = "是否调试模式,会自动下一步";
this.chbISDebug.UseVisualStyleBackColor = true; this.chbISDebug.UseVisualStyleBackColor = true;
this.chbISDebug.CheckedChanged += new System.EventHandler(this.chbISDebug_CheckedChanged);
// //
// groupBox4 // groupBox4
// //
......
...@@ -128,13 +128,9 @@ namespace TSA_V ...@@ -128,13 +128,9 @@ namespace TSA_V
LogUtil.info($"保存配置成功: 调试{ isDebug },禁用底部气缸{disBottom},禁用侧挡气缸{disSide},地址{server} "); LogUtil.info($"保存配置成功: 调试{ isDebug },禁用底部气缸{disBottom},禁用侧挡气缸{disSide},地址{server} ");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SaveOk, "保存成功")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SaveOk, "保存成功"));
} }
private void chbISDebug_CheckedChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
BoardInfo board = new BoardInfo(); BoardInfo board = new BoardInfo();
......
...@@ -9,6 +9,7 @@ using System.Text; ...@@ -9,6 +9,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary.manager;
namespace TSA_V namespace TSA_V
{ {
...@@ -45,7 +46,8 @@ namespace TSA_V ...@@ -45,7 +46,8 @@ namespace TSA_V
{ {
string str = ConfigAppSettings.GetValue(Setting_Init.Default_Language); string str = ConfigAppSettings.GetValue(Setting_Init.Default_Language);
if (rbtnEnglish.Checked) if (rbtnEnglish.Checked)
{ {
//ScanRequestLabel.Switchlanguage(1);
str = ResourceCulture.English; str = ResourceCulture.English;
} }
else if (rbtnRussian.Checked) else if (rbtnRussian.Checked)
...@@ -54,6 +56,7 @@ namespace TSA_V ...@@ -54,6 +56,7 @@ namespace TSA_V
} }
else else
{ {
//ScanRequestLabel.Switchlanguage(0);
str = ResourceCulture.China; str = ResourceCulture.China;
} }
ResourceCulture.SetCurrentCulture(str); ResourceCulture.SetCurrentCulture(str);
......
...@@ -213,7 +213,7 @@ namespace TSA_V ...@@ -213,7 +213,7 @@ namespace TSA_V
{ {
if (obj.PositionNum.Equals(com.PositionNum)) if (obj.PositionNum.Equals(com.PositionNum))
{ {
obj.ComCount = newCount; obj.ComCount = newCount.ToString();
} }
} }
......
...@@ -98,10 +98,12 @@ ...@@ -98,10 +98,12 @@
<HintPath>..\dll\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath> <HintPath>..\dll\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll</HintPath> <HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Speech" /> <Reference Include="System.Speech" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" /> <Reference Include="System.Windows.Forms.DataVisualization" />
......
...@@ -38,6 +38,7 @@ namespace TSA_V ...@@ -38,6 +38,7 @@ namespace TSA_V
if (!IOBase.NoLine) if (!IOBase.NoLine)
timer1.Start(); timer1.Start();
IsInitOk = true; IsInitOk = true;
CheckIfHaveincomplete();
} }
private void LoadCom() private void LoadCom()
{ {
...@@ -376,5 +377,23 @@ namespace TSA_V ...@@ -376,5 +377,23 @@ namespace TSA_V
//停止调宽 //停止调宽
LWidthManager.StopChangeWidth(); LWidthManager.StopChangeWidth();
} }
private void CheckIfHaveincomplete()
{
string ProcedureName = ConfigAppSettings.GetValue(Setting_Init.ProcedureName);
string TagNumber = ConfigAppSettings.GetValue(Setting_Init.TagNumber);
if (!string.IsNullOrEmpty(ProcedureName)&&!string.IsNullOrEmpty(TagNumber))
{
cmbBoardList.Text = ProcedureName;
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
BoardManager.CurrBoard = board;
FrmWork fw = new FrmWork();
this.Hide();
this.Close();
fw.ShowDialog();
}
}
} }
} }
...@@ -15,6 +15,10 @@ using PUSICANLibrary; ...@@ -15,6 +15,10 @@ using PUSICANLibrary;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using AOI; using AOI;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http;
using TSA_V.DeviceLibrary.manager;
using System.Linq;
using System.Configuration;
namespace TSA_V namespace TSA_V
{ {
...@@ -25,11 +29,13 @@ namespace TSA_V ...@@ -25,11 +29,13 @@ namespace TSA_V
InitializeComponent(); InitializeComponent();
} }
private bool isInitOk = false; private bool isInitOk = false;
private BoardInfo board = BoardManager.CurrBoard; private BoardInfo board = BoardManager.CurrBoard;
private PointDisplay display = new PointDisplay(); private PointDisplay display = new PointDisplay();
private List<SMTPointInfo> workSmtList = new List<SMTPointInfo>(); private List<SMTPointInfo> workSmtList = new List<SMTPointInfo>();
private void FrmWelding_Load(object sender, EventArgs e) private void FrmWelding_Load(object sender, EventArgs e)
{ {
btnCamera.Visible = TSAVBean.IsNeedAOI; btnCamera.Visible = TSAVBean.IsNeedAOI;
TSAVBean.Work.WorkType = 1; TSAVBean.Work.WorkType = 1;
LanguageProcess(); LanguageProcess();
...@@ -61,7 +67,15 @@ namespace TSA_V ...@@ -61,7 +67,15 @@ namespace TSA_V
smtPoint = new SMTPointInfo(); smtPoint = new SMTPointInfo();
timerShowForm.Stop(); timerShowForm.Stop();
if (workSmtList.Count > 0) int TagNumber = ConfigAppSettings.GetIntValue(Setting_Init.TagNumber);
if (workSmtList.Count > 0&&TagNumber!=0)
{
//int TagNumber =ConfigAppSettings.GetIntValue(Setting_Init.TagNumber);
var workSmt = workSmtList.Where(a => a.pointNum == TagNumber).FirstOrDefault();
smtPoint = workSmt;
preIndex = TagNumber-1;//索引从0开始
}
else
{ {
smtPoint = workSmtList[0]; smtPoint = workSmtList[0];
} }
...@@ -569,25 +583,74 @@ namespace TSA_V ...@@ -569,25 +583,74 @@ namespace TSA_V
lblPositionNum.Text = smtPoint.PositionNum; lblPositionNum.Text = smtPoint.PositionNum;
lblPartNum.Text = smtPoint.TagNo; lblPartNum.Text = smtPoint.TagNo;
lblPointName.Text = smtPoint.PN; lblPointName.Text = smtPoint.PN;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint); #region 2023-10-31修改
ComponetInfo com = null;
com=CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint);
if (com != null) if (com != null)
{ {
TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum); TSAVPosition position = null;
if (int.Parse(com.ComCount) <= 0)
if (position != null)
{ {
lblPositionNum.Text = position.PositionNum; lblComDes.Text = com.ComponentDes;
this.lblComName.Text = com.PN;
lblCount.Text = com.ComCount.ToString();
txtCount.Text = com.ComCount.ToString();
var smtpoint=workSmtList.Where(a=>a.PN==com.PN).ToList();
foreach (var item in smtpoint)
{
var componeinfo = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, item);
if (componeinfo != null && int.Parse(componeinfo.ComCount) > 0)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(componeinfo.PositionNum);
if (position != null)
{
com = componeinfo;
break;
}
}
}
string str = $"{smtPoint.PositionNum}位置元器件{smtPoint.PN}数量不足,请及时补充;\n当前使用{com.PositionNum}位置的元器件{com.PN},数量为{com.ComCount}";
lblComNotices.Text = str;
//lblComNotices.Text = ResourceCulture.GetString("元器件数量不足,请及时补充;当前使用位置的元器件", $"{smtPoint.PositionNum}位置元器件{smtPoint.PN}数量不足,请及时补充;当前使用{com.PositionNum}位置的元器件{com.PN},数量为{com.ComCount}");
} }
else
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
if (position != null)
{
lblPositionNum.Text = position.PositionNum;
}
lblComDes.Text = com.ComponentDes;
this.lblComName.Text = com.PN;
lblCount.Text = com.ComCount.ToString();
txtCount.Text = com.ComCount.ToString();
lblComNotices.Text = com.Notes.ToString();
}
//if (position != null)
//{
// lblPositionNum.Text = position.PositionNum;
//}
lblComDes.Text = com.ComponentDes; //lblComDes.Text = com.ComponentDes;
this.lblComName.Text = com.PN; //this.lblComName.Text = com.PN;
lblCount.Text = com.ComCount.ToString(); //lblCount.Text = com.ComCount.ToString();
txtCount.Text = com.ComCount.ToString(); //txtCount.Text = com.ComCount.ToString();
lblComNotices.Text = com.Notes.ToString(); //lblComNotices.Text = com.Notes.ToString();
if (com.ComCount <= 0) //if (int.Parse(com.ComCount) <= 0)
//{
//lblComNotices.Text = ResourceCulture.GetString("元器件数量不足,请及时补充", "元器件数量不足,请及时补充");
//}
//记录运行过程的位号
ConfigAppSettings.UpdateAppSetting(Setting_Init.ProcedureName, board.boardName);
ConfigAppSettings.UpdateAppSetting(Setting_Init.TagNumber, smtPoint.pointNum.ToString());
if (smtPoint.pointNum==1)//第一个位号不需要记录
{ {
lblComNotices.Text = ResourceCulture.GetString("元器件数量不足,请及时补充", "元器件数量不足,请及时补充"); ConfigAppSettings.UpdateAppSetting(Setting_Init.ProcedureName, "");
ConfigAppSettings.UpdateAppSetting(Setting_Init.TagNumber, "");
} }
#endregion
} }
else else
{ {
...@@ -674,6 +737,7 @@ namespace TSA_V ...@@ -674,6 +737,7 @@ namespace TSA_V
return; return;
} }
preIndex = TSAVBean.Work.currIndex; preIndex = TSAVBean.Work.currIndex;
smtPoint = TSAVBean.Work.currPoint; smtPoint = TSAVBean.Work.currPoint;
ShowMsg(); ShowMsg();
...@@ -813,6 +877,19 @@ namespace TSA_V ...@@ -813,6 +877,19 @@ namespace TSA_V
} }
else else
{ {
#region 2023-09-22 添加 控制便签功能
//string count = null;
//string pnname = null;
//string ComponentDes = null;
//if (com != null)
//{
// count = com.ComCount.ToString();
// pnname = com.PN.ToString();
// ComponentDes = com.ComponentDes;
//}
////调用指示灯显示
//ScanRequestLabel.RequestPost(position, count, pnname, ComponentDes);
#endregion
lblPositionNum.Text = position.PositionNum; lblPositionNum.Text = position.PositionNum;
} }
int leftCount = workSmtList.Count - 1 - preIndex; int leftCount = workSmtList.Count - 1 - preIndex;
...@@ -824,7 +901,7 @@ namespace TSA_V ...@@ -824,7 +901,7 @@ namespace TSA_V
else if (leftCount <= 0) else if (leftCount <= 0)
{ {
lblStart.Visible = false; lblStart.Visible = false;
lblLast.Visible = true; lblLast.Visible = true;
} }
else else
{ {
...@@ -837,9 +914,9 @@ namespace TSA_V ...@@ -837,9 +914,9 @@ namespace TSA_V
lblBoardPoint.Text = ResourceCulture.GetString(ResourceCulture.PointInfoMsg, "当前:第{0}步,剩余{1}步", (preIndex + 1).ToString(), leftCount); lblBoardPoint.Text = ResourceCulture.GetString(ResourceCulture.PointInfoMsg, "当前:第{0}步,剩余{1}步", (preIndex + 1).ToString(), leftCount);
} }
else else
{ {
lblBoardPoint.Text = ResourceCulture.GetString(ResourceCulture.PointInfoMsg2, "当前:第{0}步", (preIndex + 1).ToString()); lblBoardPoint.Text = ResourceCulture.GetString(ResourceCulture.PointInfoMsg2, "当前:第{0}步", (preIndex + 1).ToString());
} }
Crop(Brushes.Red); Crop(Brushes.Red);
if (timerShowForm.Enabled.Equals(false)) if (timerShowForm.Enabled.Equals(false))
{ {
...@@ -861,7 +938,6 @@ namespace TSA_V ...@@ -861,7 +938,6 @@ namespace TSA_V
} }
} }
private void btnUpateCount_Click(object sender, EventArgs e) private void btnUpateCount_Click(object sender, EventArgs e)
{ {
ShowUpdateCount(true); ShowUpdateCount(true);
...@@ -1008,6 +1084,6 @@ namespace TSA_V ...@@ -1008,6 +1084,6 @@ namespace TSA_V
{ {
FrmIoManager frmWorkIo = new FrmIoManager(true); FrmIoManager frmWorkIo = new FrmIoManager(true);
frmWorkIo.ShowDialog(); frmWorkIo.ShowDialog();
} }
} }
} }
...@@ -117,7 +117,6 @@ ...@@ -117,7 +117,6 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!