Browse Source

Merge remote-tracking branch 'origin/master-mahao'

master
mahao 2 years ago
parent
commit
2a1f47e47e
  1. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs
  2. 125
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs
  3. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs
  4. 608
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs
  5. 296
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj
  7. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  8. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PURCHASE_PRICE.cs
  9. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs
  10. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/MaterialRelationships/MaterialRelationship.cs
  11. 15
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  12. 3807
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711073528_20230711-2.Designer.cs
  13. 39
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711073528_20230711-2.cs
  14. 57
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

30
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs

@ -1,4 +1,5 @@
 
using Magicodes.ExporterAndImporter.Core;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -96,6 +97,35 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
} }
/// <summary>
/// 导出Dto
/// </summary>
public class CentralizedControlExportDto
{
/// <summary>
/// 年度
/// </summary>
[ExporterHeader(DisplayName = "年度")]
public string Year { get; protected set; }
/// <summary>
/// 期间
/// </summary>
[ExporterHeader(DisplayName = "期间")]
public string Period { set; get; }
/// <summary>
/// 版本
/// </summary>
[ExporterHeader(DisplayName = "版本")]
public string Version { set; get; }
/// <summary>
/// 是否开放状态
/// </summary>
[ExporterHeader(DisplayName = "是否开放状态")]
public int State { set; get; }
}
} }

125
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs

