diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigReq.cs
index 51b51a57..cf010872 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigReq.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigReq.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
///
- ///
+ /// 订舱货物状态管理
///
public class BookingGoodsStatusConfigReq
{
@@ -27,7 +27,10 @@ namespace DS.WMS.Core.Op.Dtos
/// 状态名称
///
public string StatusName { get; set; }
-
+ ///
+ /// 状态颜色
+ ///
+ public string StatusColor { get; set; }
///
/// 排序
///
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigRes.cs
index 3cb3740a..9289871c 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigRes.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingGoodsStatusConfigRes.cs
@@ -26,6 +26,10 @@ namespace DS.WMS.Core.Op.Dtos
/// 状态名称
///
public string StatusName { get; set; }
+ ///
+ /// 状态颜色
+ ///
+ public string StatusColor { get; set; }
///
/// 排序
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusConfigExcelReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusConfigExcelReq.cs
new file mode 100644
index 00000000..35d50d0a
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusConfigExcelReq.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos
+{
+ ///
+ /// 订舱货物状态管理导入实体
+ ///
+ public class BookingStatusConfigExcelReq
+ {
+ ///
+ /// 系统编码
+ ///
+ public string SystemCode { get; set; }
+ ///
+ /// 状态名称
+ ///
+ public string StatusName { get; set; }
+ ///
+ /// 状态颜色
+ ///
+ public string StatusColor { get; set; }
+ ///
+ /// 排序
+ ///
+ public int? OrderNo { get; set; } = 100;
+
+ ///
+ /// 备注
+ ///
+ public string Note { get; set; } = "";
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/IBookingGoodsStatusConfigService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/IBookingGoodsStatusConfigService.cs
index f09410c1..8c6ed8fd 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Interface/IBookingGoodsStatusConfigService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Interface/IBookingGoodsStatusConfigService.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
namespace DS.WMS.Core.Op.Interface
{
@@ -32,18 +33,19 @@ namespace DS.WMS.Core.Op.Interface
///
///
DataResult GetBookingGoodsStatusConfigInfo(string id);
+
+ ///
+ /// 批量删除
+ ///
+ ///
+ ///
+ public DataResult BatchDelBookingStatusConfig(IdModel req);
- /////
- ///// 删除
- /////
- /////
- /////
- //public DataResult DelBookingStatusConfig(string id);
- /////
- ///// 批量删除
- /////
- /////
- /////
- //public DataResult BatchDelBookingStatusConfig(IdModel req);
+ ///
+ /// 按Excel导入订舱货物状态
+ ///
+ ///
+ ///
+ public Task> ImportBookingStatusConfigByExcel(IFormFile file);
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingGoodsStatusConfigService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingGoodsStatusConfigService.cs
index 24421370..206659fb 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingGoodsStatusConfigService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingGoodsStatusConfigService.cs
@@ -10,13 +10,19 @@ using DS.Module.Core.Extensions;
using Mapster;
using Org.BouncyCastle.Ocsp;
using DS.WMS.Core.Code.Entity;
+using DS.Module.Core.Data;
+using DS.WMS.Core.Sys.Dtos;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using DS.WMS.Core.Check.Dtos;
+using MiniExcelLibs;
namespace DS.WMS.Core.Op.Method
{
///
///
///
- public class BookingGoodsStatusConfigService: IBookingGoodsStatusConfigService
+ public class BookingGoodsStatusConfigService : IBookingGoodsStatusConfigService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
@@ -80,5 +86,67 @@ namespace DS.WMS.Core.Op.Method
.Select().ToQueryPage(request.PageCondition);
return data;
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DataResult BatchDelBookingStatusConfig(IdModel req)
+ {
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList();
+ if (list.Count > 0)
+ {
+ tenantDb.Deleteable(list).ExecuteCommand();
+ }
+ return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
+ }
+
+ ///
+ /// 按Excel导入订舱货物状态
+ ///
+ ///
+ ///
+ public async Task> ImportBookingStatusConfigByExcel(IFormFile file)
+ {
+ //未上传文件
+ if (file == null || file.Length == 0)
+ {
+ return await Task.FromResult(DataResult.Failed("请上传Excel!"));
+ }
+ var formFile = file;
+ //DataResult api_Result = new Api_Result();
+ //获取文件名
+ var fileName = formFile.FileName;
+ // 获取文件后缀
+ var fileExtension = Path.GetExtension(fileName);
+ // 判断后缀是否是xlsx或者xls
+ if (fileExtension != ".xlsx" && fileExtension != ".xls")
+ {
+ return DataResult.Failed("文件格式错误");
+ }
+ var length = formFile.Length;
+ if (length > 1024 * 1024 * 10)
+ {
+ return DataResult.Failed("文件大小不能超过10M");
+ }
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ // MemoryStream 内存流 在内存当中创建一个流(开辟空间)
+ using (var stream = new MemoryStream())
+ {
+ //将文件写入内存流
+ formFile.CopyTo(stream);
+ //将流的位置归零
+ stream.Position = 0;
+ //将内存流转成List集合
+ var list = await stream.QueryAsync();
+ var configs = list.Adapt();
+ await tenantDb.Insertable(configs).ExecuteCommandAsync();
+
+ return await Task.FromResult(DataResult.Failed("导入成功!", MultiLanguageConst.DataImportSuccess));
+
+ }
+ }
}
}