diff --git a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs
index f54cd23e..cc039d5a 100644
--- a/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/ContainerManagementEnum.cs
@@ -257,6 +257,32 @@ namespace DS.Module.Core.Enums
///
[Description("已还箱")]
已还箱 = 101,
+
+ ///
+ /// 进口
+ ///
+ [Description("进口")]
+ 进口 = 102,
+ ///
+ /// 出口
+ ///
+ [Description("出口")]
+ 出口 = 103,
+ ///
+ /// 拆空
+ ///
+ [Description("拆空")]
+ 拆空 = 104,
+ ///
+ /// 调入
+ ///
+ [Description("调入")]
+ 调入 = 105,
+ ///
+ /// 空出
+ ///
+ [Description("空出")]
+ 空出 = 106,
}
///
diff --git a/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
index 0039da56..ffd39ec2 100644
--- a/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
+++ b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
@@ -13,6 +13,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using OfficeOpenXml;
+using NPOI.Util;
+using NPOI.SS.UserModel;
+using NPOI.HPSF;
namespace DS.Module.ExcelModule
{
@@ -59,9 +63,10 @@ namespace DS.Module.ExcelModule
public MemoryStream ExportExcelStreamByColumn(ExportByColumnReq req)
{
- var filename = Guid.NewGuid() + ".xlsx";
+
+ //var filename = Guid.NewGuid() + ".xlsx";
//var path = Path.Combine(_environment.WebRootPath, "export/" + filename);
- var path = Path.Combine("", "wwwroot/export/" + filename);
+ //var path = Path.Combine("", "wwwroot/export/" + filename);
var data = JArray.Parse(req.JsonDataStr);
var values = new List>();
@@ -78,10 +83,63 @@ namespace DS.Module.ExcelModule
}
values.Add(info);
}
- var memoryStream = new MemoryStream();
- memoryStream.SaveAs(values);
- memoryStream.Seek(0, SeekOrigin.Begin);
- return memoryStream;
+ var stream = new MemoryStream();
+ MiniExcel.SaveAs(stream, values);
+ stream.Seek(0, SeekOrigin.Begin);
+ return stream;
+
+ //var data = JArray.Parse(req.JsonDataStr);
+
+ //ExcelPackage.LicenseContext = LicenseContext.NonCommercial; // 设置许可
+ //var stream = new MemoryStream();
+ //using (var package = new ExcelPackage(stream))
+ //{
+ // var worksheet = package.Workbook.Worksheets.Add("Sheet1");
+ // // 填充数据
+ // //worksheet.Cells[1, 1].Value = "Column1";
+ // //worksheet.Cells[1, 2].Value = "Column2";
+ // //worksheet.Cells[2, 1].Value = "Data1";
+ // //worksheet.Cells[2, 2].Value = "Data2";
+
+ // if (data != null && req.ColumnSets != null)
+ // {
+ // var _count = 1;
+ // foreach (var title in req.ColumnSets) {
+ // worksheet.Cells[1, _count].Value = title.Title;
+ // _count++;
+ // }
+
+ // for (int i = 0; i < data.Count; i++)
+ // {
+ // var temp = data[i];
+ // for (int n = 0; n < req.ColumnSets.Count; n++)
+ // {
+ // var columnSet = req.ColumnSets[n];
+ // var key = columnSet.DataIndex;
+ // worksheet.Cells[i+2, n+1].Value = temp[key].ToString();
+ // }
+
+ // }
+ // }
+
+ // // 保存
+ // package.Save();
+ //}
+
+
+ ////using (var fileStream = File.Create("D:\\temp.xlsx"))
+ ////{
+ //// stream.Seek(0, SeekOrigin.Begin);//设置复制开始的地方
+ //// stream.CopyTo(fileStream);
+ ////}
+
+ //stream.Seek(0, SeekOrigin.Begin);
+
+ //stream.Position = 0;
+
+ //return stream;
+
}
+
}
}
diff --git a/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
index b7123ca1..21036e7d 100644
--- a/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
+++ b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
@@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.ExcelModule.Model;
using Microsoft.AspNetCore.Mvc;
+using Org.BouncyCastle.Crypto.Paddings;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -24,5 +25,6 @@ namespace DS.Module.ExcelModule
///
///
public MemoryStream ExportExcelStreamByColumn(ExportByColumnReq req);
+
}
}
diff --git a/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs b/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs
index 56ad1453..c8e12679 100644
--- a/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs
+++ b/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs
@@ -12,6 +12,8 @@ namespace DS.Module.ExcelModule.Model
///
public class ExportByColumnReq
{
+ public string Title { get; set; }
+
///
/// 用户自定义列设置
///
diff --git a/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs b/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs
index 5d5cc08f..1a3fcbdb 100644
--- a/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs
+++ b/ds-wms-service/DS.Module.MultiLanguage/MultiLanguageMiddleware.cs
@@ -49,8 +49,9 @@ public class MultiLanguageMiddleware
|| context.Request.Path.Value.IndexOf("LinkAttach", StringComparison.InvariantCultureIgnoreCase) > -1
|| context.Request.Path.Value.IndexOf("PrintTempFile", StringComparison.InvariantCultureIgnoreCase) > -1
|| context.Request.Path.Value.IndexOf("GetOcrImg", StringComparison.InvariantCultureIgnoreCase) > -1
- || context.Request.Path.Value.IndexOf("DownloadBookingOrClosingEDI", StringComparison.InvariantCultureIgnoreCase) > -1
- || context.Request.Path.Value.IndexOf("DownloadFile", StringComparison.InvariantCultureIgnoreCase) > -1
+ || context.Request.Path.Value.IndexOf("DownloadBookingOrClosingEDI", StringComparison.InvariantCultureIgnoreCase) > -1
+ || context.Request.Path.Value.IndexOf("DownloadFile", StringComparison.InvariantCultureIgnoreCase) > -1
+ || context.Request.Path.Value.IndexOf("ExportExcelStreamByColumn", StringComparison.InvariantCultureIgnoreCase) > -1
)
)
{
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs
index 6a637bf5..0d6ae87b 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs
@@ -200,6 +200,51 @@ public class CM_CurrentStateReq
/// 备注
///
public string Remark { get; set; }
+
+ ///
+ /// 始发港
+ ///
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
}
///
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs
index 6577d6fe..0c6ea855 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs
@@ -194,4 +194,46 @@ public class CM_CurrentStateRes: BaseFieldRes
/// 备注
///
public string Remark { get; set; }
+
+
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs
index 16dc8527..3e9a55cd 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeReq.cs
@@ -213,6 +213,53 @@ public class CM_State_ChangeReq
///
public string Remark { get; set; }
+
+ ///
+ /// 始发港
+ ///
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
+
+
///
/// 用于判断是否是相同的变动
/// 依据是:
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs
index 4636011c..a31dd488 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_ChangeRes.cs
@@ -189,4 +189,50 @@ public class CM_State_ChangeRes : BaseFieldRes
/// 备注
///
public string Remark { get; set; }
+
+
+ ///
+ /// 始发港
+ ///
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempReq.cs
index c709e1cd..ba8af01a 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempReq.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempReq.cs
@@ -218,6 +218,51 @@ public class CM_State_Change_TempReq
///
public string Remark { get; set; }
+ ///
+ /// 始发港
+ ///
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
+
///
/// 用于判断是否是相同的变动
/// 依据是:
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempRes.cs
index 6a8d4d58..785afe95 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempRes.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_State_Change_TempRes.cs
@@ -194,4 +194,51 @@ public class CM_State_Change_TempRes : BaseFieldRes
/// 备注
///
public string Remark { get; set; }
+
+ public string DealRemark { get; set; }
+
+ ///
+ /// 始发港
+ ///
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ public string PortDischargeCode { get; set; }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs
index 7c74a608..14ad38aa 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs
@@ -147,7 +147,7 @@ public class CM_CurrentState : BaseOrgModel
///
/// Desc:当前港口
///
- [SugarColumn(ColumnDescription = "当前港口", IsNullable = true, Length = 50)]
+ [SugarColumn(ColumnDescription = "当前港口", IsNullable = true, Length = 60)]
public string Port { get; set; }
///
@@ -205,5 +205,60 @@ public class CM_CurrentState : BaseOrgModel
///
[SqlSugar.SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 400)]
public string Remark { get; set; }
+
+
+ ///
+ /// 始发港
+ ///
+ [SugarColumn(ColumnDescription = "始发港", IsNullable = true, Length = 60)]
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ [SugarColumn(ColumnDescription = "始发港代码", IsNullable = true)]
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ [SugarColumn(ColumnDescription = "始发港五字码", IsNullable = true, Length = 10)]
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ [SugarColumn(ColumnDescription = "目的港", IsNullable = true, Length = 60)]
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ [SugarColumn(ColumnDescription = "目的港代码", IsNullable = true)]
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ [SugarColumn(ColumnDescription = "目的港五字码", IsNullable = true, Length = 10)]
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ [SugarColumn(ColumnDescription = "预抵港", IsNullable = true, Length = 60)]
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ [SugarColumn(ColumnDescription = "预抵港代码", IsNullable = true)]
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ [SugarColumn(ColumnDescription = "预抵港五字码", IsNullable = true, Length = 10)]
+ public string PortDischargeCode { get; set; }
}
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs
index fe9e4e94..dd476798 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_State_Change.cs
@@ -212,5 +212,59 @@ public class CM_State_Change : BaseOrgModel
[SqlSugar.SugarColumn(ColumnDescription = "备注", IsNullable = true, Length = 400)]
public string Remark { get; set; }
+
+ ///
+ /// 始发港
+ ///
+ [SugarColumn(ColumnDescription = "始发港", IsNullable = true, Length = 60)]
+ public string PortLoad { get; set; }
+
+ ///
+ /// Desc:始发港代码
+ ///
+ [SugarColumn(ColumnDescription = "始发港代码", IsNullable = true)]
+ public long? PortLoadid { get; set; }
+
+ ///
+ /// Desc:始发港五字码
+ ///
+ [SugarColumn(ColumnDescription = "始发港五字码", IsNullable = true, Length = 10)]
+ public string PortLoadCode { get; set; }
+
+ ///
+ /// 目的港
+ ///
+ [SugarColumn(ColumnDescription = "目的港", IsNullable = true, Length = 60)]
+ public string PortDelivery { get; set; }
+
+ ///
+ /// Desc:目的港代码
+ ///
+ [SugarColumn(ColumnDescription = "目的港代码", IsNullable = true)]
+ public long? PortDeliveryid { get; set; }
+
+ ///
+ /// Desc:目的港五字码
+ ///
+ [SugarColumn(ColumnDescription = "目的港五字码", IsNullable = true, Length = 10)]
+ public string PortDeliveryCode { get; set; }
+
+ ///
+ /// 预抵港
+ ///
+ [SugarColumn(ColumnDescription = "预抵港", IsNullable = true, Length = 60)]
+ public string PortDischarge { get; set; }
+
+ ///
+ /// Desc:预抵港代码
+ ///
+ [SugarColumn(ColumnDescription = "预抵港代码", IsNullable = true)]
+ public long? PortDischargeid { get; set; }
+
+ ///
+ /// Desc:预抵港五字码
+ ///
+ [SugarColumn(ColumnDescription = "预抵港五字码", IsNullable = true, Length = 10)]
+ public string PortDischargeCode { get; set; }
}
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
index 91c4dd5c..a794c0e2 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
@@ -422,7 +422,7 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
changerec.CtnFlowStateId = CMCtnFlowStateEnum.已提箱;
changerec.ChangeTime = detail.PickupDate;
- changerec.IsOnlineId = CM_IsOnlineEnum.上线;
+ changerec.IsOnlineId = CM_IsOnlineEnum.下线;
}
if (changerec.ChangeTime == null) changerec.ChangeTime = DateTime.Now;
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs
index 54b09a0f..13a8c927 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs
@@ -46,6 +46,7 @@ using SharpCompress.Common;
using System.Threading;
using DS.WMS.Core.Code.Entity;
using NPOI.OpenXmlFormats;
+using System.Runtime.CompilerServices;
namespace DS.WMS.ContainerManagement.Info.Method;
@@ -844,8 +845,13 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
// db.Queryable()
var 状态变动表head = await db.Queryable().FirstAsync(x => x.Code == "CM_StateChange_Field");
+
var 字段列表 = await db.Queryable().Where(x => x.TypeId == 状态变动表head.Id).ToListAsync();
+ var head =await tenantDb.Queryable().FirstAsync(x => x.Id == req.Id);
+
+ var 模板明细= await tenantDb.Queryable().Where(x => x.Pid == head.TempletId).ToListAsync();
+
var excel文件info = tenantDb.Queryable().FirstAsync(x => x.Id == req.FileId).Result;
//正式地址
@@ -923,40 +929,40 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
Type type = newchange.GetType();
var XXDM = "";
- var XXHM = "";
+ var XXCM = "";
var Vessel = "";
var Voyno = "";
- foreach (var 字段 in 字段列表)
+ foreach (var 字段 in 模板明细)
{
- if (string.IsNullOrWhiteSpace(字段.Value))
+ if (string.IsNullOrWhiteSpace(字段.FieldName))
continue;
- var field = type.GetProperty(字段.Value);
+ var field = type.GetProperty(字段.FieldTitle);
- if (field != null && dt.Columns.Contains(字段.Name))
+ if (field != null && dt.Columns.Contains(字段.ColumnTitle))
{
- var _value = row[字段.Name];
+ var _value = row[字段.ColumnTitle];
field.SetValue(newchange, _value);
}
else
- if (field == null && 字段.Value == "XXDM")
+ if (field == null && 字段.FieldTitle == "XXDM")
{
- XXDM = row[字段.Name].ToString();
+ XXDM = row[字段.ColumnTitle].ToString();
}
else
- if (field == null && 字段.Value == "XXHM")
+ if (field == null && 字段.FieldTitle == "XXCM")
{
- XXHM = row[字段.Name].ToString();
+ XXCM = row[字段.ColumnTitle].ToString();
}
else
- if (field == null && 字段.Value == "Vessel")
+ if (field == null && 字段.FieldTitle == "Vessel")
{
- Vessel = row[字段.Name].ToString();
+ Vessel = row[字段.ColumnTitle].ToString();
}
else
- if (field == null && 字段.Value == "Voyno")
+ if (field == null && 字段.FieldTitle == "Voyno")
{
- Voyno = row[字段.Name].ToString();
+ Voyno = row[字段.ColumnTitle].ToString();
}
else
{
@@ -967,8 +973,8 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
}
}
- if (XXDM != "" && XXHM != "") {
- newchange.Ctnall= XXDM + XXHM;
+ if (XXDM != "" && XXCM != "") {
+ newchange.Ctnall= XXCM+ XXDM ;
}
if (Vessel != "" && Voyno != "")
@@ -980,6 +986,73 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
}
+ //对于港口类字段 做如下操作:
+
+ if (changelist != null && changelist.Count > 0)
+ {
+ var portlist = await tenantDb.Queryable().ToListAsync();
+
+ portinfo getport(string port) {
+ var result = new portinfo();
+ if (portlist.Exists(x => x.PortName == port || x.EdiCode == port)) {
+ var _r = portlist.First(x => x.PortName == port || x.EdiCode == port);
+
+ result.Portid = _r.Id;
+ result.PortName = _r.PortName;
+ result.PortCode = _r.EdiCode;
+ }
+ return result;
+ }
+
+ foreach (var item in changelist) {
+
+ if (!string.IsNullOrWhiteSpace(item.Port))
+ {
+ var _port = getport(item.Port);
+ if (string.IsNullOrWhiteSpace(_port.PortName))
+ {
+ item.Port = _port.PortName;
+ item.Portid = _port.Portid;
+ item.PortCode = _port.PortCode;
+ }
+ }
+
+ if (!string.IsNullOrWhiteSpace(item.PortLoad))
+ {
+ var _port = getport(item.PortLoad);
+ if (string.IsNullOrWhiteSpace(_port.PortName))
+ {
+ item.PortLoad = _port.PortName;
+ item.PortLoadid = _port.Portid;
+ item.PortLoadCode = _port.PortCode;
+ }
+ }
+
+ if (!string.IsNullOrWhiteSpace(item.PortDelivery))
+ {
+ var _port = getport(item.PortDelivery);
+ if (string.IsNullOrWhiteSpace(_port.PortName))
+ {
+ item.PortDelivery = _port.PortName;
+ item.PortDeliveryid = _port.Portid;
+ item.PortDeliveryCode = _port.PortCode;
+ }
+ }
+
+ if (!string.IsNullOrWhiteSpace(item.PortDischarge))
+ {
+ var _port = getport(item.PortDischarge);
+ if (string.IsNullOrWhiteSpace(_port.PortName))
+ {
+ item.PortDischarge = _port.PortName;
+ item.PortDischargeid = _port.Portid;
+ item.PortDischargeCode = _port.PortCode;
+ }
+ }
+ }
+ }
+
+
if (changelist != null && changelist.Count > 0)
{
await tenantDb.Deleteable(x => x.Pid == req.Id).ExecuteCommandAsync();
@@ -1043,6 +1116,14 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
return _r;
}
+ private class portinfo {
+
+ public string PortName { get; set; }
+ public long Portid { get; set; }
+ public string PortCode { get; set; }
+
+
+ }
private async Task 通过模板导入子表明细(T ReqItem, T2 InsertItem, CM_DealExcelReq req,bool DoInsert=true) where T : class, new() where T2 : class, new()
{
//Type reqtype = ReqItem.GetType();
@@ -1290,7 +1371,7 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
_pid.SetValue(newchange, req.Id);
var XXDM = "";
- var XXHM = "";
+ var XXCM = "";
var Vessel = "";
var Voyno = "";
@@ -1342,9 +1423,9 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
XXDM = row[字段.ColumnTitle].ToString();
}
else
- if (field == null && 字段.FieldTitle == "XXHM")
+ if (field == null && 字段.FieldTitle == "XXCM")
{
- XXHM = row[字段.ColumnTitle].ToString();
+ XXCM = row[字段.ColumnTitle].ToString();
}
else
if (field == null && 字段.FieldTitle == "Vessel")
@@ -1363,11 +1444,11 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
}
}
- if (XXDM != "" && XXHM != "")
+ if (XXDM != "" && XXCM != "")
{
var field = reqtype.GetProperty("Ctnall");
if(field!=null)
- field.SetValue(newchange, XXDM+ XXHM);
+ field.SetValue(newchange, XXCM+XXDM );
}
if (Vessel != "" && Voyno != "")
diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
index bfdc3d4f..3883855d 100644
--- a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
+++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
@@ -2,10 +2,26 @@
using DS.Module.ExcelModule;
using DS.Module.ExcelModule.Model;
using DS.WMS.Core.Code.Interface;
+using Masuit.Tools.Files;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
using NPOI.HPSF;
+using NPOI.XSSF.UserModel;
+using SharpCompress.Common;
+using System.IO;
using System.Text;
+using DS.Module.Core.Data;
+using DS.WMS.Core.Code.Dtos;
+using DS.WMS.Core.Op.Dtos;
+using DS.WMS.Core.Op.Entity;
+using DS.WMS.Core.Op.Interface;
+using DS.WMS.Core.Sys.Dtos;
+using DS.WMS.Core.Sys.Interface;
+using Microsoft.AspNetCore.Authorization;
+using SixLabors.ImageSharp.Drawing;
+using System.IO;
+using System.Web;
namespace DS.WMS.MainApi.Controllers
{
@@ -44,13 +60,68 @@ namespace DS.WMS.MainApi.Controllers
///
[HttpPost]
[Route("ExportExcelStreamByColumn")]
- public async Task ExportExcelStreamByColumn([FromBody] ExportByColumnReq req)
+ [ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)]
+ //[AllowAnonymous]
+ public async Task ExportExcelStreamByColumn([FromBody] ExportByColumnReq req)//
{
- var result = _invokeService.ExportExcelStreamByColumn(req);
- HttpContext.Response.Headers.Add("Content-Length", result.Length.ToString());
- HttpContext.Response.Headers.Add("Content-Type", "charset=UTF-8");
- return File(result, "application/octet-stream;charset=UTF-8", Path.GetFileName(Path.GetRandomFileName() + ".xlsx"));
- //return new FileStreamResult(result, "application/octet-stream") { FileDownloadName = Guid.NewGuid().ToString() + ".xlsx" };
+
+ var result = _invokeService.ExportExcelStreamByColumn(req);
+ //HttpContext.Response.Headers.Add("Content-Length", result.Length.ToString());
+ //HttpContext.Response.Headers.Add("Content-Type", "application/octet-stream;charset=UTF-8");
+
+ var dtstr = DateTime.Now.ToString("yyyyMMddHHmmssfff");
+
+ var filename = $"{req.Title}-{dtstr}.xlsx";
+
+ byte[] bytes = new byte[result.Length];
+ result.ReadExactly(bytes, 0, bytes.Length);
+ string mimeType = "application/octet-stream";
+ var _r = new FileContentResult(bytes, mimeType)
+ {
+ FileDownloadName = filename
+ };
+
+ return _r;
+ //var path = Path.Combine("", "wwwroot/export/" + filename);
+ //using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
+ //{
+ // result.WriteTo(fileStream);
+ //}
+ //byte[] byteArr = System.IO.File.ReadAllBytes(path);
+ //string mimeType = "application/octet-stream";
+ //return new FileContentResult(byteArr, mimeType)
+ //{
+ // FileDownloadName = filename
+ //};
+
+
+
+ //return File(result, "application/octet-stream;charset=UTF-8",filename);
+
+ ////return new FileStreamResult(result, "application/octet-stream;charset=UTF-8")
+ ////{
+ //// FileDownloadName = filename
+ ////};
+
+ //return File(result, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename);
+
+ //var bytes = new byte[result.Length];
+
+ //result.Read(bytes, 0, bytes.Length);
+
+ //result.Close();
+
+ //return new FileContentResult(bytes, "application/octet-stream");
+
+ //return new FileStreamResult(result, "application/octet-stream") { FileDownloadName = $"{req.Title}-{dtstr}.xlsx" };
+
+ //var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
+ //var memi = provider.Mappings[".xlsx"];
+ //var fileName = Path.GetFileName(filename);
+ //return File(result, memi, fileName);
+
+ //var result = _invokeService.OutputExcel(req);
+ //return File(result, "application/octet-stream;charset=UTF-8", "UploadTemplate.xlsx");
}
}
}
diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs
index 5087f64b..2d0ab2a9 100644
--- a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs
+++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs
@@ -120,17 +120,17 @@ public class ContainerManagementTest
//tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体
//tenantDb.CodeFirst.InitTables(typeof(OpLetterYard));//指定更新特定实体
- //tenantDb.CodeFirst.InitTables(typeof(CM_CurrentState));
+ tenantDb.CodeFirst.InitTables(typeof(CM_CurrentState));
//tenantDb.CodeFirst.InitTables(typeof(CM_BaseInfo));
- //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change));
+ tenantDb.CodeFirst.InitTables(typeof(CM_State_Change));
//tenantDb.CodeFirst.InitTables(typeof(CM_RentIn));
//tenantDb.CodeFirst.InitTables(typeof(CM_RentIn_Detail));
//tenantDb.CodeFirst.InitTables(typeof(CM_RentOut));
//tenantDb.CodeFirst.InitTables(typeof(CM_RentOut_Detail));
- tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay));
- tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail));
- tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_In));
+ //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay));
+ //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail));
+ //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_In));
//tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn));
//tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn_Detail));
@@ -147,7 +147,7 @@ public class ContainerManagementTest
//tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Templat));
//tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatDetail));
//tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatImport));
- //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp));
+ tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp));
}
Assert.True(true);