Commit 842be756 贾鹏旭

1.多料盘位置放一种同一种物料

2.程序运行中当前物料为0时,获取元器件库其他位置相同物料
3.新建程序上传excel,重新解析规则
1 个父辈 0b9c6bfc
...@@ -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");
}
} }
} }
...@@ -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);
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)
{
ComponetInfo componet = new ComponetInfo();
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)) if (!string.IsNullOrEmpty(com.PositionNum))
{ {
usedposlist.Add(com.PositionNum); usedposlist.Add(com.PositionNum);
pnposlist[com.PN] = 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(';');
string[] strarr=new string[strings.Length];
int i = 0;
foreach (var item in strings)
{
TSAVPosition p = CSVPositionReader<TSAVPosition>.GetPositonByNum(item);
if (p != null) if (p != null)
{ {
return p.PositionNum; // 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);
......
...@@ -42,7 +42,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -42,7 +42,7 @@ namespace TSA_V.LoadCSVLibrary
///数量 ///数量
/// </summary> /// </summary>
[CSVAttribute("Count", true,"数量", "Quantity")] [CSVAttribute("Count", true,"数量", "Quantity")]
public int ComCount { get; set; } public string ComCount { 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.Linq;
using System.Threading; using System.Threading;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary.manager; using TSA_V.DeviceLibrary.manager;
...@@ -200,7 +201,41 @@ namespace TSA_V.DeviceLibrary ...@@ -200,7 +201,41 @@ namespace TSA_V.DeviceLibrary
TSAVPosition position = null; TSAVPosition position = null;
if (com != null) if (com != null)
{ {
#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); 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
......
...@@ -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">
......
 
using AccAOI;
using log4net; using log4net;
using MetroFramework.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using TSA_V.Common;
using System.Drawing.Drawing2D; using TSA_V.DeviceLibrary;
using PUSICANLibrary;
using TSA_V;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
using AccAOI;
using System.Runtime.ExceptionServices;
namespace TSA_V namespace TSA_V
{ {
...@@ -188,11 +178,8 @@ namespace TSA_V ...@@ -188,11 +178,8 @@ namespace TSA_V
txtLineWidth.Visible = false; txtLineWidth.Visible = false;
lbllinews.Visible = false; lbllinews.Visible = false;
} }
int count = dgvList.Columns.Count; int count = dgvList.Columns.Count;
for(int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
if (i.Equals(Column_disable.Index)) if (i.Equals(Column_disable.Index))
{ {
...@@ -200,7 +187,7 @@ namespace TSA_V ...@@ -200,7 +187,7 @@ namespace TSA_V
} }
else else
{ {
dgvList.Columns[i].ReadOnly = true ; dgvList.Columns[i].ReadOnly = true;
} }
dgvList.Columns[i].Selected = false; dgvList.Columns[i].Selected = false;
} }
...@@ -440,7 +427,7 @@ namespace TSA_V ...@@ -440,7 +427,7 @@ namespace TSA_V
try try
{ {
isFinishLoad = false; isFinishLoad = false;
if ( rowIndex >= dgvList.Rows.Count - 1) if (rowIndex >= dgvList.Rows.Count - 1)
{ {
return; return;
} }
...@@ -512,7 +499,7 @@ namespace TSA_V ...@@ -512,7 +499,7 @@ namespace TSA_V
else else
{ {
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
FrmProjectorScreen.instance.ShowPoint(new ProjectorPInfo((int)x, (int)y,type,sizeX,sizeY,penWidth,showText)); FrmProjectorScreen.instance.ShowPoint(new ProjectorPInfo((int)x, (int)y, type, sizeX, sizeY, penWidth, showText));
} }
} }
...@@ -522,7 +509,7 @@ namespace TSA_V ...@@ -522,7 +509,7 @@ namespace TSA_V
int y_colIndex = dgvList.Columns[Column_NodeY.Name].Index; int y_colIndex = dgvList.Columns[Column_NodeY.Name].Index;
dgvList.Rows[rowIndex].Cells[this.Column_NodeX.Name].Value = FrmProjectorScreen.instance.LastX; dgvList.Rows[rowIndex].Cells[this.Column_NodeX.Name].Value = FrmProjectorScreen.instance.LastX;
dgvList.Rows[rowIndex].Cells[this.Column_NodeY.Name].Value =FrmProjectorScreen.instance.LastY; dgvList.Rows[rowIndex].Cells[this.Column_NodeY.Name].Value = FrmProjectorScreen.instance.LastY;
dgvList.UpdateCellValue(x_colIndex, rowIndex); dgvList.UpdateCellValue(x_colIndex, rowIndex);
dgvList.UpdateCellValue(y_colIndex, rowIndex); dgvList.UpdateCellValue(y_colIndex, rowIndex);
...@@ -855,9 +842,10 @@ namespace TSA_V ...@@ -855,9 +842,10 @@ namespace TSA_V
} }
dgvList.Rows[currIndex].Selected = true; dgvList.Rows[currIndex].Selected = true;
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
LogUtil.error("NextProcess出错:"+ex.ToString()); LogUtil.error("NextProcess出错:" + ex.ToString());
} }
} }
private void showDetail(int rowIndex) private void showDetail(int rowIndex)
...@@ -872,7 +860,7 @@ namespace TSA_V ...@@ -872,7 +860,7 @@ namespace TSA_V
} }
List<SMTPointInfo> allPoint = allPointInfo(); List<SMTPointInfo> allPoint = allPointInfo();
FrmPointInfo fwpi = new FrmPointInfo( updateBoardInfo, allPoint, rowIndex,NextProcess); FrmPointInfo fwpi = new FrmPointInfo(updateBoardInfo, allPoint, rowIndex, NextProcess);
fwpi.AoiProgramName = cmbAOIFile.Text; fwpi.AoiProgramName = cmbAOIFile.Text;
fwpi.PicImage = picBoard.Image; fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog(); DialogResult result = fwpi.ShowDialog();
...@@ -907,7 +895,7 @@ namespace TSA_V ...@@ -907,7 +895,7 @@ namespace TSA_V
SMTPointInfo smtInfo = new SMTPointInfo(); SMTPointInfo smtInfo = new SMTPointInfo();
string name = "P" + (dgvList.Rows.Count + 1); string name = "P" + (dgvList.Rows.Count + 1);
FrmPointInfo fwpi = new FrmPointInfo( updateBoardInfo, name, x, y, nodeX, nodeY); FrmPointInfo fwpi = new FrmPointInfo(updateBoardInfo, name, x, y, nodeX, nodeY);
fwpi.AoiProgramName = cmbAOIFile.Text; fwpi.AoiProgramName = cmbAOIFile.Text;
fwpi.PicImage = picBoard.Image; fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog(); DialogResult result = fwpi.ShowDialog();
...@@ -1051,7 +1039,7 @@ namespace TSA_V ...@@ -1051,7 +1039,7 @@ namespace TSA_V
{ {
if (e.Button == MouseButtons.Right) if (e.Button == MouseButtons.Right)
{ {
if (e.RowIndex >= 0 && e.ColumnIndex>=0) if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
{ {
this.dgvList.ClearSelection(); this.dgvList.ClearSelection();
dgvList.Rows[e.RowIndex].Selected = true; dgvList.Rows[e.RowIndex].Selected = true;
...@@ -1395,7 +1383,7 @@ namespace TSA_V ...@@ -1395,7 +1383,7 @@ namespace TSA_V
frm.ShowDialog(); frm.ShowDialog();
AOIManager.LoadAOIFile(cmbAOIFile,cmbAOIFile.Text); AOIManager.LoadAOIFile(cmbAOIFile, cmbAOIFile.Text);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -1501,9 +1489,8 @@ namespace TSA_V ...@@ -1501,9 +1489,8 @@ namespace TSA_V
int cout = dgvList.Rows.Count; int cout = dgvList.Rows.Count;
for (int i = 0; i < cout; i++) for (int i = 0; i < cout; i++)
{ {
dgvList.Rows[i].Cells[this.Column_disable.Name].Value = true ; dgvList.Rows[i].Cells[this.Column_disable.Name].Value = true;
} }
} }
} }
} }
...@@ -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;
......
...@@ -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,6 +98,7 @@ ...@@ -98,6 +98,7 @@
<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>
......
...@@ -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();
}
}
} }
} }
...@@ -17,6 +17,8 @@ using AOI; ...@@ -17,6 +17,8 @@ using AOI;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using TSA_V.DeviceLibrary.manager; using TSA_V.DeviceLibrary.manager;
using System.Linq;
using System.Configuration;
namespace TSA_V namespace TSA_V
{ {
...@@ -27,11 +29,13 @@ namespace TSA_V ...@@ -27,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();
...@@ -63,7 +67,15 @@ namespace TSA_V ...@@ -63,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];
} }
...@@ -571,11 +583,39 @@ namespace TSA_V ...@@ -571,11 +583,39 @@ 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)
{
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) if (position != null)
{ {
lblPositionNum.Text = position.PositionNum; lblPositionNum.Text = position.PositionNum;
...@@ -586,10 +626,31 @@ namespace TSA_V ...@@ -586,10 +626,31 @@ namespace TSA_V
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 (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 (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
{ {
...@@ -676,6 +737,7 @@ namespace TSA_V ...@@ -676,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();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!