|
|
|
@ -36,6 +36,12 @@ namespace SlnMesnac.LabelPrint.FileOperate
|
|
|
|
|
List<BaseLabelInfo> result = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string fileName = GetFileName(filePath);
|
|
|
|
|
if (string.IsNullOrEmpty(fileName))
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sheetNames = MiniExcel.GetSheetNames(filePath);
|
|
|
|
|
|
|
|
|
|
if (sheetNames != null)
|
|
|
|
@ -56,13 +62,9 @@ namespace SlnMesnac.LabelPrint.FileOperate
|
|
|
|
|
dynamic labelDynamic = info[i];
|
|
|
|
|
BaseLabelInfo labelInfo = new BaseLabelInfo();
|
|
|
|
|
labelInfo.label = labelDynamic;
|
|
|
|
|
labelInfo.productType = sheetName;
|
|
|
|
|
if(labelDynamic.A == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
labelInfo.productType = fileName;
|
|
|
|
|
labelInfo.column_A = labelDynamic.A;
|
|
|
|
|
if (sheetName == "Pallet")
|
|
|
|
|
if (fileName == "Pallet")
|
|
|
|
|
{
|
|
|
|
|
labelInfo.recordTime = DateTime.Now;
|
|
|
|
|
result.Add(labelInfo);
|
|
|
|
@ -71,20 +73,34 @@ namespace SlnMesnac.LabelPrint.FileOperate
|
|
|
|
|
labelInfo.column_B = labelDynamic.B;
|
|
|
|
|
labelInfo.column_C = labelDynamic.C;
|
|
|
|
|
labelInfo.column_D = labelDynamic.D;
|
|
|
|
|
labelInfo.column_E = labelDynamic.E;
|
|
|
|
|
if (sheetName == "Unit")
|
|
|
|
|
if(fileName == "Gas" || fileName == "TF" || fileName == "Drum")
|
|
|
|
|
{
|
|
|
|
|
labelInfo.recordTime = DateTime.Now;
|
|
|
|
|
result.Add(labelInfo);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
labelInfo.column_F = labelDynamic.F;
|
|
|
|
|
labelInfo.column_G = labelDynamic.G;
|
|
|
|
|
labelInfo.column_H = labelDynamic.H;
|
|
|
|
|
labelInfo.column_I = labelDynamic.I;
|
|
|
|
|
labelInfo.column_J = labelDynamic.J;
|
|
|
|
|
labelInfo.recordTime = DateTime.Now;
|
|
|
|
|
result.Add(labelInfo);
|
|
|
|
|
labelInfo.column_E = labelDynamic.E;
|
|
|
|
|
if (fileName == "Unit")
|
|
|
|
|
{
|
|
|
|
|
if (labelInfo.column_D == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
labelInfo.recordTime = DateTime.Now;
|
|
|
|
|
result.Add(labelInfo);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//labelInfo.column_F = labelDynamic.F;
|
|
|
|
|
//labelInfo.column_G = labelDynamic.G;
|
|
|
|
|
//labelInfo.column_H = labelDynamic.H;
|
|
|
|
|
//labelInfo.column_I = labelDynamic.I;
|
|
|
|
|
//labelInfo.column_J = labelDynamic.J;
|
|
|
|
|
//labelInfo.recordTime = DateTime.Now;
|
|
|
|
|
//result.Add(labelInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -97,5 +113,38 @@ namespace SlnMesnac.LabelPrint.FileOperate
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取产品型号
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="filePath"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string GetFileName(string filePath)
|
|
|
|
|
{
|
|
|
|
|
if (filePath.Contains("Gas"))
|
|
|
|
|
{
|
|
|
|
|
return "Gas";
|
|
|
|
|
}else if (filePath.Contains("TF"))
|
|
|
|
|
{
|
|
|
|
|
return "TF";
|
|
|
|
|
}
|
|
|
|
|
else if (filePath.Contains("Drum"))
|
|
|
|
|
{
|
|
|
|
|
return "Drum";
|
|
|
|
|
}
|
|
|
|
|
else if (filePath.Contains("Unit"))
|
|
|
|
|
{
|
|
|
|
|
return "Unit";
|
|
|
|
|
}
|
|
|
|
|
else if (filePath.Contains("Pallet"))
|
|
|
|
|
{
|
|
|
|
|
return "Pallet";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|