修改舱位导入

usertest
jianghaiqing 4 months ago
parent 7ec4e458ce
commit 4193489bc3

@ -1361,5 +1361,36 @@ public static class MultiLanguageConst
/// </summary>
[Description("预订舱数据已发送成功,不能修改")]
public const string SpaceBookingBeSendNotModify = "SpaceBooking_BeSend_NotModify";
/// <summary>
/// 附件不能为空
/// </summary>
[Description("附件不能为空")]
public const string BookingSlotImportFileNull = "BookingSlot_Import_FileNull";
/// <summary>
/// 请上传指定模板文件
/// </summary>
[Description("请上传指定模板文件")]
public const string BookingSlotImportFileTypeError = "BookingSlot_Import_TypeError";
/// <summary>
/// 内容为空
/// </summary>
[Description("内容为空")]
public const string BookingSlotImportExcelEmpty = "BookingSlot_Import_ExcelEmpty";
/// <summary>
/// 导入舱位异常,原因:{0}
/// </summary>
[Description("导入舱位异常,原因:{0}")]
public const string BookingSlotImportException = "BookingSlot_Import_Exception";
/// <summary>
/// 导入失败
/// </summary>
[Description("导入失败")]
public const string BookingSlotImportFail = "BookingSlot_Import_Fail";
#endregion
}

@ -120,7 +120,8 @@ namespace DS.WMS.Core.Op.Interface
/// </summary>
/// <param name="file">导入舱位文件</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> ImportSlotFromFile(IFormFile file);
Task<DataResult<List<object>>> ImportSlotFromFile(IFormFile file);
/// <summary>
/// 生成订舱订单

@ -2809,28 +2809,32 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
/// <param name="file">导入舱位文件</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> ImportSlotFromFile(IFormFile file)
public async Task<DataResult<List<object>>> ImportSlotFromFile(IFormFile file)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
bool succ = false;
List<object> list = new List<object>();
try
{
result.succ = false;
if (file == null)
{
result.msg = "附件不能为空";
return result;
//附件不能为空
return DataResult<List<object>>.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportFileNull)));
}
FileInfo fileInfo = new FileInfo(file.FileName);
if (fileInfo.Extension != ".xlsx")
{
result.msg = "请上传指定模板文件";
return result;
//请上传指定模板文件
return DataResult<List<object>>.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportFileTypeError)));
}
var tempDic = string.Empty;// Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions<TempFileOptions>().Path, DateTime.Now.Ticks.ToString());
string fileRoot = AppSetting.app(new string[] { "FileSettings", "BasePath" });
string relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" });
var tempDic = Path.Combine(fileRoot, relativePath, DateTime.Now.Ticks.ToString());
Directory.CreateDirectory(tempDic);
var filePath = Path.Combine(tempDic, file.FileName);
@ -2843,15 +2847,15 @@ namespace DS.WMS.Core.Op.Method
var sheet = readbook.GetSheet("导入");
if (sheet == null)
{
result.msg = "内容为空";
return result;
//内容为空
return DataResult<List<object>>.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportExcelEmpty)));
}
var rowCount = sheet.LastRowNum;
if (rowCount <= 1)
{
result.msg = "内容为空";
return result;
//内容为空
return DataResult<List<object>>.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportExcelEmpty)));
}
Dictionary<BookingSlotBase, List<BookingSlotCtn>> data = new(rowCount);
@ -2992,7 +2996,7 @@ namespace DS.WMS.Core.Op.Method
}
}
// 特殊处理
if (!string.IsNullOrWhiteSpace(slot.CarrierCode)) slot.Carrier = cacheMappCarrier.FirstOrDefault(x => x.CarrierName == slot.CarrierCode)?.CarrierName;
if (!string.IsNullOrWhiteSpace(slot.CarrierCode)) slot.Carrier = cacheMappCarrier.FirstOrDefault(x => x.MapCode == slot.CarrierCode)?.MapName;
if (!string.IsNullOrWhiteSpace(slot.PortLoadCode)) slot.PortLoad = cachePort.FirstOrDefault(x => x.EdiCode == slot.PortLoadCode)?.PortName;
if (!string.IsNullOrWhiteSpace(slot.PortDischargeCode)) slot.PortDischarge = cachePort.FirstOrDefault(x => x.EdiCode == slot.PortDischargeCode)?.PortName;
if (!string.IsNullOrWhiteSpace(slot.LaneName)) slot.LaneCode = cacheLane.FirstOrDefault(x => x.LaneName == slot.LaneName)?.LaneEnName;
@ -3047,8 +3051,7 @@ namespace DS.WMS.Core.Op.Method
.Select(x => x.SlotBookingNo)
.ToListAsync();
List<object> list = new List<object>();
result.ext = list;
foreach (var item in data)
{
if (existsNoList.Contains(item.Key.SlotBookingNo))
@ -3079,7 +3082,7 @@ namespace DS.WMS.Core.Op.Method
});
}
result.succ = true;
succ = true;
var group = data.Keys.Where(x =>
!existsNoList.Contains(x.SlotBookingNo)
@ -3120,11 +3123,15 @@ namespace DS.WMS.Core.Op.Method
{
Logger.Log(NLog.LogLevel.Error, $"导入舱位异常,原因:{ex.Message}");
result.succ = false;
result.msg = $"导入舱位异常,原因:{ex.Message}";
return DataResult<List<object>>.Failed(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportException)), ex.Message));
}
return result;
if(succ)
{
return DataResult<List<object>>.Success(list);
}
return DataResult<List<object>>.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotImportFail)));
}
#endregion

