|
@@ -4242,7 +4242,21 @@ Group by PriceType ", dto.diId);
|
|
dt.Columns.Add(GetString(worksheet.Cells[i, j].Value));
|
|
dt.Columns.Add(GetString(worksheet.Cells[i, j].Value));
|
|
//剩下的写入datatable
|
|
//剩下的写入datatable
|
|
else
|
|
else
|
|
- dr[j - 1] = GetString(worksheet.Cells[i, j].Value);
|
|
|
|
|
|
+ {
|
|
|
|
+ var cell = worksheet.Cells[i, j];
|
|
|
|
+
|
|
|
|
+ if (j == 1 || j == 2)
|
|
|
|
+ {
|
|
|
|
+ if (cell.Value is double)
|
|
|
|
+ {
|
|
|
|
+ dr[j - 1] = EPPlusConvertToDateTime((double)cell.Value).ToString("MM/dd");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ dr[j - 1] = GetString(cell.Value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dt;
|
|
return dt;
|
|
@@ -4250,7 +4264,6 @@ Group by PriceType ", dto.diId);
|
|
|
|
|
|
private string GetString(object obj)
|
|
private string GetString(object obj)
|
|
{
|
|
{
|
|
-
|
|
|
|
if (obj == null)
|
|
if (obj == null)
|
|
return "";
|
|
return "";
|
|
|
|
|
|
@@ -4258,6 +4271,15 @@ Group by PriceType ", dto.diId);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static DateTime EPPlusConvertToDateTime(double numericDate)
|
|
|
|
+ {
|
|
|
|
+ // Excel起始日期
|
|
|
|
+ DateTime startDate = new DateTime(1899, 12, 30);
|
|
|
|
+ // 将数字日期转换为时间间隔,并加上起始日期
|
|
|
|
+ TimeSpan duration = new TimeSpan((long)(numericDate * TimeSpan.TicksPerDay));
|
|
|
|
+ return startDate.Add(duration);
|
|
|
|
+ }
|
|
|
|
+
|
|
private DataTable ExcelFileToDataTable(IFormFile file)
|
|
private DataTable ExcelFileToDataTable(IFormFile file)
|
|
{
|
|
{
|
|
DataTable dtTest = null;
|
|
DataTable dtTest = null;
|
|
@@ -4641,8 +4663,11 @@ Group by PriceType ", dto.diId);
|
|
for (int j = 0; j < dt.Rows.Count; j++)//遍历行
|
|
for (int j = 0; j < dt.Rows.Count; j++)//遍历行
|
|
{
|
|
{
|
|
DataRow dr = dt1.NewRow(); //获取每一行的数据
|
|
DataRow dr = dt1.NewRow(); //获取每一行的数据
|
|
- dr["TradingDay"] = dt.Rows[j][0].ToString();
|
|
|
|
- dr["TallyDay"] = dt.Rows[j][1].ToString();
|
|
|
|
|
|
+ var tradingDay = dt.Rows[j][0].ToString();
|
|
|
|
+
|
|
|
|
+ dr["TradingDay"] = tradingDay;
|
|
|
|
+ var tallyDay = dt.Rows[j][1].ToString();
|
|
|
|
+ dr["TallyDay"] = tallyDay;
|
|
dr["TransactionDesc"] = dt.Rows[j][2].ToString();
|
|
dr["TransactionDesc"] = dt.Rows[j][2].ToString();
|
|
dr["RMBMoney"] = dt.Rows[j][3].ToString();
|
|
dr["RMBMoney"] = dt.Rows[j][3].ToString();
|
|
dr["CardNo"] = dt.Rows[j][4].ToString();
|
|
dr["CardNo"] = dt.Rows[j][4].ToString();
|
|
@@ -4683,12 +4708,8 @@ Group by PriceType ", dto.diId);
|
|
|
|
|
|
if (item["TradingDay"] != null)
|
|
if (item["TradingDay"] != null)
|
|
{
|
|
{
|
|
- var dtBool = DateTime.TryParse(item["TradingDay"].ToString(), out DateTime _ExcelDt);
|
|
|
|
-
|
|
|
|
- if (dtBool)
|
|
|
|
- {
|
|
|
|
- ExcelDt = _ExcelDt.ToString("MMdd");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ ExcelDt = item["TradingDay"].ToString();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4706,9 +4727,9 @@ Group by PriceType ", dto.diId);
|
|
{
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(Citem.ConsumptionDate))
|
|
if (!string.IsNullOrWhiteSpace(Citem.ConsumptionDate))
|
|
{
|
|
{
|
|
- DBDt = DateTime.Parse(Citem.ConsumptionDate).ToString("MMdd");
|
|
|
|
|
|
+ DBDt = DateTime.Parse(Citem.ConsumptionDate).ToString("MM/dd");
|
|
|
|
|
|
- if (DBDt == ExcelDt)
|
|
|
|
|
|
+ if (DBDt.Equals(ExcelDt))
|
|
{
|
|
{
|
|
item["TeamRemark"] = delegationInfos.Find(it => it.Id == Citem.DIId)?.TeamName;
|
|
item["TeamRemark"] = delegationInfos.Find(it => it.Id == Citem.DIId)?.TeamName;
|
|
item["Handlers"] = users.Find(it => it.Id == Citem.CreateUserId)?.CnName;
|
|
item["Handlers"] = users.Find(it => it.Id == Citem.CreateUserId)?.CnName;
|