Commit 62c5dc32 LN

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

2 个父辈 9e26bb06 9a3dfd31
...@@ -4,6 +4,7 @@ using System.IO; ...@@ -4,6 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
...@@ -148,6 +149,12 @@ namespace TSA_V.LoadCSVLibrary ...@@ -148,6 +149,12 @@ namespace TSA_V.LoadCSVLibrary
{ {
value = "0"; value = "0";
} }
if (proName == "PositionX" || proName == "PositionY") {
value = Regex.Match(value, @"\d+\.\d+|\d+").Value;
if (value == "")
value = "0";
}
//如果属性存在 //如果属性存在
prop.SetValue(bllIns, Convert.ChangeType(value, prop.PropertyType), null);//赋值****在这里需要考虑类型问题 prop.SetValue(bllIns, Convert.ChangeType(value, prop.PropertyType), null);//赋值****在这里需要考虑类型问题
} }
...@@ -156,12 +163,7 @@ namespace TSA_V.LoadCSVLibrary ...@@ -156,12 +163,7 @@ namespace TSA_V.LoadCSVLibrary
} }
ComponetInfo com = (ComponetInfo)bllIns; ComponetInfo com = (ComponetInfo)bllIns;
com.Id = index + 1; 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); comList.Add(com);
} }
else else
...@@ -177,6 +179,46 @@ namespace TSA_V.LoadCSVLibrary ...@@ -177,6 +179,46 @@ namespace TSA_V.LoadCSVLibrary
index++; index++;
} }
Dictionary<string, string> pnposlist = new Dictionary<string, string>();
HashSet<string> usedposlist = new HashSet<string>();
foreach (var com in comList) {
if (string.IsNullOrWhiteSpace(com.PositionNum))
continue;
com.PositionNum = GetPositionNum(com.PositionNum);
if (!string.IsNullOrEmpty(com.PositionNum))
{
usedposlist.Add(com.PositionNum);
pnposlist[com.PN] = com.PositionNum;
}
}
foreach (var com in comList) {
if (string.IsNullOrWhiteSpace(com.PositionNum) && !string.IsNullOrWhiteSpace(com.PN))
{
if (pnposlist.ContainsKey(com.PN))
com.PositionNum = pnposlist[com.PN];
else
{
foreach (var p in CSVPositionReader<TSAVPosition>.allPositionMap)
{
if (usedposlist.Contains(p.Value.PositionNum))
continue;
com.PositionNum = p.Value.PositionNum;
pnposlist[com.PN] = com.PositionNum;
usedposlist.Add(com.PositionNum);
break;
}
}
}
//if (String.IsNullOrEmpty(com.PositionNum) || String.IsNullOrEmpty(com.PN))
//{
// LOGGER.Error("读取csv,数据不完整,跳过数据,line=" + com.TagNo);
// continue;
//}
}
return comList; return comList;
} }
public static string GetPositionNum(string configPosition ) public static string GetPositionNum(string configPosition )
...@@ -188,6 +230,8 @@ namespace TSA_V.LoadCSVLibrary ...@@ -188,6 +230,8 @@ namespace TSA_V.LoadCSVLibrary
} }
return ""; 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))
......
...@@ -99,7 +99,7 @@ namespace TSA_V ...@@ -99,7 +99,7 @@ namespace TSA_V
return false ; return false ;
} }
board.LineWidth = FormUtil.GetIntValue(txtLineWidth); board.LineWidth = FormUtil.GetIntValue(txtLineWidth);
if (board.LineWidth <= 0) if (board.LineWidth <= 0 && !IOBase.NoLine)
{ {
board.LineWidth = board.boardWidth; board.LineWidth = board.boardWidth;
txtLineWidth.Text = board.LineWidth.ToString(); txtLineWidth.Text = board.LineWidth.ToString();
...@@ -372,8 +372,9 @@ namespace TSA_V ...@@ -372,8 +372,9 @@ namespace TSA_V
private void btnOpenFile_Click(object sender, LinkLabelLinkClickedEventArgs e) private void btnOpenFile_Click(object sender, LinkLabelLinkClickedEventArgs e)
{ {
openFileDialogImg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); openFileDialogImg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg"; //openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg";
openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg"; //openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg";
openFileDialogImg.Filter = "Image Files|*.bmp;*.jpg;*.gif;*.png;*jpeg";
string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径 string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径
openFileDialogImg.InitialDirectory = directory; openFileDialogImg.InitialDirectory = directory;
if (openFileDialogImg.ShowDialog() == DialogResult.OK) if (openFileDialogImg.ShowDialog() == DialogResult.OK)
......
...@@ -603,12 +603,15 @@ namespace TSA_V ...@@ -603,12 +603,15 @@ namespace TSA_V
txtBoardL.Focus(); txtBoardL.Focus();
return; return;
} }
if (board.LineWidth <= 0)
if (!IOBase.NoLine && board.LineWidth <= 0)
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteLineWidth, "请输入线体宽度")); MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteLineWidth, "请输入线体宽度"));
txtLineWidth.Focus(); txtLineWidth.Focus();
return; return;
} }
else
board.LineWidth = 1;
if (picBoard.Image == null) if (picBoard.Image == null)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!