@ -194,9 +194,9 @@ namespace DS.WMS.OpApi.Controllers
/// <returns>返回回执</returns>
[HttpPost]
[Route("ImportSlotFromFile")]
public async Task<DataResult> ImportSlotFromFile([FromBody] IFormFile file)
public async Task<DataResult<List<object>>> ImportSlotFromFile(IFormFile file)
{
return null;//await _bookingSlotService.ImportSlotFromFile(file);
return await _bookingSlotService.ImportSlotFromFile(file);
}
#endregion

@ -754,3 +754,31 @@
2024-07-24 12:55:07.1385 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-24 12:55:07.1473 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-24 12:55:07.1473 Info Configuration initialized.
2024-07-24 13:38:21.3202 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-24 13:38:21.3470 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-24 13:38:21.3528 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-24 13:38:21.3717 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-24 13:38:21.3863 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-24 13:38:21.3863 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-24 13:38:21.4016 Info Configuration initialized.
2024-07-24 14:07:06.0244 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-24 14:07:06.0410 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-24 14:07:06.0410 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-24 14:07:06.0633 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-24 14:07:06.0764 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-24 14:07:06.0764 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-24 14:07:06.0901 Info Configuration initialized.
2024-07-24 14:08:38.1325 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-24 14:08:38.1325 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-24 14:08:38.1325 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-24 14:08:38.1552 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-24 14:08:38.1552 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-24 14:08:38.1635 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-24 14:08:38.1635 Info Configuration initialized.
2024-07-24 14:14:41.8507 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-24 14:14:41.8507 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-24 14:14:41.8507 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-24 14:14:41.8726 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-24 14:14:41.8726 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-24 14:14:41.8726 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-24 14:14:41.8863 Info Configuration initialized.

@ -6,7 +6,7 @@
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Code\PublishCopy\ds8-opapi</_PublishTargetUrl>
<History>True|2024-07-24T00:47:26.1616069Z||;True|2024-07-24T08:42:02.7606608+08:00||;True|2024-07-24T08:41:18.4678459+08:00||;False|2024-07-24T08:40:29.5381703+08:00||;False|2024-07-24T08:39:20.2230656+08:00||;True|2024-07-23T15:56:16.8305907+08:00||;True|2024-07-22T16:42:12.1933090+08:00||;True|2024-07-19T18:28:29.1420269+08:00||;True|2024-07-19T15:45:49.1068004+08:00||;True|2024-07-19T15:33:45.3242155+08:00||;False|2024-07-19T15:32:41.9604526+08:00||;True|2024-07-19T13:48:27.9722093+08:00||;False|2024-07-19T13:47:56.7900396+08:00||;True|2024-07-19T11:41:15.4223247+08:00||;True|2024-07-19T08:46:28.8014836+08:00||;True|2024-07-18T19:24:50.4184188+08:00||;True|2024-07-18T19:19:14.7056635+08:00||;True|2024-07-18T19:04:43.5615501+08:00||;True|2024-07-18T18:38:39.1976753+08:00||;True|2024-07-18T18:25:15.6833492+08:00||;True|2024-07-18T18:08:46.3114951+08:00||;True|2024-07-18T17:59:12.5292256+08:00||;True|2024-07-18T16:18:45.8049777+08:00||;True|2024-07-18T16:12:42.9723969+08:00||;True|2024-07-18T16:07:14.1432207+08:00||;True|2024-07-17T17:44:18.4741963+08:00||;True|2024-07-17T17:42:47.2735071+08:00||;True|2024-07-17T16:13:32.9037697+08:00||;True|2024-07-17T15:40:21.2550083+08:00||;True|2024-07-17T14:03:08.1814323+08:00||;True|2024-07-15T13:43:42.6073130+08:00||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||;</History>
<History>True|2024-07-24T04:56:48.1663545Z||;True|2024-07-24T08:47:26.1616069+08:00||;True|2024-07-24T08:42:02.7606608+08:00||;True|2024-07-24T08:41:18.4678459+08:00||;False|2024-07-24T08:40:29.5381703+08:00||;False|2024-07-24T08:39:20.2230656+08:00||;True|2024-07-23T15:56:16.8305907+08:00||;True|2024-07-22T16:42:12.1933090+08:00||;True|2024-07-19T18:28:29.1420269+08:00||;True|2024-07-19T15:45:49.1068004+08:00||;True|2024-07-19T15:33:45.3242155+08:00||;False|2024-07-19T15:32:41.9604526+08:00||;True|2024-07-19T13:48:27.9722093+08:00||;False|2024-07-19T13:47:56.7900396+08:00||;True|2024-07-19T11:41:15.4223247+08:00||;True|2024-07-19T08:46:28.8014836+08:00||;True|2024-07-18T19:24:50.4184188+08:00||;True|2024-07-18T19:19:14.7056635+08:00||;True|2024-07-18T19:04:43.5615501+08:00||;True|2024-07-18T18:38:39.1976753+08:00||;True|2024-07-18T18:25:15.6833492+08:00||;True|2024-07-18T18:08:46.3114951+08:00||;True|2024-07-18T17:59:12.5292256+08:00||;True|2024-07-18T16:18:45.8049777+08:00||;True|2024-07-18T16:12:42.9723969+08:00||;True|2024-07-18T16:07:14.1432207+08:00||;True|2024-07-17T17:44:18.4741963+08:00||;True|2024-07-17T17:42:47.2735071+08:00||;True|2024-07-17T16:13:32.9037697+08:00||;True|2024-07-17T15:40:21.2550083+08:00||;True|2024-07-17T14:03:08.1814323+08:00||;True|2024-07-15T13:43:42.6073130+08:00||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save