SVN-Revision: r409
This commit is contained in:
wyf
2025-03-27 05:05:45 +00:00
parent f5d29694bb
commit d3fee8afb9
3 changed files with 42 additions and 35 deletions
+5 -1
View File
@@ -169,11 +169,15 @@ namespace Lskj.PubBomImport
{ {
saveResult = true; saveResult = true;
} }
else
{
throw new Exception($"保存Bom失败\r\n{tipMsg}");
}
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageUtil.Show(ex.Message); throw new Exception($"保存Bom失败\r\n{ex.Message}");
} }
} }
return saveResult; return saveResult;
+1 -1
View File
@@ -707,7 +707,7 @@ namespace Lskj.PubBomImport
for (int j = firstRow.FirstCellNum; j < cellCount; j++) for (int j = firstRow.FirstCellNum; j < cellCount; j++)
{ {
ICell cell = row.GetCell(j); ICell cell = row.GetCell(j);
if (cell.IsMergedCell) if (cell != null && cell.IsMergedCell)
{ {
CellRangeAddress mergrRange = FindMergedRegion(sheet, i, j); CellRangeAddress mergrRange = FindMergedRegion(sheet, i, j);
if (j == mergrRange.FirstColumn) if (j == mergrRange.FirstColumn)
+7 -4
View File
@@ -74,7 +74,7 @@ namespace Lskj.PubBomImport
if (code.StartsWith("QD") || code.StartsWith("ZZQD")) if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
{ {
stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')"); stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}') end;"); stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak,SpeciesNo) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','0199') end;");
} }
} }
if (!string.IsNullOrEmpty(stringBuilder.ToString())) if (!string.IsNullOrEmpty(stringBuilder.ToString()))
@@ -142,7 +142,9 @@ namespace Lskj.PubBomImport
int.TryParse(dataRow["套数"] + "", out int tamount); int.TryParse(dataRow["套数"] + "", out int tamount);
string code = (dataRow["图号"] + "").Trim(); string code = (dataRow["图号"] + "").Trim();
FileInfo childInfo = fileInfos.Where(n => n.Name.StartsWith(code)).FirstOrDefault(); FileInfo childInfo = fileInfos.Where(n => n.Name.StartsWith(code)).FirstOrDefault();
if (childInfo != null && (code.StartsWith("QD") || code.StartsWith("ZZQD"))) if (childInfo != null)
{
if ((code.StartsWith("QD") || code.StartsWith("ZZQD")))
{ {
SetProcessBar(0, allCount); SetProcessBar(0, allCount);
SetProcessMsg($"正在导入:{Path.GetFileName(childInfo.FullName)}"); SetProcessMsg($"正在导入:{Path.GetFileName(childInfo.FullName)}");
@@ -179,9 +181,10 @@ namespace Lskj.PubBomImport
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message); MessageUtil.Show(ex.Message);
} }
finally finally
{ {
@@ -268,7 +271,7 @@ namespace Lskj.PubBomImport
if (code.StartsWith("QD") || code.StartsWith("ZZQD")) if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
{ {
stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')"); stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}') end;"); stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak,SpeciesNo) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','0199') end;");
} }
} }
if (!string.IsNullOrEmpty(stringBuilder.ToString())) if (!string.IsNullOrEmpty(stringBuilder.ToString()))