|
|
@ -31,7 +31,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
{ |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 区域相关应用服务
|
|
|
|
/// 区域相关应用服务
|
|
|
|
/// </summary>
|
|
|
|
[Authorize(SettleAccountPermissions.Boms.Default)] |
|
|
|
//[AllowAnonymous]
|
|
|
@ -53,12 +53,12 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
|
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<ERPShippingVersion, Guid> _versionRepository; |
|
|
|
/// <summary>
|
|
|
|
/// 构建方法
|
|
|
|
/// 构建方法
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="guidGenerator">构建UID</param>
|
|
|
|
/// <param name="objectMapper">自动map</param>
|
|
|
|
/// <param name="repository">仓储接口</param>
|
|
|
|
/// <param name="cache">缓存</param>
|
|
|
|
/// <param name="guidGenerator">构建UID</param>
|
|
|
|
/// <param name="objectMapper">自动map</param>
|
|
|
|
/// <param name="repository">仓储接口</param>
|
|
|
|
/// <param name="cache">缓存</param>
|
|
|
|
public ErpShippingAppService(IGuidGenerator guidGenerator, |
|
|
|
IObjectMapper objectMapper, |
|
|
|
IExcelImportAppService excelImportService, |
|
|
@ -80,12 +80,12 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
_importColumnMapRepository = importColumnMapRepository; |
|
|
|
} |
|
|
|
|
|
|
|
#region 导入导出功能
|
|
|
|
#region 导入导出功能
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 导入功能
|
|
|
|
/// 导入功能
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
//[HttpPost]
|
|
|
|
//[Route("ExcelImport-Map")]
|
|
|
@ -95,7 +95,6 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
//public async Task<string> ERPShippingDetailUploadExcelImportMap([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory)
|
|
|
|
//{
|
|
|
|
// var _mapList=_importColumnMapRepository.Where(p => p.ProjectName ==SettleAccountModuleName.ERPShippingDetail ).ToList();
|
|
|
|
|
|
|
|
// ExportImporter _exportImporter = new ExportImporter();
|
|
|
|
// var result = await _exportImporter.ExtendExcelImport<ImportERPShippingDetailDto>(files, _excelImportService,_mapList);
|
|
|
|
// var entityList = ObjectMapper.Map<List<ImportERPShippingDetailDto>, List<ERPShippingDetail>>(result);
|
|
|
@ -110,7 +109,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
// {
|
|
|
|
// if (itm.Count > 1)
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// var _id = GuidGenerator.Create();
|
|
|
@ -120,7 +119,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
// {
|
|
|
|
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory);
|
|
|
@ -136,9 +135,9 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
//}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 导入功能
|
|
|
|
/// 导入功能
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost] |
|
|
|
[Route("ExcelImport")] |
|
|
@ -161,7 +160,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
//{
|
|
|
|
// if (itm.Count > 1)
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//var _id = GuidGenerator.Create();
|
|
|
@ -171,7 +170,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
//{
|
|
|
|
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
|
|
|
|
// {
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory);
|
|
|
@ -188,7 +187,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
return ApplicationConsts.SuccessStr; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 导出文件
|
|
|
|
/// 导出文件
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
@ -199,7 +198,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
{ |
|
|
|
IExporter _csv = new CsvExporter(); |
|
|
|
IExporter _excel = new ExcelExporter(); |
|
|
|
//导出加上版本过滤条件,不能全导出
|
|
|
|
//导出加上版本过滤条件,不能全导出
|
|
|
|
if (!string.IsNullOrEmpty(input.Version)) |
|
|
|
{ |
|
|
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version.ToString() }); |
|
|
@ -211,14 +210,11 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
|
|
|
0, true).ConfigureAwait(false); |
|
|
|
var dtoDetails = ObjectMapper.Map<List<ERPShippingDetail>, List<ERPShippingDetailExportDto>>(entities); |
|
|
|
var _fileName = string.Format("ERP调拨_{0}.xlsx", Guid.NewGuid().ToString("N")); |
|
|
|
//声明导出容器
|
|
|
|
|
|
|
|
var _fileName = string.Format("ERP调拨_{0}.xlsx", Guid.NewGuid().ToString("N")); |
|
|
|
//声明导出容器
|
|
|
|
var result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false); |
|
|
|
|
|
|
|
result.ShouldNotBeNull(); |
|
|
|
|
|
|
|
//保存导出文件到服务器存成二进制
|
|
|
|
//保存导出文件到服务器存成二进制
|
|
|
|
await _excelImportService.SaveBlobAsync( |
|
|
|
new SaveExcelImportInputDto |
|
|
|
{ |
|
|
@ -231,13 +227,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 按ID获取唯一实体
|
|
|
|
/// 按ID获取唯一实体
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// 返回实体全部属性
|
|
|
|
/// 返回实体全部属性
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="id">ID</param>
|
|
|
|
/// <returns>实体DTO</returns>
|
|
|
|
/// <returns>实体DTO</returns>
|
|
|
|
[HttpGet] |
|
|
|
[Route("{id}")] |
|
|
|
|
|
|
@ -259,9 +255,9 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取实体总数
|
|
|
|
/// 获取实体总数
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>实体总数</returns>
|
|
|
|
/// <returns>实体总数</returns>
|
|
|
|
[HttpGet] |
|
|
|
[Route("count")] |
|
|
|
|
|
|
@ -271,10 +267,10 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 删除实体
|
|
|
|
/// 删除实体
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">ID</param>
|
|
|
|
/// <returns>无</returns>
|
|
|
|
/// <returns>无</returns>
|
|
|
|
[HttpDelete] |
|
|
|
[Route("{id}")] |
|
|
|
|
|
|
@ -286,10 +282,10 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 按IDs删除实体列表
|
|
|
|
/// 按IDs删除实体列表
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ids">IDs</param>
|
|
|
|
/// <returns>是否执行成功</returns>
|
|
|
|
/// <returns>是否执行成功</returns>
|
|
|
|
[HttpPost] |
|
|
|
[Route("delete")] |
|
|
|
|
|
|
@ -307,13 +303,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
///// <summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据筛选条件获取实体列表
|
|
|
|
/// 根据筛选条件获取实体列表
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="input">请求条件</param>
|
|
|
|
/// <returns>实体DTO列表</returns>
|
|
|
|
/// <param name="input">请求条件</param>
|
|
|
|
/// <returns>实体DTO列表</returns>
|
|
|
|
[HttpPost] |
|
|
|
[Route("list")] |
|
|
|
|
|
|
@ -337,13 +333,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
///// <summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据筛选条件获取实体列表
|
|
|
|
/// 根据筛选条件获取实体列表
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="input">请求条件</param>
|
|
|
|
/// <returns>实体DTO列表</returns>
|
|
|
|
/// <param name="input">请求条件</param>
|
|
|
|
/// <returns>实体DTO列表</returns>
|
|
|
|
[HttpPost] |
|
|
|
[Route("listVersion")] |
|
|
|
|
|
|
@ -351,7 +347,6 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails |
|
|
|
{ |
|
|
|
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
|
|
|
input.SkipCount, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
var totalCount = await GetCountAsync(input).ConfigureAwait(false); |
|
|
|
var dtos = _objectMapper.Map<List<ERPShippingVersion>, List<ERPShippingVersionDto>>(entities); |
|
|
|
//foreach (var itm in dtos)
|
|
|
|