@ -109,146 +109,75 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
} }
/// <summary> /// <summary>
/// FIS /// FIS
/// </summary> /// </summary>
public class MaterialRelationshipRequestDto : RequestDtoBase, IBranch<Guid> public class MaterialRelationshipRequestDto : RequestDtoBase
{ {
/// <summary>
/// ERP物料号
/// </summary>
public virtual string ErpMaterialCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
public virtual string MaterialDesc { get; set; }
/// <summary>
/// 物料属性
/// </summary>
public virtual string MaterialProperty { get; set; }
/// <summary>
/// 结算物料号
/// </summary>
public virtual string SettleMaterialCode { get; set; }
/// <summary>
/// 发货看板物料号
/// </summary>
public virtual string ShipMaterailCode { get; set; }
public virtual Guid BranchId { get; set; }
/// <summary>
/// 估价类
/// </summary>
public virtual string AppraisalCategory { get; set; }
public virtual Guid ParentId { get; set; }
public virtual Guid UserId { get; set; }
} }
/// <summary> /// <summary>
/// FIS /// FIS
/// </summary> /// </summary>
public class MaterialRelationshipExportDto public class MaterialRelationshipExportDto
{ {
/// <summary> /// <summary>
/// ERP物料号 /// 厂内物料号
/// </summary> /// </summary>
[ExporterHeaderAttribute(DisplayName = "ERP物料号")] [ExporterHeaderAttribute(DisplayName = "厂内物料号")]
public string ErpMaterialCode { get; set; }
public virtual string ErpMaterialCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[ExporterHeaderAttribute(DisplayName = "ERP物料描述")]
public virtual string MaterialDesc { get; set; }
[ExporterHeaderAttribute(DisplayName = "估价类")]
/// <summary> /// <summary>
/// 估价类 /// 厂内物料描述
/// </summary>
public virtual string AppraisalCategory { get; set; }
/// <summary>
/// 物料属性
/// </summary> /// </summary>
[ExporterHeaderAttribute(DisplayName = "物料属性")] [ExporterHeaderAttribute(DisplayName = "厂内物料描述")]
public string MaterialDesc { get; set; }
public virtual string MaterialProperty { get; set; }
/// <summary> /// <summary>
/// 结算物料号 /// 客户物料号
/// </summary> /// </summary>
[ExporterHeaderAttribute(DisplayName = "客户物料号")] [ExporterHeaderAttribute(DisplayName = "客户物料号")]
public string SettleMaterialCode { get; set; }
public virtual string SettleMaterialCode { get; set; }
/// <summary> /// <summary>
/// 发货看板物料号 /// 客户物料描述
/// </summary> /// </summary>
[ExporterHeaderAttribute(DisplayName = "发货看板物料号")] [ExporterHeaderAttribute(DisplayName = "客户物料描述")]
public virtual string MaterialProperty { get; set; }
public virtual string ShipMaterailCode { get; set; }
} }
[ImportProject(Name = "零件匹配关系")] [ImportProject(Name = "零件匹配关系")]
public class MaterialRelationshipImportDto public class MaterialRelationshipImportDto
{ {
/// <summary> /// <summary>
/// ERP物料号 /// 厂内物料号
/// </summary> /// </summary>
[ImporterHeader(Name = "ERP物料号")] [ImporterHeader(Name = "厂内物料号")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")] [MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string ErpMaterialCode { get; set; } public string ErpMaterialCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[ImporterHeader(Name = "ERP物料描述")]
//[Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string MaterialDesc { get; set; }
/// <summary>
/// 物料属性
/// </summary>
[ImporterHeader(Name = "物料属性")]
//[Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string MaterialProperty { get; set; }
/// <summary> /// <summary>
/// 结算物料号 /// 厂内物料描述
/// </summary> /// </summary>
[ImporterHeader(Name = "结算物料号")] [ImporterHeader(Name = "厂内物料描述")]
//[Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")] [MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string SettleMaterialCode { get; set; } public string MaterialDesc { get; set; }
/// <summary> /// <summary>
/// 发货看板物料号 /// 客户物料号
/// </summary> /// </summary>
[ImporterHeader(Name = "发货看板物料号")] [ImporterHeader(Name = "客户物料号")]
//[Required(ErrorMessage = "{0}是必填项")] public string SettleMaterialCode { get; set; }
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string ShipMaterailCode { get; set; }
[ImporterHeader(Name = "估价类")]
/// <summary> /// <summary>
/// 估价类 /// 客户物料描述
/// </summary> /// </summary>
public virtual string AppraisalCategory { get; set; } [ImporterHeader(Name = "客户物料描述")]
public virtual string MaterialProperty { get; set; }
} }

22
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs

@ -26,6 +26,7 @@ using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using Win.Utils; using Win.Utils;
@ -65,6 +66,27 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
_excelImportService = excelImportService; _excelImportService = excelImportService;
} }
#region 导入、导出
/// <summary>
/// 导出
/// </summary>
[HttpPost]
[Route("Export")]
public async Task<string> ExportAsync(CentralizedControlRequestDto input)
{
string fileName = $"期间设置_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtos = ObjectMapper.Map<List<CentralizedControl>, List<CentralizedControlExportDto>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region CURD #region CURD
/// <summary> /// <summary>
/// 获取列表 /// 获取列表

608
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs

@ -18,80 +18,83 @@ using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships; using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils; using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
{ {
/// <summary> /// <summary>
/// 区域相关应用服务 /// 客户零件关系
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.MaterialRelationships.Default)] //[Authorize(SettleAccountPermissions.MaterialRelationships.Default)]
//[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/MaterialRelationship")] [Route("api/settleaccount/MaterialRelationship")]
public class MaterialRelationshipAppService : SettleAccountApplicationBase<MaterialRelationship>, IMaterialRelationshipAppService public class MaterialRelationshipAppService : SettleAccountApplicationBase<MaterialRelationship>
{ {
/// <summary>
/// 客户零件关系仓储
/// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository; private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly IExcelImportAppService _excelImportService; private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> _repository;
/// <summary> /// <summary>
/// 构方法 /// 构方法
/// </summary> /// </summary>
/// <param name="guidGenerator">构建UID</param> public MaterialRelationshipAppService(
/// <param name="objectMapper">自动map</param> INormalEfCoreRepository<MaterialRelationship, Guid> repository,
/// <param name="repository">仓储接口</param> IGuidGenerator guidGenerator,
/// <param name="cache">缓存</param> IObjectMapper objectMapper,
public MaterialRelationshipAppService(IGuidGenerator guidGenerator, ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IDistributedCache<MaterialRelationship> cache, IDistributedCache<MaterialRelationship> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{ {
_mapRepository = mapRepository;
_repository = repository; _repository = repository;
_mapRepository = mapRepository;
_excelImportService = excelImportService; _excelImportService = excelImportService;
} }
#region 导入、导出
/// <summary> /// <summary>
/// 导入功能 /// 导入
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost] [HttpPost]
[Route("ExcelImport-Map")] [Route("Import")]
[DisableRequestSizeLimit] public async Task<string> ImportAsync([FromForm] IFormFileCollection files)
public async Task<string> MaterialRelationshipUploadExcelImportMap([FromForm] IFormFileCollection files)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var mapList=_mapRepository.Where(p => p.ProjectName == SettleAccountModuleName.MaterialRelationship).ToList(); var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(files, _excelImportService);
var result = await _exportImporter.ExtendExcelImport<MaterialRelationshipImportDto>(files, _excelImportService,mapList);
var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result); var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result);
List<string> _errorList = new List<string>(); List<string> _errorList = new List<string>();
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
if (_ls.Count > 0) if (_ls.Count > 0)
{ {
var query = from arc in _ls var query = from arc in _ls
group arc by new { arc.ErpMaterialCode } group arc by new { arc.ErpMaterialCode }
into g into g
where g.Count() > 1 where g.Count() > 1
select g; select g;
foreach (var itm in query) foreach (var itm in query)
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}有重复", itm.Key.ErpMaterialCode), string.Empty)); checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}有重复", itm.Key.ErpMaterialCode), string.Empty));
// _errorList.Add(string.Format("ERP物料号{0}有重复",itm.Key.ErpMaterialCode));
} }
} }
foreach (var itm in _ls) foreach (var itm in _ls)
@ -104,307 +107,394 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
} }
else else
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode), string.Empty)); await _repository.InsertAsync(itm);
//_errorList.Add(string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode));
//itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
//await _repository.InsertAsync(itm);
} }
//itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
return await ExportErrorReportAsync(checkList); return await ExportErrorReportAsync(checkList);
} }
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
/// <summary> /// <summary>
/// 导入功能 /// 导出
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost] [HttpPost]
[Route("ExcelImport")] [Route("Export")]
[DisableRequestSizeLimit] public async Task<string> ExportAsync(MaterialRelationshipRequestDto input)
public async Task<string> MaterialRelationshipUploadExcelImport([FromForm] IFormFileCollection files)
{ {
string fileName = $"客户零件关系_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipExportDto>>(entities);
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(files, _excelImportService); var result = await _exportImporter.ExcelExporter(dtos);
var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result); result.ShouldNotBeNull();
List<string> _errorList = new List<string>();
var checkList = new List<ErrorExportDto>();
if (_ls.Count > 0)
{
var query=from arc in _ls
group arc by new { arc.ErpMaterialCode}
into g
where g.Count() >1
select g;
foreach (var itm in query)
{
checkList.Add(new ErrorExportDto(string.Empty,string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}有重复", itm.Key.ErpMaterialCode), string.Empty));
// _errorList.Add(string.Format("ERP物料号{0}有重复",itm.Key.ErpMaterialCode));
}
}
foreach (var itm in _ls)
{
var _first = _repository.FirstOrDefault(p => p.ErpMaterialCode == itm.ErpMaterialCode );
if (_first != null)
{
_first.Update(itm.MaterialDesc,itm.MaterialProperty,itm.SettleMaterialCode,itm.ShipMaterailCode);
await _repository.UpdateAsync(_first);
}
else
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode), string.Empty));
//_errorList.Add(string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode));
//itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
//await _repository.InsertAsync(itm);
}
//itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
return ApplicationConsts.SuccessStr; await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
} }
#endregion
#region CURD
/// <summary> /// <summary>
/// 按ID获取唯一实体 /// 获取列表
/// </summary> /// </summary>
/// <remarks> [HttpPost]
/// 返回实体全部属性 [Route("list")]
/// </remarks> public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(MaterialRelationshipRequestDto input)
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
virtual public async Task<MaterialRelationshipDto> GetAsync(Guid id)
{ {
var result = await GetFromCacheAsync(id); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(result); var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
return dto; var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos);
} }
#endregion
#region 原方法(废弃)
private async Task<MaterialRelationship> GetFromCacheAsync(Guid id) ///// <summary>
{ ///// 导入功能
var result = await _repository.GetAsync(id); ///// </summary>
///// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
///// <returns></returns>
return result; //[HttpPost]
} //[Route("ExcelImport-Map")]
//[DisableRequestSizeLimit]
//public async Task<string> MaterialRelationshipUploadExcelImportMap([FromForm] IFormFileCollection files)
//{
// ExportImporter _exportImporter = new ExportImporter();
// var mapList = _mapRepository.Where(p => p.ProjectName == SettleAccountModuleName.MaterialRelationship).ToList();
// var result = await _exportImporter.ExtendExcelImport<MaterialRelationshipImportDto>(files, _excelImportService, mapList);
// var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result);
// List<string> _errorList = new List<string>();
// var checkList = new List<ErrorExportDto>();
// if (_ls.Count > 0)
// {
// var query = from arc in _ls
// group arc by new { arc.ErpMaterialCode }
// into g
// where g.Count() > 1
// select g;
// foreach (var itm in query)
// {
// checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}有重复", itm.Key.ErpMaterialCode), string.Empty));
// // _errorList.Add(string.Format("ERP物料号{0}有重复",itm.Key.ErpMaterialCode));
// }
// }
// foreach (var itm in _ls)
// {
// var _first = _repository.FirstOrDefault(p => p.ErpMaterialCode == itm.ErpMaterialCode);
// if (_first != null)
// {
// _first.Update(itm.MaterialDesc, itm.MaterialProperty, itm.SettleMaterialCode, itm.ShipMaterailCode);
// await _repository.UpdateAsync(_first);
// }
// else
// {
// checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode), string.Empty));
// //_errorList.Add(string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode));
// //itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
// //await _repository.InsertAsync(itm);
// }
// //itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
// }
// if (checkList.Count > 0)
// {
// return await ExportErrorReportAsync(checkList);
// }
// return ApplicationConsts.SuccessStr;
//}
private async Task<long> GetCountAsync(MaterialRelationshipRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
///// <summary>
///// 导入功能
///// </summary>
///// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
///// <returns></returns>
//[HttpPost]
//[Route("ExcelImport")]
//[DisableRequestSizeLimit]
//public async Task<string> MaterialRelationshipUploadExcelImport([FromForm] IFormFileCollection files)
//{
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(files, _excelImportService);
// var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result);
// List<string> _errorList = new List<string>();
// var checkList = new List<ErrorExportDto>();
// if (_ls.Count > 0)
// {
// var query = from arc in _ls
// group arc by new { arc.ErpMaterialCode }
// into g
// where g.Count() > 1
// select g;
// foreach (var itm in query)
// {
// checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}有重复", itm.Key.ErpMaterialCode), string.Empty));
// // _errorList.Add(string.Format("ERP物料号{0}有重复",itm.Key.ErpMaterialCode));
// }
// }
// foreach (var itm in _ls)
// {
// var _first = _repository.FirstOrDefault(p => p.ErpMaterialCode == itm.ErpMaterialCode);
// if (_first != null)
// {
// _first.Update(itm.MaterialDesc, itm.MaterialProperty, itm.SettleMaterialCode, itm.ShipMaterailCode);
// await _repository.UpdateAsync(_first);
// }
// else
// {
// checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode), string.Empty));
// //_errorList.Add(string.Format("关系表中不存在ERP物料号{0}!", itm.ErpMaterialCode));
// //itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
// //await _repository.InsertAsync(itm);
// }
// //itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
// }
// if (checkList.Count > 0)
// {
// return await ExportErrorReportAsync(checkList);
// }
// return ApplicationConsts.SuccessStr;
//}
///// <summary> ///// <summary>
///// 按ID获取唯一实体
///// </summary>
///// <remarks>
///// 返回实体全部属性
///// </remarks>
///// <param name="id">ID</param>
///// <returns>实体DTO</returns>
//[HttpGet]
//[Route("{id}")]
//virtual public async Task<MaterialRelationshipDto> GetAsync(Guid id)
//{
// var result = await GetFromCacheAsync(id);
// var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(result);
// return dto;
//}
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("list")]
virtual public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(MaterialRelationshipRequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true);
var totalCount = await GetCountAsync(input); //private async Task<MaterialRelationship> GetFromCacheAsync(Guid id)
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities); //{
// var result = await _repository.GetAsync(id);
return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos);
}
// return result;
//}
/// <summary>
/// 获取实体总数
/// </summary>
/// <returns>实体总数</returns>
[HttpGet]
[Route("count")]
virtual public async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _repository.GetCountAsync(branchId);
}
/// <summary> //private async Task<long> GetCountAsync(MaterialRelationshipRequestDto input)
/// 获取全部实体列表 //{
/// </summary> // return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
/// <returns>实体DTO列表</returns> //}
[HttpGet]
[Route("all")]
virtual public async Task<ListResultDto<MaterialRelationshipDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
return new ListResultDto<MaterialRelationshipDto>(dtos); /////// <summary>
}
///// <summary>
///// 根据筛选条件获取实体列表
///// </summary>
///// <remarks>
///// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
///// </remarks>
///// <param name="input">请求条件</param>
///// <returns>实体DTO列表</returns>
//[HttpPost]
//[Route("list")]
//virtual public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(MaterialRelationshipRequestDto input)
//{
// var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount,
// input.SkipCount, true);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
// return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos);
//}
/// <summary> ///// <summary>
/// 新增实体 ///// 获取实体总数
/// </summary> ///// </summary>
/// <param name="input">新增实体DTO</param> ///// <returns>实体总数</returns>
/// <returns>实体DTO</returns> //[HttpGet]
//[Route("count")]
//virtual public async Task<long> GetTotalCountAsync(Guid branchId)
//{
// return await _repository.GetCountAsync(branchId);
//}
[HttpPost] ///// <summary>
[Route("")] ///// 获取全部实体列表
virtual public async Task<MaterialRelationshipDto> CreateAsync(MaterialRelationshipCreateDto input) ///// </summary>
{ ///// <returns>实体DTO列表</returns>
//[HttpGet]
//[Route("all")]
//virtual public async Task<ListResultDto<MaterialRelationshipDto>> GetAllAsync(Guid branchId)
//{
// var entities = await _repository.GetAllAsync(branchId, true);
var _first = _repository.Where(p => p.ErpMaterialCode == input.ErpMaterialCode ).FirstOrDefault(); // var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
if (_first != null)
{
throw new BusinessException("001", "已经存数据请修改后创建");
}
// return new ListResultDto<MaterialRelationshipDto>(dtos);
//}
var entity = new MaterialRelationship(
GuidGenerator.Create(),
input.BranchId,
input.ErpMaterialCode,
input.MaterialDesc,
input.MaterialProperty,
input.SettleMaterialCode,
input.ShipMaterailCode,
input.AppraisalCategory
);
await _repository.InsertAsync(entity); ///// <summary>
///// 新增实体
///// </summary>
///// <param name="input">新增实体DTO</param>
///// <returns>实体DTO</returns>
////create cache //[HttpPost]
//await Cache.SetAsync(entity.Id.ToString(), entity, //[Route("")]
// CacheStrategyConst.FIVE_MINUTES); //virtual public async Task<MaterialRelationshipDto> CreateAsync(MaterialRelationshipCreateDto input)
//{
var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity);
return dto;
} // var _first = _repository.Where(p => p.ErpMaterialCode == input.ErpMaterialCode).FirstOrDefault();
/// <summary> // if (_first != null)
/// 修改实体 // {
/// </summary> // throw new BusinessException("001", "已经存数据请修改后创建");
/// <param name="id">ID</param> // }
/// <param name="input">修改实体DTO</param>
/// <returns>实体DTO</returns>
[HttpPut]
[Route("{id}")]
virtual public async Task<MaterialRelationshipDto> UpdateAsync(Guid id, MaterialRelationshipUpdateDto input)
{
var entity = await _repository.GetAsync(id);
if (entity != null)
{
entity.Update( input.MaterialDesc, input.MaterialProperty, input.SettleMaterialCode, input.ShipMaterailCode);
await _repository.UpdateAsync(entity);
// var entity = new MaterialRelationship(
var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity); // GuidGenerator.Create(),
return dto; // input.BranchId,
} // input.ErpMaterialCode,
else
{
return null;
}
} // input.MaterialDesc,
// input.MaterialProperty,
// input.SettleMaterialCode,
// input.ShipMaterailCode,
// input.AppraisalCategory
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">ID</param>
/// <returns>无</returns>
[HttpDelete]
[Route("{id}")]
virtual public async Task DeleteAsync(Guid id)
{
var entity = await GetFromCacheAsync(id);
await Cache.DeleteAsync<MaterialRelationship>(id.ToString());
await _repository.DeleteAsync(id);
}
/// <summary> // );
/// 按IDs删除实体列表
/// </summary>
/// <param name="ids">IDs</param>
/// <returns>是否执行成功</returns>
[HttpPost]
[Route("delete")]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
var _query = _repository.Where(p => ids.Contains(p.Id));
int i = await _query.BatchDeleteAsync();
if (i == 0) // await _repository.InsertAsync(entity);
{
return false;
}
return true;
}
[HttpPost]
[Route("Export")]
virtual public async Task<string> ExportAsync(MaterialRelationshipRequestDto input)
{
//var _userId = CurrentUser.Id.Value.ToString();
string _fileName = string.Format("零件关系_{0}.xlsx",Guid.NewGuid().ToString());
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipExportDto>>(entities); // ////create cache
// //await Cache.SetAsync(entity.Id.ToString(), entity,
// // CacheStrategyConst.FIVE_MINUTES);
//声明导出容器 // var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity);
ExportImporter _exportImporter = new ExportImporter(); // return dto;
var result = await _exportImporter.ExcelExporter(dtoDetails); //}
result.ShouldNotBeNull(); ///// <summary>
///// 修改实体
///// </summary>
///// <param name="id">ID</param>
///// <param name="input">修改实体DTO</param>
///// <returns>实体DTO</returns>
//[HttpPut]
//[Route("{id}")]
//virtual public async Task<MaterialRelationshipDto> UpdateAsync(Guid id, MaterialRelationshipUpdateDto input)
//{
// var entity = await _repository.GetAsync(id);
// if (entity != null)
// {
// entity.Update(input.MaterialDesc, input.MaterialProperty, input.SettleMaterialCode, input.ShipMaterailCode);
// await _repository.UpdateAsync(entity);
// var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity);
// return dto;
// }
// else
// {
// return null;
// }
//}
//保存导出文件到服务器存成二进制 ///// <summary>
await _excelImportService.SaveBlobAsync( ///// 删除实体
new SaveExcelImportInputDto ///// </summary>
{ ///// <param name="id">ID</param>
Name = _fileName, ///// <returns>无</returns>
Content = result //[HttpDelete]
} //[Route("{id}")]
); //virtual public async Task DeleteAsync(Guid id)
return _fileName; //{
} // var entity = await GetFromCacheAsync(id);
// await Cache.DeleteAsync<MaterialRelationship>(id.ToString());
// await _repository.DeleteAsync(id);
//}
///// <summary>
///// 按IDs删除实体列表
///// </summary>
///// <param name="ids">IDs</param>
///// <returns>是否执行成功</returns>
//[HttpPost]
//[Route("delete")]
//virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
//{
// var _query = _repository.Where(p => ids.Contains(p.Id));
// int i = await _query.BatchDeleteAsync();
// if (i == 0)
// {
// return false;
// }
// return true;
//}
//[HttpPost]
//[Route("Export")]
//virtual public async Task<string> ExportAsync(MaterialRelationshipRequestDto input)
//{
// //var _userId = CurrentUser.Id.Value.ToString();
// string _fileName = string.Format("零件关系_{0}.xlsx", Guid.NewGuid().ToString());
// var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
// 0, true);
// var dtoDetails = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipExportDto>>(entities);
// //声明导出容器
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.ExcelExporter(dtoDetails);
// result.ShouldNotBeNull();
// //保存导出文件到服务器存成二进制
// await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto
// {
// Name = _fileName,
// Content = result
// }
// );
// return _fileName;
//}
#endregion
} }
} }

