|
|
@ -5,6 +5,7 @@ using NPOI.HPSF;
|
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
|
using NPOI.OpenXmlFormats.Wordprocessing;
|
|
|
|
using NPOI.OpenXmlFormats.Wordprocessing;
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
|
|
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
@ -46,7 +47,7 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
//读取文件
|
|
|
|
//读取文件
|
|
|
|
var file = new FileStream(fileAbsPath, FileMode.Open);
|
|
|
|
var file = new FileStream(fileAbsPath, FileMode.Open);
|
|
|
|
|
|
|
|
|
|
|
|
var excelwork = new HSSFWorkbook(file);
|
|
|
|
var excelwork = new XSSFWorkbook(file);
|
|
|
|
|
|
|
|
|
|
|
|
//截单主信息
|
|
|
|
//截单主信息
|
|
|
|
var sheetBase = excelwork.GetSheetAt(0);
|
|
|
|
var sheetBase = excelwork.GetSheetAt(0);
|
|
|
@ -55,7 +56,7 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
throw Oops.Bah("读取模板Sheet Header data失败");
|
|
|
|
throw Oops.Bah("读取模板Sheet Header data失败");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lstLabelRow = sheetBase.GetRow(sheetBase.LastRowNum);
|
|
|
|
var lstLabelRow = sheetBase.GetRow(sheetBase.LastRowNum - 1);
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<int, string> baseColsDict = lstLabelRow.Cells.Select((p, idx) =>
|
|
|
|
Dictionary<int, string> baseColsDict = lstLabelRow.Cells.Select((p, idx) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -65,7 +66,7 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
return new { Name = "", Idx = idx };
|
|
|
|
return new { Name = "", Idx = idx };
|
|
|
|
}).Where(p => !string.IsNullOrWhiteSpace(p.Name)).ToDictionary(a => a.Idx, b => b.Name);
|
|
|
|
}).Where(p => !string.IsNullOrWhiteSpace(p.Name)).ToDictionary(a => a.Idx, b => b.Name);
|
|
|
|
|
|
|
|
|
|
|
|
var newRow = sheetBase.CreateRow(sheetBase.LastRowNum + 1);
|
|
|
|
var newRow = sheetBase.CreateRow(sheetBase.LastRowNum);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lstLabelRow.Cells.Count; i++)
|
|
|
|
for (int i = 0; i < lstLabelRow.Cells.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -193,7 +194,7 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
#region 箱信息填写
|
|
|
|
#region 箱信息填写
|
|
|
|
if (ctnColsDict[k].Equals("Item Number", StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (ctnColsDict[k].Equals("Item Number", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GenerateCellInfo(model.ContaList[j].SNo.ToString(), k + 1, newCtnRow);
|
|
|
|
GenerateCellInfoWithInt(model.ContaList[j].SNo, k + 1, newCtnRow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ctnColsDict[k].Equals("Container Serial Number", StringComparison.OrdinalIgnoreCase))
|
|
|
|
else if (ctnColsDict[k].Equals("Container Serial Number", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -281,7 +282,7 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
|
|
|
|
|
|
|
|
ctnStartNo++;
|
|
|
|
ctnStartNo++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var fileName = $"{model.BookingId}_SLS_{DateTime.Now.Ticks.ToString()}.xls";//名称
|
|
|
|
var fileName = $"{model.BookingId}_SLS_{DateTime.Now.Ticks.ToString()}.xlsx";//名称
|
|
|
|
|
|
|
|
|
|
|
|
var excelFileName = Path.Combine(model.FilePath, fileName);
|
|
|
|
var excelFileName = Path.Combine(model.FilePath, fileName);
|
|
|
|
|
|
|
|
|
|
|
@ -313,6 +314,11 @@ namespace Myshipping.Application.EDI.SeaLead
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void GenerateCellInfoWithInt(int val, int cellIndex, IRow row)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
row.CreateCell(cellIndex).SetCellValue(val);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 校验VOLTA请求参数s
|
|
|
|
#region 校验VOLTA请求参数s
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 校验VOLTA请求参数
|
|
|
|
/// 校验VOLTA请求参数
|
|
|
|