Commit f1b1963e LN

把元器件库导入和备料移到程序操作

1 个父辈 fe5fd0e4
......@@ -86,7 +86,7 @@
<Compile Include="csvLoad\position\CSVPositionReader.cs" />
<Compile Include="csvLoad\position\PostionBase.cs" />
<Compile Include="csvLoad\position\TSAVPosition.cs" />
<Compile Include="csvLoad\CSVReaderManager.cs" />
<Compile Include="csvLoad\CSVBomManager.cs" />
<Compile Include="db.cs" />
<Compile Include="deviceLibrary\halcon\UsbCameraHDevelop.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" />
......@@ -120,20 +120,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="config\boardData.txt" />
<None Include="config\componentData.txt" />
<None Include="config\database.db3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\user.sqlite3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="config\boardData.txt" />
<Content Include="config\componentData.txt" />
<Content Include="config\database.db3" />
<Content Include="config\user.sqlite3" />
<Content Include="config\image\defaultBoard.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="config\元器件信息模板.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="config\元器件信息模板.csv" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
......@@ -146,12 +140,8 @@
<None Include="config\componet\元器件库A.csv" />
<None Include="config\componet\元器件库A_A.csv" />
<None Include="config\componet\红外导入测试.csv" />
<None Include="config\Positions.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\元器件信息模板-英文.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="config\Positions.csv" />
<Content Include="config\元器件信息模板-英文.csv" />
</ItemGroup>
<ItemGroup>
<Content Include="config\image\43.jpg">
......
......@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
namespace TSA_V.DeviceLibrary
{
......@@ -25,6 +26,7 @@ namespace TSA_V.DeviceLibrary
}
set { }
}
/// <summary>
/// 电路板ID
/// </summary>
......@@ -92,13 +94,29 @@ namespace TSA_V.DeviceLibrary
public string AOIProName = "";
public Image myImage = null;
public string GetImgPath(bool isCheck = false)
{
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string imagePath = Application.StartupPath + "/" + path + "/" + imgName;
if (isCheck)
{
if (imgName != null && File.Exists(imagePath))
{
return imagePath;
}
else
{
imagePath = Application.StartupPath + @"\" + path + ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
}
}
return imagePath;
}
public Image GetImage()
{
if (myImage == null)
{
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string imagePath = Application.StartupPath + "/" + path + "/" + imgName;
string defaultImg = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
string imagePath = GetImgPath();
if (imgName != null && File.Exists(imagePath))
{
System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath);
......@@ -130,22 +148,29 @@ namespace TSA_V.DeviceLibrary
//return "电路板名称:" + boardName + ",长度:" + boardLength + ",宽度:" + boardWidth + ",组装信息数量:" + pointList.Count;
}
//public List<SMTPointInfo> GetSolderingSMTList()
//{
// List<SMTPointInfo> newList = (from m in smtList where m.NeedSoldering.Equals(true) select m).ToList<SMTPointInfo>();
// return newList;
//}
//public List<SMTPointInfo> GetCheckSMTList()
//{
// List<SMTPointInfo> newList = (from m in smtList where m.NeedCheck.Equals(true) select m).ToList<SMTPointInfo>();
// return newList;
//}
public string GetAoiFileName()
{
string path = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig)+AOIProName;
return path;
}
public int GetNextPNum()
{
int maxNum = 0;
foreach(SMTPointInfo p in smtList)
{
if (p.pointNum > maxNum)
{
maxNum = p.pointNum;
}
}
maxNum++;
return maxNum;
}
/// <summary>
/// 导出导入程序时使用
/// </summary>
public byte[] imageByte { get; set; }
}
/// <summary>
......@@ -157,7 +182,7 @@ namespace TSA_V.DeviceLibrary
{
PositionNum = "";
pointNum = 0;
pointName = "";
PN = "";
PositionX = 0;
PositionY = 0;
}
......@@ -165,9 +190,9 @@ namespace TSA_V.DeviceLibrary
int pointType=1,int pointSizex=1,int pointSizeY=1,int penWidth =2,
bool needs = false, bool needc = false, int sTemp = 0, double sTime = 0)
{
this.PartNum = partNum;
this.TagNo = partNum;
this.pointNum = num;
this.pointName = name;
this.PN = name;
this.PositionX = positionX;
this.PositionY = positionY;
this.PositionNum = PositionNum;
......@@ -186,22 +211,32 @@ namespace TSA_V.DeviceLibrary
///组装信息编号
/// </summary>
public int pointNum { get; set; }
/// <summary>
/// 编号,与元器件库中的编号一致,不可以修改,作为关联关系
/// 位号 原来的PartNum
/// </summary>
public string PartNum { get; set; }
public string TagNo { get; set; }
/// <summary>
/// 物料编码 原来的pointName
/// </summary>
public string PN { get; set; }
/// <summary>
/// 料格的位置信息
///已过时。 位号/编号,与元器件库中的编号一致,不可以修改,作为关联关系
/// </summary>
public string PositionNum { get; set; }
public string PartNum { get; set; }
/// <summary>
///组装信息名字
///已过时。物料编码/组装信息名字
/// </summary>
public string pointName { get; set; }
/// <summary>
/// 料格的位置信息
/// </summary>
public string PositionNum { get; set; }
/// <summary>
/// 图片上显示的x坐标
/// </summary>
public double PositionX { get; set; }
......@@ -240,6 +275,7 @@ namespace TSA_V.DeviceLibrary
/// 是否需要焊接
/// </summary>
public bool NeedSoldering { get; set; } = false;
/// <summary>
/// 焊接温度
/// </summary>
......@@ -261,15 +297,15 @@ namespace TSA_V.DeviceLibrary
public string ToCSVStr()
{
string spilt = ",";
return pointName + spilt + "1" + spilt + "2" + spilt + PositionX + spilt + PositionY + spilt + "CRD" + spilt + NodePositionX + spilt + NodePositionY;
return PN + spilt + "1" + spilt + "2" + spilt + PositionX + spilt + PositionY + spilt + "CRD" + spilt + NodePositionX + spilt + NodePositionY;
}
public string GetDisplayStr()
{
string text = pointName;
string text = PN;
if (BoardManager.PointDisplayType.Equals(1))
{
text = PartNum;
text = TagNo;
}
return text;
}
......@@ -291,5 +327,12 @@ namespace TSA_V.DeviceLibrary
/// 是否禁用,默认0
/// </summary>
public bool Disable = false;
/// <summary>
/// 导出导入程序时使用
/// </summary>
public ComponetInfo componet;
}
}
......@@ -81,12 +81,12 @@ namespace TSA_V.DeviceLibrary
BoardInfo theBorad = BoardManager.getBoardByName(log.BoardName);
if (theBorad != null)
{
list = (from m in theBorad.smtList where m.pointName.Equals(log.BoardPoint) select m).ToList<SMTPointInfo>();
list = (from m in theBorad.smtList where m.PN.Equals(log.BoardPoint) select m).ToList<SMTPointInfo>();
}
}
else
{
list = (from m in board.smtList where m.pointName.Equals(log.BoardPoint) select m).ToList<SMTPointInfo>();
list = (from m in board.smtList where m.PN.Equals(log.BoardPoint) select m).ToList<SMTPointInfo>();
}
if (list != null && list.Count > 0)
{
......
......@@ -22,15 +22,10 @@ namespace TSA_V.LoadCSVLibrary
FieldName = fieldName;
this.FiledNames = filedNames;
}
public CSVAttribute(string fieldName,bool IsMust)
{
this.IsMustHave = IsMust;
FieldName = fieldName;
}
public CSVAttribute(string fieldName)
{
FieldName = fieldName;
}
//public CSVAttribute(string fieldName)
//{
// FieldName = fieldName;
//}
public string[] FiledNames { get; set; }
public string FieldName { get; set; }
......
......@@ -258,7 +258,7 @@ namespace TSA_V.LoadCSVLibrary
}
foreach (T p in allPositionMap.Values)
{
if (p.PositionNum.ToString().Equals(positionNum))
if (p.PositionNo.ToString().Equals(positionNum))
{
return p;
}
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary;
namespace TSA_V.LoadCSVLibrary
......@@ -16,17 +17,20 @@ namespace TSA_V.LoadCSVLibrary
Notes = "";
ComponentDes = "";
}
public int Id { get; set; }
/// <summary>
///编号
///位号/编号
/// </summary>
[CSVAttribute("Num", true,"位号", "编号")]
public string PartNum { get; set; }
public string TagNo { get; set; }
/// <summary>
/// 元器件名称
/// 物料编码/元器件名称
/// </summary>
[CSVAttribute("Code", true, "物料编码", "元器件名称", "Name")]
public string ComponentName { get; set; }
public string PN { get; set; }
/// <summary>
///元器件描述
/// </summary>
......@@ -64,7 +68,7 @@ namespace TSA_V.LoadCSVLibrary
public string Notes { get; set; }
public int GetPosition()
public int GetSortPosition()
{
try
{
......@@ -75,5 +79,43 @@ namespace TSA_V.LoadCSVLibrary
}
return 0;
}
public bool IsSameCom(ComponetInfo com)
{
if (String.IsNullOrEmpty(this.TagNo))
{
if (this.Id <= 0)
{
if (this.PN.Equals(com.PN) && this.PositionNum.Equals(com.PositionNum))
{
return true;
}
}
else if (this.Id.Equals(com.Id))
{
return true;
}
}
else if (this.TagNo.Equals(com.TagNo))
{
return true;
}
return false;
}
public bool IsSameCom(SMTPointInfo point)
{
if (String.IsNullOrEmpty(this.TagNo))
{
if (this.PN.Equals(point.PN) )
{
return true;
}
}
else if (this.TagNo.Equals(point.TagNo))
{
return true;
}
return false;
}
}
}
......@@ -23,10 +23,10 @@ namespace TSA_V.LoadCSVLibrary
/// </summary>
[CSVAttribute("位置编号")]
public string PositionNum{ get; set; }
///// <summary>
/////元器件
///// </summary>
//[CSVAttribute("元器件")]
//public int ComponentId { get; set; }
/// <summary>
///对应号码
/// </summary>
[CSVAttribute("对应号码")]
public int PositionNo { get; set; }
}
}
......@@ -5,11 +5,7 @@ using TSA_V.DeviceLibrary;
namespace TSA_V.LoadCSVLibrary
{
public class TSAVPosition : PostionBase
{ /// <summary>
///对应号码
/// </summary>
[CSVAttribute("对应号码")]
public int PositionNo { get; set; }
{
/// <summary>
///旋转位置
/// </summary>
......
......@@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
using System.Drawing.Imaging;
namespace TSA_V.DeviceLibrary
{
......@@ -53,6 +54,8 @@ namespace TSA_V.DeviceLibrary
boardList = new List<BoardInfo>();
List<int> idList = new List<int>();
List<string> nameList = new List<string>();
bool needSave = false;
foreach (string str in lines)
{
try
......@@ -68,19 +71,27 @@ namespace TSA_V.DeviceLibrary
{
if (board.smtList == null)
{
needSave = true;
board.smtList = new List<SMTPointInfo>();
}
foreach (SMTPointInfo sm in board.smtList)
{
if (sm.PartNum == null)
if (String.IsNullOrEmpty(sm.TagNo) && (!String.IsNullOrEmpty(sm.PartNum)))
{
needSave = true;
sm.TagNo = sm.PartNum; ;
}
if (String.IsNullOrEmpty(sm.PN) && (!String.IsNullOrEmpty(sm.pointName)))
{
sm.PartNum = "";
needSave = true;
sm.PN = sm.pointName; ;
}
}
if (board.boardId > MaxId)
{
needSave = true;
MaxId = board.boardId;
}
if (idList.Contains(board.boardId))
......@@ -93,6 +104,7 @@ namespace TSA_V.DeviceLibrary
}
if (board.AOIProName.Equals(""))
{
needSave = true;
board.AOIProName = board.boardName + ".data";
}
idList.Add(board.boardId);
......@@ -100,10 +112,12 @@ namespace TSA_V.DeviceLibrary
if (board.orgType == 0)
{
needSave = true;
board.orgType = 1;
}
if (board.LineWidth <= 0)
{
needSave = true;
board.LineWidth = board.boardWidth;
}
boardList.Add(board);
......@@ -127,6 +141,12 @@ namespace TSA_V.DeviceLibrary
{
LogUtil.error("未找到默认图片:" + imagePath);
}
if (needSave)
{
SaveListToFile(boardList);
LogUtil.info("保存程序集合到文件");
}
}
public static void Update(BoardInfo board)
{
......@@ -151,6 +171,81 @@ namespace TSA_V.DeviceLibrary
SaveListToFile(boardList);
}
/// <summary>
/// 导入程序
/// </summary>
/// <param name="board"></param>
public static void ImportBoard(BoardInfo board)
{
bool hasImg = false;
if (board.imageByte != null)
{
Image image = BoardManager.ByteToImg(board.imageByte);
if (image != null)
{
hasImg = true;
string configPath = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string newName = board.boardName + ".png";
string newPath = Application.StartupPath + @"\" + configPath + @"\" + newName;
image.Save(newPath, ImageFormat.Png);
board.imgName = newName;
}
}
if (!hasImg)
{
string oldName = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
string newName = board.boardName + Path.GetExtension(oldName);
string configPath = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string oldPath = Application.StartupPath + @"\" + configPath + @"\" + oldName;
string newPath = Application.StartupPath + @"\" + configPath + @"\" + newName;
if (File.Exists(oldPath))
{
File.Copy(oldPath, newPath, true);
}
board.imgName = newName;
}
LogUtil.info("导入程序:程序名【"+board.boardName+"】,图片名【"+board.imgName+"】");
//判断bom是否存在
if (!CSVBomManager.BomNameIsExists(board.bomName))
{
List<ComponetInfo> componetInfos = new List<ComponetInfo>();
int i = 0;
foreach (SMTPointInfo p in board.smtList)
{
ComponetInfo c = new ComponetInfo();
if (p.componet != null)
{
c = p.componet;
}
else
{
c.Id = i + 1;
c.PN = p.PN;
c.PositionNum = CSVPositionReader<TSAVPosition>.getPositionKeyList()[0];
c.PositionX = p.PositionX;
c.PositionY = p.PositionY;
c.TagNo = p.TagNo;
c.Notes = "";
c.ComponentDes = "";
}
i++;
componetInfos.Add(c);
}
board.bomName = CSVBomManager.AutoAddBomList(board.bomName, componetInfos);
LogUtil.info("导入程序:程序名【" + board.boardName + "】,自动创建bom【"+board.bomName+"】");
}
board.boardId = BoardManager.GetNextId();
BoardManager.Add(board);
}
private static bool SaveListToFile(List<BoardInfo> list)
{
string[] lines = new string[boardList.Count];
......@@ -354,23 +449,90 @@ namespace TSA_V.DeviceLibrary
/// </summary>
/// <param name="bomName"></param>
/// <param name="obj"></param>
internal static void AddCom(string bomName, ComponetInfo obj)
//internal static void AddCom(string bomName, ComponetInfo obj)
//{
// List<BoardInfo> list = (from m in boardList where m.bomName.Equals(bomName) select m).ToList();
// foreach (BoardInfo board in list)
// {
// if (board.bomName.Equals(bomName))
// {
// int count = board.smtList.Count + 1;
// SMTPointInfo pointInfo = new SMTPointInfo(count, obj.TagNo, obj.PN, 5, 5, obj.PositionNum,1,5,5,2);
// pointInfo.Disable = true;
// board.smtList.Add(pointInfo);
// Update(board);
// LogUtil.info($"程序[{board.boardName}]使用元器件库[{bomName}],自动新增元器件[{obj.TagNo}-{obj.PN}],默认禁用");
// }
// }
//}
public static TSAVPosition getPointPosition(BoardInfo board, SMTPointInfo smtPoint)
{
ComponetInfo com = CSVBomManager.GetCom(board.bomName, smtPoint);
TSAVPosition position = null;
if (com != null)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
}
else
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(smtPoint.PositionNum);
}
return position;
}
/// <summary>
/// 图片路径转二进制
/// </summary>
/// <param name="strpath"></param>
/// <returns></returns>
public static byte[] ImgToByte(string strpath)
{
List<BoardInfo> list = (from m in boardList where m.bomName.Equals(bomName) select m).ToList();
foreach (BoardInfo board in list)
try
{
if (board.bomName.Equals(bomName))
// 以二进制方式读文件
FileStream fsMyfile = new FileStream(strpath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
// 创建一个二进制数据流读入器,和打开的文件关联
BinaryReader brMyfile = new BinaryReader(fsMyfile);
// 把文件指针重新定位到文件的开始
brMyfile.BaseStream.Seek(0, SeekOrigin.Begin);
byte[] bytes = brMyfile.ReadBytes(Convert.ToInt32(fsMyfile.Length.ToString()));
// 关闭以上new的各个对象
brMyfile.Close();
return bytes;
}
catch (Exception ex)
{
int count = board.smtList.Count + 1;
LogUtil.error("图片【" + strpath + "】转为byte[]出错:" + ex.ToString());
return null;
}
SMTPointInfo pointInfo = new SMTPointInfo(count, obj.PartNum, obj.ComponentName, 5, 5, obj.PositionNum,1,5,5,2);
pointInfo.Disable = true;
board.smtList.Add(pointInfo);
Update(board);
LogUtil.info($"程序[{board.boardName}]使用元器件库[{bomName}],自动新增元器件[{obj.PartNum}-{obj.ComponentName}],默认禁用");
}
/// <summary>
/// 二进制转为图片
/// </summary>
/// <param name="streamByte"></param>
/// <returns></returns>
public static System.Drawing.Image ByteToImg(byte[] streamByte)
{
try
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(streamByte);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
return img;
}
catch (Exception ex)
{
LogUtil.error(" byte[]转为图片ByteToImg出错:" + ex.ToString());
return null;
}
}
}
}
......@@ -205,7 +205,7 @@ namespace TSA_V.DeviceLibrary
currPoint = GetSmtList()[currIndex];
//LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】");
ComponetInfo com = CSVBomManager.GetCom(currBoard.bomName, currPoint.PartNum);
ComponetInfo com = CSVBomManager.GetCom(currBoard.bomName, currPoint);
TSAVPosition position = null;
if (com != null)
{
......@@ -217,7 +217,7 @@ namespace TSA_V.DeviceLibrary
}
if (position == null)
{
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】未找到对应的元器件");
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】未找到对应的元器件");
}
else
{
......@@ -226,7 +226,7 @@ namespace TSA_V.DeviceLibrary
//插件机工作
if (WorkType.Equals(1))
{
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】 库位【" + position.PositionName + "】X轴【" + currPoint.NodePositionX + "】,Y轴【" + currPoint.NodePositionY + "】");
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】 库位【" + position.PositionName + "】X轴【" + currPoint.NodePositionX + "】,Y轴【" + currPoint.NodePositionY + "】");
MoveToBag(position);
......@@ -245,7 +245,7 @@ namespace TSA_V.DeviceLibrary
BoardCount++;
}
int temp = currPoint.WeldTemp;
LogUtil.info(" 程序【" + currBoard.boardName + "】焊接【" + currPoint.pointName + "】,温度【" + temp + "】");
LogUtil.info(" 程序【" + currBoard.boardName + "】焊接【" + currPoint.PN + "】,温度【" + temp + "】");
}
else if (WorkType.Equals(3))
......@@ -255,7 +255,7 @@ namespace TSA_V.DeviceLibrary
BoardCount++;
}
int temp = currPoint.WeldTemp;
LogUtil.info(" 程序【" + currBoard.boardName + "】检测【" + currPoint.pointName + "】");
LogUtil.info(" 程序【" + currBoard.boardName + "】检测【" + currPoint.PN + "】");
}
}
}
......@@ -268,12 +268,12 @@ namespace TSA_V.DeviceLibrary
if (TSAVBean.IsValidPosition(currPoint.NodePositionX, currPoint.NodePositionY))
{
//LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】,X轴【" + currPoint.NodePositionX + "】,Y轴【" + currPoint.NodePositionY + "】");
TSAVBean.ShowPoint(currPoint.NodePositionX, currPoint.NodePositionY,currPoint.PointType,currPoint.PointSizeX,currPoint.PointSizeY,currPoint.PenWidth,currPoint.pointName);
TSAVBean.ShowPoint(currPoint.NodePositionX, currPoint.NodePositionY,currPoint.PointType,currPoint.PointSizeX,currPoint.PointSizeY,currPoint.PenWidth,currPoint.PN);
waitList.Add(WaitResultInfo.WaitTime(1000));
}
else
{
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】,X轴【" + currPoint.NodePositionX + "】,Y轴【" + currPoint.NodePositionY + "】坐标无效,不移动光标");
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】,X轴【" + currPoint.NodePositionX + "】,Y轴【" + currPoint.NodePositionY + "】坐标无效,不移动光标");
}
}
......
......@@ -80,7 +80,7 @@ namespace TSA_V.DeviceLibrary
{
break;
}
op.pointList.Add(new OpPointInfo(sm.PartNum, sm.pointName));
op.pointList.Add(new OpPointInfo(sm.TagNo, sm.PN));
index++;
}
}
......
......@@ -5,7 +5,7 @@
</configSections>
<appSettings>
<!--开机自动运行-->
<add key="App_AutoRun" value="0" />
<add key="App_AutoRun" value="1" />
<add key="CodeRun" value="0" />
<add key="IsDebug" value="1" />
<add key="IsNeedCount" value="1" />
......
......@@ -73,7 +73,7 @@ namespace TSA_V
//smtPoint.PointSize = 4;
//smtPoint.NodePositionX = BPoint.NodePositionX - (BPoint.NodePositionX - APoint.NodePositionX) * (BPoint.PositionX - smtPoint.PositionX) / (BPoint.PositionX - APoint.PositionX);
//smtPoint.NodePositionY = BPoint.NodePositionY - (BPoint.NodePositionY - APoint.NodePositionY) * (BPoint.PositionY - smtPoint.PositionY) / (BPoint.PositionY - APoint.PositionY);
LogUtil.info(" 【" + smtPoint.pointName + "】图片坐标【" + smtPoint.PositionX + "," + smtPoint.PositionY + "】旧坐标【" + oldX + "," + oldY + "】A【" + APoint.pointName + "】,B【" + BPoint.pointName + "】,新坐标【" + smtPoint.NodePositionX + "," + smtPoint.NodePositionY + "】");
LogUtil.info(" 【" + smtPoint.PN + "】图片坐标【" + smtPoint.PositionX + "," + smtPoint.PositionY + "】旧坐标【" + oldX + "," + oldY + "】A【" + APoint.PN + "】,B【" + BPoint.PN + "】,新坐标【" + smtPoint.NodePositionX + "," + smtPoint.NodePositionY + "】");
return smtPoint;
}
......
......@@ -117,10 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="openFileDialogImg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
<metadata name="openFileDialogCsv.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>197, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -24,6 +24,16 @@ namespace TSA_V
SetSkin(this);
LanguageProcess();
}
private string getListMsg(List<string> list)
{
string msg = "";
foreach (string str in list)
{
msg += str + ",";
}
return msg.Substring(0, msg.Length - 1);
}
private List<ComponetInfo> comList = new List<ComponetInfo>();
private void btnBomImport_Click(object sender, EventArgs e)
{
......@@ -35,39 +45,44 @@ namespace TSA_V
comList = CSVBomManager.ReadFile(fileName);
if (comList.Count > 0)
if (comList.Count <= 0)
{
Dictionary<string, string> namePositonMap = new Dictionary<string, string>();
Dictionary<string, string> posiitonNameMap = new Dictionary<string, string>();
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectRightFile, "请选择正确的文件(文件格式可以通过下载模板获得)"));
}
Dictionary<string, List<string>> PnPositonMap = new Dictionary<string, List<string>>();
Dictionary<string, List<string>> positionPNMap = new Dictionary<string, List<string>>();
foreach (ComponetInfo com in comList)
{
if (!namePositonMap.ContainsKey(com.ComponentName))
if (!PnPositonMap.ContainsKey(com.PN))
{
namePositonMap.Add(com.ComponentName, com.PositionNum);
PnPositonMap.Add(com.PN, new List<string>());
}
else
{
string prePosition = namePositonMap[com.ComponentName];
if (!prePosition.Equals(com.PositionNum))
if (!PnPositonMap[com.PN].Contains(com.PositionNum))
{
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImport,
"元器件【{0}】配置了两个位置【{1}】和【{2}】,是否确定导入?", com.ComponentName, prePosition, com.PositionNum), "",
MessageBoxButtons.OKCancel); ;
if (!result.Equals(DialogResult.OK))
PnPositonMap[com.PN].Add(com.PositionNum);
}
if (!positionPNMap.ContainsKey(com.PositionNum))
{
comList = new List<ComponetInfo>();
return;
positionPNMap.Add(com.PositionNum, new List<string>());
}
if (!positionPNMap[com.PositionNum].Contains(com.PN))
{
positionPNMap[com.PositionNum].Add(com.PN);
}
}
if (posiitonNameMap.ContainsKey(com.PositionNum))
foreach (string pnKey in PnPositonMap.Keys)
{
string name = posiitonNameMap[com.PositionNum];
if (!name.Equals(com.ComponentName))
List<string> positions = new List<string>(PnPositonMap[pnKey]);
if (positions.Count > 1)
{
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.CheckFile, "两个元器件【{0}】和【{1}】都配置在位置【{2}】中,是否确定导入", name,com.ComponentName, com.PositionNum) ,"",
MessageBoxButtons.OKCancel); ;
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImportPosition,
"元器件【{0}】配置多个位置【{1}】,是否确定导入?", pnKey, getListMsg(positions), "",
MessageBoxButtons.OKCancel)); ;
if (!result.Equals(DialogResult.OK))
{
comList = new List<ComponetInfo>();
......@@ -75,16 +90,22 @@ namespace TSA_V
}
}
}
else
foreach (string key in positionPNMap.Keys)
{
posiitonNameMap.Add(com.PositionNum, com.ComponentName);
}
List<string> pnList = new List<string>(positionPNMap[key]);
if (pnList.Count > 1)
{
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImportPn,
"位置【{0}】配置多个元器件【{1}】,是否确定导入?", key, getListMsg(pnList), "",
MessageBoxButtons.OKCancel)); ;
if (!result.Equals(DialogResult.OK))
{
comList = new List<ComponetInfo>();
return;
}
this.txtBomFilePath.Text = fileName;
}
else
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectRightFile, "请选择正确的文件(文件格式可以通过下载模板获得)"));
}
}
}
......@@ -119,7 +140,7 @@ namespace TSA_V
return false;
}
if (CSVBomManager.AddBomList(bomName, comList))
if (CSVBomManager.AddBom(bomName, comList))
{
return true;
} return false;
......
......@@ -113,6 +113,7 @@
this.label24 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.新增ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -129,21 +130,22 @@
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.记录为组装坐标ToolStripMenuItem,
this.更新为组装坐标ToolStripMenuItem});
this.更新为组装坐标ToolStripMenuItem,
this.新增ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(161, 48);
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 92);
//
// 记录为组装坐标ToolStripMenuItem
//
this.记录为组装坐标ToolStripMenuItem.Name = "记录为组装坐标ToolStripMenuItem";
this.记录为组装坐标ToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
this.记录为组装坐标ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.记录为组装坐标ToolStripMenuItem.Text = "更新为组装位置";
this.记录为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.记录为组装坐标ToolStripMenuItem_Click);
//
// 更新为组装坐标ToolStripMenuItem
//
this.更新为组装坐标ToolStripMenuItem.Name = "更新为组装坐标ToolStripMenuItem";
this.更新为组装坐标ToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
this.更新为组装坐标ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.更新为组装坐标ToolStripMenuItem.Text = "更新为组装位置";
this.更新为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.更新为组装坐标ToolStripMenuItem_Click);
//
......@@ -980,6 +982,13 @@
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// 新增ToolStripMenuItem
//
this.新增ToolStripMenuItem.Name = "新增ToolStripMenuItem";
this.新增ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.新增ToolStripMenuItem.Text = "新增组装点";
this.新增ToolStripMenuItem.Click += new System.EventHandler(this.新增ToolStripMenuItem_Click);
//
// FrmBoardInfo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -1096,5 +1105,6 @@
private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
private System.Windows.Forms.DataGridViewLinkColumn Column_Up;
private System.Windows.Forms.DataGridViewLinkColumn Column_Down;
private System.Windows.Forms.ToolStripMenuItem 新增ToolStripMenuItem;
}
}
\ No newline at end of file
......@@ -111,6 +111,17 @@ namespace TSA_V
this.详情ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_Detial, "详情");
this.测试位置ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_MoveTest, "移动测试");
this.更新为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_UpdateN, "更新为组装位置");
if (dgvList.SelectedRows != null && dgvList.SelectedRows.Count > 0)
{
int rowIndex = dgvList.SelectedRows[0].Index;
string partNum = dgvList.Rows[rowIndex].Cells[this.Column_PartNum.Name].Value.ToString();
string name = dgvList.Rows[rowIndex].Cells[this.Column_Name.Name].Value.ToString();
记录为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemTextUpdateP, "更新为【{0}-{1}】的位置", partNum, name);
}
else
{
记录为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_UpdateN, "更新为组装位置");
}
this.Column_PartNum.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Num, "位号");
......@@ -144,6 +155,7 @@ namespace TSA_V
this.Column_CheckOK.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Check, "校准点");
this.Column_disable.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Disable, "禁用");
this.Column_Notes.HeaderText = ResourceCulture.GetString("注意事项", "注意事项");
this.新增ToolStripMenuItem.Text = ResourceCulture.GetString("新增组装点", "新增组装点");
}
private void FrmBoardInfo_Load(object sender, EventArgs e)
{
......@@ -272,8 +284,8 @@ namespace TSA_V
view.CreateCells(dgvList);
}
view.Cells[0].Value = point.pointNum.ToString();
view.Cells[1].Value = point.PartNum.ToString();
view.Cells[2].Value = point.pointName;
view.Cells[1].Value = point.TagNo.ToString();
view.Cells[2].Value = point.PN;
view.Cells[3].Value = point.PositionX.ToString();
view.Cells[4].Value = point.PositionY.ToString();
view.Cells[5].Value = point.NodePositionX.ToString();
......@@ -292,7 +304,7 @@ namespace TSA_V
view.Cells[Column_disable.Index].Value = point.Disable;
if (updateBoardInfo != null)
{
ComponetInfo com = CSVBomManager.GetCom(updateBoardInfo.bomName, point.PartNum);
ComponetInfo com = CSVBomManager.GetCom(updateBoardInfo.bomName, point);
if (com != null)
{
view.Cells[Column_Notes.Index].Value = com.Notes;
......@@ -607,7 +619,7 @@ namespace TSA_V
return;
}
}
nameList.Add(point.pointName);
nameList.Add(point.PN);
index++;
}
......@@ -660,9 +672,9 @@ namespace TSA_V
{
return null;
}
point.pointName = row.Cells[Column_Name.Name].Value.ToString();
point.PN = row.Cells[Column_Name.Name].Value.ToString();
point.pointNum = Convert.ToInt32(row.Cells[this.Column_pointNum.Name].Value.ToString());
point.PartNum = row.Cells[this.Column_PartNum.Name].Value.ToString();
point.TagNo = row.Cells[this.Column_PartNum.Name].Value.ToString();
point.PositionX = Math.Round(Convert.ToDouble(row.Cells[this.Column_X.Name].Value.ToString()), 3);
point.PositionY = Math.Round(Convert.ToDouble(row.Cells[this.Column_Y.Name].Value.ToString()), 3);
......@@ -827,7 +839,7 @@ namespace TSA_V
fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog();
//if (result.Equals(DialogResult.OK))
if (fwpi.IsUpdate)
if (fwpi.updateOK)
{
dgvList.Rows.Clear();
allPoint = fwpi.PointList;
......@@ -851,31 +863,13 @@ namespace TSA_V
}
private void 保存组装信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (m_MouseDownPointX.Equals(0) || m_MouseDownPointY.Equals(0))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectZZh, "请点击要保存的组装信息"));
return;
}
double x = m_MouseDownPointX / imageXiShu;
double y = m_MouseDownPointY / imageXiShu;
x = Math.Round(x, 0, MidpointRounding.AwayFromZero);
y = Math.Round(y, 0, MidpointRounding.AwayFromZero);
//double NodeX = TSAVBean.Axis_X.LastVoltage;
//double NodeY = TSAVBean.Axis_Y.LastVoltage;
double NodeX = FrmProjectorScreen.instance.LastX;
double NodeY = FrmProjectorScreen.instance.LastY;
LogUtil.info("新增组装信息:X【" + m_MouseDownPointX + "】Y【" + m_MouseDownPointY + "】,坐标X【" + x + "】坐标Y【" + y + "】");
AddNewPoint(x, y, NodeX, NodeY);
}
private void AddNewPoint(double x, double y, double nodeX, double nodeY)
{
SMTPointInfo smtInfo = new SMTPointInfo();
string name = "P" + (dgvList.Rows.Count + 1);
FrmPointInfo fwpi = new FrmPointInfo( name, x, y, nodeX, nodeY);
FrmPointInfo fwpi = new FrmPointInfo( updateBoardInfo, name, x, y, nodeX, nodeY);
fwpi.AoiProgramName = cmbAOIFile.Text;
fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog();
......@@ -1232,16 +1226,16 @@ namespace TSA_V
List<string> names = new List<string>();
foreach (ComponetInfo com in list)
{
List<SMTPointInfo> smts = (from m in allSmt where m.PartNum.Equals(com.PartNum) select m).ToList<SMTPointInfo>();
List<SMTPointInfo> smts = (from m in allSmt where m.TagNo.Equals(com.TagNo) select m).ToList<SMTPointInfo>();
if (smts.Count > 0)
{
newList.Add(smts[0]);
}
names.Add(com.PartNum);
names.Add(com.TagNo);
}
foreach (SMTPointInfo s in allSmt)
{
if (!names.Contains(s.PartNum))
if (!names.Contains(s.TagNo))
{
newList.Add(s);
}
......@@ -1372,6 +1366,25 @@ namespace TSA_V
}
}
private void 新增ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (m_MouseDownPointX.Equals(0) || m_MouseDownPointY.Equals(0))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectZZh, "请点击要保存的组装信息"));
return;
}
double x = m_MouseDownPointX / imageXiShu;
double y = m_MouseDownPointY / imageXiShu;
x = Math.Round(x, 0, MidpointRounding.AwayFromZero);
y = Math.Round(y, 0, MidpointRounding.AwayFromZero);
//double NodeX = TSAVBean.Axis_X.LastVoltage;
//double NodeY = TSAVBean.Axis_Y.LastVoltage;
double NodeX = FrmProjectorScreen.instance.LastX;
double NodeY = FrmProjectorScreen.instance.LastY;
LogUtil.info("新增组装信息:X【" + m_MouseDownPointX + "】Y【" + m_MouseDownPointY + "】,坐标X【" + x + "】坐标Y【" + y + "】");
AddNewPoint(x, y, NodeX, NodeY);
}
private void llblAllUSel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
int cout = dgvList.Rows.Count;
......
......@@ -58,6 +58,7 @@
this.cmbBoardList = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnBeiliao = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.panBoard.SuspendLayout();
......@@ -98,9 +99,9 @@
this.groupBox2.Controls.Add(this.txtBomName);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(12, 82);
this.groupBox2.Location = new System.Drawing.Point(8, 82);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(1232, 531);
this.groupBox2.Size = new System.Drawing.Size(1230, 531);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "程序信息";
......@@ -170,7 +171,7 @@
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(-1034, 23);
this.label6.Location = new System.Drawing.Point(-1036, 23);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 33;
......@@ -186,7 +187,7 @@
this.panBoard.Controls.Add(this.picBoard);
this.panBoard.Location = new System.Drawing.Point(437, 19);
this.panBoard.Name = "panBoard";
this.panBoard.Size = new System.Drawing.Size(782, 499);
this.panBoard.Size = new System.Drawing.Size(780, 499);
this.panBoard.TabIndex = 10;
//
// picBoard
......@@ -272,6 +273,7 @@
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.btnBeiliao);
this.groupBox1.Controls.Add(this.btnImport);
this.groupBox1.Controls.Add(this.btnExport);
this.groupBox1.Controls.Add(this.btnBack);
......@@ -281,9 +283,9 @@
this.groupBox1.Controls.Add(this.cmbBoardList);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(12, 5);
this.groupBox1.Location = new System.Drawing.Point(8, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1233, 70);
this.groupBox1.Size = new System.Drawing.Size(1231, 70);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "程序管理";
......@@ -292,9 +294,9 @@
//
this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(839, 15);
this.btnImport.Location = new System.Drawing.Point(871, 15);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(120, 45);
this.btnImport.Size = new System.Drawing.Size(109, 45);
this.btnImport.TabIndex = 8;
this.btnImport.Text = "导入";
this.btnImport.UseVisualStyleBackColor = true;
......@@ -304,9 +306,9 @@
//
this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExport.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExport.Location = new System.Drawing.Point(973, 15);
this.btnExport.Location = new System.Drawing.Point(985, 15);
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(120, 45);
this.btnExport.Size = new System.Drawing.Size(109, 45);
this.btnExport.TabIndex = 7;
this.btnExport.Text = "导出";
this.btnExport.UseVisualStyleBackColor = true;
......@@ -317,9 +319,9 @@
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1103, 15);
this.btnBack.Location = new System.Drawing.Point(1097, 15);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(120, 45);
this.btnBack.Size = new System.Drawing.Size(109, 45);
this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回";
this.btnBack.UseVisualStyleBackColor = true;
......@@ -329,9 +331,9 @@
//
this.btnDel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDel.Location = new System.Drawing.Point(705, 15);
this.btnDel.Location = new System.Drawing.Point(643, 15);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(120, 45);
this.btnDel.Size = new System.Drawing.Size(109, 45);
this.btnDel.TabIndex = 5;
this.btnDel.Text = "删除";
this.btnDel.UseVisualStyleBackColor = true;
......@@ -341,9 +343,9 @@
//
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(571, 15);
this.btnSave.Location = new System.Drawing.Point(529, 15);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(120, 45);
this.btnSave.Size = new System.Drawing.Size(109, 45);
this.btnSave.TabIndex = 4;
this.btnSave.Text = "修改";
this.btnSave.UseVisualStyleBackColor = true;
......@@ -353,9 +355,9 @@
//
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(437, 15);
this.btnNew.Location = new System.Drawing.Point(415, 15);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(120, 45);
this.btnNew.Size = new System.Drawing.Size(109, 45);
this.btnNew.TabIndex = 3;
this.btnNew.Text = "新增";
this.btnNew.UseVisualStyleBackColor = true;
......@@ -385,6 +387,18 @@
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// btnBeiliao
//
this.btnBeiliao.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBeiliao.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBeiliao.Location = new System.Drawing.Point(757, 15);
this.btnBeiliao.Name = "btnBeiliao";
this.btnBeiliao.Size = new System.Drawing.Size(109, 45);
this.btnBeiliao.TabIndex = 9;
this.btnBeiliao.Text = "备料";
this.btnBeiliao.UseVisualStyleBackColor = true;
this.btnBeiliao.Click += new System.EventHandler(this.btnBeiliao_Click);
//
// FrmBoardList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -440,5 +454,6 @@
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button btnBeiliao;
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
using System.Drawing.Imaging;
namespace TSA_V
{
......@@ -157,10 +158,10 @@ namespace TSA_V
ListViewItem lvi = new ListViewItem();
lvi.ImageIndex = i;
lvi.Text = point.PartNum.ToString();
lvi.SubItems.Add(point.pointName);
lvi.Text = point.TagNo.ToString();
lvi.SubItems.Add(point.PN);
ComponetInfo com = CSVBomManager.GetCom(board.bomName, point.PartNum);
ComponetInfo com = CSVBomManager.GetCom(board.bomName, point);
if (com != null)
{
lvi.SubItems.Add(com.PositionNum);
......@@ -325,19 +326,7 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString("导入失败:程序名已存在"), ResourceCulture.GetString("提示"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string oldName = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
string newName = board.boardName + Path.GetExtension(oldName);
string configPath = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string oldPath = Application.StartupPath + @"\" + configPath +@"\" + oldName;
string newPath = Application.StartupPath + @"\" + configPath + @"\" + newName;
if (File.Exists(oldPath))
{
File.Copy(oldPath, newPath, true);
}
board.imgName = newName;
board.boardId = BoardManager.GetNextId();
BoardManager.Add(board);
BoardManager.ImportBoard(board);
MessageBox.Show(ResourceCulture.GetString("导入成功"), ResourceCulture.GetString("提示"));
LoadCom();
preId = -1;
......@@ -349,7 +338,12 @@ namespace TSA_V
if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0)
{
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
board.imageByte = BoardManager.ImgToByte(board.GetImgPath());
for (int i= 0;i < board.smtList.Count; i++){
SMTPointInfo p = board.smtList[i];
board.smtList[i].componet = CSVBomManager.GetCom(board.boardName, p);
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = "";
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
......@@ -385,5 +379,47 @@ namespace TSA_V
}
}
}
private void btnBeiliao_Click(object sender, EventArgs e)
{
if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0)
{
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
List<ComponetInfo> allList = CSVBomManager.GetComList(board.bomName);
List<SMTPointInfo> plist = (from m in board.smtList where m.Disable.Equals(0) select m).ToList();
List<ComponetInfo> list = new List<ComponetInfo>();
foreach (ComponetInfo p in allList)
{
List<SMTPointInfo> hasList = new List<SMTPointInfo>();
if (String.IsNullOrEmpty(p.TagNo))
{
hasList = (from m in board.smtList where m.PN.Equals(p.PN) select m).ToList();
}
else
{
hasList = (from m in board.smtList where m.TagNo.Equals(p.TagNo) select m).ToList();
}
if (hasList.Count > 0)
{
list.Add(p);
}
}
list = (from m in list orderby m.PN ascending select m ).ToList();
FrmBoardPutCom frm = new FrmBoardPutCom();
if (frm.SetOperateInfo(board, board.bomName, list))
{
this.Visible = false;
frm.ShowDialog();
this.Visible = true;
}
}
else
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectP, "请选择程序!"));
}
}
}
}
using PUSICANLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary;
namespace TSA_V
{
public partial class FrmBoardPutCom : FrmBase
{
private string bomName = "";
private StockInfo Work = new StockInfo();
private TSAVPosition currPosition = null;
ComponetInfo currCom = new ComponetInfo();
private List<ComponetInfo> oldConList = new List<ComponetInfo>();
private List<ComponetInfo> comList = null;
private int currIndex = 0;
private BoardInfo board;
public FrmBoardPutCom()
{
InitializeComponent();
}
private void FrmPutCom_Load(object sender, EventArgs e)
{
LanguageProcess();
TSAVBean.IsInPut = true;
Work.StartWork();
SetScreen();
timer1.Enabled = true;
}
public bool SetOperateInfo(BoardInfo board, string bomName, List<ComponetInfo> list)
{
this.board = board;
oldConList = list;
comList = new List<ComponetInfo>();
List<string> positinList = new List<string>();
foreach (ComponetInfo obj in list)
{
if (positinList.Contains(obj.PositionNum))
{
}
else
{
positinList.Add(obj.PositionNum);
comList.Add(obj);
}
}
//排序
comList = (from m in comList orderby m.GetSortPosition() ascending select m).ToList();
this.bomName = bomName;
this.Text =ResourceCulture.GetString(ResourceCulture.BLText, "程序【{0}】元器件库【{1}】备料中", board.boardName, bomName);
LogUtil.info("开始备料:程序【" + board.boardName + "】元器件库【" + bomName + "】");
if (comList.Count <= 0)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ConotFindCom,"未找到需要备料的元器件!"));
return false;
}
currIndex = 0;
ShowCom();
//if (TSAVBean.Status <= TSAVStatus.Wait)
//{
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DeviceNotOk,"设备未连接,无法备料!"));
// return false ;
//}
//else if (TSAVBean.Status.Equals(TSAVStatus.Reset))
//{
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DeviceInReset,"设备正在重置中,请稍后再备料!"));
// return false;
//}
return true;
}
private void ShowCom()
{
if (currIndex < 0)
{
currIndex = 0;
}
if (currIndex >= comList.Count)
{
currIndex = comList.Count - 1;
}
currCom = comList[currIndex];
currPosition = CSVPositionReader<TSAVPosition>.GetPositonByNum(currCom.PositionNum);
this.lblPN.Text = currCom.PN;
this.numCount.Text = currCom.ComCount.ToString();
this.lblTagNo.Text = currCom.TagNo;
this.lblPosition.Text = currCom.PositionNum;
this.lblDes.Text = currCom.ComponentDes;
if (String.IsNullOrEmpty(currCom.TagNo))
{
string tagNo = "";
List<SMTPointInfo> smts = (from m in board.smtList where m.PN.Equals(currCom.PN) select m).ToList();
foreach(SMTPointInfo smt in smts)
{
tagNo += smt.TagNo + " ";
}
lblTagNo.Text = tagNo;
}
if (CurrLanguage.Equals(ResourceCulture.China))
{
lblEndInfo.Text = "已完成" + currIndex + "个";
this.lblLeftInfo.Text = "剩余" + (comList.Count - 1 - currIndex) + "个";
}
else
{
lblEndInfo.Text = "" + currIndex + "/" + (comList.Count - 1 - currIndex) ;
this.lblLeftInfo.Text = " ";
}
//lblEndInfo.Text = "已完成" + currIndex + "个";
//this.lblLeftInfo.Text = "剩余" + (comList.Count - 1 - currIndex) + "个";
LogUtil.info("正在备料中:元器件库【" + bomName + "】位号【" + lblTagNo.Text + "】物料编号【" + currCom.PN + "】料盘编号【" + currCom.PositionNum + "】");
if (currIndex.Equals(0))
{
btnPre.Enabled = false;
btnNext.Enabled = true;
}
else if (currIndex.Equals(comList.Count - 1))
{
btnPre.Enabled = true;
btnNext.Enabled = false;
}
else
{
btnPre.Enabled = true;
btnNext.Enabled = true;
}
if (currPosition == null)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.CanotFindPosition, "未找到物料编号【{0}】的坐标", currCom.PositionNum));
}
else if (TSAVBean.Status.Equals(TSAVStatus.Runing))
{
Work.MoveToBag(currPosition);
}
}
private void btnPre_Click(object sender, EventArgs e)
{
if (!Work.IsWaitMove)
{
currIndex--;
ShowCom();
}
}
private void SaveCom()
{
int newCount = (int)numCount.Value;
ComponetInfo com = comList[currIndex];
com.ComCount = newCount;
CSVBomManager.UpdateComponet(bomName, com);
}
private void btnNext_Click(object sender, EventArgs e)
{
if (!Work.IsWaitMove)
{
SaveCom();
currIndex++;
ShowCom();
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
// 按快捷键Ctrl+S执行按钮的点击事件方法
if (keyData.Equals(Keys.Up) || keyData.Equals(Keys.MButton | Keys.Space))
{
if (btnPre.Enabled)
{
btnPre.PerformClick();
}
return true;
}
else if (keyData.Equals(Keys.Down) || keyData.Equals(Keys.Back | Keys.Space))
{
if (btnNext.Enabled)
{
this.btnNext.PerformClick();
}
return true;
}
else if (keyData.Equals(Keys.Left) || keyData.Equals(Keys.LButton | Keys.MButton | Keys.Space))
{
if (btnPre.Enabled)
{
btnPre.PerformClick();
}
return true;
}
else if (keyData.Equals(Keys.Right) || keyData.Equals(Keys.LButton | Keys.RButton | Keys.MButton | Keys.Space))
{
if (btnNext.Enabled)
{
this.btnNext.PerformClick();
}
return true;
}
return base.ProcessCmdKey(ref msg, keyData); // 其他键按默认处理 
}
private void btnSaveCount_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
SaveCom();
}
private void FrmPutCom_FormClosing(object sender, FormClosingEventArgs e)
{
LogUtil.info("结束备料:元器件库【" + bomName + "】");
timer1.Enabled = false;
if (TSAVBean.Status > TSAVStatus.Reset)
{
Work.StopWork();
}
TSAVBean.IsInPut = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (Work.IsWorking)
{
if (Work.IsWaitMove)
{
lblMoveStr.Text =ResourceCulture.GetString( ResourceCulture.Move,"移动中");
CheckWorkWait();
}
else if (IOManager.IOValue(IOManager.Footrest_Single).Equals(IO_VALUE.HIGH))
{
btnNext.PerformClick();
}
if (!Work.IsWaitMove)
{
lblMoveStr.Text = ResourceCulture.GetString(ResourceCulture.Inplace, "已到位");
}
}
}
private void CheckWorkWait()
{
string waitMsg = "";
List<WaitResultInfo> list = Work.waitList;
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - Work.LastSetpTime;
bool isOk = WaitResultInfo.GetWaitResult(list, span,false, out waitMsg);
if (isOk)
{
Work.EndWait();
}
else
{
if (span.TotalMinutes > 1)
{
waitMsg = "等待【" + waitMsg + "】超时 已等待【" + span.TotalMinutes.ToString() + "】分钟,";
foreach (WaitResultInfo wait in list)
{
waitMsg = waitMsg + "\r\n" + wait.ToStr();
}
LogUtil.error(waitMsg);
}
}
}
private void FrmPutCom_Shown(object sender, EventArgs e)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -117,10 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<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">
......
......@@ -118,12 +118,11 @@ namespace TSA_V
//加载板卡
BoardManager.LoadBoard();
CSVBomManager.LoadAllCom();
WorkCountManager.LoadData();
//CalibrationManager.LoadData();
string positionFileName = CSVPositionReader<TSAVPosition>.getPositionFilePath();
//加载位置
LoadCSVLibrary.CSVPositionReader<TSAVPosition>.LoadFile(positionFileName);
CSVBomManager.LoadAllCom();
//加载设备信息
TSAVBean.LoadTSAV();
//需要链接IO
......@@ -259,6 +258,10 @@ namespace TSA_V
// return;
//}
isClick = true;
if (FrmComponentList.instance != null && FrmComponentList.instance.Visible == false)
{
FrmComponentList.instance.LoadComList();
}
FrmComponentList.instance.Show();
this.Visible = false;
}
......
......@@ -31,7 +31,6 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPointInfo));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.xyMoveControl1 = new UserFromControl.ProjectorControl();
this.btnPre = new System.Windows.Forms.Button();
this.btnSaveAndNext = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
......@@ -43,16 +42,18 @@
this.label7 = new System.Windows.Forms.Label();
this.chbNeedCheck = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.txtNum = new System.Windows.Forms.TextBox();
this.txtTagNo = new System.Windows.Forms.TextBox();
this.chbNeedSoldering = new System.Windows.Forms.CheckBox();
this.txtY = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtName = new System.Windows.Forms.TextBox();
this.txtPn = new System.Windows.Forms.TextBox();
this.txtX = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
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();
//
......@@ -61,23 +62,6 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// xyMoveControl1
//
this.xyMoveControl1.BackColor = System.Drawing.Color.White;
this.xyMoveControl1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.xyMoveControl1.GroupName = "坐标";
this.xyMoveControl1.Location = new System.Drawing.Point(41, 241);
this.xyMoveControl1.Name = "xyMoveControl1";
this.xyMoveControl1.PenWidth = 2;
this.xyMoveControl1.PointSizeX = 4;
this.xyMoveControl1.PointSizeY = 1;
this.xyMoveControl1.PointType = 1;
this.xyMoveControl1.ShowText = "";
this.xyMoveControl1.Size = new System.Drawing.Size(515, 299);
this.xyMoveControl1.TabIndex = 63;
this.xyMoveControl1.XValue = 1D;
this.xyMoveControl1.YValue = 1D;
//
// btnPre
//
this.btnPre.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
......@@ -106,6 +90,7 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.cmbPnList);
this.groupBox1.Controls.Add(this.lblNotes);
this.groupBox1.Controls.Add(this.chbCheck);
this.groupBox1.Controls.Add(this.txtWeldTemp);
......@@ -114,12 +99,12 @@
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.chbNeedCheck);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.txtNum);
this.groupBox1.Controls.Add(this.txtTagNo);
this.groupBox1.Controls.Add(this.chbNeedSoldering);
this.groupBox1.Controls.Add(this.txtY);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtName);
this.groupBox1.Controls.Add(this.txtPn);
this.groupBox1.Controls.Add(this.txtX);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -210,15 +195,15 @@
this.label3.Text = "X:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtNum
// txtTagNo
//
this.txtNum.Enabled = false;
this.txtNum.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtNum.Location = new System.Drawing.Point(135, 24);
this.txtNum.MaxLength = 30;
this.txtNum.Name = "txtNum";
this.txtNum.Size = new System.Drawing.Size(219, 26);
this.txtNum.TabIndex = 64;
this.txtTagNo.Enabled = false;
this.txtTagNo.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtTagNo.Location = new System.Drawing.Point(135, 24);
this.txtTagNo.MaxLength = 30;
this.txtTagNo.Name = "txtTagNo";
this.txtTagNo.Size = new System.Drawing.Size(219, 26);
this.txtTagNo.TabIndex = 64;
//
// chbNeedSoldering
//
......@@ -256,17 +241,17 @@
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(128, 22);
this.label2.TabIndex = 60;
this.label2.Text = "号:";
this.label2.Text = "号:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtName
// txtPn
//
this.txtName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtName.Location = new System.Drawing.Point(135, 62);
this.txtName.MaxLength = 30;
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(219, 26);
this.txtName.TabIndex = 33;
this.txtPn.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPn.Location = new System.Drawing.Point(135, 62);
this.txtPn.MaxLength = 30;
this.txtPn.Name = "txtPn";
this.txtPn.Size = new System.Drawing.Size(219, 26);
this.txtPn.TabIndex = 33;
//
// txtX
//
......@@ -283,7 +268,7 @@
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 22);
this.label1.TabIndex = 32;
this.label1.Text = "名称:";
this.label1.Text = "物料编码:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnCancel
......@@ -312,6 +297,33 @@
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// xyMoveControl1
//
this.xyMoveControl1.BackColor = System.Drawing.Color.White;
this.xyMoveControl1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.xyMoveControl1.GroupName = "坐标";
this.xyMoveControl1.Location = new System.Drawing.Point(41, 241);
this.xyMoveControl1.Name = "xyMoveControl1";
this.xyMoveControl1.PenWidth = 2;
this.xyMoveControl1.PointSizeX = 4;
this.xyMoveControl1.PointSizeY = 1;
this.xyMoveControl1.PointType = 1;
this.xyMoveControl1.ShowText = "";
this.xyMoveControl1.Size = new System.Drawing.Size(515, 299);
this.xyMoveControl1.TabIndex = 63;
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);
......@@ -340,7 +352,7 @@
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.TextBox txtPn;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
......@@ -348,7 +360,7 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtX;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TextBox txtNum;
private System.Windows.Forms.TextBox txtTagNo;
private System.Windows.Forms.Button btnSaveAndNext;
private System.Windows.Forms.CheckBox chbNeedCheck;
private System.Windows.Forms.CheckBox chbNeedSoldering;
......@@ -360,5 +372,6 @@
private UserFromControl.ProjectorControl xyMoveControl1;
private System.Windows.Forms.CheckBox chbCheck;
private System.Windows.Forms.Label lblNotes;
private System.Windows.Forms.ComboBox cmbPnList;
}
}
\ No newline at end of file
......@@ -20,24 +20,23 @@ namespace TSA_V
{
public delegate void NextDel(int index, SMTPointInfo smt=null);
public event NextDel NextEvent;
public bool IsUpdate = false;
public SMTPointInfo smtPointInfo = new SMTPointInfo();
public BoardInfo boardInfo = null;
public string AoiProgramName = "";
public Image PicImage = null;
public FrmPointInfo(string name, double x, double y, double nodex, double nodey)
internal bool updateOK = false;
internal SMTPointInfo smtPointInfo = new SMTPointInfo();
internal BoardInfo boardInfo = null;
internal string AoiProgramName = "";
internal Image PicImage = null;
internal bool isNewPoint = false;
public FrmPointInfo(BoardInfo board, string name, double x, double y, double nodex, double nodey)
{
InitializeComponent();
loadPositionList();
this.boardInfo = board;
isNewPoint = true;
this.Text = "新增组装信息";
this.txtNum.Enabled = true;
this.txtName.Text = name;
//if (cmbPositionNumList.Items.Count > 0)
//{
// cmbPositionNumList.SelectedIndex = 0;
//}
//this.txtRobotX.Text = nodex.ToString();
//txtRobotY.Text = nodey.ToString();
this.txtTagNo.Text = name;
updateFrom(true);
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.XValue = nodex;
xyMoveControl1.YValue = nodey;
......@@ -46,7 +45,31 @@ namespace TSA_V
this.txtY.Text = y.ToString();
}
private void updateFrom(bool isNew)
{
this.txtPn.Enabled = false;
this.txtTagNo.Enabled = isNew;
btnSaveAndNext.Visible = !isNew;
this.txtPn.Visible = !isNew;
cmbPnList.Visible = isNew;
this.txtPn.Text = "";
if (isNew)
{
List<string> pnList = new List<string>();
List<ComponetInfo> list = CSVBomManager.GetComList(this.boardInfo.bomName);
foreach (ComponetInfo obj in list)
{
if (!pnList.Contains(obj.PN))
{
pnList.Add(obj.PN);
}
}
cmbPnList.Items.Clear();
cmbPnList.DataSource = pnList;
}
}
private bool XyMoveControl1_ShowPointEvent(ProjectorPInfo p)
{
FrmProjectorScreen.instance.ClearPoint();
......@@ -83,34 +106,14 @@ namespace TSA_V
private void ShowPoint()
{
updateFrom(false);
btnSave.Visible = true;
this.smtPointInfo = PointList[CurrIndex];
this.txtNum.Enabled = false;
this.Text = "修改组装信息【" + smtPointInfo.pointName + "】 ";
this.Text = "修改组装信息【" + smtPointInfo.PN + "】 ";
loadPositionList();
this.txtName.Text = smtPointInfo.pointName;
this.txtPn.Text = smtPointInfo.PN;
int index = -1;
int selPosIndex = -1;
foreach (TSAVPosition p in allPosition)
{
index++;
if (p.PositionNum.Equals(smtPointInfo.PositionNum))
{
selPosIndex = index;
break;
}
}
index = -1; selPosIndex = -1;
foreach (TSAVPosition p in allPosition)
{
index++;
if (p.PositionNo.ToString().Equals(smtPointInfo.PositionNum))
{
selPosIndex = index;
break;
}
}
//this.txtRobotX.Text = smpPointInfo.NodePositionX.ToString();
//txtRobotY.Text = smpPointInfo.NodePositionY.ToString();
xyMoveControl1.XValue = smtPointInfo.NodePositionX;
......@@ -123,7 +126,7 @@ namespace TSA_V
xyMoveControl1.ShowCurrPoint();
this.txtX.Text = smtPointInfo.PositionX.ToString();
this.txtY.Text = smtPointInfo.PositionY.ToString();
this.txtNum.Text = smtPointInfo.PartNum;
this.txtTagNo.Text = smtPointInfo.TagNo;
this.chbNeedCheck.Checked = smtPointInfo.NeedCheck;
this.chbNeedSoldering.Checked = smtPointInfo.NeedSoldering;
this.txtWeldTemp.Text = smtPointInfo.WeldTemp.ToString();
......@@ -132,7 +135,7 @@ namespace TSA_V
lblNotes.Text = "";
if (boardInfo != null)
{
ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo.PartNum);
ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo);
if (com != null)
{
lblNotes.Text = com.Notes;
......@@ -171,29 +174,38 @@ namespace TSA_V
}
private bool saveInfo()
{
//if (cmbPositionNumList.SelectedIndex < 0)
//{
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ChoiceComPosition, "请选择元器件所在位置!"));
// cmbPositionNumList.Focus();
// return false;
//}
string name = FormUtil.getValue(txtName);
if (name.Equals(""))
if (isNewPoint)
{
smtPointInfo = new SMTPointInfo();
smtPointInfo.pointNum = boardInfo.GetNextPNum();
}
string pn = FormUtil.getValue(txtPn);
if (pn.Equals(""))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteName, "请输入物料编码!"));
txtName.Focus();
txtPn.Focus();
return false;
}
smtPointInfo.PartNum = FormUtil.getValue(txtNum);
if (smtPointInfo.PartNum.Equals(""))
string tagNo = FormUtil.getValue(txtTagNo);
if (tagNo.Equals(""))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WritePartNumber, "请输入位号!"));
txtNum.Focus();
txtTagNo.Focus();
return false;
}
smtPointInfo.pointName = name;
List<SMTPointInfo> pos = (from m in boardInfo.smtList where m.pointNum != smtPointInfo.pointNum && m.TagNo.Equals(tagNo) select m).ToList();
if (pos.Count > 0)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WritePartNumber, "请输入位号!"));
txtTagNo.Text = smtPointInfo.TagNo;
txtTagNo.Focus();
return false;
}
smtPointInfo.PN = pn;
smtPointInfo.TagNo = tagNo;
smtPointInfo.PositionX = FormUtil.getDoubleValue(txtX);
smtPointInfo.PositionY = FormUtil.getDoubleValue(txtY);
smtPointInfo.NodePositionX = xyMoveControl1.XValue;
......@@ -203,8 +215,6 @@ namespace TSA_V
smtPointInfo.PointSizeY = xyMoveControl1.PointSizeY;
smtPointInfo.PenWidth = xyMoveControl1.PenWidth;
smtPointInfo.ShowText = xyMoveControl1.ShowText;
//smtPointInfo.NodePositionX = FormUtil.getDoubleValue(txtRobotX);
//smtPointInfo.NodePositionY = FormUtil.getDoubleValue(txtRobotY);
smtPointInfo.NeedSoldering = chbNeedSoldering.Checked;
smtPointInfo.NeedCheck = chbNeedCheck.Checked;
smtPointInfo.WeldTime = FormUtil.getDoubleValue(txtWeldTime);
......@@ -219,16 +229,36 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteRightTime,"请输入正确的焊接时间!"));
return false;
}
//TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem;
//smtPointInfo.PositionNum = position.PositionNum;
// this.DialogResult = DialogResult.OK;
if (isNewPoint)
{
ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo);
if (com != null)
{
smtPointInfo.PositionNum = com.PositionNum;
}
boardInfo.smtList.Add(smtPointInfo);
this.DialogResult = DialogResult.OK;
closeForm();
return true;
}
else
{
if (String.IsNullOrEmpty(smtPointInfo.PositionNum))
{
ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo);
if (com != null)
{
smtPointInfo.PositionNum = com.PositionNum;
}
}
if (this.PointList.Count > 0 && CurrIndex >= 0)
{
PointList[CurrIndex] = smtPointInfo;
}
IsUpdate = true;
updateOK = true;
return true;
}
}
private void closeForm()
{
......@@ -297,5 +327,13 @@ namespace TSA_V
FrmAoiSetting frm = new FrmAoiSetting(path+AoiProgramName, PicImage,path);
frm.ShowDialog();
}
private void cmbPnList_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbPnList.SelectedIndex >= 0)
{
txtPn.Text = cmbPnList.Text;
}
}
}
}
......@@ -260,7 +260,7 @@
this.Controls.Add(this.txtName);
this.Controls.Add(this.label2);
this.Name = "FrmPutCom";
this.Text = "备料";
this.Text = "程序备料";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmPutCom_FormClosing);
this.Load += new System.EventHandler(this.FrmPutCom_Load);
this.Shown += new System.EventHandler(this.FrmPutCom_Shown);
......
......@@ -56,7 +56,7 @@ namespace TSA_V
}
//排序
comList = (from m in comList orderby m.GetPosition() ascending select m).ToList();
comList = (from m in comList orderby m.GetSortPosition() ascending select m).ToList();
this.bomName = bomName;
this.Text = "元器件库【" + bomName + "】备料中";
LogUtil.info("开始备料:元器件库【" + bomName + "】");
......@@ -93,9 +93,9 @@ namespace TSA_V
currCom = comList[currIndex];
currPosition = CSVPositionReader<TSAVPosition>.GetPositonByNum(currCom.PositionNum);
this.txtName.Text = currCom.ComponentName;
this.txtName.Text = currCom.PN;
this.txtNum.Text = currCom.ComCount.ToString();
this.txtPartNum.Text = currCom.PartNum;
this.txtPartNum.Text = currCom.TagNo;
this.txtPosition.Text = currCom.PositionNum;
this.txtDes.Text = currCom.ComponentDes;
if (CurrLanguage.Equals(ResourceCulture.China))
......@@ -110,7 +110,7 @@ namespace TSA_V
}
//lblEndInfo.Text = "已完成" + currIndex + "个";
//this.lblLeftInfo.Text = "剩余" + (comList.Count - 1 - currIndex) + "个";
LogUtil.info("正在备料中:元器件库【" + bomName + "】位号【" + currCom.PartNum + "】物料编号【" + currCom.ComponentName + "】料盘编号【" + currCom.PositionNum + "】");
LogUtil.info("正在备料中:元器件库【" + bomName + "】位号【" + currCom.TagNo + "】物料编号【" + currCom.PN + "】料盘编号【" + currCom.PositionNum + "】");
if (currIndex.Equals(0))
{
btnPre.Enabled = false;
......@@ -217,7 +217,7 @@ namespace TSA_V
}
}
CSVBomManager.SaveComponet(bomName, oldConList);
CSVBomManager.SaveBomToFile(bomName, oldConList);
}
private void FrmPutCom_FormClosing(object sender, FormClosingEventArgs e)
......
......@@ -45,7 +45,7 @@ namespace TSA_V
this.cmbPointList.Items.Clear();
foreach (SMTPointInfo point in pointList)
{
cmbPointList.Items.Add(point.PartNum + "-" + point.pointName);
cmbPointList.Items.Add(point.TagNo + "-" + point.PN);
}
if (cmbPointList.Items.Count > 0)
{
......
......@@ -325,10 +325,10 @@
<value>END</value>
</data>
<data name="FrmPutCom_btnNext_Text" xml:space="preserve">
<value>LAST</value>
<value>NEXT</value>
</data>
<data name="FrmPutCom_btnPre_Text" xml:space="preserve">
<value>NEXT</value>
<value>PREVIOUS</value>
</data>
<data name="FrmPutCom_label1_Text" xml:space="preserve">
<value>PLATE POSITION</value>
......@@ -385,10 +385,10 @@
<value>ASSEMBLY QUANTITY</value>
</data>
<data name="FrmBoardList_label4_Text" xml:space="preserve">
<value>LENGTH→</value>
<value>LENGTH→ :</value>
</data>
<data name="FrmBoardList_label3_Text" xml:space="preserve">
<value>WIDTH ↑</value>
<value>WIDTH ↑ :</value>
</data>
<data name="FrmBoardList_label2_Text" xml:space="preserve">
<value>STOCK NAME</value>
......@@ -2345,7 +2345,7 @@
<value> Projection words: </value>
</data>
<data name="FrmBoardInfo_lblLineW_Text" xml:space="preserve">
<value> Line body width: </value>
<value> Line width: </value>
</data>
<data name="FrmBoardInfo_lbllinews_Text" xml:space="preserve">
<value> mm </value>
......@@ -2413,7 +2413,35 @@
<data name="注意事项" xml:space="preserve">
<value>ANNOUNCEMENTS</value>
</data>
<data name = "FrmAddBoard_lblWidth_Text" xml:space = "preserve"> <value>Line width:</value> </data>
<data name = "FrmAddBoard_lblWidth_Text" xml:space = "preserve"> <value>LINE WIDTH:</value> </data>
<data name = "FrmBoardSelect_chbWorkSingleStart_Text" xml:space = "preserve"> <value> Enable workspace detection to start working </value> </data>
<data name = "FrmPointInfo_lblName_Text" xml:space = "preserve"> <value> Projection words: </value> </data>
<data name = "FrmBoardList_btnBeiliao_Text" xml:space = "preserve"> <value> COMPONENT PREPARATION </value> </data>
<data name = "FrmBoardPutCom_label2_Text" xml:space = "preserve"> <value> MATERIAL CODE: </value> </data>
<data name = "FrmBoardPutCom_btnSaveCount_Text" xml:space = "preserve"> <value> SAVE </value> </data>
<data name = "FrmBoardPutCom_label5_Text" xml:space = "preserve"> <value> DESCRIBE: </value> </data>
<data name = "FrmBoardPutCom_label4_Text" xml:space = "preserve"> <value> MATERIAL CODE: </value> </data>
<data name = "FrmBoardPutCom_label1_Text" xml:space = "preserve"> <value> PLATE POSITION: </value> </data>
<data name = "FrmBoardPutCom_label3_Text" xml:space = "preserve"> <value> NUMBER: </value> </data>
<data name = "FrmBoardPutCom_btnCancel_Text" xml:space = "preserve"> <value> END </value> </data>
<data name = "FrmBoardPutCom_btnNext_Text" xml:space = "preserve"> <value> NEXT </value> </data>
<data name = "FrmBoardPutCom_btnPre_Text" xml:space = "preserve"> <value> PREVIOUS </value> </data>
<data name = "UploadFile" xml:space = "preserve"> <value> Please upload the program file </value> </data>
<data name = "CanotDelCom" xml:space = "preserve"> <value> The component is in use and cannot be deleted </value> </data>
<data name = "SureImportPosition" xml:space = "preserve"> <value> The component [{0}] is configured with multiple locations [{1}], whether it is determined to import ? </value> </data>
<data name = "ComExists" xml:space = "preserve"> <value> The component already exists </value> </data>
<data name = "SureImportPn" xml:space = "preserve"> <value> Location [{0}] Configure multiple components [{1}], determine whether to import? </value> </data>
<data name = "BLText" xml:space = "preserve"> <value> Program [{0}] component library [{1}] is preparing materials </value> </data>
<data name = "Move" xml:space = "preserve"> <value> moving </value> </data>
<data name = "Inplace" xml:space = "preserve"> <value> Already in place </value> </data>
<data name = "新增组装点" xml:space = "preserve"> <value> New assembly point </value> </data>
<data name = "FrmAddBoard_linkLabel1_Text" xml:space = "preserve"> <value> Select file </value> </data>
<data name = "FrmAddBoard_groupBoxSelCom_Text" xml:space = "preserve"> <value> Select position </value> </data>
<data name = "FrmAddBoard_likSelCsvFile_Text" xml:space = "preserve"> <value> Select file </value> </data>
<data name = "FrmAddBoard_likDownFile_Text" xml:space = "preserve"> <value>Template download</value> </data>
<data name = "FrmAddBoard_rdbUpload_Text" xml:space = "preserve"> <value> Uploader program </value> </data>
<data name = "FrmAddBoard_rdbSelCom_Text" xml:space = "preserve"> <value> Select position </value> </data>
</root>
\ No newline at end of file
......@@ -2431,4 +2431,32 @@
<data name = "FrmBoardSelect_chbWorkSingleStart_Text" xml:space = "preserve"> <value> 启用工作区检测开始工作 </value> </data>
<data name = "FrmPointInfo_lblName_Text" xml:space = "preserve"> <value> 投影文字: </value> </data>
<data name = "FrmBoardList_btnBeiliao_Text" xml:space = "preserve"> <value> 备料 </value> </data>
<data name = "FrmBoardPutCom_label2_Text" xml:space = "preserve"> <value> 物料编号: </value> </data>
<data name = "FrmBoardPutCom_btnSaveCount_Text" xml:space = "preserve"> <value> 保存数量 </value> </data>
<data name = "FrmBoardPutCom_label5_Text" xml:space = "preserve"> <value> 描述: </value> </data>
<data name = "FrmBoardPutCom_label4_Text" xml:space = "preserve"> <value> 位号: </value> </data>
<data name = "FrmBoardPutCom_label1_Text" xml:space = "preserve"> <value> 料盘位置: </value> </data>
<data name = "FrmBoardPutCom_label3_Text" xml:space = "preserve"> <value> 数量: </value> </data>
<data name = "FrmBoardPutCom_btnCancel_Text" xml:space = "preserve"> <value> 结束 </value> </data>
<data name = "FrmBoardPutCom_btnNext_Text" xml:space = "preserve"> <value> 下一个元器件 </value> </data>
<data name = "FrmBoardPutCom_btnPre_Text" xml:space = "preserve"> <value> 上一个元器件 </value> </data>
<data name = "UploadFile" xml:space = "preserve"> <value> 请上传程序文件 </value> </data>
<data name = "CanotDelCom" xml:space = "preserve"> <value> 元器件已使用,不能删除 </value> </data>
<data name = "SureImportPosition" xml:space = "preserve"> <value> 元器件【{0}】配置多个位置【{1}】,是否确定导入? </value> </data>
<data name = "ComExists" xml:space = "preserve"> <value> 元器件已存在 </value> </data>
<data name = "SureImportPn" xml:space = "preserve"> <value> 位置【{0}】配置多个元器件【{1}】,是否确定导入? </value> </data>
<data name = "BLText" xml:space = "preserve"> <value> 程序【{0}】元器件库【{1}】备料中 </value> </data>
<data name = "Move" xml:space = "preserve"> <value> 移动中 </value> </data>
<data name = "Inplace" xml:space = "preserve"> <value> 已到位 </value> </data>
<data name = "新增组装点" xml:space = "preserve"> <value> 新增组装点 </value> </data>
<data name = "FrmAddBoard_linkLabel1_Text" xml:space = "preserve"> <value> 选择文件 </value> </data>
<data name = "FrmAddBoard_groupBoxSelCom_Text" xml:space = "preserve"> <value> 请选择元器件库 </value> </data>
<data name = "FrmAddBoard_likSelCsvFile_Text" xml:space = "preserve"> <value> 选择文件 </value> </data>
<data name = "FrmAddBoard_likDownFile_Text" xml:space = "preserve"> <value> 下载模板 </value> </data>
<data name = "FrmAddBoard_rdbUpload_Text" xml:space = "preserve"> <value> 上传程序 </value> </data>
<data name = "FrmAddBoard_rdbSelCom_Text" xml:space = "preserve"> <value> 选择元器件库 </value> </data>
</root>
\ No newline at end of file
......@@ -189,14 +189,14 @@ namespace TSA_V
/// 请先输入元器件库名称
/// </summary>
public static string WriteCName = "WriteCName";
/// <summary>
/// 两个不同的元器件中都配置在库位【{0}】中,请检查文件
/// </summary>
public static string CheckFile = "CheckFile";
/// <summary>
/// 元器件【{0}】配置了两个位置【(1)】和【(2)】,是否确定导入?
/// </summary>
public static string SureImport = "SureImport";
///// <summary>
///// 两个不同的元器件中都配置在库位【{0}】中,请检查文件
///// </summary>
//public static string CheckFile = "CheckFile";
///// <summary>
///// 元器件【{0}】配置了两个位置【(1)】和【(2)】,是否确定导入?
///// </summary>
//public static string SureImport = "SureImport";
/// <summary>
/// 请选择正确的文件(文件格式可以通过下载模板获得)
/// </summary>
......@@ -722,6 +722,42 @@ namespace TSA_V
/// 调宽{0}={1}结束:{2}
/// </summary>
public static string ChangeWEnd = "ChangeWEnd";
/// <summary>
/// 请上传程序文件
/// </summary>
public static string UploadFile = "UploadFile";
/// <summary>
/// 元器件已使用,不能删除
/// </summary>
public static string CanotDelCom = "CanotDelCom";
/// <summary>
/// 元器件【{0}】配置多个位置【{1}】,是否确定导入?
/// </summary>
public static string SureImportPosition = "SureImportPosition";
/// <summary>
/// 元器件已存在
/// </summary>
internal static string ComExists= "ComExists";
/// <summary>
/// 移动中
/// </summary>
internal static string Move= "Move";
/// <summary>
/// 已到位
/// </summary>
internal static string Inplace= "Inplace";
/// <summary>
/// 位置【{0}】配置多个元器件【{1}】,是否确定导入?
/// </summary>
internal static readonly string SureImportPn= "SureImportPn";
/// <summary>
/// 程序【{0}】元器件库【{1}】备料中
/// </summary>
internal static readonly string BLText = "BLText";
}
}
......@@ -184,6 +184,12 @@
<Compile Include="FrmChangeWidth.Designer.cs">
<DependentUpon>FrmChangeWidth.cs</DependentUpon>
</Compile>
<Compile Include="FrmBoardPutCom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmBoardPutCom.Designer.cs">
<DependentUpon>FrmBoardPutCom.cs</DependentUpon>
</Compile>
<Compile Include="projector\FrmProjectorScreen.cs">
<SubType>Form</SubType>
</Compile>
......@@ -336,6 +342,9 @@
<EmbeddedResource Include="FrmChangeWidth.resx">
<DependentUpon>FrmChangeWidth.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmBoardPutCom.resx">
<DependentUpon>FrmBoardPutCom.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="projector\FrmProjectorScreen.resx">
<DependentUpon>FrmProjectorScreen.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -517,21 +517,14 @@ namespace TSA_V
{
return;
}
if (!smtPoint.pointName.Equals(""))
if (!smtPoint.PN.Equals(""))
{
lblPositionNum.Text = smtPoint.PositionNum;
lblPartNum.Text = smtPoint.PartNum;
lblPointName.Text = smtPoint.pointName;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint.PartNum);
TSAVPosition position = null;
if (com != null)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
}
else
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(smtPoint.PositionNum);
}
lblPartNum.Text = smtPoint.TagNo;
lblPointName.Text = smtPoint.PN;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint);
TSAVPosition position = CSVPositionReader<TSAVPosition >.GetPositonByNum(com.PositionNum);
if (position != null)
{
lblPositionNum.Text = position.PositionNum;
......@@ -539,7 +532,7 @@ namespace TSA_V
if (com != null)
{
lblComDes.Text = com.ComponentDes;
this.lblComName.Text = com.ComponentName;
this.lblComName.Text = com.PN;
lblCount.Text = com.ComCount.ToString();
txtCount.Text = com.ComCount.ToString();
lblComNotices.Text = com.Notes.ToString();
......@@ -754,7 +747,7 @@ namespace TSA_V
}
FrmProjectorScreen.instance.ShowPoint(true, smtPoint);
ComponetInfo com = CSVBomManager.GetCom(this.board.bomName, smtPoint.PartNum);
ComponetInfo com = CSVBomManager.GetCom(this.board.bomName, smtPoint);
TSAVPosition position = null;
if (com != null)
{
......@@ -839,12 +832,17 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DeviceNotOkMsg, "设备未连接!"));
return;
}
string comName = lblComName.Text;
if (smtPoint == null)
{
return;
}
//string comName = lblComName.Text;
int count = FormUtil.GetIntValue(txtCount);
string bomName = TSAVBean.Work.currBoard.bomName;
if (CSVBomManager.UpdateCount(bomName, comName, count))
if (CSVBomManager.UpdateCount(bomName, smtPoint, count))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.UpdateCNumOk, "元器件【{0}】的数量已更新为【{1}】", comName, count));
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.UpdateCNumOk, "元器件【{0}】的数量已更新为【{1}】", smtPoint.TagNo, count));
}
txtCount.Visible = false;
......
......@@ -186,7 +186,7 @@ namespace TSA_V
float y = (float)Math.Abs(weld.PositionY) * picBoard.Width / Width;
pointXMap.Add(weld.pointNum, x);
pointYMap.Add(weld.pointNum, y);
if (weld.PartNum.Equals(smtPoint.PartNum))
if (weld.TagNo.Equals(smtPoint.TagNo))
//if (prepareWeld && weld.pointName.Equals(smtPoint.pointName))
{
int lineLength = 12;
......
 20190802
20210926 新建分支:SO856-LineSmartWorkstation ,把元器件库导入和备料移到程序操作。
1.备料从程序中启动
2.位号被启用的设定为备料,位号禁用的默认不备料,元器件在同一库位的备料只显示第一个其余的跳过
3.新增程序可以直接导入程序,自动创建元器件库
4.导出导入程序时,包含图片和元器件库的导入导出。
5.工作时,需要减去转动位置的数量。
一.元器件备料在程序里设定备料
1位号被启用的设定为备料,位号禁用的默认不备料
2.元器件在同一库位的备料只显示第一个其余的跳过
3.上传程序时不需要上传元器件库,只上传程序
4.元器件库可以1对1也可1对多
5.在生产过程中以更改库位中元器件数量来备料
20190802
在分支Line-TSAV-Galvanometer的基础上拉 新分支:Line-TSAV-GAOI
增加AOI功能。
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!