Commit f1b1963e LN

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

1 个父辈 fe5fd0e4
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<Compile Include="csvLoad\position\CSVPositionReader.cs" /> <Compile Include="csvLoad\position\CSVPositionReader.cs" />
<Compile Include="csvLoad\position\PostionBase.cs" /> <Compile Include="csvLoad\position\PostionBase.cs" />
<Compile Include="csvLoad\position\TSAVPosition.cs" /> <Compile Include="csvLoad\position\TSAVPosition.cs" />
<Compile Include="csvLoad\CSVReaderManager.cs" /> <Compile Include="csvLoad\CSVBomManager.cs" />
<Compile Include="db.cs" /> <Compile Include="db.cs" />
<Compile Include="deviceLibrary\halcon\UsbCameraHDevelop.cs" /> <Compile Include="deviceLibrary\halcon\UsbCameraHDevelop.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" /> <Compile Include="deviceLibrary\IO\IOManager.cs" />
...@@ -120,20 +120,14 @@ ...@@ -120,20 +120,14 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="config\boardData.txt" /> <Content Include="config\boardData.txt" />
<None Include="config\componentData.txt" /> <Content Include="config\componentData.txt" />
<None Include="config\database.db3"> <Content Include="config\database.db3" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Content Include="config\user.sqlite3" />
</None>
<None Include="config\user.sqlite3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="config\image\defaultBoard.jpg"> <Content Include="config\image\defaultBoard.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="config\元器件信息模板.csv"> <Content Include="config\元器件信息模板.csv" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
...@@ -146,12 +140,8 @@ ...@@ -146,12 +140,8 @@
<None Include="config\componet\元器件库A.csv" /> <None Include="config\componet\元器件库A.csv" />
<None Include="config\componet\元器件库A_A.csv" /> <None Include="config\componet\元器件库A_A.csv" />
<None Include="config\componet\红外导入测试.csv" /> <None Include="config\componet\红外导入测试.csv" />
<None Include="config\Positions.csv"> <Content Include="config\Positions.csv" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Content Include="config\元器件信息模板-英文.csv" />
</None>
<None Include="config\元器件信息模板-英文.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="config\image\43.jpg"> <Content Include="config\image\43.jpg">
......
...@@ -7,6 +7,7 @@ using System.Linq; ...@@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
namespace TSA_V.DeviceLibrary namespace TSA_V.DeviceLibrary
{ {
...@@ -25,6 +26,7 @@ namespace TSA_V.DeviceLibrary ...@@ -25,6 +26,7 @@ namespace TSA_V.DeviceLibrary
} }
set { } set { }
} }
/// <summary> /// <summary>
/// 电路板ID /// 电路板ID
/// </summary> /// </summary>
...@@ -92,13 +94,29 @@ namespace TSA_V.DeviceLibrary ...@@ -92,13 +94,29 @@ namespace TSA_V.DeviceLibrary
public string AOIProName = ""; public string AOIProName = "";
public Image myImage = null; 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() public Image GetImage()
{ {
if (myImage == null) if (myImage == null)
{ {
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH); string imagePath = GetImgPath();
string imagePath = Application.StartupPath + "/" + path + "/" + imgName;
string defaultImg = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
if (imgName != null && File.Exists(imagePath)) if (imgName != null && File.Exists(imagePath))
{ {
System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath); System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath);
...@@ -130,22 +148,29 @@ namespace TSA_V.DeviceLibrary ...@@ -130,22 +148,29 @@ namespace TSA_V.DeviceLibrary
//return "电路板名称:" + boardName + ",长度:" + boardLength + ",宽度:" + boardWidth + ",组装信息数量:" + pointList.Count; //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() public string GetAoiFileName()
{ {
string path = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig)+AOIProName; string path = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig)+AOIProName;
return path; 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> /// <summary>
...@@ -157,7 +182,7 @@ namespace TSA_V.DeviceLibrary ...@@ -157,7 +182,7 @@ namespace TSA_V.DeviceLibrary
{ {
PositionNum = ""; PositionNum = "";
pointNum = 0; pointNum = 0;
pointName = ""; PN = "";
PositionX = 0; PositionX = 0;
PositionY = 0; PositionY = 0;
} }
...@@ -165,9 +190,9 @@ namespace TSA_V.DeviceLibrary ...@@ -165,9 +190,9 @@ namespace TSA_V.DeviceLibrary
int pointType=1,int pointSizex=1,int pointSizeY=1,int penWidth =2, int pointType=1,int pointSizex=1,int pointSizeY=1,int penWidth =2,
bool needs = false, bool needc = false, int sTemp = 0, double sTime = 0) bool needs = false, bool needc = false, int sTemp = 0, double sTime = 0)
{ {
this.PartNum = partNum; this.TagNo = partNum;
this.pointNum = num; this.pointNum = num;
this.pointName = name; this.PN = name;
this.PositionX = positionX; this.PositionX = positionX;
this.PositionY = positionY; this.PositionY = positionY;
this.PositionNum = PositionNum; this.PositionNum = PositionNum;
...@@ -186,22 +211,32 @@ namespace TSA_V.DeviceLibrary ...@@ -186,22 +211,32 @@ namespace TSA_V.DeviceLibrary
///组装信息编号 ///组装信息编号
/// </summary> /// </summary>
public int pointNum { get; set; } public int pointNum { get; set; }
/// <summary> /// <summary>
/// 编号,与元器件库中的编号一致,不可以修改,作为关联关系 /// 位号 原来的PartNum
/// </summary> /// </summary>
public string PartNum { get; set; } public string TagNo { get; set; }
/// <summary>
/// 物料编码 原来的pointName
/// </summary>
public string PN { get; set; }
/// <summary> /// <summary>
/// 料格的位置信息 ///已过时。 位号/编号,与元器件库中的编号一致,不可以修改,作为关联关系
/// </summary> /// </summary>
public string PositionNum { get; set; } public string PartNum { get; set; }
/// <summary> /// <summary>
///组装信息名字 ///已过时。物料编码/组装信息名字
/// </summary> /// </summary>
public string pointName { get; set; } public string pointName { get; set; }
/// <summary> /// <summary>
/// 料格的位置信息
/// </summary>
public string PositionNum { get; set; }
/// <summary>
/// 图片上显示的x坐标 /// 图片上显示的x坐标
/// </summary> /// </summary>
public double PositionX { get; set; } public double PositionX { get; set; }
...@@ -240,6 +275,7 @@ namespace TSA_V.DeviceLibrary ...@@ -240,6 +275,7 @@ namespace TSA_V.DeviceLibrary
/// 是否需要焊接 /// 是否需要焊接
/// </summary> /// </summary>
public bool NeedSoldering { get; set; } = false; public bool NeedSoldering { get; set; } = false;
/// <summary> /// <summary>
/// 焊接温度 /// 焊接温度
/// </summary> /// </summary>
...@@ -261,15 +297,15 @@ namespace TSA_V.DeviceLibrary ...@@ -261,15 +297,15 @@ namespace TSA_V.DeviceLibrary
public string ToCSVStr() public string ToCSVStr()
{ {
string spilt = ","; 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() public string GetDisplayStr()
{ {
string text = pointName; string text = PN;
if (BoardManager.PointDisplayType.Equals(1)) if (BoardManager.PointDisplayType.Equals(1))
{ {
text = PartNum; text = TagNo;
} }
return text; return text;
} }
...@@ -291,5 +327,12 @@ namespace TSA_V.DeviceLibrary ...@@ -291,5 +327,12 @@ namespace TSA_V.DeviceLibrary
/// 是否禁用,默认0 /// 是否禁用,默认0
/// </summary> /// </summary>
public bool Disable = false; public bool Disable = false;
/// <summary>
/// 导出导入程序时使用
/// </summary>
public ComponetInfo componet;
} }
} }
...@@ -81,12 +81,12 @@ namespace TSA_V.DeviceLibrary ...@@ -81,12 +81,12 @@ namespace TSA_V.DeviceLibrary
BoardInfo theBorad = BoardManager.getBoardByName(log.BoardName); BoardInfo theBorad = BoardManager.getBoardByName(log.BoardName);
if (theBorad != null) 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 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) if (list != null && list.Count > 0)
{ {
......
...@@ -22,15 +22,10 @@ namespace TSA_V.LoadCSVLibrary ...@@ -22,15 +22,10 @@ namespace TSA_V.LoadCSVLibrary
FieldName = fieldName; FieldName = fieldName;
this.FiledNames = filedNames; this.FiledNames = filedNames;
} }
public CSVAttribute(string fieldName,bool IsMust) //public CSVAttribute(string fieldName)
{ //{
this.IsMustHave = IsMust; // FieldName = fieldName;
FieldName = fieldName; //}
}
public CSVAttribute(string fieldName)
{
FieldName = fieldName;
}
public string[] FiledNames { get; set; } public string[] FiledNames { get; set; }
public string FieldName { get; set; } public string FieldName { get; set; }
......
...@@ -17,13 +17,13 @@ namespace TSA_V.LoadCSVLibrary ...@@ -17,13 +17,13 @@ namespace TSA_V.LoadCSVLibrary
/// <summary> /// <summary>
/// 所有的位置集合,key=位置 /// 所有的位置集合,key=位置
/// </summary> /// </summary>
public static Dictionary<string, Dictionary<string, ComponetInfo>> allComMap = new Dictionary<string, Dictionary<string, ComponetInfo>>(); public static Dictionary<string, List< ComponetInfo>> allComMap = new Dictionary<string, List<ComponetInfo>>();
public static List<ComponetInfo> GetComList(string bomName) public static List<ComponetInfo> GetComList(string bomName)
{ {
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
return new List<ComponetInfo>(allComMap[bomName].Values); return new List<ComponetInfo>(allComMap[bomName] );
} }
else else
{ {
...@@ -31,23 +31,26 @@ namespace TSA_V.LoadCSVLibrary ...@@ -31,23 +31,26 @@ namespace TSA_V.LoadCSVLibrary
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
List<ComponetInfo> list = ReadFile(fileName); List<ComponetInfo> list = ReadFile(fileName);
allComMap.Add(bomName, list);
Dictionary<string, ComponetInfo> map = new Dictionary<string, ComponetInfo>();
foreach (ComponetInfo com in list)
{
map.Add(com.PartNum, com);
}
allComMap.Add(bomName, map);
return list; return list;
} }
} }
return null; return null;
} }
public static bool BomNameIsExists(string bomName)
{
if (allComMap.ContainsKey(bomName))
{
return true;
}
return false;
}
public static void LoadAllCom() public static void LoadAllCom()
{ {
allComMap = new Dictionary<string, Dictionary<string, ComponetInfo>>(); allComMap = new Dictionary<string, List<ComponetInfo>>();
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string filePath = appPath + ConfigAppSettings.GetValue(Setting_Init.ComPath_Config); string filePath = appPath + ConfigAppSettings.GetValue(Setting_Init.ComPath_Config);
if (!Directory.Exists(filePath)) if (!Directory.Exists(filePath))
...@@ -56,46 +59,33 @@ namespace TSA_V.LoadCSVLibrary ...@@ -56,46 +59,33 @@ namespace TSA_V.LoadCSVLibrary
} }
//加载所有数据 //加载所有数据
string[] fileList = Directory.GetFiles(filePath); string[] fileList = Directory.GetFiles(filePath);
if (fileList.Length > 0) if (fileList.Length <= 0)
{ {
return;
}
foreach (string fileName in fileList) foreach (string fileName in fileList)
{ {
try { try
{
string extension = Path.GetExtension(fileName); //-->.xml string extension = Path.GetExtension(fileName); //-->.xml
if (extension.ToLower().Equals(".csv")) if (extension.ToLower().Equals(".csv"))
{ {
string bomName = Path.GetFileNameWithoutExtension(fileName); //-->BenXHCMS string bomName = Path.GetFileNameWithoutExtension(fileName); //-->BenXHCMS
List<ComponetInfo> list = ReadFile(fileName); List<ComponetInfo> list = ReadFile(fileName);
Dictionary<string, ComponetInfo> map = new Dictionary<string, ComponetInfo>(); if (list.Count > 0)
foreach (ComponetInfo com in list)
{
if (com == null||com.PartNum==null||com.PositionNum==null)
{ {
continue; allComMap.Add(bomName, list);
}
if (map.ContainsKey(com.PartNum))
{
LogUtil.error("元器件库【" + bomName + "】【" + com.PartNum + "】重复");
} }
else
{
map.Add(com.PartNum, com);
} }
} }
if (map.Count > 0) catch (Exception ex)
{
allComMap.Add(bomName, map);
}
}
}catch(Exception ex)
{ {
LogUtil.error("加载出错:"+ex.ToString()); LogUtil.error("加载出错:" + ex.ToString());
}
} }
} }
} }
public static string getFilePath(string bomName) private static string getFilePath(string bomName)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string filePath = appPath + ConfigAppSettings.GetValue(Setting_Init.ComPath_Config); string filePath = appPath + ConfigAppSettings.GetValue(Setting_Init.ComPath_Config);
...@@ -118,7 +108,6 @@ namespace TSA_V.LoadCSVLibrary ...@@ -118,7 +108,6 @@ namespace TSA_V.LoadCSVLibrary
string[] lines = ReadCSVFile(filePath); string[] lines = ReadCSVFile(filePath);
int index = 0; int index = 0;
Dictionary<string, int> propIndexMap = new Dictionary<string, int>(); Dictionary<string, int> propIndexMap = new Dictionary<string, int>();
foreach (var line in lines) foreach (var line in lines)
{ {
var array = line.Split(Spilt_Char); var array = line.Split(Spilt_Char);
...@@ -132,10 +121,10 @@ namespace TSA_V.LoadCSVLibrary ...@@ -132,10 +121,10 @@ namespace TSA_V.LoadCSVLibrary
{ {
if (array.Length >= propIndexMap.Count) if (array.Length >= propIndexMap.Count)
{ {
if (array.Length > 0 && array[0].Equals("")) //if (array.Length > 0 && array[0].Equals(""))
{ //{
continue; // continue;
} //}
var bllIns = type.Assembly.CreateInstance(type.FullName); var bllIns = type.Assembly.CreateInstance(type.FullName);
//取得属性集合 //取得属性集合
PropertyInfo[] props = type.GetProperties(); PropertyInfo[] props = type.GetProperties();
...@@ -164,7 +153,15 @@ namespace TSA_V.LoadCSVLibrary ...@@ -164,7 +153,15 @@ namespace TSA_V.LoadCSVLibrary
} }
listIndex++; listIndex++;
} }
comList.Add((ComponetInfo)bllIns); ComponetInfo com = (ComponetInfo)bllIns;
com.Id = index + 1;
com.PositionNum = GetPositionNum(com.PositionNum);
if (String.IsNullOrEmpty(com.PositionNum) || String.IsNullOrEmpty(com.PN))
{
LOGGER.Error("读取csv,index=" + index + ",数据不完整,跳过数据,line=" + line);
continue;
}
comList.Add(com);
} }
else else
{ {
...@@ -178,33 +175,44 @@ namespace TSA_V.LoadCSVLibrary ...@@ -178,33 +175,44 @@ namespace TSA_V.LoadCSVLibrary
} }
index++; index++;
} }
return comList; return comList;
} }
public static string GetPositionNum(string configPosition )
{
TSAVPosition p = CSVPositionReader<TSAVPosition>.GetPositonByNum(configPosition);
if (p != null)
{
return p.PositionNum;
}
return "";
}
public static bool UpdateComponet(string bomName, ComponetInfo com) public static bool UpdateComponet(string bomName, ComponetInfo com)
{ {
if (!allComMap.ContainsKey(bomName)) if (!allComMap.ContainsKey(bomName))
{ {
return false; return false;
} }
Dictionary<string, ComponetInfo> oldMap = allComMap[bomName]; List<ComponetInfo> oldList = allComMap[bomName];
if (oldMap.ContainsKey(com.PartNum)) for (int index = 0; index < oldList.Count; index++)
{ {
oldMap[com.PartNum] = com; if (oldList[index].IsSameCom(com))
{
oldList[index] = com;
break;
}
} }
if (SaveComponet(bomName, new List<ComponetInfo>(oldMap.Values))) if (SaveBomToFile(bomName, oldList))
{ {
allComMap[bomName] = oldMap; allComMap[bomName] = oldList;
return true;
} }
else
{
return false; return false;
} }
return true;
}
public static bool SaveComponet(string bomName, List<ComponetInfo> positionList) public static bool SaveBomToFile(string bomName, List<ComponetInfo> positionList)
{ {
string filePath = getFilePath(bomName); string filePath = getFilePath(bomName);
System.Type type = typeof(ComponetInfo); System.Type type = typeof(ComponetInfo);
...@@ -253,6 +261,8 @@ namespace TSA_V.LoadCSVLibrary ...@@ -253,6 +261,8 @@ namespace TSA_V.LoadCSVLibrary
return WriteCSVFile(filePath, lines); return WriteCSVFile(filePath, lines);
} }
private static string ObjToString(ComponetInfo position, Dictionary<string, int> propIndexMap) private static string ObjToString(ComponetInfo position, Dictionary<string, int> propIndexMap)
{ {
//取得属性集合 //取得属性集合
...@@ -274,24 +284,12 @@ namespace TSA_V.LoadCSVLibrary ...@@ -274,24 +284,12 @@ namespace TSA_V.LoadCSVLibrary
string newStr = ""; string newStr = "";
foreach (string str in array) foreach (string str in array)
{ {
if (newStr.Equals("")) newStr += str + Spilt_Char;
{
newStr = str;
}
else
{
newStr = newStr + Spilt_Char + str;
}
} }
return newStr; return newStr;
} }
public static bool AddBom(string bomName, List<ComponetInfo> comList)
/// <summary>
/// 增加一个元器件库
/// </summary>
public static bool AddBomList(string bomName, List<ComponetInfo> comList)
{ {
try try
{ {
...@@ -303,13 +301,9 @@ namespace TSA_V.LoadCSVLibrary ...@@ -303,13 +301,9 @@ namespace TSA_V.LoadCSVLibrary
File.Delete(filePath); File.Delete(filePath);
LogUtil.error("新增元器件库:" + bomName + ",发现文件【" + filePath + "】已存在,删除原来的文件"); LogUtil.error("新增元器件库:" + bomName + ",发现文件【" + filePath + "】已存在,删除原来的文件");
} }
Dictionary<string, ComponetInfo> map = new Dictionary<string, ComponetInfo>();
foreach (ComponetInfo com in comList) allComMap.Add(bomName, comList);
{ return SaveBomToFile(bomName, comList);
map.Add(com.PartNum, com);
}
allComMap.Add(bomName, map);
return SaveComponet(bomName, comList);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -320,7 +314,6 @@ namespace TSA_V.LoadCSVLibrary ...@@ -320,7 +314,6 @@ namespace TSA_V.LoadCSVLibrary
public static void RemoveBom(string bomName) public static void RemoveBom(string bomName)
{ {
string fileName = getFilePath(bomName); string fileName = getFilePath(bomName);
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
...@@ -332,82 +325,151 @@ namespace TSA_V.LoadCSVLibrary ...@@ -332,82 +325,151 @@ namespace TSA_V.LoadCSVLibrary
} }
} }
public static bool RemoveCom(string bomName, ComponetInfo obj) public static List<ComponetInfo> RemoveCom(string bomName, ComponetInfo obj)
{ {
string fileName = getFilePath(bomName); string fileName = getFilePath(bomName);
File.Delete(bomName); File.Delete(bomName);
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
Dictionary<string, ComponetInfo> map = allComMap[bomName]; int delIndex = -1;
map.Remove(obj.PartNum); List<ComponetInfo> list = allComMap[bomName];
List<ComponetInfo> newList = new List<ComponetInfo>(map.Values); for (int index = 0; index < list.Count; index++)
AddBomList(bomName, newList); {
return true; if (list[index].IsSameCom(obj))
{
delIndex = index;
break;
}
} }
if (delIndex >= 0)
{
list.RemoveAt(delIndex);
for (int i = 0; i < list.Count; i++)
{
list[i].Id = i + 1;
}
AddBom(bomName, list);
}
return list;
return false;
} }
public static bool AddCom(string bomName, ComponetInfo obj)
return null;
}
public static List<ComponetInfo> AddCom(string bomName, ComponetInfo obj)
{ {
string fileName = getFilePath(bomName); string fileName = getFilePath(bomName);
File.Delete(bomName); File.Delete(bomName);
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
Dictionary<string, ComponetInfo> map = allComMap[bomName]; List<ComponetInfo> list = allComMap[bomName];
map.Add (obj.PartNum, obj); list.Add(obj);
List<ComponetInfo> newList = new List<ComponetInfo>(map.Values); for(int i = 0; i < list.Count; i++)
AddBomList(bomName, newList); {
LogUtil.info($"元器件库[{bomName}]新增元器件[{obj.PartNum}-{obj.ComponentName}]"); list[i].Id = i + 1;
}
AddBom(bomName, list);
LogUtil.info($"元器件库[{bomName}]新增元器件[{obj.TagNo}-{obj.PN}]");
//更新此元器件库对应的程序 ////更新此元器件库对应的程序
BoardManager.AddCom(bomName, obj); //BoardManager.AddCom(bomName, obj);
return true; return list;
} }
return false; return null;
} }
public static ComponetInfo GetCom(string bomName, string partNum) public static ComponetInfo GetCom(string bomName, SMTPointInfo pointInfo)
{ {
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
Dictionary<string, ComponetInfo> map = allComMap[bomName]; List<ComponetInfo> map = allComMap[bomName];
if (map.ContainsKey(partNum)) foreach (ComponetInfo obj in map)
{
if (obj.IsSameCom(pointInfo))
{
return obj;
}
}
foreach (ComponetInfo obj in map)
{
if (obj.PN.Equals(pointInfo.PN))
{
return obj;
}
}
}
return null;
}
public static bool canRemoveCom(string bomName, ComponetInfo obj)
{
List<ComponetInfo> list = CSVBomManager.GetComList(bomName);
//已使用的元器件不能删除
foreach (BoardInfo board in BoardManager.boardList)
{ {
return map[partNum]; if (board.bomName.Equals(bomName))
{
foreach (SMTPointInfo p in board.smtList)
{
if ((!String.IsNullOrEmpty(obj.TagNo)))
{
if (p.TagNo.Equals(obj.TagNo))
{
return false;
}
}
else if (p.PN.Equals(obj.PN))
{
List<ComponetInfo> pnlist = (from m in list where m.Id != obj.Id && m.PN.Equals(p.PN) select m).ToList();
if (pnlist.Count <= 0)
{
return false;
}
} }
} return null; }
}
}
return true;
} }
/// <summary> /// <summary>
/// 更新元器件数量 /// 更新元器件数量,优先用位号查找,未找到时用Pn查找
/// </summary> /// </summary>
public static bool UpdateCount(string bomName, string comName, int count) public static bool UpdateCount(string bomName, SMTPointInfo smtPoint, int count)
{ {
List<ComponetInfo> comList = CSVBomManager.GetComList(bomName); List<ComponetInfo> comList = CSVBomManager.GetComList(bomName);
if (comList == null) if (comList == null)
{ {
return false; return false;
} }
List<ComponetInfo> newList = new List<ComponetInfo>();
foreach (ComponetInfo obj in comList) bool updateOk = false;
for(int i=0;i<comList.Count;i++)
{ {
if (obj.ComponentName.Equals(comName)) if (comList[i].IsSameCom(smtPoint))
{ {
obj.ComCount = count; comList[i].ComCount = count;
if (allComMap.ContainsKey(bomName)) updateOk = true;
break;
}
}
if (!updateOk)
{ {
if (allComMap[bomName].ContainsKey(obj.PartNum)) for (int i = 0; i < comList.Count; i++)
{ {
allComMap[bomName][obj.PartNum] = obj; if (comList[i].PN.Equals(smtPoint.PN))
} {
comList[i].ComCount = count;
updateOk = true;
break;
} }
} }
newList.Add(obj);
} }
CSVBomManager.SaveComponet(bomName, newList); CSVBomManager.SaveBomToFile(bomName, comList);
return true; return true;
} }
/// <summary> /// <summary>
...@@ -433,44 +495,82 @@ namespace TSA_V.LoadCSVLibrary ...@@ -433,44 +495,82 @@ namespace TSA_V.LoadCSVLibrary
{ {
break; break;
} }
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smt.PartNum); ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smt);
if (useCount.ContainsKey(com.ComponentName)) if (useCount.ContainsKey(com.PN))
{ {
useCount[com.ComponentName]++; useCount[com.PN]++;
} }
else else
{ {
useCount.Add(com.ComponentName, 1); useCount.Add(com.PN, 1);
} }
index++; index++;
} }
List<ComponetInfo> newList = new List<ComponetInfo>(); List<ComponetInfo> newList = new List<ComponetInfo>();
foreach (ComponetInfo obj in comList) foreach (ComponetInfo obj in comList)
{ {
if (useCount.ContainsKey(obj.ComponentName)) if (useCount.ContainsKey(obj.PN))
{ {
obj.ComCount = obj.ComCount - useCount[obj.ComponentName]; obj.ComCount = obj.ComCount - useCount[obj.PN];
if (obj.ComCount < 0) if (obj.ComCount < 0)
{ {
obj.ComCount = 0; obj.ComCount = 0;
} }
} }
newList.Add(obj); newList.Add(obj);
if(allComMap.ContainsKey(bomName))
{
if (allComMap[bomName].ContainsKey(obj.PartNum))
{
allComMap[bomName][obj.PartNum] = obj;
}
} }
if (allComMap.ContainsKey(bomName))
{
allComMap[bomName] = newList;
} }
CSVBomManager.SaveBomToFile(bomName, newList);
CSVBomManager.SaveComponet(bomName, newList);
}catch(Exception ex) }catch(Exception ex)
{ {
} }
return true; return true;
} }
public static string AutoAddBomList(string bomName, List<ComponetInfo> comList)
{
string newBomName = bomName;
//自动新增元器件库
if (CSVBomManager.BomNameIsExists(bomName))
{
bomName = bomName + DateTime.Now.ToString("-MM-dd-HH-mm-ss");
if (CSVBomManager.BomNameIsExists(bomName))
{
for (int i = 1; i <= 100; i++)
{
string testName = bomName + "-" + i;
if (!CSVBomManager.BomNameIsExists(testName))
{
bomName = testName;
break;
}
}
}
}
Dictionary<string, ComponetInfo> comMap = new Dictionary<string, ComponetInfo>();
foreach (ComponetInfo obj in comList)
{
string key = obj.PN + "-" + obj.PositionNum;
if (comMap.ContainsKey(key))
{
continue;
}
obj.TagNo = "";
comMap.Add(key, obj);
}
List<ComponetInfo> list = new List<ComponetInfo>(comMap.Values);
for (int i = 0; i < list.Count; i++)
{
list[i].Id = i + 1;
}
CSVBomManager.AddBom(bomName, list);
return bomName;
}
} }
} }
...@@ -258,7 +258,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -258,7 +258,7 @@ namespace TSA_V.LoadCSVLibrary
} }
foreach (T p in allPositionMap.Values) foreach (T p in allPositionMap.Values)
{ {
if (p.PositionNum.ToString().Equals(positionNum)) if (p.PositionNo.ToString().Equals(positionNum))
{ {
return p; return p;
} }
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
namespace TSA_V.LoadCSVLibrary namespace TSA_V.LoadCSVLibrary
...@@ -16,17 +17,20 @@ namespace TSA_V.LoadCSVLibrary ...@@ -16,17 +17,20 @@ namespace TSA_V.LoadCSVLibrary
Notes = ""; Notes = "";
ComponentDes = ""; ComponentDes = "";
} }
public int Id { get; set; }
/// <summary> /// <summary>
///编号 ///位号/编号
/// </summary> /// </summary>
[CSVAttribute("Num", true,"位号", "编号")] [CSVAttribute("Num", true,"位号", "编号")]
public string PartNum { get; set; } public string TagNo { get; set; }
/// <summary> /// <summary>
/// 元器件名称 /// 物料编码/元器件名称
/// </summary> /// </summary>
[CSVAttribute("Code", true, "物料编码", "元器件名称", "Name")] [CSVAttribute("Code", true, "物料编码", "元器件名称", "Name")]
public string ComponentName { get; set; } public string PN { get; set; }
/// <summary> /// <summary>
///元器件描述 ///元器件描述
/// </summary> /// </summary>
...@@ -64,7 +68,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -64,7 +68,7 @@ namespace TSA_V.LoadCSVLibrary
public string Notes { get; set; } public string Notes { get; set; }
public int GetPosition() public int GetSortPosition()
{ {
try try
{ {
...@@ -75,5 +79,43 @@ namespace TSA_V.LoadCSVLibrary ...@@ -75,5 +79,43 @@ namespace TSA_V.LoadCSVLibrary
} }
return 0; 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 ...@@ -23,10 +23,10 @@ namespace TSA_V.LoadCSVLibrary
/// </summary> /// </summary>
[CSVAttribute("位置编号")] [CSVAttribute("位置编号")]
public string PositionNum{ get; set; } public string PositionNum{ get; set; }
///// <summary> /// <summary>
/////元器件 ///对应号码
///// </summary> /// </summary>
//[CSVAttribute("元器件")] [CSVAttribute("对应号码")]
//public int ComponentId { get; set; } public int PositionNo { get; set; }
} }
} }
...@@ -5,11 +5,7 @@ using TSA_V.DeviceLibrary; ...@@ -5,11 +5,7 @@ using TSA_V.DeviceLibrary;
namespace TSA_V.LoadCSVLibrary namespace TSA_V.LoadCSVLibrary
{ {
public class TSAVPosition : PostionBase public class TSAVPosition : PostionBase
{ /// <summary> {
///对应号码
/// </summary>
[CSVAttribute("对应号码")]
public int PositionNo { get; set; }
/// <summary> /// <summary>
///旋转位置 ///旋转位置
/// </summary> /// </summary>
......
...@@ -10,6 +10,7 @@ using System.Text; ...@@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
using System.Drawing.Imaging;
namespace TSA_V.DeviceLibrary namespace TSA_V.DeviceLibrary
{ {
...@@ -53,6 +54,8 @@ namespace TSA_V.DeviceLibrary ...@@ -53,6 +54,8 @@ namespace TSA_V.DeviceLibrary
boardList = new List<BoardInfo>(); boardList = new List<BoardInfo>();
List<int> idList = new List<int>(); List<int> idList = new List<int>();
List<string> nameList = new List<string>(); List<string> nameList = new List<string>();
bool needSave = false;
foreach (string str in lines) foreach (string str in lines)
{ {
try try
...@@ -68,19 +71,27 @@ namespace TSA_V.DeviceLibrary ...@@ -68,19 +71,27 @@ namespace TSA_V.DeviceLibrary
{ {
if (board.smtList == null) if (board.smtList == null)
{ {
needSave = true;
board.smtList = new List<SMTPointInfo>(); board.smtList = new List<SMTPointInfo>();
} }
foreach (SMTPointInfo sm in board.smtList) 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) if (board.boardId > MaxId)
{ {
needSave = true;
MaxId = board.boardId; MaxId = board.boardId;
} }
if (idList.Contains(board.boardId)) if (idList.Contains(board.boardId))
...@@ -93,6 +104,7 @@ namespace TSA_V.DeviceLibrary ...@@ -93,6 +104,7 @@ namespace TSA_V.DeviceLibrary
} }
if (board.AOIProName.Equals("")) if (board.AOIProName.Equals(""))
{ {
needSave = true;
board.AOIProName = board.boardName + ".data"; board.AOIProName = board.boardName + ".data";
} }
idList.Add(board.boardId); idList.Add(board.boardId);
...@@ -100,10 +112,12 @@ namespace TSA_V.DeviceLibrary ...@@ -100,10 +112,12 @@ namespace TSA_V.DeviceLibrary
if (board.orgType == 0) if (board.orgType == 0)
{ {
needSave = true;
board.orgType = 1; board.orgType = 1;
} }
if (board.LineWidth <= 0) if (board.LineWidth <= 0)
{ {
needSave = true;
board.LineWidth = board.boardWidth; board.LineWidth = board.boardWidth;
} }
boardList.Add(board); boardList.Add(board);
...@@ -127,6 +141,12 @@ namespace TSA_V.DeviceLibrary ...@@ -127,6 +141,12 @@ namespace TSA_V.DeviceLibrary
{ {
LogUtil.error("未找到默认图片:" + imagePath); LogUtil.error("未找到默认图片:" + imagePath);
} }
if (needSave)
{
SaveListToFile(boardList);
LogUtil.info("保存程序集合到文件");
}
} }
public static void Update(BoardInfo board) public static void Update(BoardInfo board)
{ {
...@@ -151,6 +171,81 @@ namespace TSA_V.DeviceLibrary ...@@ -151,6 +171,81 @@ namespace TSA_V.DeviceLibrary
SaveListToFile(boardList); 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) private static bool SaveListToFile(List<BoardInfo> list)
{ {
string[] lines = new string[boardList.Count]; string[] lines = new string[boardList.Count];
...@@ -354,23 +449,90 @@ namespace TSA_V.DeviceLibrary ...@@ -354,23 +449,90 @@ namespace TSA_V.DeviceLibrary
/// </summary> /// </summary>
/// <param name="bomName"></param> /// <param name="bomName"></param>
/// <param name="obj"></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(); try
foreach (BoardInfo board in list)
{ {
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 ...@@ -205,7 +205,7 @@ namespace TSA_V.DeviceLibrary
currPoint = GetSmtList()[currIndex]; currPoint = GetSmtList()[currIndex];
//LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】"); //LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】");
ComponetInfo com = CSVBomManager.GetCom(currBoard.bomName, currPoint.PartNum); ComponetInfo com = CSVBomManager.GetCom(currBoard.bomName, currPoint);
TSAVPosition position = null; TSAVPosition position = null;
if (com != null) if (com != null)
{ {
...@@ -217,7 +217,7 @@ namespace TSA_V.DeviceLibrary ...@@ -217,7 +217,7 @@ namespace TSA_V.DeviceLibrary
} }
if (position == null) if (position == null)
{ {
LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】未找到对应的元器件"); LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.PN + "】未找到对应的元器件");
} }
else else
{ {
...@@ -226,7 +226,7 @@ namespace TSA_V.DeviceLibrary ...@@ -226,7 +226,7 @@ namespace TSA_V.DeviceLibrary
//插件机工作 //插件机工作
if (WorkType.Equals(1)) 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); MoveToBag(position);
...@@ -245,7 +245,7 @@ namespace TSA_V.DeviceLibrary ...@@ -245,7 +245,7 @@ namespace TSA_V.DeviceLibrary
BoardCount++; BoardCount++;
} }
int temp = currPoint.WeldTemp; int temp = currPoint.WeldTemp;
LogUtil.info(" 程序【" + currBoard.boardName + "】焊接【" + currPoint.pointName + "】,温度【" + temp + "】"); LogUtil.info(" 程序【" + currBoard.boardName + "】焊接【" + currPoint.PN + "】,温度【" + temp + "】");
} }
else if (WorkType.Equals(3)) else if (WorkType.Equals(3))
...@@ -255,7 +255,7 @@ namespace TSA_V.DeviceLibrary ...@@ -255,7 +255,7 @@ namespace TSA_V.DeviceLibrary
BoardCount++; BoardCount++;
} }
int temp = currPoint.WeldTemp; int temp = currPoint.WeldTemp;
LogUtil.info(" 程序【" + currBoard.boardName + "】检测【" + currPoint.pointName + "】"); LogUtil.info(" 程序【" + currBoard.boardName + "】检测【" + currPoint.PN + "】");
} }
} }
} }
...@@ -268,12 +268,12 @@ namespace TSA_V.DeviceLibrary ...@@ -268,12 +268,12 @@ namespace TSA_V.DeviceLibrary
if (TSAVBean.IsValidPosition(currPoint.NodePositionX, currPoint.NodePositionY)) if (TSAVBean.IsValidPosition(currPoint.NodePositionX, currPoint.NodePositionY))
{ {
//LogUtil.info(" 程序【" + currBoard.boardName + "】插件【" + currPoint.pointName + "】,X轴【" + currPoint.NodePositionX + "】,Y轴【" + 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)); waitList.Add(WaitResultInfo.WaitTime(1000));
} }
else 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 ...@@ -80,7 +80,7 @@ namespace TSA_V.DeviceLibrary
{ {
break; break;
} }
op.pointList.Add(new OpPointInfo(sm.PartNum, sm.pointName)); op.pointList.Add(new OpPointInfo(sm.TagNo, sm.PN));
index++; index++;
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</configSections> </configSections>
<appSettings> <appSettings>
<!--开机自动运行--> <!--开机自动运行-->
<add key="App_AutoRun" value="0" /> <add key="App_AutoRun" value="1" />
<add key="CodeRun" value="0" /> <add key="CodeRun" value="0" />
<add key="IsDebug" value="1" /> <add key="IsDebug" value="1" />
<add key="IsNeedCount" value="1" /> <add key="IsNeedCount" value="1" />
......
...@@ -73,7 +73,7 @@ namespace TSA_V ...@@ -73,7 +73,7 @@ namespace TSA_V
//smtPoint.PointSize = 4; //smtPoint.PointSize = 4;
//smtPoint.NodePositionX = BPoint.NodePositionX - (BPoint.NodePositionX - APoint.NodePositionX) * (BPoint.PositionX - smtPoint.PositionX) / (BPoint.PositionX - APoint.PositionX); //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); //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; return smtPoint;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialogImg = new System.Windows.Forms.OpenFileDialog();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.txtCode = new System.Windows.Forms.TextBox(); this.txtCode = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
...@@ -51,11 +51,20 @@ ...@@ -51,11 +51,20 @@
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.cmbOrgType = new System.Windows.Forms.ComboBox(); this.cmbOrgType = new System.Windows.Forms.ComboBox();
this.xyMoveControl1 = new UserFromControl.ProjectorControl();
this.chbSort = new System.Windows.Forms.CheckBox(); this.chbSort = new System.Windows.Forms.CheckBox();
this.lblWidth = new System.Windows.Forms.Label(); this.lblWidth = new System.Windows.Forms.Label();
this.txtLineWidth = new System.Windows.Forms.TextBox(); this.txtLineWidth = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.txtCsvFileName = new System.Windows.Forms.TextBox();
this.groupBoxSelCom = new System.Windows.Forms.GroupBox();
this.likSelCsvFile = new System.Windows.Forms.LinkLabel();
this.likDownFile = new System.Windows.Forms.LinkLabel();
this.rdbUpload = new System.Windows.Forms.RadioButton();
this.rdbSelCom = new System.Windows.Forms.RadioButton();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.xyMoveControl1 = new UserFromControl.ProjectorControl();
this.openFileDialogCsv = new System.Windows.Forms.OpenFileDialog();
this.groupBoxSelCom.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
...@@ -65,29 +74,28 @@ ...@@ -65,29 +74,28 @@
// //
// txtCode // txtCode
// //
this.txtCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtCode.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCode.Location = new System.Drawing.Point(144, 60); this.txtCode.Location = new System.Drawing.Point(177, 60);
this.txtCode.MaxLength = 40; this.txtCode.MaxLength = 40;
this.txtCode.Name = "txtCode"; this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(220, 29); this.txtCode.Size = new System.Drawing.Size(220, 26);
this.txtCode.TabIndex = 5; this.txtCode.TabIndex = 5;
// //
// label6 // label6
// //
this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(43, 62); this.label6.Location = new System.Drawing.Point(14, 64);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(97, 20); this.label6.Size = new System.Drawing.Size(158, 20);
this.label6.TabIndex = 286; this.label6.TabIndex = 286;
this.label6.Text = "条码:"; this.label6.Text = "条码:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(392, 641); this.btnCancel.Location = new System.Drawing.Point(476, 631);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(120, 45); this.btnCancel.Size = new System.Drawing.Size(120, 45);
this.btnCancel.TabIndex = 285; this.btnCancel.TabIndex = 285;
...@@ -97,10 +105,9 @@ ...@@ -97,10 +105,9 @@
// //
// btnStart // btnStart
// //
this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnStart.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnStart.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStart.Location = new System.Drawing.Point(258, 641); this.btnStart.Location = new System.Drawing.Point(347, 631);
this.btnStart.Name = "btnStart"; this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(120, 45); this.btnStart.Size = new System.Drawing.Size(120, 45);
this.btnStart.TabIndex = 284; this.btnStart.TabIndex = 284;
...@@ -110,10 +117,9 @@ ...@@ -110,10 +117,9 @@
// //
// btnSave // btnSave
// //
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(120, 641); this.btnSave.Location = new System.Drawing.Point(218, 631);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(120, 45); this.btnSave.Size = new System.Drawing.Size(120, 45);
this.btnSave.TabIndex = 283; this.btnSave.TabIndex = 283;
...@@ -124,9 +130,9 @@ ...@@ -124,9 +130,9 @@
// label5 // label5
// //
this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(390, 23); this.label5.Location = new System.Drawing.Point(400, 23);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(97, 20); this.label5.Size = new System.Drawing.Size(124, 20);
this.label5.TabIndex = 282; this.label5.TabIndex = 282;
this.label5.Text = "宽度↑:"; this.label5.Text = "宽度↑:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
...@@ -134,36 +140,36 @@ ...@@ -134,36 +140,36 @@
// label4 // label4
// //
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(407, 63); this.label4.Location = new System.Drawing.Point(400, 63);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 20); this.label4.Size = new System.Drawing.Size(124, 20);
this.label4.TabIndex = 281; this.label4.TabIndex = 281;
this.label4.Text = "长度→:"; this.label4.Text = "长度→:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtBoardL // txtBoardL
// //
this.txtBoardL.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtBoardL.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtBoardL.Location = new System.Drawing.Point(493, 60); this.txtBoardL.Location = new System.Drawing.Point(526, 60);
this.txtBoardL.MaxLength = 8; this.txtBoardL.MaxLength = 8;
this.txtBoardL.Name = "txtBoardL"; this.txtBoardL.Name = "txtBoardL";
this.txtBoardL.Size = new System.Drawing.Size(70, 29); this.txtBoardL.Size = new System.Drawing.Size(70, 26);
this.txtBoardL.TabIndex = 278; this.txtBoardL.TabIndex = 278;
// //
// txtBoardW // txtBoardW
// //
this.txtBoardW.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtBoardW.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtBoardW.Location = new System.Drawing.Point(493, 21); this.txtBoardW.Location = new System.Drawing.Point(526, 21);
this.txtBoardW.MaxLength = 8; this.txtBoardW.MaxLength = 8;
this.txtBoardW.Name = "txtBoardW"; this.txtBoardW.Name = "txtBoardW";
this.txtBoardW.Size = new System.Drawing.Size(70, 29); this.txtBoardW.Size = new System.Drawing.Size(70, 26);
this.txtBoardW.TabIndex = 277; this.txtBoardW.TabIndex = 277;
// //
// label25 // label25
// //
this.label25.AutoSize = true; this.label25.AutoSize = true;
this.label25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label25.Location = new System.Drawing.Point(570, 63); this.label25.Location = new System.Drawing.Point(603, 63);
this.label25.Name = "label25"; this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(30, 17); this.label25.Size = new System.Drawing.Size(30, 17);
this.label25.TabIndex = 280; this.label25.TabIndex = 280;
...@@ -173,7 +179,7 @@ ...@@ -173,7 +179,7 @@
// //
this.label24.AutoSize = true; this.label24.AutoSize = true;
this.label24.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label24.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label24.Location = new System.Drawing.Point(569, 27); this.label24.Location = new System.Drawing.Point(603, 27);
this.label24.Name = "label24"; this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(30, 17); this.label24.Size = new System.Drawing.Size(30, 17);
this.label24.TabIndex = 279; this.label24.TabIndex = 279;
...@@ -182,31 +188,32 @@ ...@@ -182,31 +188,32 @@
// btnOpenFile // btnOpenFile
// //
this.btnOpenFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnOpenFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOpenFile.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOpenFile.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenFile.Location = new System.Drawing.Point(445, 149); this.btnOpenFile.Location = new System.Drawing.Point(615, 350);
this.btnOpenFile.Name = "btnOpenFile"; this.btnOpenFile.Name = "btnOpenFile";
this.btnOpenFile.Size = new System.Drawing.Size(139, 39); this.btnOpenFile.Size = new System.Drawing.Size(70, 33);
this.btnOpenFile.TabIndex = 261; this.btnOpenFile.TabIndex = 261;
this.btnOpenFile.Text = "选择图片"; this.btnOpenFile.Text = "导入图片";
this.btnOpenFile.UseVisualStyleBackColor = true; this.btnOpenFile.UseVisualStyleBackColor = true;
this.btnOpenFile.Visible = false;
this.btnOpenFile.Click += new System.EventHandler(this.btnOpenFile_Click); this.btnOpenFile.Click += new System.EventHandler(this.btnOpenFile_Click);
// //
// txtImagePath // txtImagePath
// //
this.txtImagePath.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtImagePath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtImagePath.Location = new System.Drawing.Point(144, 147); this.txtImagePath.Location = new System.Drawing.Point(177, 141);
this.txtImagePath.MaxLength = 20; this.txtImagePath.MaxLength = 20;
this.txtImagePath.Multiline = true; this.txtImagePath.Multiline = true;
this.txtImagePath.Name = "txtImagePath"; this.txtImagePath.Name = "txtImagePath";
this.txtImagePath.Size = new System.Drawing.Size(288, 89); this.txtImagePath.Size = new System.Drawing.Size(343, 48);
this.txtImagePath.TabIndex = 74; this.txtImagePath.TabIndex = 74;
// //
// label1 // label1
// //
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(43, 149); this.label1.Location = new System.Drawing.Point(14, 145);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(97, 20); this.label1.Size = new System.Drawing.Size(158, 20);
this.label1.TabIndex = 73; this.label1.TabIndex = 73;
this.label1.Text = "导入图片:"; this.label1.Text = "导入图片:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
...@@ -214,38 +221,39 @@ ...@@ -214,38 +221,39 @@
// label3 // label3
// //
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(43, 101); this.label3.Location = new System.Drawing.Point(603, 405);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(97, 20); this.label3.Size = new System.Drawing.Size(97, 20);
this.label3.TabIndex = 72; this.label3.TabIndex = 72;
this.label3.Text = "元器件库:"; this.label3.Text = "元器件库:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Visible = false;
// //
// cmbBomList // cmbBomList
// //
this.cmbBomList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbBomList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbBomList.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbBomList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbBomList.FormattingEnabled = true; this.cmbBomList.FormattingEnabled = true;
this.cmbBomList.Location = new System.Drawing.Point(144, 99); this.cmbBomList.Location = new System.Drawing.Point(145, 74);
this.cmbBomList.Name = "cmbBomList"; this.cmbBomList.Name = "cmbBomList";
this.cmbBomList.Size = new System.Drawing.Size(220, 29); this.cmbBomList.Size = new System.Drawing.Size(220, 28);
this.cmbBomList.TabIndex = 71; this.cmbBomList.TabIndex = 71;
// //
// txtBoardName // txtBoardName
// //
this.txtBoardName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtBoardName.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtBoardName.Location = new System.Drawing.Point(144, 21); this.txtBoardName.Location = new System.Drawing.Point(177, 21);
this.txtBoardName.MaxLength = 20; this.txtBoardName.MaxLength = 20;
this.txtBoardName.Name = "txtBoardName"; this.txtBoardName.Name = "txtBoardName";
this.txtBoardName.Size = new System.Drawing.Size(220, 29); this.txtBoardName.Size = new System.Drawing.Size(220, 26);
this.txtBoardName.TabIndex = 4; this.txtBoardName.TabIndex = 4;
// //
// label2 // label2
// //
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(43, 23); this.label2.Location = new System.Drawing.Point(14, 23);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(97, 20); this.label2.Size = new System.Drawing.Size(158, 20);
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
this.label2.Text = "程序名称:"; this.label2.Text = "程序名称:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
...@@ -253,9 +261,9 @@ ...@@ -253,9 +261,9 @@
// label8 // label8
// //
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(43, 254); this.label8.Location = new System.Drawing.Point(14, 105);
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(97, 20); this.label8.Size = new System.Drawing.Size(158, 20);
this.label8.TabIndex = 290; this.label8.TabIndex = 290;
this.label8.Text = "坐标原点位置:"; this.label8.Text = "坐标原点位置:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
...@@ -263,44 +271,27 @@ ...@@ -263,44 +271,27 @@
// cmbOrgType // cmbOrgType
// //
this.cmbOrgType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbOrgType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbOrgType.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbOrgType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbOrgType.FormattingEnabled = true; this.cmbOrgType.FormattingEnabled = true;
this.cmbOrgType.Items.AddRange(new object[] { this.cmbOrgType.Items.AddRange(new object[] {
"左上角", "左上角",
"左下角", "左下角",
"右上角", "右上角",
"右下角"}); "右下角"});
this.cmbOrgType.Location = new System.Drawing.Point(144, 252); this.cmbOrgType.Location = new System.Drawing.Point(177, 99);
this.cmbOrgType.Name = "cmbOrgType"; this.cmbOrgType.Name = "cmbOrgType";
this.cmbOrgType.Size = new System.Drawing.Size(220, 29); this.cmbOrgType.Size = new System.Drawing.Size(220, 28);
this.cmbOrgType.TabIndex = 289; this.cmbOrgType.TabIndex = 289;
// //
// 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(46, 297);
this.xyMoveControl1.Name = "xyMoveControl1";
this.xyMoveControl1.PenWidth = 2;
this.xyMoveControl1.PointSizeX = 1;
this.xyMoveControl1.PointSizeY = 1;
this.xyMoveControl1.PointType = 1;
this.xyMoveControl1.ShowText = "";
this.xyMoveControl1.Size = new System.Drawing.Size(526, 315);
this.xyMoveControl1.TabIndex = 287;
this.xyMoveControl1.XValue = 1D;
this.xyMoveControl1.YValue = 1D;
//
// chbSort // chbSort
// //
this.chbSort.AutoSize = true; this.chbSort.AutoSize = true;
this.chbSort.Checked = true; this.chbSort.Checked = true;
this.chbSort.CheckState = System.Windows.Forms.CheckState.Checked; this.chbSort.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbSort.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbSort.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbSort.Location = new System.Drawing.Point(428, 258); this.chbSort.Location = new System.Drawing.Point(39, 646);
this.chbSort.Name = "chbSort"; this.chbSort.Name = "chbSort";
this.chbSort.Size = new System.Drawing.Size(84, 24); this.chbSort.Size = new System.Drawing.Size(75, 21);
this.chbSort.TabIndex = 291; this.chbSort.TabIndex = 291;
this.chbSort.Text = "自动排序"; this.chbSort.Text = "自动排序";
this.chbSort.UseVisualStyleBackColor = true; this.chbSort.UseVisualStyleBackColor = true;
...@@ -308,36 +299,140 @@ ...@@ -308,36 +299,140 @@
// lblWidth // lblWidth
// //
this.lblWidth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblWidth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWidth.Location = new System.Drawing.Point(407, 104); this.lblWidth.Location = new System.Drawing.Point(400, 101);
this.lblWidth.Name = "lblWidth"; this.lblWidth.Name = "lblWidth";
this.lblWidth.Size = new System.Drawing.Size(80, 20); this.lblWidth.Size = new System.Drawing.Size(124, 20);
this.lblWidth.TabIndex = 294; this.lblWidth.TabIndex = 294;
this.lblWidth.Text = "线体宽度:"; this.lblWidth.Text = "线体宽度:";
this.lblWidth.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblWidth.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtLineWidth // txtLineWidth
// //
this.txtLineWidth.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtLineWidth.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtLineWidth.Location = new System.Drawing.Point(493, 100); this.txtLineWidth.Location = new System.Drawing.Point(526, 97);
this.txtLineWidth.MaxLength = 8; this.txtLineWidth.MaxLength = 8;
this.txtLineWidth.Name = "txtLineWidth"; this.txtLineWidth.Name = "txtLineWidth";
this.txtLineWidth.Size = new System.Drawing.Size(70, 29); this.txtLineWidth.Size = new System.Drawing.Size(70, 26);
this.txtLineWidth.TabIndex = 292; this.txtLineWidth.TabIndex = 292;
// //
// label9 // label9
// //
this.label9.AutoSize = true; this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(570, 106); this.label9.Location = new System.Drawing.Point(603, 103);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(30, 17); this.label9.Size = new System.Drawing.Size(30, 17);
this.label9.TabIndex = 293; this.label9.TabIndex = 293;
this.label9.Text = "mm"; this.label9.Text = "mm";
// //
// txtCsvFileName
//
this.txtCsvFileName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCsvFileName.Location = new System.Drawing.Point(145, 28);
this.txtCsvFileName.MaxLength = 20;
this.txtCsvFileName.Multiline = true;
this.txtCsvFileName.Name = "txtCsvFileName";
this.txtCsvFileName.Size = new System.Drawing.Size(419, 48);
this.txtCsvFileName.TabIndex = 297;
//
// groupBoxSelCom
//
this.groupBoxSelCom.Controls.Add(this.likSelCsvFile);
this.groupBoxSelCom.Controls.Add(this.likDownFile);
this.groupBoxSelCom.Controls.Add(this.rdbUpload);
this.groupBoxSelCom.Controls.Add(this.rdbSelCom);
this.groupBoxSelCom.Controls.Add(this.cmbBomList);
this.groupBoxSelCom.Controls.Add(this.txtCsvFileName);
this.groupBoxSelCom.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBoxSelCom.Location = new System.Drawing.Point(39, 195);
this.groupBoxSelCom.Name = "groupBoxSelCom";
this.groupBoxSelCom.Size = new System.Drawing.Size(599, 122);
this.groupBoxSelCom.TabIndex = 298;
this.groupBoxSelCom.TabStop = false;
this.groupBoxSelCom.Text = "请选择元器件库";
//
// likSelCsvFile
//
this.likSelCsvFile.AutoSize = true;
this.likSelCsvFile.Location = new System.Drawing.Point(347, 90);
this.likSelCsvFile.Name = "likSelCsvFile";
this.likSelCsvFile.Size = new System.Drawing.Size(56, 17);
this.likSelCsvFile.TabIndex = 301;
this.likSelCsvFile.TabStop = true;
this.likSelCsvFile.Text = "选择文件";
this.likSelCsvFile.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.likSelCsvFile_LinkClicked);
//
// likDownFile
//
this.likDownFile.AutoSize = true;
this.likDownFile.Location = new System.Drawing.Point(458, 90);
this.likDownFile.Name = "likDownFile";
this.likDownFile.Size = new System.Drawing.Size(56, 17);
this.likDownFile.TabIndex = 300;
this.likDownFile.TabStop = true;
this.likDownFile.Text = "下载模板";
this.likDownFile.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.likDownFile_LinkClicked);
//
// rdbUpload
//
this.rdbUpload.AutoSize = true;
this.rdbUpload.Checked = true;
this.rdbUpload.Location = new System.Drawing.Point(7, 37);
this.rdbUpload.Name = "rdbUpload";
this.rdbUpload.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.rdbUpload.Size = new System.Drawing.Size(74, 21);
this.rdbUpload.TabIndex = 299;
this.rdbUpload.TabStop = true;
this.rdbUpload.Text = "上传程序";
this.rdbUpload.UseVisualStyleBackColor = true;
this.rdbUpload.CheckedChanged += new System.EventHandler(this.rdbUpload_CheckedChanged);
//
// rdbSelCom
//
this.rdbSelCom.AutoSize = true;
this.rdbSelCom.Location = new System.Drawing.Point(7, 76);
this.rdbSelCom.Name = "rdbSelCom";
this.rdbSelCom.Size = new System.Drawing.Size(98, 21);
this.rdbSelCom.TabIndex = 298;
this.rdbSelCom.TabStop = true;
this.rdbSelCom.Text = "选择元器件库";
this.rdbSelCom.UseVisualStyleBackColor = true;
this.rdbSelCom.CheckedChanged += new System.EventHandler(this.rdbSelCom_CheckedChanged);
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(526, 153);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(53, 12);
this.linkLabel1.TabIndex = 302;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "选择文件";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.btnOpenFile_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(74, 319);
this.xyMoveControl1.Name = "xyMoveControl1";
this.xyMoveControl1.PenWidth = 2;
this.xyMoveControl1.PointSizeX = 1;
this.xyMoveControl1.PointSizeY = 1;
this.xyMoveControl1.PointType = 1;
this.xyMoveControl1.ShowText = "";
this.xyMoveControl1.Size = new System.Drawing.Size(548, 303);
this.xyMoveControl1.TabIndex = 287;
this.xyMoveControl1.XValue = 1D;
this.xyMoveControl1.YValue = 1D;
//
// FrmAddBoard // FrmAddBoard
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(632, 707); this.ClientSize = new System.Drawing.Size(686, 700);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.groupBoxSelCom);
this.Controls.Add(this.lblWidth); this.Controls.Add(this.lblWidth);
this.Controls.Add(this.txtLineWidth); this.Controls.Add(this.txtLineWidth);
this.Controls.Add(this.label9); this.Controls.Add(this.label9);
...@@ -359,13 +454,14 @@ ...@@ -359,13 +454,14 @@
this.Controls.Add(this.btnOpenFile); this.Controls.Add(this.btnOpenFile);
this.Controls.Add(this.txtImagePath); this.Controls.Add(this.txtImagePath);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.cmbBomList);
this.Controls.Add(this.txtBoardName); this.Controls.Add(this.txtBoardName);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Name = "FrmAddBoard"; this.Name = "FrmAddBoard";
this.Text = "新增程序"; this.Text = "新增程序";
this.Load += new System.EventHandler(this.FrmAddBoard_Load); this.Load += new System.EventHandler(this.FrmAddBoard_Load);
this.groupBoxSelCom.ResumeLayout(false);
this.groupBoxSelCom.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -389,7 +485,7 @@ ...@@ -389,7 +485,7 @@
private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnStart; private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialogImg;
private System.Windows.Forms.TextBox txtCode; private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
...@@ -400,5 +496,13 @@ ...@@ -400,5 +496,13 @@
private System.Windows.Forms.Label lblWidth; private System.Windows.Forms.Label lblWidth;
private System.Windows.Forms.TextBox txtLineWidth; private System.Windows.Forms.TextBox txtLineWidth;
private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtCsvFileName;
private System.Windows.Forms.GroupBox groupBoxSelCom;
private System.Windows.Forms.LinkLabel likSelCsvFile;
private System.Windows.Forms.LinkLabel likDownFile;
private System.Windows.Forms.RadioButton rdbUpload;
private System.Windows.Forms.RadioButton rdbSelCom;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.OpenFileDialog openFileDialogCsv;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -62,7 +62,6 @@ namespace TSA_V ...@@ -62,7 +62,6 @@ namespace TSA_V
return false ; return false ;
} }
board.boardCode = FormUtil.getValue(txtCode); board.boardCode = FormUtil.getValue(txtCode);
board.bomName = cmbBomList.Text;
board.imgName = FormUtil.getValue(txtImagePath); board.imgName = FormUtil.getValue(txtImagePath);
if (board.imgName.Equals("")) if (board.imgName.Equals(""))
{ {
...@@ -98,10 +97,24 @@ namespace TSA_V ...@@ -98,10 +97,24 @@ namespace TSA_V
//this.txtRobotX.Focus(); //this.txtRobotX.Focus();
return false ; return false ;
} }
if (rdbSelCom.Checked)
{
board.bomName = cmbBomList.Text;
}
else
{
board.bomName = board.boardName;
if (txtCsvFileName.Text.Equals("") || uploadPointList.Count <= 0)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.UploadFile, "请上传程序文件!"));
this.likSelCsvFile.Focus();
return false;
}
}
string imagePath = Path.GetFullPath(txtImagePath.Text); string imagePath = Path.GetFullPath(txtImagePath.Text);
ProcessPictures.copyImage(Application.StartupPath, board.boardName, imagePath); ProcessPictures.copyImage(Application.StartupPath, board.boardName, imagePath);
board.imgName = board.boardName + Path.GetExtension(openFileDialog1.FileName); board.imgName = board.boardName + Path.GetExtension(openFileDialogImg.FileName);
return true; return true;
} }
private BoardInfo SaveBoard() private BoardInfo SaveBoard()
...@@ -114,7 +127,12 @@ namespace TSA_V ...@@ -114,7 +127,12 @@ namespace TSA_V
{ {
return null; return null;
} }
List<ComponetInfo> comList = CSVBomManager.GetComList(board.bomName); List<ComponetInfo> comList = this.uploadPointList;
if (rdbSelCom.Checked)
{
comList = CSVBomManager.GetComList(board.bomName);
}
if (chbSort.Checked) if (chbSort.Checked)
{ {
comList = (from m in comList orderby m.PositionX ascending, m.PositionY ascending select m).ToList<ComponetInfo>(); comList = (from m in comList orderby m.PositionX ascending, m.PositionY ascending select m).ToList<ComponetInfo>();
...@@ -153,7 +171,7 @@ namespace TSA_V ...@@ -153,7 +171,7 @@ namespace TSA_V
y = board.boardLength - y; y = board.boardLength - y;
x = board.boardWidth - x; x = board.boardWidth - x;
} }
SMTPointInfo point = new SMTPointInfo(i, com.PartNum, com.ComponentName, x, y, com.PositionNum,pointType,pointSizeX,pointSizeY,penWidth); SMTPointInfo point = new SMTPointInfo(i, com.TagNo, com.PN, x, y, com.PositionNum,pointType,pointSizeX,pointSizeY,penWidth);
y = board.boardLength - y; y = board.boardLength - y;
...@@ -184,17 +202,23 @@ namespace TSA_V ...@@ -184,17 +202,23 @@ namespace TSA_V
{ {
point.NodePositionX = board.originX; point.NodePositionX = board.originX;
point.NodePositionY = board.originY; point.NodePositionY = board.originY;
LogUtil.error("新增【" + board.boardName + "】元器件【" + point.pointName + "】导入【" + com.PositionX + "," + com.PositionY + "】红点【" + nodeXValue + "," + nodeYValue + "】超出移动范围,默认为右下角坐标!"); LogUtil.error("新增【" + board.boardName + "】元器件【" + point.PN + "】导入【" + com.PositionX + "," + com.PositionY + "】红点【" + nodeXValue + "," + nodeYValue + "】超出移动范围,默认为右下角坐标!");
} }
point.WeldTemp = 360; point.WeldTemp = 360;
point.WeldTime = 3; point.WeldTime = 3;
point.NeedCheck = true; point.NeedCheck = true;
point.NeedSoldering = true; point.NeedSoldering = true;
LogUtil.info("新增【" + board.boardName + "】元器件【" + point.pointName + "】导入【" + com.PositionX + "," + com.PositionY + "】图片【" + point.PositionX+","+point.PositionY+ "】红点【" + nodeXValue + "," + nodeYValue + "】"); LogUtil.info("新增【" + board.boardName + "】元器件【" + point.PN + "】导入【" + com.PositionX + "," + com.PositionY + "】图片【" + point.PositionX+","+point.PositionY+ "】红点【" + nodeXValue + "," + nodeYValue + "】");
smtList.Add(point); smtList.Add(point);
i++; i++;
} }
if (!rdbSelCom.Checked)
{
board.bomName =CSVBomManager. AutoAddBomList(board.bomName, new List<ComponetInfo>(comList));
LogUtil.info("新增【" + board.boardName + "】自动创建bom【" + board.bomName + "】");
}
board.smtList = smtList; board.smtList = smtList;
board.boardId = BoardManager.GetNextId(); board.boardId = BoardManager.GetNextId();
BoardManager.Add(board); BoardManager.Add(board);
...@@ -208,6 +232,7 @@ namespace TSA_V ...@@ -208,6 +232,7 @@ namespace TSA_V
} }
} }
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
BoardInfo board = SaveBoard(); BoardInfo board = SaveBoard();
...@@ -223,15 +248,15 @@ namespace TSA_V ...@@ -223,15 +248,15 @@ namespace TSA_V
private void btnOpenFile_Click(object sender, EventArgs e) private void btnOpenFile_Click(object sender, EventArgs e)
{ {
openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); openFileDialogImg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
openFileDialog1.DefaultExt = "jpg|gif|bmp|png|jpeg"; openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg";
openFileDialog1.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg"; openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg";
string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径 string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径
openFileDialog1.InitialDirectory = directory; openFileDialogImg.InitialDirectory = directory;
if (openFileDialog1.ShowDialog() == DialogResult.OK) if (openFileDialogImg.ShowDialog() == DialogResult.OK)
{ {
openFileDialog1.Tag = true; openFileDialogImg.Tag = true;
this.txtImagePath.Text= openFileDialog1.FileName; this.txtImagePath.Text= openFileDialogImg.FileName;
} }
} }
...@@ -268,6 +293,10 @@ namespace TSA_V ...@@ -268,6 +293,10 @@ namespace TSA_V
xyMoveControl1.YValue = TSAVBean.Y_Max/2; xyMoveControl1.YValue = TSAVBean.Y_Max/2;
xyMoveControl1.ShowText = ""; xyMoveControl1.ShowText = "";
rdbUpload.Checked = true;
ComChange(true);
} }
private bool XyMoveControl1_ShowPointEvent(ProjectorPInfo p) private bool XyMoveControl1_ShowPointEvent(ProjectorPInfo p)
{ {
...@@ -293,5 +322,151 @@ namespace TSA_V ...@@ -293,5 +322,151 @@ namespace TSA_V
{ {
xyMoveControl1.UpdateStatus(); xyMoveControl1.UpdateStatus();
} }
private void ComChange(bool isUploadSel)
{
txtCsvFileName.Visible = isUploadSel;
likDownFile.Visible = isUploadSel;
likSelCsvFile.Visible = isUploadSel;
cmbBomList.Visible = !isUploadSel;
}
private void rdbUpload_CheckedChanged(object sender, EventArgs e)
{
ComChange(rdbUpload.Checked);
}
private void rdbSelCom_CheckedChanged(object sender, EventArgs e)
{
ComChange(!rdbSelCom.Checked);
}
private void btnOpenFile_Click(object sender, LinkLabelLinkClickedEventArgs e)
{
openFileDialogImg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg";
openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg";
string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径
openFileDialogImg.InitialDirectory = directory;
if (openFileDialogImg.ShowDialog() == DialogResult.OK)
{
openFileDialogImg.Tag = true;
this.txtImagePath.Text = openFileDialogImg.FileName;
}
}
private void likDownFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
sfd.FileName = ResourceCulture.GetString("元器件库模板");
sfd.Filter = @"csv|*.csv";
DialogResult result = sfd.ShowDialog();
if (result.Equals(DialogResult.OK))
{
string filePath = sfd.FileName;
//if (Directory.Exists(filePath))
{
string sourcePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Componet_Template);
if (File.Exists(filePath))
{
File.Delete(filePath);
}
//复制文件
File.Copy(sourcePath, filePath);
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DemoSave, "模板已保存在:") + filePath);
}
}
}
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> uploadPointList = new List<ComponetInfo>();
private void likSelCsvFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
openFileDialogCsv.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
this.openFileDialogCsv.Filter = "csv|*.csv";
DialogResult result = this.openFileDialogCsv.ShowDialog();
if (!result.Equals(DialogResult.OK))
{
return;
}
string fileName = this.openFileDialogCsv.FileName;
uploadPointList = CSVBomManager.ReadFile(fileName);
if (uploadPointList.Count <= 0)
{
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 uploadPointList)
{
if (!PnPositonMap.ContainsKey(com.PN))
{
PnPositonMap.Add(com.PN, new List<string>());
}
if (!PnPositonMap[com.PN].Contains(com.PositionNum))
{
PnPositonMap[com.PN].Add(com.PositionNum);
}
if (!positionPNMap.ContainsKey(com.PositionNum))
{
positionPNMap.Add(com.PositionNum, new List<string>());
}
if (!positionPNMap[com.PositionNum].Contains(com.PN))
{
positionPNMap[com.PositionNum].Add(com.PN);
}
}
foreach (string pnKey in PnPositonMap.Keys)
{
List<string> positions = new List<string>(PnPositonMap[pnKey]);
if (positions.Count > 1)
{
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImportPosition,
"元器件【{0}】配置多个位置【{1}】,是否确定导入?", pnKey, getListMsg(positions), "",
MessageBoxButtons.OKCancel)); ;
if (!result.Equals(DialogResult.OK))
{
uploadPointList = new List<ComponetInfo>();
return;
}
}
}
foreach (string key in positionPNMap.Keys)
{
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))
{
uploadPointList = new List<ComponetInfo>();
return;
}
}
}
this.txtCsvFileName.Text = fileName;
}
} }
} }
...@@ -117,10 +117,13 @@ ...@@ -117,10 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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> <value>17, 17</value>
</metadata> </metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value> <value>107, 17</value>
</metadata> </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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,16 @@ namespace TSA_V ...@@ -24,6 +24,16 @@ namespace TSA_V
SetSkin(this); SetSkin(this);
LanguageProcess(); 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 List<ComponetInfo> comList = new List<ComponetInfo>();
private void btnBomImport_Click(object sender, EventArgs e) private void btnBomImport_Click(object sender, EventArgs e)
{ {
...@@ -35,39 +45,44 @@ namespace TSA_V ...@@ -35,39 +45,44 @@ namespace TSA_V
comList = CSVBomManager.ReadFile(fileName); comList = CSVBomManager.ReadFile(fileName);
if (comList.Count > 0)
if (comList.Count <= 0)
{ {
Dictionary<string, string> namePositonMap = new Dictionary<string, string>(); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectRightFile, "请选择正确的文件(文件格式可以通过下载模板获得)"));
Dictionary<string, string> posiitonNameMap = new Dictionary<string, string>(); }
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) 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 if (!PnPositonMap[com.PN].Contains(com.PositionNum))
{
string prePosition = namePositonMap[com.ComponentName];
if (!prePosition.Equals(com.PositionNum))
{ {
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImport, PnPositonMap[com.PN].Add(com.PositionNum);
"元器件【{0}】配置了两个位置【{1}】和【{2}】,是否确定导入?", com.ComponentName, prePosition, com.PositionNum), "", }
MessageBoxButtons.OKCancel); ;
if (!result.Equals(DialogResult.OK))
if (!positionPNMap.ContainsKey(com.PositionNum))
{ {
comList = new List<ComponetInfo>(); positionPNMap.Add(com.PositionNum, new List<string>());
return;
} }
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]; List<string> positions = new List<string>(PnPositonMap[pnKey]);
if (!name.Equals(com.ComponentName)) if (positions.Count > 1)
{ {
result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.CheckFile, "两个元器件【{0}】和【{1}】都配置在位置【{2}】中,是否确定导入", name,com.ComponentName, com.PositionNum) ,"", result = MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SureImportPosition,
MessageBoxButtons.OKCancel); ; "元器件【{0}】配置多个位置【{1}】,是否确定导入?", pnKey, getListMsg(positions), "",
MessageBoxButtons.OKCancel)); ;
if (!result.Equals(DialogResult.OK)) if (!result.Equals(DialogResult.OK))
{ {
comList = new List<ComponetInfo>(); comList = new List<ComponetInfo>();
...@@ -75,16 +90,22 @@ namespace TSA_V ...@@ -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 ...@@ -119,7 +140,7 @@ namespace TSA_V
return false; return false;
} }
if (CSVBomManager.AddBomList(bomName, comList)) if (CSVBomManager.AddBom(bomName, comList))
{ {
return true; return true;
} return false; } return false;
......
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
this.label24 = new System.Windows.Forms.Label(); this.label24 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button();
this.新增ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
...@@ -129,21 +130,22 @@ ...@@ -129,21 +130,22 @@
// //
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.记录为组装坐标ToolStripMenuItem, this.记录为组装坐标ToolStripMenuItem,
this.更新为组装坐标ToolStripMenuItem}); this.更新为组装坐标ToolStripMenuItem,
this.新增ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(161, 48); this.contextMenuStrip1.Size = new System.Drawing.Size(181, 92);
// //
// 记录为组装坐标ToolStripMenuItem // 记录为组装坐标ToolStripMenuItem
// //
this.记录为组装坐标ToolStripMenuItem.Name = "记录为组装坐标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.Text = "更新为组装位置";
this.记录为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.记录为组装坐标ToolStripMenuItem_Click); this.记录为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.记录为组装坐标ToolStripMenuItem_Click);
// //
// 更新为组装坐标ToolStripMenuItem // 更新为组装坐标ToolStripMenuItem
// //
this.更新为组装坐标ToolStripMenuItem.Name = "更新为组装坐标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.Text = "更新为组装位置";
this.更新为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.更新为组装坐标ToolStripMenuItem_Click); this.更新为组装坐标ToolStripMenuItem.Click += new System.EventHandler(this.更新为组装坐标ToolStripMenuItem_Click);
// //
...@@ -980,6 +982,13 @@ ...@@ -980,6 +982,13 @@
this.btnSave.UseVisualStyleBackColor = true; this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 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 // FrmBoardInfo
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -1096,5 +1105,6 @@ ...@@ -1096,5 +1105,6 @@
private System.Windows.Forms.DataGridViewLinkColumn Column_Del; private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
private System.Windows.Forms.DataGridViewLinkColumn Column_Up; private System.Windows.Forms.DataGridViewLinkColumn Column_Up;
private System.Windows.Forms.DataGridViewLinkColumn Column_Down; private System.Windows.Forms.DataGridViewLinkColumn Column_Down;
private System.Windows.Forms.ToolStripMenuItem 新增ToolStripMenuItem;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -111,6 +111,17 @@ namespace TSA_V ...@@ -111,6 +111,17 @@ namespace TSA_V
this.详情ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_Detial, "详情"); this.详情ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_Detial, "详情");
this.测试位置ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_MoveTest, "移动测试"); this.测试位置ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_MoveTest, "移动测试");
this.更新为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemText_UpdateN, "更新为组装位置"); 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, "位号"); this.Column_PartNum.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Num, "位号");
...@@ -144,6 +155,7 @@ namespace TSA_V ...@@ -144,6 +155,7 @@ namespace TSA_V
this.Column_CheckOK.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Check, "校准点"); this.Column_CheckOK.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Check, "校准点");
this.Column_disable.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Disable, "禁用"); this.Column_disable.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Disable, "禁用");
this.Column_Notes.HeaderText = ResourceCulture.GetString("注意事项", "注意事项"); this.Column_Notes.HeaderText = ResourceCulture.GetString("注意事项", "注意事项");
this.新增ToolStripMenuItem.Text = ResourceCulture.GetString("新增组装点", "新增组装点");
} }
private void FrmBoardInfo_Load(object sender, EventArgs e) private void FrmBoardInfo_Load(object sender, EventArgs e)
{ {
...@@ -272,8 +284,8 @@ namespace TSA_V ...@@ -272,8 +284,8 @@ namespace TSA_V
view.CreateCells(dgvList); view.CreateCells(dgvList);
} }
view.Cells[0].Value = point.pointNum.ToString(); view.Cells[0].Value = point.pointNum.ToString();
view.Cells[1].Value = point.PartNum.ToString(); view.Cells[1].Value = point.TagNo.ToString();
view.Cells[2].Value = point.pointName; view.Cells[2].Value = point.PN;
view.Cells[3].Value = point.PositionX.ToString(); view.Cells[3].Value = point.PositionX.ToString();
view.Cells[4].Value = point.PositionY.ToString(); view.Cells[4].Value = point.PositionY.ToString();
view.Cells[5].Value = point.NodePositionX.ToString(); view.Cells[5].Value = point.NodePositionX.ToString();
...@@ -292,7 +304,7 @@ namespace TSA_V ...@@ -292,7 +304,7 @@ namespace TSA_V
view.Cells[Column_disable.Index].Value = point.Disable; view.Cells[Column_disable.Index].Value = point.Disable;
if (updateBoardInfo != null) if (updateBoardInfo != null)
{ {
ComponetInfo com = CSVBomManager.GetCom(updateBoardInfo.bomName, point.PartNum); ComponetInfo com = CSVBomManager.GetCom(updateBoardInfo.bomName, point);
if (com != null) if (com != null)
{ {
view.Cells[Column_Notes.Index].Value = com.Notes; view.Cells[Column_Notes.Index].Value = com.Notes;
...@@ -607,7 +619,7 @@ namespace TSA_V ...@@ -607,7 +619,7 @@ namespace TSA_V
return; return;
} }
} }
nameList.Add(point.pointName); nameList.Add(point.PN);
index++; index++;
} }
...@@ -660,9 +672,9 @@ namespace TSA_V ...@@ -660,9 +672,9 @@ namespace TSA_V
{ {
return null; 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.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.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); point.PositionY = Math.Round(Convert.ToDouble(row.Cells[this.Column_Y.Name].Value.ToString()), 3);
...@@ -827,7 +839,7 @@ namespace TSA_V ...@@ -827,7 +839,7 @@ namespace TSA_V
fwpi.PicImage = picBoard.Image; fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog(); DialogResult result = fwpi.ShowDialog();
//if (result.Equals(DialogResult.OK)) //if (result.Equals(DialogResult.OK))
if (fwpi.IsUpdate) if (fwpi.updateOK)
{ {
dgvList.Rows.Clear(); dgvList.Rows.Clear();
allPoint = fwpi.PointList; allPoint = fwpi.PointList;
...@@ -851,31 +863,13 @@ namespace TSA_V ...@@ -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) private void AddNewPoint(double x, double y, double nodeX, double nodeY)
{ {
SMTPointInfo smtInfo = new SMTPointInfo(); SMTPointInfo smtInfo = new SMTPointInfo();
string name = "P" + (dgvList.Rows.Count + 1); string name = "P" + (dgvList.Rows.Count + 1);
FrmPointInfo fwpi = new FrmPointInfo( name, x, y, nodeX, nodeY); FrmPointInfo fwpi = new FrmPointInfo( updateBoardInfo, name, x, y, nodeX, nodeY);
fwpi.AoiProgramName = cmbAOIFile.Text; fwpi.AoiProgramName = cmbAOIFile.Text;
fwpi.PicImage = picBoard.Image; fwpi.PicImage = picBoard.Image;
DialogResult result = fwpi.ShowDialog(); DialogResult result = fwpi.ShowDialog();
...@@ -1232,16 +1226,16 @@ namespace TSA_V ...@@ -1232,16 +1226,16 @@ namespace TSA_V
List<string> names = new List<string>(); List<string> names = new List<string>();
foreach (ComponetInfo com in list) 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) if (smts.Count > 0)
{ {
newList.Add(smts[0]); newList.Add(smts[0]);
} }
names.Add(com.PartNum); names.Add(com.TagNo);
} }
foreach (SMTPointInfo s in allSmt) foreach (SMTPointInfo s in allSmt)
{ {
if (!names.Contains(s.PartNum)) if (!names.Contains(s.TagNo))
{ {
newList.Add(s); newList.Add(s);
} }
...@@ -1372,6 +1366,25 @@ namespace TSA_V ...@@ -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) private void llblAllUSel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
int cout = dgvList.Rows.Count; int cout = dgvList.Rows.Count;
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
this.cmbBoardList = new System.Windows.Forms.ComboBox(); this.cmbBoardList = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnBeiliao = new System.Windows.Forms.Button();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.panBoard.SuspendLayout(); this.panBoard.SuspendLayout();
...@@ -98,9 +99,9 @@ ...@@ -98,9 +99,9 @@
this.groupBox2.Controls.Add(this.txtBomName); this.groupBox2.Controls.Add(this.txtBomName);
this.groupBox2.Controls.Add(this.label2); 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.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.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.TabIndex = 1;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "程序信息"; this.groupBox2.Text = "程序信息";
...@@ -170,7 +171,7 @@ ...@@ -170,7 +171,7 @@
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.label6.AutoSize = true; 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.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17); this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 33; this.label6.TabIndex = 33;
...@@ -186,7 +187,7 @@ ...@@ -186,7 +187,7 @@
this.panBoard.Controls.Add(this.picBoard); this.panBoard.Controls.Add(this.picBoard);
this.panBoard.Location = new System.Drawing.Point(437, 19); this.panBoard.Location = new System.Drawing.Point(437, 19);
this.panBoard.Name = "panBoard"; 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; this.panBoard.TabIndex = 10;
// //
// picBoard // picBoard
...@@ -272,6 +273,7 @@ ...@@ -272,6 +273,7 @@
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.btnBeiliao);
this.groupBox1.Controls.Add(this.btnImport); this.groupBox1.Controls.Add(this.btnImport);
this.groupBox1.Controls.Add(this.btnExport); this.groupBox1.Controls.Add(this.btnExport);
this.groupBox1.Controls.Add(this.btnBack); this.groupBox1.Controls.Add(this.btnBack);
...@@ -281,9 +283,9 @@ ...@@ -281,9 +283,9 @@
this.groupBox1.Controls.Add(this.cmbBoardList); this.groupBox1.Controls.Add(this.cmbBoardList);
this.groupBox1.Controls.Add(this.label1); 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.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.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.TabIndex = 0;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "程序管理"; this.groupBox1.Text = "程序管理";
...@@ -292,9 +294,9 @@ ...@@ -292,9 +294,9 @@
// //
this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 8;
this.btnImport.Text = "导入"; this.btnImport.Text = "导入";
this.btnImport.UseVisualStyleBackColor = true; this.btnImport.UseVisualStyleBackColor = true;
...@@ -304,9 +306,9 @@ ...@@ -304,9 +306,9 @@
// //
this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 7;
this.btnExport.Text = "导出"; this.btnExport.Text = "导出";
this.btnExport.UseVisualStyleBackColor = true; this.btnExport.UseVisualStyleBackColor = true;
...@@ -317,9 +319,9 @@ ...@@ -317,9 +319,9 @@
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 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.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.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.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.TabIndex = 6;
this.btnBack.Text = "返回"; this.btnBack.Text = "返回";
this.btnBack.UseVisualStyleBackColor = true; this.btnBack.UseVisualStyleBackColor = true;
...@@ -329,9 +331,9 @@ ...@@ -329,9 +331,9 @@
// //
this.btnDel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 5;
this.btnDel.Text = "删除"; this.btnDel.Text = "删除";
this.btnDel.UseVisualStyleBackColor = true; this.btnDel.UseVisualStyleBackColor = true;
...@@ -341,9 +343,9 @@ ...@@ -341,9 +343,9 @@
// //
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 4;
this.btnSave.Text = "修改"; this.btnSave.Text = "修改";
this.btnSave.UseVisualStyleBackColor = true; this.btnSave.UseVisualStyleBackColor = true;
...@@ -353,9 +355,9 @@ ...@@ -353,9 +355,9 @@
// //
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 3;
this.btnNew.Text = "新增"; this.btnNew.Text = "新增";
this.btnNew.UseVisualStyleBackColor = true; this.btnNew.UseVisualStyleBackColor = true;
...@@ -385,6 +387,18 @@ ...@@ -385,6 +387,18 @@
// //
this.openFileDialog1.FileName = "openFileDialog1"; 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 // FrmBoardList
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -440,5 +454,6 @@ ...@@ -440,5 +454,6 @@
private System.Windows.Forms.Button btnImport; private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnExport; private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button btnBeiliao;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,6 +14,7 @@ using System.Text; ...@@ -14,6 +14,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
using System.Drawing.Imaging;
namespace TSA_V namespace TSA_V
{ {
...@@ -157,10 +158,10 @@ namespace TSA_V ...@@ -157,10 +158,10 @@ namespace TSA_V
ListViewItem lvi = new ListViewItem(); ListViewItem lvi = new ListViewItem();
lvi.ImageIndex = i; lvi.ImageIndex = i;
lvi.Text = point.PartNum.ToString(); lvi.Text = point.TagNo.ToString();
lvi.SubItems.Add(point.pointName); lvi.SubItems.Add(point.PN);
ComponetInfo com = CSVBomManager.GetCom(board.bomName, point.PartNum); ComponetInfo com = CSVBomManager.GetCom(board.bomName, point);
if (com != null) if (com != null)
{ {
lvi.SubItems.Add(com.PositionNum); lvi.SubItems.Add(com.PositionNum);
...@@ -325,19 +326,7 @@ namespace TSA_V ...@@ -325,19 +326,7 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString("导入失败:程序名已存在"), ResourceCulture.GetString("提示"), MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ResourceCulture.GetString("导入失败:程序名已存在"), ResourceCulture.GetString("提示"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
BoardManager.ImportBoard(board);
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);
MessageBox.Show(ResourceCulture.GetString("导入成功"), ResourceCulture.GetString("提示")); MessageBox.Show(ResourceCulture.GetString("导入成功"), ResourceCulture.GetString("提示"));
LoadCom(); LoadCom();
preId = -1; preId = -1;
...@@ -349,7 +338,12 @@ namespace TSA_V ...@@ -349,7 +338,12 @@ namespace TSA_V
if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0) if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0)
{ {
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem; 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(); SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = ""; sfd.FileName = "";
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
...@@ -385,5 +379,47 @@ namespace TSA_V ...@@ -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, "请选择程序!"));
}
}
} }
} }
namespace TSA_V
{
partial class FrmBoardPutCom
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblMoveStr = new System.Windows.Forms.Label();
this.lblLeftInfo = new System.Windows.Forms.Label();
this.lblEndInfo = new System.Windows.Forms.Label();
this.btnSaveCount = new System.Windows.Forms.LinkLabel();
this.label4 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnNext = new System.Windows.Forms.Button();
this.btnPre = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.numCount = new System.Windows.Forms.NumericUpDown();
this.lblPN = new System.Windows.Forms.Label();
this.lblTagNo = new System.Windows.Forms.Label();
this.lblDes = new System.Windows.Forms.Label();
this.lblPosition = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.numCount)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 300;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lblMoveStr
//
this.lblMoveStr.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblMoveStr.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveStr.Location = new System.Drawing.Point(406, 239);
this.lblMoveStr.Name = "lblMoveStr";
this.lblMoveStr.Size = new System.Drawing.Size(129, 51);
this.lblMoveStr.TabIndex = 294;
this.lblMoveStr.Text = "移动中";
this.lblMoveStr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblLeftInfo
//
this.lblLeftInfo.AutoSize = true;
this.lblLeftInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLeftInfo.Location = new System.Drawing.Point(226, 437);
this.lblLeftInfo.Name = "lblLeftInfo";
this.lblLeftInfo.Size = new System.Drawing.Size(44, 17);
this.lblLeftInfo.TabIndex = 293;
this.lblLeftInfo.Text = "编号:";
//
// lblEndInfo
//
this.lblEndInfo.AutoSize = true;
this.lblEndInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblEndInfo.Location = new System.Drawing.Point(83, 437);
this.lblEndInfo.Name = "lblEndInfo";
this.lblEndInfo.Size = new System.Drawing.Size(44, 17);
this.lblEndInfo.TabIndex = 292;
this.lblEndInfo.Text = "编号:";
//
// btnSaveCount
//
this.btnSaveCount.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnSaveCount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveCount.Location = new System.Drawing.Point(406, 291);
this.btnSaveCount.Name = "btnSaveCount";
this.btnSaveCount.Size = new System.Drawing.Size(129, 33);
this.btnSaveCount.TabIndex = 291;
this.btnSaveCount.TabStop = true;
this.btnSaveCount.Text = "保存数量";
this.btnSaveCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSaveCount.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.btnSaveCount_LinkClicked);
//
// label4
//
this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(4, 53);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(127, 92);
this.label4.TabIndex = 289;
this.label4.Text = "位号:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(354, 376);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(128, 50);
this.btnCancel.TabIndex = 288;
this.btnCancel.Text = "结束";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnNext
//
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNext.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNext.Location = new System.Drawing.Point(217, 376);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(128, 50);
this.btnNext.TabIndex = 287;
this.btnNext.Text = "下一个元器件";
this.btnNext.UseVisualStyleBackColor = true;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// btnPre
//
this.btnPre.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPre.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnPre.Location = new System.Drawing.Point(80, 376);
this.btnPre.Name = "btnPre";
this.btnPre.Size = new System.Drawing.Size(128, 50);
this.btnPre.TabIndex = 286;
this.btnPre.Text = "上一个元器件";
this.btnPre.UseVisualStyleBackColor = true;
this.btnPre.Click += new System.EventHandler(this.btnPre_Click);
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(4, 239);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(127, 51);
this.label1.TabIndex = 78;
this.label1.Text = "料盘位置:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Location = new System.Drawing.Point(4, 291);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(127, 33);
this.label3.TabIndex = 76;
this.label3.Text = "数量:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label2.Location = new System.Drawing.Point(4, 1);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(127, 51);
this.label2.TabIndex = 73;
this.label2.Text = "物料编号:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label5
//
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label5.Location = new System.Drawing.Point(4, 146);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(127, 92);
this.label5.TabIndex = 295;
this.label5.Text = "描述:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// numCount
//
this.numCount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.numCount.Increment = new decimal(new int[] {
10,
0,
0,
0});
this.numCount.Location = new System.Drawing.Point(138, 294);
this.numCount.Maximum = new decimal(new int[] {
1410065408,
2,
0,
0});
this.numCount.Name = "numCount";
this.numCount.Size = new System.Drawing.Size(163, 29);
this.numCount.TabIndex = 297;
//
// lblPN
//
this.lblPN.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.lblPN, 2);
this.lblPN.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblPN.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPN.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblPN.Location = new System.Drawing.Point(138, 1);
this.lblPN.Name = "lblPN";
this.lblPN.Size = new System.Drawing.Size(397, 51);
this.lblPN.TabIndex = 298;
this.lblPN.Text = "移动中";
this.lblPN.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTagNo
//
this.tableLayoutPanel1.SetColumnSpan(this.lblTagNo, 2);
this.lblTagNo.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTagNo.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTagNo.Location = new System.Drawing.Point(138, 53);
this.lblTagNo.Name = "lblTagNo";
this.lblTagNo.Size = new System.Drawing.Size(397, 92);
this.lblTagNo.TabIndex = 299;
this.lblTagNo.Text = "移动中";
this.lblTagNo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblDes
//
this.tableLayoutPanel1.SetColumnSpan(this.lblDes, 2);
this.lblDes.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblDes.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblDes.Location = new System.Drawing.Point(138, 146);
this.lblDes.Name = "lblDes";
this.lblDes.Size = new System.Drawing.Size(397, 92);
this.lblDes.TabIndex = 300;
this.lblDes.Text = "移动中";
this.lblDes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPosition
//
this.lblPosition.AutoSize = true;
this.lblPosition.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblPosition.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPosition.Location = new System.Drawing.Point(138, 239);
this.lblPosition.Name = "lblPosition";
this.lblPosition.Size = new System.Drawing.Size(261, 51);
this.lblPosition.TabIndex = 301;
this.lblPosition.Text = "移动中";
this.lblPosition.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.lblMoveStr, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.numCount, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.lblPosition, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.lblPN, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.lblDes, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.btnSaveCount, 2, 4);
this.tableLayoutPanel1.Controls.Add(this.lblTagNo, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 4);
this.tableLayoutPanel1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tableLayoutPanel1.Location = new System.Drawing.Point(21, 25);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.85715F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 32.14286F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 32.14286F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.85714F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(539, 325);
this.tableLayoutPanel1.TabIndex = 302;
//
// FrmBoardPutCom
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(591, 488);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.lblLeftInfo);
this.Controls.Add(this.lblEndInfo);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnNext);
this.Controls.Add(this.btnPre);
this.Name = "FrmBoardPutCom";
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);
((System.ComponentModel.ISupportInitialize)(this.numCount)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnPre;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.LinkLabel btnSaveCount;
private System.Windows.Forms.Label lblEndInfo;
private System.Windows.Forms.Label lblLeftInfo;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lblMoveStr;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown numCount;
private System.Windows.Forms.Label lblPN;
private System.Windows.Forms.Label lblTagNo;
private System.Windows.Forms.Label lblDes;
private System.Windows.Forms.Label lblPosition;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}
\ No newline at end of file \ No newline at end of file
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 \ No newline at end of file
...@@ -51,8 +51,11 @@ ...@@ -51,8 +51,11 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.btnSave = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button();
this.dgvList = new System.Windows.Forms.DataGridView(); this.dgvList = new System.Windows.Forms.DataGridView();
this.btnBack = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.Column_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_partNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_partNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_PN = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Position = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Position = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Notes = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Notes = new System.Windows.Forms.DataGridViewTextBoxColumn();
...@@ -60,8 +63,7 @@ ...@@ -60,8 +63,7 @@
this.Column_X = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_X = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Y = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn(); this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn();
this.btnBack = new System.Windows.Forms.Button(); this.txtId = new System.Windows.Forms.TextBox();
this.btnNew = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupInfo.SuspendLayout(); this.groupInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
...@@ -82,9 +84,9 @@ ...@@ -82,9 +84,9 @@
this.groupBox1.Controls.Add(this.btnBack); this.groupBox1.Controls.Add(this.btnBack);
this.groupBox1.Controls.Add(this.btnNew); this.groupBox1.Controls.Add(this.btnNew);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 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(13, 16); this.groupBox1.Location = new System.Drawing.Point(5, 4);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1264, 701); this.groupBox1.Size = new System.Drawing.Size(1278, 716);
this.groupBox1.TabIndex = 1; this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "元器件库管理"; this.groupBox1.Text = "元器件库管理";
...@@ -93,9 +95,9 @@ ...@@ -93,9 +95,9 @@
// //
this.btnDel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnDel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnDel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDel.Location = new System.Drawing.Point(762, 14); this.btnDel.Location = new System.Drawing.Point(564, 21);
this.btnDel.Name = "btnDel"; this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(150, 53); this.btnDel.Size = new System.Drawing.Size(130, 45);
this.btnDel.TabIndex = 73; this.btnDel.TabIndex = 73;
this.btnDel.Text = "删除"; this.btnDel.Text = "删除";
this.btnDel.UseVisualStyleBackColor = true; this.btnDel.UseVisualStyleBackColor = true;
...@@ -105,30 +107,31 @@ ...@@ -105,30 +107,31 @@
// //
this.btnBeiLiao.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnBeiLiao.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBeiLiao.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBeiLiao.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBeiLiao.Location = new System.Drawing.Point(606, 14); this.btnBeiLiao.Location = new System.Drawing.Point(703, 21);
this.btnBeiLiao.Name = "btnBeiLiao"; this.btnBeiLiao.Name = "btnBeiLiao";
this.btnBeiLiao.Size = new System.Drawing.Size(150, 53); this.btnBeiLiao.Size = new System.Drawing.Size(130, 45);
this.btnBeiLiao.TabIndex = 72; this.btnBeiLiao.TabIndex = 72;
this.btnBeiLiao.Text = "备料"; this.btnBeiLiao.Text = "备料";
this.btnBeiLiao.UseVisualStyleBackColor = true; this.btnBeiLiao.UseVisualStyleBackColor = true;
this.btnBeiLiao.Visible = false;
this.btnBeiLiao.Click += new System.EventHandler(this.BtnBeiLiao_Click); this.btnBeiLiao.Click += new System.EventHandler(this.BtnBeiLiao_Click);
// //
// btnDownLoad // btnDownLoad
// //
this.btnDownLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnDownLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnDownLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDownLoad.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnDownLoad.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDownLoad.Location = new System.Drawing.Point(832, 623); this.btnDownLoad.Location = new System.Drawing.Point(842, 21);
this.btnDownLoad.Name = "btnDownLoad"; this.btnDownLoad.Name = "btnDownLoad";
this.btnDownLoad.Size = new System.Drawing.Size(131, 63); this.btnDownLoad.Size = new System.Drawing.Size(130, 45);
this.btnDownLoad.TabIndex = 71; this.btnDownLoad.TabIndex = 71;
this.btnDownLoad.Text = "下载模板"; this.btnDownLoad.Text = "下载模板";
this.btnDownLoad.UseVisualStyleBackColor = true; this.btnDownLoad.UseVisualStyleBackColor = true;
this.btnDownLoad.Visible = false;
this.btnDownLoad.Click += new System.EventHandler(this.btnDownLoad_Click); this.btnDownLoad.Click += new System.EventHandler(this.btnDownLoad_Click);
// //
// label3 // label3
// //
this.label3.Location = new System.Drawing.Point(6, 30); this.label3.Location = new System.Drawing.Point(6, 32);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(222, 22); this.label3.Size = new System.Drawing.Size(222, 22);
this.label3.TabIndex = 70; this.label3.TabIndex = 70;
...@@ -140,7 +143,7 @@ ...@@ -140,7 +143,7 @@
this.cmbList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbList.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbList.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbList.FormattingEnabled = true; this.cmbList.FormattingEnabled = true;
this.cmbList.Location = new System.Drawing.Point(234, 26); this.cmbList.Location = new System.Drawing.Point(234, 29);
this.cmbList.Name = "cmbList"; this.cmbList.Name = "cmbList";
this.cmbList.Size = new System.Drawing.Size(278, 29); this.cmbList.Size = new System.Drawing.Size(278, 29);
this.cmbList.TabIndex = 69; this.cmbList.TabIndex = 69;
...@@ -150,6 +153,7 @@ ...@@ -150,6 +153,7 @@
// //
this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupInfo.Controls.Add(this.txtId);
this.groupInfo.Controls.Add(this.btnNewCom); this.groupInfo.Controls.Add(this.btnNewCom);
this.groupInfo.Controls.Add(this.cmbPositionNumList); this.groupInfo.Controls.Add(this.cmbPositionNumList);
this.groupInfo.Controls.Add(this.txtPartNum); this.groupInfo.Controls.Add(this.txtPartNum);
...@@ -164,9 +168,9 @@ ...@@ -164,9 +168,9 @@
this.groupInfo.Controls.Add(this.txtName); this.groupInfo.Controls.Add(this.txtName);
this.groupInfo.Controls.Add(this.label1); this.groupInfo.Controls.Add(this.label1);
this.groupInfo.Controls.Add(this.btnSave); this.groupInfo.Controls.Add(this.btnSave);
this.groupInfo.Location = new System.Drawing.Point(829, 84); this.groupInfo.Location = new System.Drawing.Point(843, 84);
this.groupInfo.Name = "groupInfo"; this.groupInfo.Name = "groupInfo";
this.groupInfo.Size = new System.Drawing.Size(416, 520); this.groupInfo.Size = new System.Drawing.Size(416, 626);
this.groupInfo.TabIndex = 68; this.groupInfo.TabIndex = 68;
this.groupInfo.TabStop = false; this.groupInfo.TabStop = false;
this.groupInfo.Text = "元器件基本信息"; this.groupInfo.Text = "元器件基本信息";
...@@ -319,8 +323,9 @@ ...@@ -319,8 +323,9 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.dgvList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dgvList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column_ID,
this.Column_partNumber, this.Column_partNumber,
this.Column_Name, this.Column_PN,
this.Column_Count, this.Column_Count,
this.Column_Position, this.Column_Position,
this.Column_Notes, this.Column_Notes,
...@@ -335,24 +340,57 @@ ...@@ -335,24 +340,57 @@
this.dgvList.RowHeadersWidth = 10; this.dgvList.RowHeadersWidth = 10;
this.dgvList.RowTemplate.Height = 23; this.dgvList.RowTemplate.Height = 23;
this.dgvList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvList.Size = new System.Drawing.Size(815, 611); this.dgvList.Size = new System.Drawing.Size(829, 626);
this.dgvList.TabIndex = 32; this.dgvList.TabIndex = 32;
this.dgvList.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvList_CellContentClick); this.dgvList.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvList_CellContentClick);
this.dgvList.SelectionChanged += new System.EventHandler(this.dgvList_SelectionChanged); this.dgvList.SelectionChanged += new System.EventHandler(this.dgvList_SelectionChanged);
// //
// btnBack
//
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("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1120, 21);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(130, 45);
this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回(&B)";
this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnNew
//
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(981, 21);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(130, 45);
this.btnNew.TabIndex = 3;
this.btnNew.Text = "上传元器件库";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Visible = false;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// Column_ID
//
this.Column_ID.HeaderText = "ID";
this.Column_ID.Name = "Column_ID";
this.Column_ID.ReadOnly = true;
this.Column_ID.Visible = false;
//
// Column_partNumber // Column_partNumber
// //
this.Column_partNumber.DataPropertyName = "PartNum"; this.Column_partNumber.DataPropertyName = "PartNum";
this.Column_partNumber.HeaderText = "号"; this.Column_partNumber.HeaderText = "号";
this.Column_partNumber.Name = "Column_partNumber"; this.Column_partNumber.Name = "Column_partNumber";
this.Column_partNumber.ReadOnly = true; this.Column_partNumber.ReadOnly = true;
// //
// Column_Name // Column_PN
// //
this.Column_Name.DataPropertyName = "ComponentName"; this.Column_PN.DataPropertyName = "ComponentName";
this.Column_Name.HeaderText = "物料编码"; this.Column_PN.HeaderText = "物料编码";
this.Column_Name.Name = "Column_Name"; this.Column_PN.Name = "Column_PN";
this.Column_Name.ReadOnly = true; this.Column_PN.ReadOnly = true;
// //
// Column_Count // Column_Count
// //
...@@ -415,31 +453,16 @@ ...@@ -415,31 +453,16 @@
this.Column_Del.UseColumnTextForLinkValue = true; this.Column_Del.UseColumnTextForLinkValue = true;
this.Column_Del.Width = 70; this.Column_Del.Width = 70;
// //
// btnBack // txtId
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1110, 623);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(131, 63);
this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回(&B)";
this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnNew
// //
this.btnNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.txtId.Enabled = false;
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.txtId.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtId.Location = new System.Drawing.Point(126, 8);
this.btnNew.Location = new System.Drawing.Point(971, 623); this.txtId.MaxLength = 30;
this.btnNew.Name = "btnNew"; this.txtId.Name = "txtId";
this.btnNew.Size = new System.Drawing.Size(131, 63); this.txtId.Size = new System.Drawing.Size(271, 29);
this.btnNew.TabIndex = 3; this.txtId.TabIndex = 77;
this.btnNew.Text = "上传元器件库"; this.txtId.Visible = false;
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
// //
// FrmComponentList // FrmComponentList
// //
...@@ -489,8 +512,9 @@ ...@@ -489,8 +512,9 @@
private System.Windows.Forms.Button btnDel; private System.Windows.Forms.Button btnDel;
private System.Windows.Forms.ComboBox cmbPositionNumList; private System.Windows.Forms.ComboBox cmbPositionNumList;
private System.Windows.Forms.Button btnNewCom; private System.Windows.Forms.Button btnNewCom;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_partNumber; private System.Windows.Forms.DataGridViewTextBoxColumn Column_partNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Name; private System.Windows.Forms.DataGridViewTextBoxColumn Column_PN;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Count; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Count;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Position; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Position;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Notes; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Notes;
...@@ -498,5 +522,6 @@ ...@@ -498,5 +522,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column_X; private System.Windows.Forms.DataGridViewTextBoxColumn Column_X;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Y; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Y;
private System.Windows.Forms.DataGridViewLinkColumn Column_Del; private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
private System.Windows.Forms.TextBox txtId;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -32,8 +32,8 @@ namespace TSA_V ...@@ -32,8 +32,8 @@ namespace TSA_V
} }
private void LanguagePro() private void LanguagePro()
{ {
this.Column_partNumber.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Num, "号"); this.Column_partNumber.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Num, "号");
this.Column_Name.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Name, "物料编码"); this.Column_PN.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Name, "物料编码");
this.Column_Count.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Count, "数量"); this.Column_Count.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Count, "数量");
this.Column_Position.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Position, "料盘位置"); this.Column_Position.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Position, "料盘位置");
this.Column_Notes.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Notes, "注意事项"); this.Column_Notes.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Notes, "注意事项");
...@@ -51,7 +51,7 @@ namespace TSA_V ...@@ -51,7 +51,7 @@ namespace TSA_V
cmbPositionNumList.DisplayMember = "PositionNum"; cmbPositionNumList.DisplayMember = "PositionNum";
cmbPositionNumList.ValueMember = "PositionNum"; cmbPositionNumList.ValueMember = "PositionNum";
} }
private void LoadComList() internal void LoadComList()
{ {
List<string> keyList =new List<string> ( LoadCSVLibrary.CSVBomManager.allComMap.Keys); List<string> keyList =new List<string> ( LoadCSVLibrary.CSVBomManager.allComMap.Keys);
this.cmbList.Items.Clear(); this.cmbList.Items.Clear();
...@@ -70,9 +70,23 @@ namespace TSA_V ...@@ -70,9 +70,23 @@ namespace TSA_V
{ {
if (cmbList.SelectedIndex >= 0) if (cmbList.SelectedIndex >= 0)
{ {
this.dgvList.Rows.Clear(); //this.dgvList.Rows.Clear();
string key = cmbList.Text; string key = cmbList.Text;
List<ComponetInfo> list = CSVBomManager.GetComList(key); List<ComponetInfo> list = CSVBomManager.GetComList(key);
//foreach (ComponetInfo com in list)
//{
// if (com != null)
// {
// dgvList.Rows.Add(SetRowInfo(null, com));
// }
//}
UpdateGridList(list);
}
}
private void UpdateGridList(List<ComponetInfo > list)
{
this.dgvList.Rows.Clear();
foreach (ComponetInfo com in list) foreach (ComponetInfo com in list)
{ {
if (com != null) if (com != null)
...@@ -80,7 +94,7 @@ namespace TSA_V ...@@ -80,7 +94,7 @@ namespace TSA_V
dgvList.Rows.Add(SetRowInfo(null, com)); dgvList.Rows.Add(SetRowInfo(null, com));
} }
} }
}
} }
private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com) private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com)
{ {
...@@ -89,14 +103,15 @@ namespace TSA_V ...@@ -89,14 +103,15 @@ namespace TSA_V
view = new DataGridViewRow(); view = new DataGridViewRow();
view.CreateCells(dgvList); view.CreateCells(dgvList);
} }
view.Cells[Column_Name.Index].Value = com.ComponentName.ToString(); view.Cells[Column_PN.Index].Value = com.PN.ToString();
view.Cells[this.Column_X.Index].Value = com.PositionX.ToString(); view.Cells[this.Column_X.Index].Value = com.PositionX.ToString();
view.Cells[Column_Y.Index].Value = com.PositionY.ToString(); view.Cells[Column_Y.Index].Value = com.PositionY.ToString();
view.Cells[this.Column_description.Index].Value = com.ComponentDes.ToString(); view.Cells[this.Column_description.Index].Value = com.ComponentDes.ToString();
view.Cells[this.Column_Notes.Index].Value = com.Notes.ToString(); view.Cells[this.Column_Notes.Index].Value = com.Notes.ToString();
view.Cells[this.Column_partNumber.Index].Value = com.PartNum.ToString(); view.Cells[this.Column_partNumber.Index].Value = com.TagNo.ToString();
view.Cells[this.Column_Position.Index].Value = com.PositionNum.ToString(); view.Cells[this.Column_Position.Index].Value = com.PositionNum.ToString();
view.Cells[this.Column_Count.Index].Value = com.ComCount.ToString(); view.Cells[this.Column_Count.Index].Value = com.ComCount.ToString();
view.Cells[this.Column_ID.Index].Value = com.Id.ToString();
return view; return view;
} }
...@@ -124,7 +139,10 @@ namespace TSA_V ...@@ -124,7 +139,10 @@ namespace TSA_V
int rowIndex = dgvList.SelectedRows[0].Index; int rowIndex = dgvList.SelectedRows[0].Index;
DataGridViewRow row = dgvList.Rows[rowIndex]; DataGridViewRow row = dgvList.Rows[rowIndex];
ComponetInfo obj = getRowPointInfo(row); ComponetInfo obj = getRowPointInfo(row);
string oldPosition = obj.PositionNum;
if (obj == null) if (obj == null)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectC,"请选择元器件!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectC,"请选择元器件!"));
...@@ -138,15 +156,15 @@ namespace TSA_V ...@@ -138,15 +156,15 @@ namespace TSA_V
} }
TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem; TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem;
obj.ComponentName = FormUtil.getValue(txtName); obj.PN = FormUtil.getValue(txtName);
obj.ComponentDes = FormUtil.getValue(txtDes); obj.ComponentDes = FormUtil.getValue(txtDes);
obj.ComCount = FormUtil.GetIntValue(txtCount); obj.ComCount = FormUtil.GetIntValue(txtCount);
obj.Notes = FormUtil.getValue(txtNotes); obj.Notes = FormUtil.getValue(txtNotes);
obj.PartNum = FormUtil.getValue(txtPartNum); obj.TagNo = FormUtil.getValue(txtPartNum);
obj.Id = FormUtil.GetIntValue(txtId);
obj.PositionNum = position.PositionNum; obj.PositionNum = position.PositionNum;
if (obj.ComponentName.Equals("")) if (obj.PN.Equals(""))
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComName,"请输入元器件名称!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComName,"请输入元器件名称!"));
txtName.Focus(); txtName.Focus();
...@@ -159,14 +177,22 @@ namespace TSA_V ...@@ -159,14 +177,22 @@ namespace TSA_V
txtCount.Focus(); txtCount.Focus();
return; return;
} }
if (obj.PositionNum.Equals(oldPosition).Equals(false) &&(!String.IsNullOrEmpty(obj.TagNo)))
{
List<ComponetInfo> list = CSVBomManager.GetComList(cmbList.Text);
List<ComponetInfo> objs = (from m in list where m.Id.Equals(obj.Id).Equals(false) && m.PN.Equals(obj.PN) && m.PositionNum.Equals(obj.PositionNum) select m).ToList();
if (objs.Count > 0)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComExists, "元器件已存在"));
}
}
bool result = CSVBomManager.UpdateComponet(cmbList.Text, obj); bool result = CSVBomManager.UpdateComponet(cmbList.Text, obj);
if (result) if (result)
{ {
//ComponentManager.Update(obj); //ComponentManager.Update(obj);
SetRowInfo(dgvList.Rows[rowIndex], obj); SetRowInfo(dgvList.Rows[rowIndex], obj);
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", obj.PartNum + "-" + obj.ComponentName)); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", obj.TagNo + "-" + obj.PN));
groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo, "元器件【{0}】的基本信息", obj.PartNum + "-" + obj.ComponentName); groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo, "元器件【{0}】的基本信息", obj.TagNo + "-" + obj.PN);
} }
} }
} }
...@@ -183,30 +209,35 @@ namespace TSA_V ...@@ -183,30 +209,35 @@ namespace TSA_V
return; return;
} }
TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem; TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem;
obj.PartNum = FormUtil.getValue(txtPartNum); obj.TagNo = FormUtil.getValue(txtPartNum);
obj.ComponentName = FormUtil.getValue(txtName); obj.PN = FormUtil.getValue(txtName);
obj.ComponentDes = FormUtil.getValue(txtDes); obj.ComponentDes = FormUtil.getValue(txtDes);
obj.ComCount = FormUtil.GetIntValue(txtCount); obj.ComCount = FormUtil.GetIntValue(txtCount);
obj.Notes = FormUtil.getValue(txtNotes); obj.Notes = FormUtil.getValue(txtNotes);
obj.PositionNum = position.PositionNum; obj.PositionNum = position.PositionNum;
//if (obj.TagNo.Equals(""))
if (obj.PartNum.Equals("")) //{
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WritePartName, "请输入元器件编号!"));
// txtPartNum.Focus();
// return;
//}
//判断编号是否存在
List<ComponetInfo> allList = CSVBomManager.GetComList(cmbList.Text);
List<ComponetInfo> objs = (from m in allList where (!String.IsNullOrEmpty(m.TagNo)) && m.TagNo.Equals(obj.TagNo) select m).ToList();
if (objs.Count > 0)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WritePartName, "请输入元器件编号!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PartNAExist, "元器件编号[{0}]已存在", obj.TagNo));
txtPartNum.Focus(); txtPartNum.Focus();
return; return;
} }
//判断编号是否存在 objs = (from m in allList where m.PN.Equals(obj.PN) && m.PositionNum.Equals(m.PositionNum) select m).ToList();
List<ComponetInfo> allList = CSVBomManager.GetComList(cmbList.Text);
List<ComponetInfo> objs = (from m in allList where m.PartNum.Equals(obj.PartNum) select m).ToList();
if (objs.Count > 0) if (objs.Count > 0)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PartNAExist, "元器件编号[{0}]已存在",obj.PartNum)); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PartNAExist, "元器件编号[{0}]已存在", obj.PN + "-" + obj.PositionNum));
txtPartNum.Focus(); txtPartNum.Focus();
return; return;
} }
if (obj.PN.Equals(""))
if (obj.ComponentName.Equals(""))
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComName, "请输入元器件名称!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComName, "请输入元器件名称!"));
txtName.Focus(); txtName.Focus();
...@@ -219,17 +250,31 @@ namespace TSA_V ...@@ -219,17 +250,31 @@ namespace TSA_V
txtCount.Focus(); txtCount.Focus();
return; return;
} }
if (String.IsNullOrEmpty(obj.TagNo))
{
List<ComponetInfo> lists = CSVBomManager.GetComList(cmbList.Text);
List<ComponetInfo> hasList = (from m in lists where m.Id.Equals(obj.Id).Equals(false) && m.PN.Equals(obj.PN) && m.PositionNum.Equals(obj.PositionNum) select m).ToList();
if (objs.Count > 0)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComExists, "元器件已存在"));
}
}
CSVBomManager.AddCom(cmbList.Text,obj);
List<ComponetInfo> list = CSVBomManager.AddCom(cmbList.Text, obj);
if (list == null)
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SaveError, "保存失败!"));
return;
}
//ComponentManager.Update(obj); //ComponentManager.Update(obj);
//dgvList.Rows.Add(SetRowInfo(null, obj));
dgvList.Rows.Add(SetRowInfo(null, obj)); UpdateGridList(list);
dgvList.Rows[dgvList.Rows.Count - 1].Selected = true; dgvList.Rows[dgvList.Rows.Count - 1].Selected = true;
btnNewCom.Visible = true ; btnNewCom.Visible = true;
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", obj.PartNum + "-" + obj.ComponentName)); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", obj.TagNo + "-" + obj.PN));
groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo, "元器件【{0}】的基本信息", obj.PartNum + "-" + obj.ComponentName); groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo, "元器件【{0}】的基本信息", obj.TagNo + "-" + obj.PN);
} }
private void btnDel_Click(object sender, EventArgs e) private void btnDel_Click(object sender, EventArgs e)
...@@ -246,12 +291,12 @@ namespace TSA_V ...@@ -246,12 +291,12 @@ namespace TSA_V
ComponetInfo point = new ComponetInfo(); ComponetInfo point = new ComponetInfo();
try try
{ {
if (row.Cells[Column_Name.Name].Value == null) if (row.Cells[Column_PN.Name].Value == null)
{ {
return null; return null;
} }
point.PartNum = row.Cells[this.Column_partNumber.Name].Value.ToString(); point.TagNo = row.Cells[this.Column_partNumber.Name].Value.ToString();
point.ComponentName = row.Cells[this.Column_Name.Name].Value.ToString(); point.PN = row.Cells[this.Column_PN.Name].Value.ToString();
point.PositionX =Convert.ToDouble( row.Cells[this.Column_X.Name].Value.ToString()); point.PositionX =Convert.ToDouble( row.Cells[this.Column_X.Name].Value.ToString());
point.PositionY =Convert.ToDouble( row.Cells[this.Column_Y.Name].Value.ToString()); point.PositionY =Convert.ToDouble( row.Cells[this.Column_Y.Name].Value.ToString());
point.ComponentDes = row.Cells[this.Column_description.Name].Value.ToString(); point.ComponentDes = row.Cells[this.Column_description.Name].Value.ToString();
...@@ -294,57 +339,52 @@ namespace TSA_V ...@@ -294,57 +339,52 @@ namespace TSA_V
} }
IsNew = false; IsNew = false;
txtPartNum.Tag = obj; txtPartNum.Tag = obj;
txtName.Text = obj.ComponentName; txtName.Text = obj.PN;
txtDes.Text = obj.ComponentDes; txtDes.Text = obj.ComponentDes;
txtCount.Text = obj.ComCount.ToString(); txtCount.Text = obj.ComCount.ToString();
txtPartNum.Text = obj.PartNum; txtPartNum.Text = obj.TagNo;
txtNotes.Text = obj.Notes; txtNotes.Text = obj.Notes;
txtPartNum.Enabled = false; txtPartNum.Enabled = false;
btnNewCom.Visible = true ; btnNewCom.Visible = true ;
txtId.Text = obj.Id.ToString();
//txtPosition.Text = obj.PositionNum; //txtPosition.Text = obj.PositionNum;
int selPosIndex = -1; int selPosIndex = -1;
int index = -1; int index = -1;
string posNum = CSVBomManager.GetPositionNum(obj.PositionNum);
foreach (TSAVPosition p in allPosition) foreach (TSAVPosition p in allPosition)
{ {
index++; index++;
if (p.PositionNum.Equals(obj.PositionNum)) if (p.PositionNum.Equals(posNum))
{
selPosIndex = index;
break;
}
}
if (selPosIndex >= 0)
{
this.cmbPositionNumList.SelectedIndex = selPosIndex;
}
else
{
index = -1; selPosIndex = -1;
foreach (TSAVPosition p in allPosition)
{
index++;
if (p.PositionNo.ToString().Equals(obj.PositionNum))
{ {
selPosIndex = index; selPosIndex = index;
break; break;
} }
} }
if (selPosIndex >= 0) if (selPosIndex >= 0&&this.cmbPositionNumList.Items.Count>0)
{ {
this.cmbPositionNumList.SelectedIndex = selPosIndex; this.cmbPositionNumList.SelectedIndex = selPosIndex;
} }
}
groupInfo.Text = ResourceCulture.GetString( ResourceCulture.ComInfo, "元器件【{ 0}】的基本信息",obj.PartNum+" -"+obj.ComponentName); groupInfo.Text = ResourceCulture.GetString( ResourceCulture.ComInfo, "元器件【{ 0}】的基本信息",obj.TagNo+" -"+obj.PN);
} }
private void DeleteCom(int rowIndex) private void DeleteCom(int rowIndex)
{ {
DataGridViewRow row = dgvList.Rows[rowIndex]; DataGridViewRow row = dgvList.Rows[rowIndex];
ComponetInfo obj = getRowPointInfo(row); ComponetInfo obj = getRowPointInfo(row);
if (cmbList.SelectedIndex >= 0)
{
string bomName = this.cmbList.Text;
if (!CSVBomManager.canRemoveCom(bomName, obj))
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.CanotDelCom, "元器件已使用,不能删除!"));
return;
}
if (MessageBox.Show( if (MessageBox.Show(
ResourceCulture.GetString(ResourceCulture.SureDelCom, "确认要删除元器件【{0}】吗?", obj.PartNum + "-" + obj.ComponentName), ResourceCulture.GetString(ResourceCulture.SureDelCom, "确认要删除元器件【{0}】吗?", obj.TagNo + "-" + obj.PN),
ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"), ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示"),
MessageBoxButtons.OKCancel, MessageBoxButtons.OKCancel,
MessageBoxIcon.Question) != DialogResult.OK) MessageBoxIcon.Question) != DialogResult.OK)
...@@ -353,10 +393,21 @@ namespace TSA_V ...@@ -353,10 +393,21 @@ namespace TSA_V
} }
else else
{ {
CSVBomManager.RemoveCom(cmbList.Text, obj); List<ComponetInfo> newlist= CSVBomManager.RemoveCom(cmbList.Text, obj);
this.dgvList.Rows.RemoveAt(rowIndex); if (newlist == null)
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DelComOk,"元器件【{0}】删除成功!",obj.PartNum + "-" + obj.ComponentName) {
,ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SaveError, "保存失败!"));
return;
}
//this.dgvList.Rows.RemoveAt(rowIndex);
UpdateGridList(newlist);
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DelComOk, "元器件【{0}】删除成功!", obj.TagNo + "-" + obj.PN)
, ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示"));
}
}
else
{
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectC, "请先选择一个元器件库"));
} }
} }
......
...@@ -117,10 +117,13 @@ ...@@ -117,10 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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"> <metadata name="Column_partNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_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> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <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 ...@@ -118,12 +118,11 @@ namespace TSA_V
//加载板卡 //加载板卡
BoardManager.LoadBoard(); BoardManager.LoadBoard();
CSVBomManager.LoadAllCom();
WorkCountManager.LoadData(); WorkCountManager.LoadData();
//CalibrationManager.LoadData();
string positionFileName = CSVPositionReader<TSAVPosition>.getPositionFilePath(); string positionFileName = CSVPositionReader<TSAVPosition>.getPositionFilePath();
//加载位置 //加载位置
LoadCSVLibrary.CSVPositionReader<TSAVPosition>.LoadFile(positionFileName); LoadCSVLibrary.CSVPositionReader<TSAVPosition>.LoadFile(positionFileName);
CSVBomManager.LoadAllCom();
//加载设备信息 //加载设备信息
TSAVBean.LoadTSAV(); TSAVBean.LoadTSAV();
//需要链接IO //需要链接IO
...@@ -259,6 +258,10 @@ namespace TSA_V ...@@ -259,6 +258,10 @@ namespace TSA_V
// return; // return;
//} //}
isClick = true; isClick = true;
if (FrmComponentList.instance != null && FrmComponentList.instance.Visible == false)
{
FrmComponentList.instance.LoadComList();
}
FrmComponentList.instance.Show(); FrmComponentList.instance.Show();
this.Visible = false; this.Visible = false;
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPointInfo)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPointInfo));
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.xyMoveControl1 = new UserFromControl.ProjectorControl();
this.btnPre = new System.Windows.Forms.Button(); this.btnPre = new System.Windows.Forms.Button();
this.btnSaveAndNext = new System.Windows.Forms.Button(); this.btnSaveAndNext = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
...@@ -43,16 +42,18 @@ ...@@ -43,16 +42,18 @@
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.chbNeedCheck = new System.Windows.Forms.CheckBox(); this.chbNeedCheck = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label(); 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.chbNeedSoldering = new System.Windows.Forms.CheckBox();
this.txtY = new System.Windows.Forms.TextBox(); this.txtY = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label2 = 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.txtX = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = 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.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -61,23 +62,6 @@ ...@@ -61,23 +62,6 @@
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); 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 // btnPre
// //
this.btnPre.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnPre.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
...@@ -106,6 +90,7 @@ ...@@ -106,6 +90,7 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.cmbPnList);
this.groupBox1.Controls.Add(this.lblNotes); this.groupBox1.Controls.Add(this.lblNotes);
this.groupBox1.Controls.Add(this.chbCheck); this.groupBox1.Controls.Add(this.chbCheck);
this.groupBox1.Controls.Add(this.txtWeldTemp); this.groupBox1.Controls.Add(this.txtWeldTemp);
...@@ -114,12 +99,12 @@ ...@@ -114,12 +99,12 @@
this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.chbNeedCheck); this.groupBox1.Controls.Add(this.chbNeedCheck);
this.groupBox1.Controls.Add(this.label3); 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.chbNeedSoldering);
this.groupBox1.Controls.Add(this.txtY); this.groupBox1.Controls.Add(this.txtY);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label2); 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.txtX);
this.groupBox1.Controls.Add(this.label1); 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.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -210,15 +195,15 @@ ...@@ -210,15 +195,15 @@
this.label3.Text = "X:"; this.label3.Text = "X:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtNum // txtTagNo
// //
this.txtNum.Enabled = false; this.txtTagNo.Enabled = false;
this.txtNum.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtTagNo.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.txtTagNo.Location = new System.Drawing.Point(135, 24);
this.txtNum.MaxLength = 30; this.txtTagNo.MaxLength = 30;
this.txtNum.Name = "txtNum"; this.txtTagNo.Name = "txtTagNo";
this.txtNum.Size = new System.Drawing.Size(219, 26); this.txtTagNo.Size = new System.Drawing.Size(219, 26);
this.txtNum.TabIndex = 64; this.txtTagNo.TabIndex = 64;
// //
// chbNeedSoldering // chbNeedSoldering
// //
...@@ -256,17 +241,17 @@ ...@@ -256,17 +241,17 @@
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(128, 22); this.label2.Size = new System.Drawing.Size(128, 22);
this.label2.TabIndex = 60; this.label2.TabIndex = 60;
this.label2.Text = "号:"; this.label2.Text = "号:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 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.txtPn.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.txtPn.Location = new System.Drawing.Point(135, 62);
this.txtName.MaxLength = 30; this.txtPn.MaxLength = 30;
this.txtName.Name = "txtName"; this.txtPn.Name = "txtPn";
this.txtName.Size = new System.Drawing.Size(219, 26); this.txtPn.Size = new System.Drawing.Size(219, 26);
this.txtName.TabIndex = 33; this.txtPn.TabIndex = 33;
// //
// txtX // txtX
// //
...@@ -283,7 +268,7 @@ ...@@ -283,7 +268,7 @@
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 22); this.label1.Size = new System.Drawing.Size(128, 22);
this.label1.TabIndex = 32; this.label1.TabIndex = 32;
this.label1.Text = "名称:"; this.label1.Text = "物料编码:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// btnCancel // btnCancel
...@@ -312,6 +297,33 @@ ...@@ -312,6 +297,33 @@
this.btnSave.UseVisualStyleBackColor = true; this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 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 // FrmPointInfo
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -340,7 +352,7 @@ ...@@ -340,7 +352,7 @@
private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.GroupBox groupBox1; 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 label1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
...@@ -348,7 +360,7 @@ ...@@ -348,7 +360,7 @@
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtX; private System.Windows.Forms.TextBox txtX;
private System.Windows.Forms.Timer timer1; 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.Button btnSaveAndNext;
private System.Windows.Forms.CheckBox chbNeedCheck; private System.Windows.Forms.CheckBox chbNeedCheck;
private System.Windows.Forms.CheckBox chbNeedSoldering; private System.Windows.Forms.CheckBox chbNeedSoldering;
...@@ -360,5 +372,6 @@ ...@@ -360,5 +372,6 @@
private UserFromControl.ProjectorControl xyMoveControl1; private UserFromControl.ProjectorControl xyMoveControl1;
private System.Windows.Forms.CheckBox chbCheck; private System.Windows.Forms.CheckBox chbCheck;
private System.Windows.Forms.Label lblNotes; private System.Windows.Forms.Label lblNotes;
private System.Windows.Forms.ComboBox cmbPnList;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -20,24 +20,23 @@ namespace TSA_V ...@@ -20,24 +20,23 @@ namespace TSA_V
{ {
public delegate void NextDel(int index, SMTPointInfo smt=null); public delegate void NextDel(int index, SMTPointInfo smt=null);
public event NextDel NextEvent; public event NextDel NextEvent;
public bool IsUpdate = false; internal bool updateOK = false;
public SMTPointInfo smtPointInfo = new SMTPointInfo(); internal SMTPointInfo smtPointInfo = new SMTPointInfo();
public BoardInfo boardInfo = null; internal BoardInfo boardInfo = null;
public string AoiProgramName = ""; internal string AoiProgramName = "";
public Image PicImage = null; internal Image PicImage = null;
public FrmPointInfo(string name, double x, double y, double nodex, double nodey)
internal bool isNewPoint = false;
public FrmPointInfo(BoardInfo board, string name, double x, double y, double nodex, double nodey)
{ {
InitializeComponent(); InitializeComponent();
loadPositionList(); loadPositionList();
this.boardInfo = board;
isNewPoint = true;
this.Text = "新增组装信息"; this.Text = "新增组装信息";
this.txtNum.Enabled = true; this.txtTagNo.Text = name;
this.txtName.Text = name; updateFrom(true);
//if (cmbPositionNumList.Items.Count > 0)
//{
// cmbPositionNumList.SelectedIndex = 0;
//}
//this.txtRobotX.Text = nodex.ToString();
//txtRobotY.Text = nodey.ToString();
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent; xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.XValue = nodex; xyMoveControl1.XValue = nodex;
xyMoveControl1.YValue = nodey; xyMoveControl1.YValue = nodey;
...@@ -46,7 +45,31 @@ namespace TSA_V ...@@ -46,7 +45,31 @@ namespace TSA_V
this.txtY.Text = y.ToString(); 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) private bool XyMoveControl1_ShowPointEvent(ProjectorPInfo p)
{ {
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
...@@ -83,34 +106,14 @@ namespace TSA_V ...@@ -83,34 +106,14 @@ namespace TSA_V
private void ShowPoint() private void ShowPoint()
{ {
updateFrom(false);
btnSave.Visible = true;
this.smtPointInfo = PointList[CurrIndex]; this.smtPointInfo = PointList[CurrIndex];
this.txtNum.Enabled = false; this.Text = "修改组装信息【" + smtPointInfo.PN + "】 ";
this.Text = "修改组装信息【" + smtPointInfo.pointName + "】 ";
loadPositionList(); 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(); //this.txtRobotX.Text = smpPointInfo.NodePositionX.ToString();
//txtRobotY.Text = smpPointInfo.NodePositionY.ToString(); //txtRobotY.Text = smpPointInfo.NodePositionY.ToString();
xyMoveControl1.XValue = smtPointInfo.NodePositionX; xyMoveControl1.XValue = smtPointInfo.NodePositionX;
...@@ -123,7 +126,7 @@ namespace TSA_V ...@@ -123,7 +126,7 @@ namespace TSA_V
xyMoveControl1.ShowCurrPoint(); xyMoveControl1.ShowCurrPoint();
this.txtX.Text = smtPointInfo.PositionX.ToString(); this.txtX.Text = smtPointInfo.PositionX.ToString();
this.txtY.Text = smtPointInfo.PositionY.ToString(); this.txtY.Text = smtPointInfo.PositionY.ToString();
this.txtNum.Text = smtPointInfo.PartNum; this.txtTagNo.Text = smtPointInfo.TagNo;
this.chbNeedCheck.Checked = smtPointInfo.NeedCheck; this.chbNeedCheck.Checked = smtPointInfo.NeedCheck;
this.chbNeedSoldering.Checked = smtPointInfo.NeedSoldering; this.chbNeedSoldering.Checked = smtPointInfo.NeedSoldering;
this.txtWeldTemp.Text = smtPointInfo.WeldTemp.ToString(); this.txtWeldTemp.Text = smtPointInfo.WeldTemp.ToString();
...@@ -132,7 +135,7 @@ namespace TSA_V ...@@ -132,7 +135,7 @@ namespace TSA_V
lblNotes.Text = ""; lblNotes.Text = "";
if (boardInfo != null) if (boardInfo != null)
{ {
ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo.PartNum); ComponetInfo com = CSVBomManager.GetCom(boardInfo.bomName, smtPointInfo);
if (com != null) if (com != null)
{ {
lblNotes.Text = com.Notes; lblNotes.Text = com.Notes;
...@@ -171,29 +174,38 @@ namespace TSA_V ...@@ -171,29 +174,38 @@ namespace TSA_V
} }
private bool saveInfo() private bool saveInfo()
{ {
//if (cmbPositionNumList.SelectedIndex < 0)
//{ if (isNewPoint)
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ChoiceComPosition, "请选择元器件所在位置!")); {
// cmbPositionNumList.Focus(); smtPointInfo = new SMTPointInfo();
// return false; smtPointInfo.pointNum = boardInfo.GetNextPNum();
//} }
string name = FormUtil.getValue(txtName);
if (name.Equals("")) string pn = FormUtil.getValue(txtPn);
if (pn.Equals(""))
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteName, "请输入物料编码!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteName, "请输入物料编码!"));
txtName.Focus(); txtPn.Focus();
return false; 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, "请输入位号!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WritePartNumber, "请输入位号!"));
txtNum.Focus(); txtTagNo.Focus();
return false; return false;
} }
List<SMTPointInfo> pos = (from m in boardInfo.smtList where m.pointNum != smtPointInfo.pointNum && m.TagNo.Equals(tagNo) select m).ToList();
smtPointInfo.pointName = name; 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.PositionX = FormUtil.getDoubleValue(txtX);
smtPointInfo.PositionY = FormUtil.getDoubleValue(txtY); smtPointInfo.PositionY = FormUtil.getDoubleValue(txtY);
smtPointInfo.NodePositionX = xyMoveControl1.XValue; smtPointInfo.NodePositionX = xyMoveControl1.XValue;
...@@ -203,8 +215,6 @@ namespace TSA_V ...@@ -203,8 +215,6 @@ namespace TSA_V
smtPointInfo.PointSizeY = xyMoveControl1.PointSizeY; smtPointInfo.PointSizeY = xyMoveControl1.PointSizeY;
smtPointInfo.PenWidth = xyMoveControl1.PenWidth; smtPointInfo.PenWidth = xyMoveControl1.PenWidth;
smtPointInfo.ShowText = xyMoveControl1.ShowText; smtPointInfo.ShowText = xyMoveControl1.ShowText;
//smtPointInfo.NodePositionX = FormUtil.getDoubleValue(txtRobotX);
//smtPointInfo.NodePositionY = FormUtil.getDoubleValue(txtRobotY);
smtPointInfo.NeedSoldering = chbNeedSoldering.Checked; smtPointInfo.NeedSoldering = chbNeedSoldering.Checked;
smtPointInfo.NeedCheck = chbNeedCheck.Checked; smtPointInfo.NeedCheck = chbNeedCheck.Checked;
smtPointInfo.WeldTime = FormUtil.getDoubleValue(txtWeldTime); smtPointInfo.WeldTime = FormUtil.getDoubleValue(txtWeldTime);
...@@ -219,16 +229,36 @@ namespace TSA_V ...@@ -219,16 +229,36 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteRightTime,"请输入正确的焊接时间!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteRightTime,"请输入正确的焊接时间!"));
return false; return false;
} }
//TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem; if (isNewPoint)
//smtPointInfo.PositionNum = position.PositionNum; {
// this.DialogResult = DialogResult.OK; 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) if (this.PointList.Count > 0 && CurrIndex >= 0)
{ {
PointList[CurrIndex] = smtPointInfo; PointList[CurrIndex] = smtPointInfo;
} }
IsUpdate = true; updateOK = true;
return true; return true;
} }
}
private void closeForm() private void closeForm()
{ {
...@@ -297,5 +327,13 @@ namespace TSA_V ...@@ -297,5 +327,13 @@ namespace TSA_V
FrmAoiSetting frm = new FrmAoiSetting(path+AoiProgramName, PicImage,path); FrmAoiSetting frm = new FrmAoiSetting(path+AoiProgramName, PicImage,path);
frm.ShowDialog(); frm.ShowDialog();
} }
private void cmbPnList_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbPnList.SelectedIndex >= 0)
{
txtPn.Text = cmbPnList.Text;
}
}
} }
} }
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
this.Controls.Add(this.txtName); this.Controls.Add(this.txtName);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Name = "FrmPutCom"; this.Name = "FrmPutCom";
this.Text = "备料"; this.Text = "程序备料";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmPutCom_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmPutCom_FormClosing);
this.Load += new System.EventHandler(this.FrmPutCom_Load); this.Load += new System.EventHandler(this.FrmPutCom_Load);
this.Shown += new System.EventHandler(this.FrmPutCom_Shown); this.Shown += new System.EventHandler(this.FrmPutCom_Shown);
......
...@@ -56,7 +56,7 @@ namespace TSA_V ...@@ -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.bomName = bomName;
this.Text = "元器件库【" + bomName + "】备料中"; this.Text = "元器件库【" + bomName + "】备料中";
LogUtil.info("开始备料:元器件库【" + bomName + "】"); LogUtil.info("开始备料:元器件库【" + bomName + "】");
...@@ -93,9 +93,9 @@ namespace TSA_V ...@@ -93,9 +93,9 @@ namespace TSA_V
currCom = comList[currIndex]; currCom = comList[currIndex];
currPosition = CSVPositionReader<TSAVPosition>.GetPositonByNum(currCom.PositionNum); currPosition = CSVPositionReader<TSAVPosition>.GetPositonByNum(currCom.PositionNum);
this.txtName.Text = currCom.ComponentName; this.txtName.Text = currCom.PN;
this.txtNum.Text = currCom.ComCount.ToString(); this.txtNum.Text = currCom.ComCount.ToString();
this.txtPartNum.Text = currCom.PartNum; this.txtPartNum.Text = currCom.TagNo;
this.txtPosition.Text = currCom.PositionNum; this.txtPosition.Text = currCom.PositionNum;
this.txtDes.Text = currCom.ComponentDes; this.txtDes.Text = currCom.ComponentDes;
if (CurrLanguage.Equals(ResourceCulture.China)) if (CurrLanguage.Equals(ResourceCulture.China))
...@@ -110,7 +110,7 @@ namespace TSA_V ...@@ -110,7 +110,7 @@ namespace TSA_V
} }
//lblEndInfo.Text = "已完成" + currIndex + "个"; //lblEndInfo.Text = "已完成" + currIndex + "个";
//this.lblLeftInfo.Text = "剩余" + (comList.Count - 1 - 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)) if (currIndex.Equals(0))
{ {
btnPre.Enabled = false; btnPre.Enabled = false;
...@@ -217,7 +217,7 @@ namespace TSA_V ...@@ -217,7 +217,7 @@ namespace TSA_V
} }
} }
CSVBomManager.SaveComponet(bomName, oldConList); CSVBomManager.SaveBomToFile(bomName, oldConList);
} }
private void FrmPutCom_FormClosing(object sender, FormClosingEventArgs e) private void FrmPutCom_FormClosing(object sender, FormClosingEventArgs e)
......
...@@ -45,7 +45,7 @@ namespace TSA_V ...@@ -45,7 +45,7 @@ namespace TSA_V
this.cmbPointList.Items.Clear(); this.cmbPointList.Items.Clear();
foreach (SMTPointInfo point in pointList) foreach (SMTPointInfo point in pointList)
{ {
cmbPointList.Items.Add(point.PartNum + "-" + point.pointName); cmbPointList.Items.Add(point.TagNo + "-" + point.PN);
} }
if (cmbPointList.Items.Count > 0) if (cmbPointList.Items.Count > 0)
{ {
......
...@@ -325,10 +325,10 @@ ...@@ -325,10 +325,10 @@
<value>END</value> <value>END</value>
</data> </data>
<data name="FrmPutCom_btnNext_Text" xml:space="preserve"> <data name="FrmPutCom_btnNext_Text" xml:space="preserve">
<value>LAST</value> <value>NEXT</value>
</data> </data>
<data name="FrmPutCom_btnPre_Text" xml:space="preserve"> <data name="FrmPutCom_btnPre_Text" xml:space="preserve">
<value>NEXT</value> <value>PREVIOUS</value>
</data> </data>
<data name="FrmPutCom_label1_Text" xml:space="preserve"> <data name="FrmPutCom_label1_Text" xml:space="preserve">
<value>PLATE POSITION</value> <value>PLATE POSITION</value>
...@@ -385,10 +385,10 @@ ...@@ -385,10 +385,10 @@
<value>ASSEMBLY QUANTITY</value> <value>ASSEMBLY QUANTITY</value>
</data> </data>
<data name="FrmBoardList_label4_Text" xml:space="preserve"> <data name="FrmBoardList_label4_Text" xml:space="preserve">
<value>LENGTH→</value> <value>LENGTH→ :</value>
</data> </data>
<data name="FrmBoardList_label3_Text" xml:space="preserve"> <data name="FrmBoardList_label3_Text" xml:space="preserve">
<value>WIDTH ↑</value> <value>WIDTH ↑ :</value>
</data> </data>
<data name="FrmBoardList_label2_Text" xml:space="preserve"> <data name="FrmBoardList_label2_Text" xml:space="preserve">
<value>STOCK NAME</value> <value>STOCK NAME</value>
...@@ -2345,7 +2345,7 @@ ...@@ -2345,7 +2345,7 @@
<value> Projection words: </value> <value> Projection words: </value>
</data> </data>
<data name="FrmBoardInfo_lblLineW_Text" xml:space="preserve"> <data name="FrmBoardInfo_lblLineW_Text" xml:space="preserve">
<value> Line body width: </value> <value> Line width: </value>
</data> </data>
<data name="FrmBoardInfo_lbllinews_Text" xml:space="preserve"> <data name="FrmBoardInfo_lbllinews_Text" xml:space="preserve">
<value> mm </value> <value> mm </value>
...@@ -2413,7 +2413,35 @@ ...@@ -2413,7 +2413,35 @@
<data name="注意事项" xml:space="preserve"> <data name="注意事项" xml:space="preserve">
<value>ANNOUNCEMENTS</value> <value>ANNOUNCEMENTS</value>
</data> </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 = "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 = "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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -2431,4 +2431,32 @@ ...@@ -2431,4 +2431,32 @@
<data name = "FrmBoardSelect_chbWorkSingleStart_Text" xml:space = "preserve"> <value> 启用工作区检测开始工作 </value> </data> <data name = "FrmBoardSelect_chbWorkSingleStart_Text" xml:space = "preserve"> <value> 启用工作区检测开始工作 </value> </data>
<data name = "FrmPointInfo_lblName_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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -189,14 +189,14 @@ namespace TSA_V ...@@ -189,14 +189,14 @@ namespace TSA_V
/// 请先输入元器件库名称 /// 请先输入元器件库名称
/// </summary> /// </summary>
public static string WriteCName = "WriteCName"; public static string WriteCName = "WriteCName";
/// <summary> ///// <summary>
/// 两个不同的元器件中都配置在库位【{0}】中,请检查文件 ///// 两个不同的元器件中都配置在库位【{0}】中,请检查文件
/// </summary> ///// </summary>
public static string CheckFile = "CheckFile"; //public static string CheckFile = "CheckFile";
/// <summary> ///// <summary>
/// 元器件【{0}】配置了两个位置【(1)】和【(2)】,是否确定导入? ///// 元器件【{0}】配置了两个位置【(1)】和【(2)】,是否确定导入?
/// </summary> ///// </summary>
public static string SureImport = "SureImport"; //public static string SureImport = "SureImport";
/// <summary> /// <summary>
/// 请选择正确的文件(文件格式可以通过下载模板获得) /// 请选择正确的文件(文件格式可以通过下载模板获得)
/// </summary> /// </summary>
...@@ -722,6 +722,42 @@ namespace TSA_V ...@@ -722,6 +722,42 @@ namespace TSA_V
/// 调宽{0}={1}结束:{2} /// 调宽{0}={1}结束:{2}
/// </summary> /// </summary>
public static string ChangeWEnd = "ChangeWEnd"; 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 @@ ...@@ -184,6 +184,12 @@
<Compile Include="FrmChangeWidth.Designer.cs"> <Compile Include="FrmChangeWidth.Designer.cs">
<DependentUpon>FrmChangeWidth.cs</DependentUpon> <DependentUpon>FrmChangeWidth.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmBoardPutCom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmBoardPutCom.Designer.cs">
<DependentUpon>FrmBoardPutCom.cs</DependentUpon>
</Compile>
<Compile Include="projector\FrmProjectorScreen.cs"> <Compile Include="projector\FrmProjectorScreen.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -336,6 +342,9 @@ ...@@ -336,6 +342,9 @@
<EmbeddedResource Include="FrmChangeWidth.resx"> <EmbeddedResource Include="FrmChangeWidth.resx">
<DependentUpon>FrmChangeWidth.cs</DependentUpon> <DependentUpon>FrmChangeWidth.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmBoardPutCom.resx">
<DependentUpon>FrmBoardPutCom.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="projector\FrmProjectorScreen.resx"> <EmbeddedResource Include="projector\FrmProjectorScreen.resx">
<DependentUpon>FrmProjectorScreen.cs</DependentUpon> <DependentUpon>FrmProjectorScreen.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -517,21 +517,14 @@ namespace TSA_V ...@@ -517,21 +517,14 @@ namespace TSA_V
{ {
return; return;
} }
if (!smtPoint.pointName.Equals("")) if (!smtPoint.PN.Equals(""))
{ {
lblPositionNum.Text = smtPoint.PositionNum; lblPositionNum.Text = smtPoint.PositionNum;
lblPartNum.Text = smtPoint.PartNum; lblPartNum.Text = smtPoint.TagNo;
lblPointName.Text = smtPoint.pointName; lblPointName.Text = smtPoint.PN;
ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint.PartNum); ComponetInfo com = CSVBomManager.GetCom(BoardManager.CurrBoard.bomName, smtPoint);
TSAVPosition position = null; TSAVPosition position = CSVPositionReader<TSAVPosition >.GetPositonByNum(com.PositionNum);
if (com != null)
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(com.PositionNum);
}
else
{
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(smtPoint.PositionNum);
}
if (position != null) if (position != null)
{ {
lblPositionNum.Text = position.PositionNum; lblPositionNum.Text = position.PositionNum;
...@@ -539,7 +532,7 @@ namespace TSA_V ...@@ -539,7 +532,7 @@ namespace TSA_V
if (com != null) if (com != null)
{ {
lblComDes.Text = com.ComponentDes; lblComDes.Text = com.ComponentDes;
this.lblComName.Text = com.ComponentName; this.lblComName.Text = com.PN;
lblCount.Text = com.ComCount.ToString(); lblCount.Text = com.ComCount.ToString();
txtCount.Text = com.ComCount.ToString(); txtCount.Text = com.ComCount.ToString();
lblComNotices.Text = com.Notes.ToString(); lblComNotices.Text = com.Notes.ToString();
...@@ -754,7 +747,7 @@ namespace TSA_V ...@@ -754,7 +747,7 @@ namespace TSA_V
} }
FrmProjectorScreen.instance.ShowPoint(true, smtPoint); 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; TSAVPosition position = null;
if (com != null) if (com != null)
{ {
...@@ -839,12 +832,17 @@ namespace TSA_V ...@@ -839,12 +832,17 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DeviceNotOkMsg, "设备未连接!")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DeviceNotOkMsg, "设备未连接!"));
return; return;
} }
string comName = lblComName.Text; if (smtPoint == null)
{
return;
}
//string comName = lblComName.Text;
int count = FormUtil.GetIntValue(txtCount); int count = FormUtil.GetIntValue(txtCount);
string bomName = TSAVBean.Work.currBoard.bomName; 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; txtCount.Visible = false;
......
...@@ -186,7 +186,7 @@ namespace TSA_V ...@@ -186,7 +186,7 @@ namespace TSA_V
float y = (float)Math.Abs(weld.PositionY) * picBoard.Width / Width; float y = (float)Math.Abs(weld.PositionY) * picBoard.Width / Width;
pointXMap.Add(weld.pointNum, x); pointXMap.Add(weld.pointNum, x);
pointYMap.Add(weld.pointNum, y); pointYMap.Add(weld.pointNum, y);
if (weld.PartNum.Equals(smtPoint.PartNum)) if (weld.TagNo.Equals(smtPoint.TagNo))
//if (prepareWeld && weld.pointName.Equals(smtPoint.pointName)) //if (prepareWeld && weld.pointName.Equals(smtPoint.pointName))
{ {
int lineLength = 12; 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 在分支Line-TSAV-Galvanometer的基础上拉 新分支:Line-TSAV-GAOI
增加AOI功能。 增加AOI功能。
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!