296
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -36,7 +36,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[Route("api/SettleAccount/PriceList")] [Route("api/SettleAccount/PriceList")]
[AllowAnonymous] [AllowAnonymous]
public class PriceListAppService : ApplicationService public class PriceListAppService : ApplicationService
/*, IPriceListAppService*/
{ {
private readonly PriceListManager _priceListManager; private readonly PriceListManager _priceListManager;
private readonly IExcelImportAppService _excelImportService; private readonly IExcelImportAppService _excelImportService;
@ -71,7 +70,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Import")] [Route("Import")]
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
public virtual async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version) public virtual async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
@ -102,7 +100,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Export")] [Route("Export")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
public virtual async Task<string> ExportAsync(TB_PRICE_LIST_RequestDto input) public virtual async Task<string> ExportAsync(TB_PRICE_LIST_RequestDto input)
{ {
IExporter _csv = new CsvExporter(); IExporter _csv = new CsvExporter();
@ -150,7 +147,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("list")] [Route("list")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(TB_PRICE_LIST_RequestDto input) public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(TB_PRICE_LIST_RequestDto input)
{ {
if (!string.IsNullOrEmpty(input.Version)) if (!string.IsNullOrEmpty(input.Version))
@ -158,7 +154,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
} }
var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await GetCountAsync(input); var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys); var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos); return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos);
} }
@ -168,7 +164,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpDelete] [HttpDelete]
[Route("{id}")] [Route("{id}")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task DeleteAsync(Guid id) virtual public async Task DeleteAsync(Guid id)
{ {
await _priceListManager.DeleteAsync(id); await _priceListManager.DeleteAsync(id);
@ -179,169 +174,160 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("delete")] [Route("delete")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{ {
return await _priceListManager.DeleteListAsync(ids); return await _priceListManager.DeleteListAsync(ids);
} }
#endregion #endregion
#region 私有方法
/// <summary>
/// 获取总数
/// </summary>
private async Task<long> GetCountAsync(TB_PRICE_LIST_RequestDto input)
{
return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
}
#endregion
/// <summary>
/// 获取总数
/// </summary>
private async Task<long> GetCountAsync(PriceListRequestDto input)
{
return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
}
/// <summary>
/// 结算总成和ERP总成价格对比
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("BomDiffPrice-Make")]
[DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.PriceLists.Default)]
public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode) ? string.Empty : customerCode });
var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
[HttpPost]
[Route("job/list")]
[Authorize(SettleAccountPermissions.PriceLists.Default)]
[UnitOfWork(false)]
virtual public async Task<List<JobDto>> GetListAsync(JobRequestDto input)
{
return await _service.GetListAsync(input);
}
/// <summary>
/// 按ID获取唯一实体
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
/// [Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<PriceListDto> GetAsync(Guid id)
{
var result = await _priceListManager.GetAsync(id); ;
var dto = ObjectMapper.Map<PriceList, PriceListDto>(result);
return dto;
}
#region 原方法(废弃)
// /// <summary>
// /// 获取总数
// /// </summary>
// private async Task<long> GetCountAsync(PriceListRequestDto input)
// {
// return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
// }
/// <summary> // /// <summary>
/// 根据筛选条件获取实体列表 // /// 结算总成和ERP总成价格对比
/// </summary> // /// </summary>
/// <remarks> // /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 // /// <returns></returns>
/// </remarks> // [HttpGet]
/// <param name="input">请求条件</param> // [Route("BomDiffPrice-Make")]
/// <returns>实体DTO列表</returns> // [DisableRequestSizeLimit]
[HttpPost] // [Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("versionlist")]
// [Authorize(SettleAccountPermissions.PriceLists.Default)] // public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
virtual public async Task<PagedResultDto<PriceListVersionDto>> GetVersionListAsync(PriceListRequestDto input) // {
{
var entities = await _priceListManager.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<PriceListVersion>, List<PriceListVersionDto>>(entities);
return new PagedResultDto<PriceListVersionDto>(totalCount, dtos);
}
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
// customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
// customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode) ? string.Empty : customerCode });
/// <summary> // var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
/// 获取实体总数 // {
/// </summary>
/// <returns>实体总数</returns> // });
[HttpGet] // return _taskid;
[Route("count")] // }
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<long> GetTotalCountAsync(Guid branchId) // [HttpPost]
{ // [Route("job/list")]
return await _priceListManager.GetCountAsync(new List<FilterCondition>(), branchId); // [Authorize(SettleAccountPermissions.PriceLists.Default)]
} // [UnitOfWork(false)]
// virtual public async Task<List<JobDto>> GetListAsync(JobRequestDto input)
/// <summary> // {
/// 获取全部实体列表 // return await _service.GetListAsync(input);
/// </summary> // }
/// <returns>实体DTO列表</returns>
[HttpGet] // /// <summary>
[Route("all")] // /// 按ID获取唯一实体
//[Authorize(SettleAccountPermissions.PriceLists.Default)] // /// </summary>
virtual public async Task<ListResultDto<PriceListDto>> GetAllAsync(Guid branchId) // /// <remarks>
{ // /// 返回实体全部属性
var entities = await _priceListManager.GetAllAsync(branchId); // /// </remarks>
var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities); // /// <param name="id">ID</param>
return new ListResultDto<PriceListDto>(dtos); // /// <returns>实体DTO</returns>
}
// [HttpGet]
// [Route("{id}")]
/// <summary> // /// [Authorize(SettleAccountPermissions.PriceLists.Default)]
/// 修改实体 // virtual public async Task<PriceListDto> GetAsync(Guid id)
/// </summary> // {
/// <param name="id">ID</param> // var result = await _priceListManager.GetAsync(id); ;
/// <param name="input">修改实体DTO</param> // var dto = ObjectMapper.Map<PriceList, PriceListDto>(result);
/// <returns>实体DTO</returns> // return dto;
[HttpPut]
[Route("{id}")] // }
[Authorize(SettleAccountPermissions.PriceLists.Update)]
virtual public async Task<PriceListDto> UpdateAsync(Guid id, PriceListDto input)
{
var entity = new PriceList(
); // /// <summary>
// /// 根据筛选条件获取实体列表
var _ent = await _priceListManager.UpdateAsync(id, entity); // /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
var dto = ObjectMapper.Map<PriceList, PriceListDto>(_ent); // /// </remarks>
return dto; // /// <param name="input">请求条件</param>
} // /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("versionlist")]
//// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListVersionDto>> GetVersionListAsync(PriceListRequestDto input)
// {
// var entities = await _priceListManager.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListVersion>, List<PriceListVersionDto>>(entities);
// return new PagedResultDto<PriceListVersionDto>(totalCount, dtos);
// }
// /// <summary>
// /// 获取实体总数
// /// </summary>
// /// <returns>实体总数</returns>
// [HttpGet]
// [Route("count")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<long> GetTotalCountAsync(Guid branchId)
// {
// return await _priceListManager.GetCountAsync(new List<FilterCondition>(), branchId);
// }
// /// <summary>
// /// 获取全部实体列表
// /// </summary>
// /// <returns>实体DTO列表</returns>
// [HttpGet]
// [Route("all")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<ListResultDto<PriceListDto>> GetAllAsync(Guid branchId)
// {
// var entities = await _priceListManager.GetAllAsync(branchId);
// var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities);
// return new ListResultDto<PriceListDto>(dtos);
// }
// /// <summary>
// /// 修改实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <param name="input">修改实体DTO</param>
// /// <returns>实体DTO</returns>
// [HttpPut]
// [Route("{id}")]
// [Authorize(SettleAccountPermissions.PriceLists.Update)]
// virtual public async Task<PriceListDto> UpdateAsync(Guid id, PriceListDto input)
// {
// var entity = new PriceList(
// );
// var _ent = await _priceListManager.UpdateAsync(id, entity);
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(_ent);
// return dto;
// }
#endregion
} }
} }

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj

