|
|
@@ -188,7 +188,8 @@ namespace ShwasherSys.ProductInfo
|
|
|
StandardAbbrName = lua.StandardAbbrName,
|
|
|
StandardAbbr = lua.StandardAbbr,
|
|
|
StandardFullName = lua.StandardName,
|
|
|
- Specs = detail.Specs
|
|
|
+ Specs = detail.Specs,
|
|
|
+ Model = detail.Model
|
|
|
};
|
|
|
|
|
|
if (input.SearchList != null && input.SearchList.Count > 0)
|
|
|
@@ -273,53 +274,67 @@ namespace ShwasherSys.ProductInfo
|
|
|
// await StandardCatalogRepository.InsertAsync(catalog);
|
|
|
//}
|
|
|
|
|
|
- using var stream = File.OpenRead("C:\\Users\\Lenovo\\Desktop\\项目文档目录\\shwasher\\标准明细整理-导入数据.xlsx");
|
|
|
+ using var stream = File.OpenRead("D:\\workstation\\Iwb-workstation-2022\\Shwasher\\docs\\2025-垫圈标准\\标准明细整理-导入数据.xlsx");
|
|
|
var rows = (await stream.QueryAsync(true)).ToList();
|
|
|
//rows[0].序号
|
|
|
-
|
|
|
- foreach (dynamic row in rows)
|
|
|
- {
|
|
|
- //var ss = row["序号"];
|
|
|
- int standardId = Convert.ToInt32(row.编号);
|
|
|
- string standardName = row.名称 + "";
|
|
|
- string specs = row.规格 + "";
|
|
|
- string innerDiameter1 = SplitEx(row.内径);
|
|
|
- string innerDiameter2 = SplitEx(row.内径, 1);
|
|
|
-
|
|
|
- string outDiameter1 = SplitEx(row.外径);
|
|
|
- string outDiameter2 = SplitEx(row.外径, 1);
|
|
|
- string thickness1 = SplitEx(row.厚度);
|
|
|
- string thickness2 = SplitEx(row.厚度, 1);
|
|
|
- string innerChamfer1 = SplitEx(row.内倒角);
|
|
|
- string innerChamfer2 = SplitEx(row.内倒角, 1);
|
|
|
- string outChamfer1 = SplitEx(row.外倒角);
|
|
|
- string outChamfer2 = SplitEx(row.外倒角, 1);
|
|
|
- string height1 = SplitEx(row.高度);
|
|
|
- string height2 = SplitEx(row.高度, 1);
|
|
|
-
|
|
|
- string thousandWeigh = row.千件重 + "";
|
|
|
-
|
|
|
- StandardDetail detail = new StandardDetail()
|
|
|
- {
|
|
|
- StandardId = standardId,
|
|
|
- StandardName = standardName,
|
|
|
- Specs = specs,
|
|
|
- InnerDiameter1 = Convert.ToDecimal(innerDiameter1),
|
|
|
- InnerDiameter2 = Convert.ToDecimal(innerDiameter2),
|
|
|
- OutDiameter1 = Convert.ToDecimal(outDiameter1),
|
|
|
- OutDiameter2 = Convert.ToDecimal(outDiameter2),
|
|
|
- OutChamfer1 = Convert.ToDecimal(outChamfer1),
|
|
|
- OutChamfer2 = Convert.ToDecimal(outChamfer2),
|
|
|
- InnerChamfer1 = Convert.ToDecimal(innerChamfer1),
|
|
|
- InnerChamfer2 = Convert.ToDecimal(innerChamfer2),
|
|
|
- Thickness1 = Convert.ToDecimal(thickness1),
|
|
|
- Thickness2 = Convert.ToDecimal(thickness2),
|
|
|
- Height1 = Convert.ToDecimal(height1),
|
|
|
- Height2 = Convert.ToDecimal(height2),
|
|
|
- ThousandWeigh = Convert.ToDecimal(thousandWeigh.IsNullOrEmpty() ? "0" : thousandWeigh)
|
|
|
- };
|
|
|
- await StandardDetailRepository.InsertAsync(detail);
|
|
|
- }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ foreach (dynamic row in rows)
|
|
|
+ {
|
|
|
+ //var ss = row["序号"];
|
|
|
+ int standardId = Convert.ToInt32(row.编号);
|
|
|
+ if (standardId == 0)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ string standardName = row.名称 + "";
|
|
|
+ string specs = row.规格 + "";
|
|
|
+ string innerDiameter1 = SplitEx(row.内径);
|
|
|
+ string innerDiameter2 = SplitEx(row.内径, 1);
|
|
|
+
|
|
|
+ string outDiameter1 = SplitEx(row.外径);
|
|
|
+ string outDiameter2 = SplitEx(row.外径, 1);
|
|
|
+ string thickness1 = SplitEx(row.厚度);
|
|
|
+ string thickness2 = SplitEx(row.厚度, 1);
|
|
|
+ string innerChamfer1 = SplitEx(row.内倒角);
|
|
|
+ string innerChamfer2 = SplitEx(row.内倒角, 1);
|
|
|
+ string outChamfer1 = SplitEx(row.外倒角);
|
|
|
+ string outChamfer2 = SplitEx(row.外倒角, 1);
|
|
|
+ string height1 = SplitEx(row.高度);
|
|
|
+ string height2 = SplitEx(row.高度, 1);
|
|
|
+
|
|
|
+ string thousandWeigh = row.千件重 + "";
|
|
|
+ string modelName = row.型号 + "";
|
|
|
+
|
|
|
+ StandardDetail detail = new StandardDetail()
|
|
|
+ {
|
|
|
+ StandardId = standardId,
|
|
|
+ StandardName = standardName,
|
|
|
+ Specs = specs,
|
|
|
+ InnerDiameter1 = Convert.ToDecimal(innerDiameter1),
|
|
|
+ InnerDiameter2 = Convert.ToDecimal(innerDiameter2),
|
|
|
+ OutDiameter1 = Convert.ToDecimal(outDiameter1),
|
|
|
+ OutDiameter2 = Convert.ToDecimal(outDiameter2),
|
|
|
+ OutChamfer1 = Convert.ToDecimal(outChamfer1),
|
|
|
+ OutChamfer2 = Convert.ToDecimal(outChamfer2),
|
|
|
+ InnerChamfer1 = Convert.ToDecimal(innerChamfer1),
|
|
|
+ InnerChamfer2 = Convert.ToDecimal(innerChamfer2),
|
|
|
+ Thickness1 = Convert.ToDecimal(thickness1),
|
|
|
+ Thickness2 = Convert.ToDecimal(thickness2),
|
|
|
+ Height1 = Convert.ToDecimal(height1),
|
|
|
+ Height2 = Convert.ToDecimal(height2),
|
|
|
+ ThousandWeigh = Convert.ToDecimal(thousandWeigh.IsNullOrEmpty() ? "0" : thousandWeigh),
|
|
|
+ Model = modelName
|
|
|
+ };
|
|
|
+ await StandardDetailRepository.InsertAsync(detail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Console.WriteLine(e);
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private string SplitEx(dynamic input, int index = 0)
|
|
|
@@ -337,7 +352,10 @@ namespace ShwasherSys.ProductInfo
|
|
|
}else if (str.IndexOf("/", StringComparison.Ordinal) > 0)
|
|
|
{
|
|
|
split = str?.Split(new[] { '/' }, StringSplitOptions.None);
|
|
|
- }
|
|
|
+ }else if (str.IndexOf("-", StringComparison.Ordinal) > 0)
|
|
|
+ {
|
|
|
+ split = str?.Split(new[] { '-' }, StringSplitOptions.None);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
return str.Trim();
|