Commit 57f23ad0 LN

1

1 个父辈 f1b1963e
......@@ -476,7 +476,7 @@ namespace TSA_V.LoadCSVLibrary
/// 减去此电路板使用的元器件数量
/// </summary>
/// <param name="currBoard"></param>
public static bool DelUseCount(DeviceLibrary.BoardInfo currBoard,int maxIndex)
public static bool DelUseCount(DeviceLibrary.BoardInfo currBoard, List<ComponetInfo> useComponets)
{
try
{
......@@ -486,46 +486,47 @@ namespace TSA_V.LoadCSVLibrary
{
return false;
}
Dictionary<string, int> useCount = new Dictionary<string, int>();
int index = 0;
List<SMTPointInfo> list = currBoard.GetSmtList();
foreach (SMTPointInfo smt in list)
{
if (index > maxIndex)
{
break;
}
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smt);
if (useCount.ContainsKey(com.PN))
{
useCount[com.PN]++;
}
else
{
useCount.Add(com.PN, 1);
}
index++;
}
//Dictionary<string, int> useCount = new Dictionary<string, int>();
//int index = 0;
//List<SMTPointInfo> list = currBoard.GetSmtList();
//foreach (SMTPointInfo smt in list)
//{
// if (index > maxIndex)
// {
// break;
// }
// ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smt);
// if (useCount.ContainsKey(com.PN))
// {
// useCount[com.PN]++;
// }
// else
// {
// useCount.Add(com.PN, 1);
// }
// index++;
//}
List<ComponetInfo> newList = new List<ComponetInfo>();
foreach (ComponetInfo obj in comList)
{
if (useCount.ContainsKey(obj.PN))
List<ComponetInfo> list = (from m in useComponets where m.Id.Equals(obj.Id) select m).ToList();
if (list.Count > 0)
{
obj.ComCount = obj.ComCount - useCount[obj.PN];
obj.ComCount = obj.ComCount - list.Count;
if (obj.ComCount < 0)
{
obj.ComCount = 0;
}
}
newList.Add(obj);
}
if (allComMap.ContainsKey(bomName))
{
allComMap[bomName] = newList;
}
CSVBomManager.SaveBomToFile(bomName, newList);
}catch(Exception ex)
}
catch (Exception ex)
{
}
......
......@@ -34,27 +34,21 @@ namespace TSA_V.DeviceLibrary
public DateTime endWorkTime = DateTime.Now;
public DateTime LastSetpTime = DateTime.Now;
public uint PreNodeId = 0;
//public List<SMTPointInfo> needSoldSmtList = new List<SMTPointInfo>();
//public List<SMTPointInfo> needCheckSmtList = new List<SMTPointInfo>();
public List<SMTPointInfo> needWorkSmtList = new List<SMTPointInfo>();
//开始工作后共工作了几块电路板
public int BoardCount = 0;
public DateTime beginWorkTime = DateTime.Now;
public bool IsShowAOI = false;
//public bool IsShowSoldering = false;
private List<ComponetInfo> useComponets = new List<ComponetInfo>();
public void StartWork(BoardInfo boardInfo)
{
//StatusClient.instance.SendNew(Color.Green, "扫码成功:" + BoardManager.CurrBoard.boardCode);
beginWorkTime = DateTime.Now;
//开始工作
LogUtil.info("开始程序【" + boardInfo.boardName + "】的插件");
// StatusClient.instance.SendNew(Color.Green, "开始组装【" + boardInfo.boardName + "】" );
currBoard = boardInfo;
//needSoldSmtList = (from m in currBoard.smtList where m.NeedSoldering.Equals(true) select m).ToList<SMTPointInfo>();
//needCheckSmtList = (from m in currBoard.smtList where m.NeedCheck.Equals(true) select m).ToList<SMTPointInfo>();
needWorkSmtList = currBoard.GetSmtList();
currIndex = -1;
//IsShowSoldering = false;
IsShowAOI = false;
currPoint = null;
IsWorking = true;
......@@ -93,7 +87,8 @@ namespace TSA_V.DeviceLibrary
if (currIndex > 0 && currBoard != null)
{
//如果是下一个并且当前是最后一个,其实是切换了新程序,需要减去刚刚的数量
CSVBomManager.DelUseCount(currBoard, currIndex);
CSVBomManager.DelUseCount(currBoard, useComponets);
useComponets = new List<ComponetInfo>();
}
DeviceStatus deviceStatus = MesUtil.GetCurrStatus();
if (MesUtil.CodeISOk)
......@@ -210,6 +205,7 @@ namespace TSA_V.DeviceLibrary
if (com != null)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
useComponets.Add(com);
}
else
{
......@@ -234,7 +230,8 @@ namespace TSA_V.DeviceLibrary
if (isNext && (currIndex == 0))
{
BoardCount++;
CSVBomManager.DelUseCount(currBoard, GetSmtList().Count);
CSVBomManager.DelUseCount(currBoard, useComponets);
useComponets = new List<ComponetInfo>();
}
}
//焊接工作
......
......@@ -73,7 +73,7 @@
<!--AOI程序文件夹-->
<add key="AOIFileConfig" value="\config\AOIConfig\" />
<!--是否启动AOI-->
<add key="IsNeedAOI" value="0" />
<add key="IsNeedAOI" value="1" />
<add key="DefaultPointSize" value="5" />
<add key="DefaultPointType" value="1" />
<add key="Config_Pwd" value="123456" />
......
......@@ -51,7 +51,7 @@ namespace TSA_V
}
if (!(BoardManager.getBoardByName(board.boardName) == null))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PNameExist, "程序名【" + board.boardName + "】已存在,请重新输入!"));
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PNameExist, "程序名【{0}】已存在,请重新输入!", board.boardName));
txtBoardName.Focus();
return false ;
}
......
......@@ -149,7 +149,7 @@ namespace TSA_V
}
else
{
con.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
con.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
}
}
// con.Refresh();
......@@ -184,7 +184,7 @@ namespace TSA_V
}
else
{
con.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
con.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
}
}
// con.Refresh();
......
......@@ -303,6 +303,7 @@ namespace TSA_V
point.Notes = row.Cells[this.Column_Notes.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.Id = Convert.ToInt32(row.Cells[this.Column_ID.Name].Value.ToString());
}
catch (Exception ex)
......@@ -366,7 +367,7 @@ namespace TSA_V
this.cmbPositionNumList.SelectedIndex = selPosIndex;
}
groupInfo.Text = ResourceCulture.GetString( ResourceCulture.ComInfo, "元器件【{ 0}】的基本信息",obj.TagNo+" -"+obj.PN);
groupInfo.Text = ResourceCulture.GetString( ResourceCulture.ComInfo, "元器件【{ 0}】的基本信息",obj.TagNo+" "+obj.PN);
}
private void DeleteCom(int rowIndex)
{
......@@ -383,7 +384,7 @@ namespace TSA_V
if (MessageBox.Show(
ResourceCulture.GetString(ResourceCulture.SureDelCom, "确认要删除元器件【{0}】吗?", obj.TagNo + "-" + obj.PN),
ResourceCulture.GetString(ResourceCulture.SureDelCom, "确认要删除元器件【{0}】吗?", obj.TagNo + " " + obj.PN),
ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示"),
MessageBoxButtons.OKCancel,
......@@ -401,7 +402,7 @@ namespace TSA_V
}
//this.dgvList.Rows.RemoveAt(rowIndex);
UpdateGridList(newlist);
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DelComOk, "元器件【{0}】删除成功!", obj.TagNo + "-" + obj.PN)
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DelComOk, "元器件【{0}】删除成功!", obj.TagNo + " " + obj.PN)
, ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示"));
}
}
......
......@@ -34,6 +34,7 @@
this.btnPre = new System.Windows.Forms.Button();
this.btnSaveAndNext = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cmbPnList = new System.Windows.Forms.ComboBox();
this.lblNotes = new System.Windows.Forms.Label();
this.chbCheck = new System.Windows.Forms.CheckBox();
this.txtWeldTemp = new System.Windows.Forms.TextBox();
......@@ -53,7 +54,6 @@
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.xyMoveControl1 = new UserFromControl.ProjectorControl();
this.cmbPnList = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
......@@ -66,7 +66,7 @@
//
this.btnPre.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnPre.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPre.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnPre.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnPre.Location = new System.Drawing.Point(46, 563);
this.btnPre.Name = "btnPre";
this.btnPre.Size = new System.Drawing.Size(120, 45);
......@@ -79,7 +79,7 @@
//
this.btnSaveAndNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSaveAndNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSaveAndNext.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveAndNext.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveAndNext.Location = new System.Drawing.Point(300, 563);
this.btnSaveAndNext.Name = "btnSaveAndNext";
this.btnSaveAndNext.Size = new System.Drawing.Size(120, 45);
......@@ -115,6 +115,16 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "组装信息";
//
// cmbPnList
//
this.cmbPnList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbPnList.FormattingEnabled = true;
this.cmbPnList.Location = new System.Drawing.Point(135, 62);
this.cmbPnList.Name = "cmbPnList";
this.cmbPnList.Size = new System.Drawing.Size(219, 25);
this.cmbPnList.TabIndex = 86;
this.cmbPnList.SelectedIndexChanged += new System.EventHandler(this.cmbPnList_SelectedIndexChanged);
//
// lblNotes
//
this.lblNotes.Location = new System.Drawing.Point(6, 179);
......@@ -275,7 +285,7 @@
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(427, 563);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(120, 45);
......@@ -288,7 +298,7 @@
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(173, 563);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(120, 45);
......@@ -314,16 +324,6 @@
this.xyMoveControl1.XValue = 1D;
this.xyMoveControl1.YValue = 1D;
//
// cmbPnList
//
this.cmbPnList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbPnList.FormattingEnabled = true;
this.cmbPnList.Location = new System.Drawing.Point(135, 62);
this.cmbPnList.Name = "cmbPnList";
this.cmbPnList.Size = new System.Drawing.Size(219, 25);
this.cmbPnList.TabIndex = 86;
this.cmbPnList.SelectedIndexChanged += new System.EventHandler(this.cmbPnList_SelectedIndexChanged);
//
// FrmPointInfo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!