@ -6,7 +6,7 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<RootNamespace>Win.Sfs.SettleAccount</RootNamespace> <RootNamespace>Win.Sfs.SettleAccount</RootNamespace>
<SignAssembly>false</SignAssembly> <SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>False</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -628,9 +628,15 @@ namespace Win.Sfs.SettleAccount
CreateMap<PrebatchUpdateDto, Prebatch>(); CreateMap<PrebatchUpdateDto, Prebatch>();
} }
/// <summary>
/// 期间设置
/// </summary>
private void CreateMapCentralizedControl() private void CreateMapCentralizedControl()
{ {
CreateMap<CentralizedControl, CentralizedControlDto>().ReverseMap(); CreateMap<CentralizedControl, CentralizedControlDto>().ReverseMap();
CreateMap<CentralizedControl, CentralizedControlExportDto>();
CreateMap<CentralizedControl, CentralizedControlCreateDto>(); CreateMap<CentralizedControl, CentralizedControlCreateDto>();
CreateMap<CentralizedControl, CentralizedControlUpdateDto>(); CreateMap<CentralizedControl, CentralizedControlUpdateDto>();

23
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PURCHASE_PRICE.cs

@ -1,11 +1,24 @@
using System.ComponentModel.DataAnnotations; using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
namespace SettleAccount.Domain.BQ; namespace SettleAccount.Domain.BQ;
/// <summary>
/// 采购价格单
/// </summary>
[Display(Name = "采购价格单")] [Display(Name = "采购价格单")]
public class PURCHASE_PRICE : FullAuditedAggregateRoot<Guid>
public class PURCHASE_PRICE
{ {
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
public decimal Price { get; set; }
} }

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs

@ -1,12 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase; using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.Controls namespace Win.Sfs.SettleAccount.Entities.Controls
{ {
/// <summary>
/// 期间设置
/// </summary>
public class CentralizedControl: FullAuditedAggregateRootBase<Guid> public class CentralizedControl: FullAuditedAggregateRootBase<Guid>
{ {
/// <summary> /// <summary>

35
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/MaterialRelationships/MaterialRelationship.cs

@ -1,24 +1,39 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using Win.Sfs.Shared.DomainBase; using Win.Sfs.Shared.DomainBase;
using Win.Sfs.Shared.Constant;
namespace Win.Sfs.SettleAccount.MaterialRelationships namespace Win.Sfs.SettleAccount.MaterialRelationships
{ {
/// <summary> /// <summary>
/// 物料关系 /// 客户零件关系
/// </summary> /// </summary>
public class MaterialRelationship : FullAuditedAggregateRootBase<Guid> public class MaterialRelationship : FullAuditedAggregateRootBase<Guid>
{ {
/// <summary> /// <summary>
/// ERP物料号 /// 厂内物料号
/// </summary> /// </summary>
public string ErpMaterialCode { get; set; } public string ErpMaterialCode { get; set; }
/// <summary> /// <summary>
/// 物料描述 /// 厂内物料描述
/// </summary> /// </summary>
public string MaterialDesc { get; set; } public string MaterialDesc { get; set; }
/// <summary>
/// 客户物料号
/// </summary>
public string SettleMaterialCode { get; set; }
/// <summary> /// <summary>
/// 物料属性 /// 物料属性
/// </summary> /// </summary>
@ -27,10 +42,10 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
/// <summary> ///// <summary>
/// 结算物料号 ///// 结算物料号
/// </summary> ///// </summary>
public string SettleMaterialCode { get; set; } //public string SettleMaterialCode { get; set; }
/// <summary> /// <summary>

15
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -80,7 +80,8 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureBomVersion(options); builder.ConfigureBomVersion(options);
//期间 //期间
builder.ConfigureCentralizedControl(options); builder.ConfigureCentralizedControl(options);
//采购价格单
builder.ConfigurePURCHASE_PRICE(options);
#endregion #endregion
@ -322,6 +323,18 @@ namespace Win.Sfs.SettleAccount
}); });
} }
/// <summary>
/// 采购价格单
/// </summary>
private static void ConfigurePURCHASE_PRICE(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PURCHASE_PRICE>(b =>
{
b.ToTable($"{options.TablePrefix}_PURCHASE_PRICE", options.Schema);
b.ConfigureByConvention();
});
}
#endregion #endregion

3807
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711073528_20230711-2.Designer.cs

File diff suppressed because it is too large

39
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711073528_20230711-2.cs

@ -0,0 +1,39 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307112 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_PURCHASE_PRICE",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LU = table.Column<string>(type: "nvarchar(max)", nullable: true),
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_PURCHASE_PRICE", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_PURCHASE_PRICE");
}
}
}

57
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -2938,6 +2938,63 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_PUB_SE_DETAIL"); b.ToTable("Set_PUB_SE_DETAIL");
}); });
modelBuilder.Entity("SettleAccount.Domain.BQ.PURCHASE_PRICE", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<string>("LU")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.ToTable("Set_PURCHASE_PRICE");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Boms.Bom", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Boms.Bom", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

Loading…
Cancel
Save