Browse Source

EF迁移采购价格单

master
mahao 1 year ago
parent
commit
b12c7b2868
  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.Collections.Generic;
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>
/// FIS
/// </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>
/// FIS
/// </summary>
public class MaterialRelationshipExportDto
{
/// <summary>
/// ERP物料号
/// 厂内物料号
/// </summary>
[ExporterHeaderAttribute(DisplayName = "ERP物料号")]
public virtual string ErpMaterialCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[ExporterHeaderAttribute(DisplayName = "ERP物料描述")]
public virtual string MaterialDesc { get; set; }
[ExporterHeaderAttribute(DisplayName = "厂内物料号")]
public string ErpMaterialCode { get; set; }
[ExporterHeaderAttribute(DisplayName = "估价类")]
/// <summary>
/// 估价类
/// </summary>
public virtual string AppraisalCategory { get; set; }
/// <summary>
/// 物料属性
/// 厂内物料描述
/// </summary>
[ExporterHeaderAttribute(DisplayName = "物料属性")]
public virtual string MaterialProperty { get; set; }
[ExporterHeaderAttribute(DisplayName = "厂内物料描述")]
public string MaterialDesc { get; set; }
/// <summary>
/// 结算物料号
/// 客户物料号
/// </summary>
[ExporterHeaderAttribute(DisplayName = "客户物料号")]
public virtual string SettleMaterialCode { get; set; }
public string SettleMaterialCode { get; set; }
/// <summary>
/// 发货看板物料号
/// 客户物料描述
/// </summary>
[ExporterHeaderAttribute(DisplayName = "发货看板物料号")]
public virtual string ShipMaterailCode { get; set; }
[ExporterHeaderAttribute(DisplayName = "客户物料描述")]
public virtual string MaterialProperty { get; set; }
}
[ImportProject(Name = "零件匹配关系")]
public class MaterialRelationshipImportDto
{
/// <summary>
/// ERP物料号
/// 厂内物料号
/// </summary>
[ImporterHeader(Name = "ERP物料号")]
[ImporterHeader(Name = "厂内物料号")]
[Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual 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; }
public string ErpMaterialCode { get; set; }
/// <summary>
/// 结算物料号
/// 厂内物料描述
/// </summary>
[ImporterHeader(Name = "结算物料号")]
//[Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "厂内物料描述")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string SettleMaterialCode { get; set; }
public string MaterialDesc { get; set; }
/// <summary>
/// 发货看板物料号
/// 客户物料号
/// </summary>
[ImporterHeader(Name = "发货看板物料号")]
//[Required(ErrorMessage = "{0}是必填项")]
[MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")]
public virtual string ShipMaterailCode { get; set; }
[ImporterHeader(Name = "客户物料号")]
public string SettleMaterialCode { get; set; }
[ImporterHeader(Name = "估价类")]
/// <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.Materials;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
@ -65,6 +66,27 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
_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
/// <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 Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
{
/// <summary>
/// 区域相关应用服务
/// 客户零件关系
/// </summary>
//[Authorize(SettleAccountPermissions.MaterialRelationships.Default)]
//[AllowAnonymous]
//[Authorize(SettleAccountPermissions.MaterialRelationships.Default)]
[AllowAnonymous]
[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 IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> _repository;
/// <summary>
/// 构方法
/// 构方法
/// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="objectMapper">自动map</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public MaterialRelationshipAppService(IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
public MaterialRelationshipAppService(
INormalEfCoreRepository<MaterialRelationship, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IDistributedCache<MaterialRelationship> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{
_mapRepository = mapRepository;
_repository = repository;
_mapRepository = mapRepository;
_excelImportService = excelImportService;
}
#region 导入、导出
/// <summary>
/// 导入功能
/// 导入
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport-Map")]
[DisableRequestSizeLimit]
public async Task<string> MaterialRelationshipUploadExcelImportMap([FromForm] IFormFileCollection files)
[Route("Import")]
public async Task<string> ImportAsync([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 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
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)
@ -104,307 +107,394 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
}
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);
await _repository.InsertAsync(itm);
}
//itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导入功能
/// 导出
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport")]
[DisableRequestSizeLimit]
public async Task<string> MaterialRelationshipUploadExcelImport([FromForm] IFormFileCollection files)
[Route("Export")]
public async Task<string> ExportAsync(MaterialRelationshipRequestDto input)
{
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();
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);
}
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
return ApplicationConsts.SuccessStr;
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 按ID获取唯一实体
/// 获取列表
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
virtual public async Task<MaterialRelationshipDto> GetAsync(Guid id)
[HttpPost]
[Route("list")]
public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(MaterialRelationshipRequestDto input)
{
var result = await GetFromCacheAsync(id);
var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(result);
return dto;
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos);
}
#endregion
private async Task<MaterialRelationship> GetFromCacheAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return result;
}
#region 原方法(废弃)
///// <summary>
///// 导入功能
///// </summary>
///// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
///// <returns></returns>
//[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>
///// 按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);
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities);
//private async Task<MaterialRelationship> GetFromCacheAsync(Guid id)
//{
// 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>
/// 获取全部实体列表
/// </summary>
/// <returns>实体DTO列表</returns>
[HttpGet]
[Route("all")]
virtual public async Task<ListResultDto<MaterialRelationshipDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
//private async Task<long> GetCountAsync(MaterialRelationshipRequestDto input)
//{
// return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
//}
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>
/// <param name="input">新增实体DTO</param>
/// <returns>实体DTO</returns>
///// <summary>
///// 获取实体总数
///// </summary>
///// <returns>实体总数</returns>
//[HttpGet]
//[Route("count")]
//virtual public async Task<long> GetTotalCountAsync(Guid branchId)
//{
// return await _repository.GetCountAsync(branchId);
//}
[HttpPost]
[Route("")]
virtual public async Task<MaterialRelationshipDto> CreateAsync(MaterialRelationshipCreateDto input)
{
///// <summary>
///// 获取全部实体列表
///// </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
//await Cache.SetAsync(entity.Id.ToString(), entity,
// CacheStrategyConst.FIVE_MINUTES);
//[HttpPost]
//[Route("")]
//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>
/// 修改实体
/// </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);
// if (_first != null)
// {
// throw new BusinessException("001", "已经存数据请修改后创建");
// }
await _repository.UpdateAsync(entity);
var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity);
return dto;
}
else
{
return null;
}
// var entity = new MaterialRelationship(
// GuidGenerator.Create(),
// input.BranchId,
// input.ErpMaterialCode,
}
// 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)
{
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);
// await _repository.InsertAsync(entity);
var dtoDetails = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipExportDto>>(entities);
// ////create cache
// //await Cache.SetAsync(entity.Id.ToString(), entity,
// // CacheStrategyConst.FIVE_MINUTES);
//声明导出容器
ExportImporter _exportImporter = new ExportImporter();
// var dto = ObjectMapper.Map<MaterialRelationship, MaterialRelationshipDto>(entity);
// 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;
// }
//}
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
///// <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)
// {
// 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")]
[AllowAnonymous]
public class PriceListAppService : ApplicationService
/*, IPriceListAppService*/
{
private readonly PriceListManager _priceListManager;
private readonly IExcelImportAppService _excelImportService;
@ -71,7 +70,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("Import")]
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
public virtual async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{
ExportImporter _exportImporter = new ExportImporter();
@ -102,7 +100,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
public virtual async Task<string> ExportAsync(TB_PRICE_LIST_RequestDto input)
{
IExporter _csv = new CsvExporter();
@ -150,7 +147,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("list")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(TB_PRICE_LIST_RequestDto input)
{
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 });
}
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);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos);
}
@ -168,7 +164,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpDelete]
[Route("{id}")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task DeleteAsync(Guid id)
{
await _priceListManager.DeleteAsync(id);
@ -179,169 +174,160 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("delete")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _priceListManager.DeleteListAsync(ids);
}
#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>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <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>
// /// 结算总成和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>();
/// <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;
}
// 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;
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <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>
<RootNamespace>Win.Sfs.SettleAccount</RootNamespace>
<SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

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

@ -620,9 +620,15 @@ namespace Win.Sfs.SettleAccount
CreateMap<PrebatchUpdateDto, Prebatch>();
}
/// <summary>
/// 期间设置
/// </summary>
private void CreateMapCentralizedControl()
{
CreateMap<CentralizedControl, CentralizedControlDto>().ReverseMap();
CreateMap<CentralizedControl, CentralizedControlExportDto>();
CreateMap<CentralizedControl, CentralizedControlCreateDto>();
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;
/// <summary>
/// 采购价格单
/// </summary>
[Display(Name = "采购价格单")]
public class PURCHASE_PRICE
public class PURCHASE_PRICE : FullAuditedAggregateRoot<Guid>
{
/// <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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.Controls
{
/// <summary>
/// 期间设置
/// </summary>
public class CentralizedControl: FullAuditedAggregateRootBase<Guid>
{
/// <summary>

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

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

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

@ -80,7 +80,8 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureBomVersion(options);
//期间
builder.ConfigureCentralizedControl(options);
//采购价格单
builder.ConfigurePURCHASE_PRICE(options);
#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

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");
});
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 =>
{
b.Property<Guid>("Id")

Loading…
Cancel
Save