Browse Source

销售价格导入

master
mahao 1 year ago
parent
commit
993ac4521b
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  3. 303
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs
  4. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  5. 275
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  6. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  7. 338
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  8. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.cs
  9. 5774
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.Designer.cs
  10. 294
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.cs
  11. 68
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  12. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -371,7 +371,7 @@ public class PriceListBJRequestDto : RequestInputBase
/// <summary> /// <summary>
/// 列表 /// 列表
/// </summary> /// </summary>
public class TB_PRICE_LISTDto : AuditedEntityDto<Guid> public class TB_PRICE_LISTDto : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 零件号 /// 零件号

19
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Volo.Abp;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Uow; using Volo.Abp.Uow;
@ -34,15 +35,15 @@ public class HandSeSyncAppService : ApplicationService
using var scope = this._applicationServices.CreateScope(); using var scope = this._applicationServices.CreateScope();
IInvocable seSyncAppService = businessType switch IInvocable seSyncAppService = businessType switch
{ {
EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(), //EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(),
EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(), //EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(),
EnumBusinessType.MaiDanJianBBAC => scope.ServiceProvider.GetRequiredService<MaiDanBBACSeSyncAppService>(), //EnumBusinessType.MaiDanJianBBAC => scope.ServiceProvider.GetRequiredService<MaiDanBBACSeSyncAppService>(),
EnumBusinessType.MaiDanJianHBPO => scope.ServiceProvider.GetRequiredService<MaiDanHBPOSeSyncAppService>(), //EnumBusinessType.MaiDanJianHBPO => scope.ServiceProvider.GetRequiredService<MaiDanHBPOSeSyncAppService>(),
EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(), //EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(),
EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongHBPOSeSyncAppService>(), //EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongHBPOSeSyncAppService>(),
EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(), //EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(),
EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(), //EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(),
_ => throw new ArgumentOutOfRangeException(nameof(businessType), $"Not expected direction value: {businessType}"), _ => throw new UserFriendlyException($"{nameof(businessType)}参数值无效", "403")
}; };
await seSyncAppService.Invoke().ConfigureAwait(false); await seSyncAppService.Invoke().ConfigureAwait(false);
} }

303
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs

@ -1,303 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
using Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
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.Errors;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.Shared.CacheBase;
using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.ErrorBills
{
/// <summary>
/// 物料主数据应用服务
/// </summary>
// [Authorize(SettleAccountPermissions.ErrorBills.Default)]
//[AllowAnonymous]
[Route("api/settleaccount/ErrorBill")]
[ApiExplorerSettings(IgnoreApi = true)]
public class ErrorBillAppService : SettleAccountApplicationBase<ErrorBill>
{
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<Bom, Guid> _bomRepository;
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _bomversionRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> _priceversionRepository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
//private readonly ISettleAccountBranchEfCoreRepository<ErrorBillRelationship, Guid> _relationshipRepository;
/// <summary>
/// 构建方法
/// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="objectMapper">自动map</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public ErrorBillAppService(
ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
ISettleAccountBranchEfCoreRepository<Bom, Guid> bomRepository,
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> bomversionRepository,
TaskJobService service,
//ISettleAccountBranchEfCoreRepository<ErrorBillRelationship, Guid> relationshipRepository,
ISettleAccountBranchEfCoreRepository<PriceList, Guid> priceRepository,
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> priceversionRepository,
IDistributedCache<ErrorBill> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{
_priceRepository = priceRepository;
_priceversionRepository = priceversionRepository;
_bomRepository = bomRepository;
_excelImportService = excelImportService;
_repository = repository;
//_relationshipRepository = relationshipRepository;
_mapRepository = mapRepository;
_bomversionRepository = bomversionRepository;
}
/// <summary>
/// 导入功能
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
//[HttpPost]
//[Route("ExcelImport")]
//[DisableRequestSizeLimit]
//public async Task<string> ErrorBillUploadExcelImportMap([FromForm] IFormFileCollection files,string version)
//{
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.ExtendExcelImport<ErrorBill>(files, _excelImportService);
// return ApplicationConsts.SuccessStr;
//}
//public List<T> RemoveError<T>(List<T> p_list) where T : ReportDetailBase, new ()
//{
// return p_list;
//}
/// <summary>
/// 导入功能
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport")]
[DisableRequestSizeLimit]
public async Task<string> ErrorBillUploadExcelImport([FromForm] IFormFileCollection files)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<ErrorBillImportDto>(files, _excelImportService);
var _ls = ObjectMapper.Map<List<ErrorBillImportDto>, List<ErrorBill>>(result);
var checkList = new List<ErrorExportDto>();
foreach (var itm in _ls)
{
var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.CustomerMaterialCode==itm.CustomerMaterialCode && p.WmsBillNum==itm.WmsBillNum);
if (_first == null)
{
var entity = new ErrorBill(
GuidGenerator.Create(),
GuidGenerator.Create(),
itm.BillNum,
itm.MaterialCode,
itm.WmsBillNum,
itm.MaterialDesc,
itm.CustomerMaterialCode
);
await _repository.InsertAsync(entity);
}
}
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 按ID获取唯一实体
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
virtual public async Task<ErrorBillDto> GetAsync(Guid id)
{
var result = await GetFromCacheAsync(id);
var dto = ObjectMapper.Map<ErrorBill, ErrorBillDto>(result);
return dto;
}
private async Task<ErrorBill> GetFromCacheAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return result;
}
private async Task<long> GetCountAsync(ErrorBillRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("list")]
virtual public async Task<PagedResultDto<ErrorBillDto>> GetListAsync(ErrorBillRequestDto 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<ErrorBill>, List<ErrorBillDto>>(entities);
return new PagedResultDto<ErrorBillDto>(totalCount, dtos);
}
/// <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<ErrorBillDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<ErrorBill>, List<ErrorBillDto>>(entities);
return new ListResultDto<ErrorBillDto>(dtos);
}
/// <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<ErrorBill>(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(ErrorBillRequestDto input)
{
string _fileName = string.Format("错误单据输出_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd"));
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<ErrorBill>, List<ErrorBillExportDto>>(entities);
//声明导出容器
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtoDetails);
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
}
}

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

@ -35,13 +35,11 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository;
private readonly PriceListManager _priceListManager;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository; private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly TaskJobService _service; private readonly TaskJobService _service;
public PriceListAppService( public PriceListAppService(
INormalEfCoreRepository<PriceList, Guid> priceListRepository, INormalEfCoreRepository<PriceList, Guid> priceListRepository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository, ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManager priceListManager,
TaskJobService service, TaskJobService service,
IDistributedCache<PriceList> cache, IDistributedCache<PriceList> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
@ -51,7 +49,6 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
{ {
_priceListRepository = priceListRepository; _priceListRepository = priceListRepository;
_mapRepository = mapRepository; _mapRepository = mapRepository;
_priceListManager = priceListManager;
_service = service; _service = service;
} }
@ -90,7 +87,7 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
var query = from item1 in entityList var query = from item1 in entityList
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime >= item2.BeginTime && item1.EndTime <= item2.EndTime) || (item2.BeginTime >= item1.BeginTime && item2.EndTime <= item1.EndTime) where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) || (item1.BeginTime == item2.BeginTime && item1.EndTime != item2.EndTime) || (item1.BeginTime != item2.BeginTime && item1.EndTime == item2.EndTime)
select item1.LU; select item1.LU;
var repeat = query.Distinct().ToList(); var repeat = query.Distinct().ToList();
foreach (var item in repeat) foreach (var item in repeat)
@ -105,7 +102,28 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);
var priceListModelEntitys = _priceListRepository.Where(t => t.ContractNo == contractNo && lus.Contains(t.ContractNo)).ToList();
var prices = _priceListRepository.Where(t => lus.Contains(t.LU) && t.ContractNo != contractNo).ToList();
if (prices.Any())
{
var query = from item1 in entityList
join item2 in prices
on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime >= item2.BeginTime && item1.EndTime <= item2.EndTime) || (item2.BeginTime >= item1.BeginTime && item2.EndTime <= item1.EndTime)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间与系统内数据存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
var priceListModelEntitys = _priceListRepository.Where(t => t.ContractNo == contractNo && lus.Contains(t.LU)).ToList();
if (priceListModelEntitys.Any()) if (priceListModelEntitys.Any())
{ {
await _priceListRepository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false); await _priceListRepository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
@ -126,10 +144,10 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
public virtual async Task<string> ExportAsync(RequestDto input) public virtual async Task<string> ExportAsync(RequestDto input)
{ {
IExporter _excel = new ExcelExporter(); IExporter _excel = new ExcelExporter();
var entities = await _priceListManager.GetListAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var entities = await _priceListRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<PriceList>, List<PriceListExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<PriceList>, List<PriceListExportDto>>(entities);
string fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString()); string fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
byte[] result = await _excel.ExportAsByteArray(dtoDetails); byte[] result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false);
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
@ -139,7 +157,7 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
Name = fileName, Name = fileName,
Content = result Content = result
} }
); ).ConfigureAwait(false);
return fileName; return fileName;
} }
#endregion #endregion
@ -149,11 +167,11 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// 获取列表 /// 获取列表
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(RequestDto input) public async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(RequestDto input)
{ {
var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var entities = await _priceListRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create()); var totalCount = await _priceListRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys); var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entities);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos); return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos);
} }
@ -161,18 +179,18 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// 删除 /// 删除
/// </summary> /// </summary>
[HttpPost] [HttpPost]
virtual public async Task DeleteAsync(Guid id) public async Task DeleteAsync(Guid id)
{ {
await _priceListManager.DeleteAsync(id); await _priceListRepository.DeleteAsync(id).ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// 批量删除 /// 批量删除
/// </summary> /// </summary>
[HttpPost] [HttpPost]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) public async Task<bool> DeleteListAsync(List<Guid> ids)
{ {
return await _priceListManager.DeleteListAsync(ids); return await _priceListRepository.DeleteListAsync(ids).ConfigureAwait(false);
} }
#endregion #endregion
} }

275
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -29,11 +29,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ> public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
{ {
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _repository; private readonly INormalEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly PriceListManagerBJ _priceListManagerBJ;
public PriceListAppServiceBJ( public PriceListAppServiceBJ(
INormalEfCoreRepository<PriceListBJ, Guid> repository, INormalEfCoreRepository<PriceListBJ, Guid> repository,
PriceListManagerBJ priceListManagerBJ,
IDistributedCache<PriceListBJ> cache, IDistributedCache<PriceListBJ> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -41,7 +39,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{ {
_repository = repository; _repository = repository;
_priceListManagerBJ = priceListManagerBJ;
} }
#region 导入、导出 #region 导入、导出
@ -70,7 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var query = from item1 in entityList var query = from item1 in entityList
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) || (item1.BeginDate == item2.BeginDate && item1.EndDate != item2.EndDate) || (item1.BeginDate != item2.BeginDate && item1.EndDate == item2.EndDate)
select item1.LU; select item1.LU;
var repeat = query.Distinct().ToList(); var repeat = query.Distinct().ToList();
foreach (var item in query) foreach (var item in query)
@ -85,7 +82,28 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);
var priceListModelEntitys = _repository.Where(t => t.ContractNo == contractNo && lus.Contains(t.ContractNo)).ToList();
var prices = _repository.Where(t => lus.Contains(t.LU) && t.ContractNo != contractNo).ToList();
if (prices.Any())
{
var query = from item1 in entityList
join item2 in prices
on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate >= item2.BeginDate && item1.EndDate <= item2.EndDate) || (item2.BeginDate >= item1.BeginDate && item2.EndDate <= item1.EndDate)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间与系统内数据存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
var priceListModelEntitys = _repository.Where(t => t.ContractNo == contractNo && lus.Contains(t.LU)).ToList();
if (priceListModelEntitys.Any()) if (priceListModelEntitys.Any())
{ {
await _repository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false); await _repository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
@ -125,255 +143,12 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[HttpPost] [HttpPost]
public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(RequestDto input) public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(RequestDto input)
{ {
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities); var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new PagedResultDto<PriceListBJDto>(totalCount, dtos); return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
} }
#endregion #endregion
#region 原有的方法之后废弃删除
// /// <summary>
// /// 按ID获取唯一实体
// /// </summary>
// /// <remarks>
// /// 返回实体全部属性
// /// </remarks>
// /// <param name="id">ID</param>
// /// <returns>实体DTO</returns>
// [HttpGet]
// [Route("{id}")]
// /// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PriceListBJDto> GetAsync(Guid id)
// {
// var result = await _mng.GetAsync(id); ;
// var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(result);
// return dto;
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("list")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(PriceListRequestDto input)
// {
// if (!string.IsNullOrEmpty(input.Version))
// {
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
// }
// var entities = await _mng.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount,
//input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
// return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("versionlist")]
// // [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListVersionBJDto>> GetVersionListAsync(PriceListRequestDto input)
// {
// var entities = await _mng.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListVersionBJ>, List<PriceListVersionBJDto>>(entities);
// return new PagedResultDto<PriceListVersionBJDto>(totalCount, dtos);
// }
// private async Task<long> GetCountAsync(PriceListRequestDto input)
// {
// return await _mng.GetCountAsync(input.Filters, GuidGenerator.Create());
// }
// /// <summary>
// /// 获取实体总数
// /// </summary>
// /// <returns>实体总数</returns>
// [HttpGet]
// [Route("count")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<long> GetTotalCountAsync(Guid branchId)
// {
// return await _mng.GetCountAsync(new List<FilterCondition>(), branchId);
// }
// /// <summary>
// /// 获取全部实体列表
// /// </summary>
// /// <returns>实体DTO列表</returns>
// [HttpGet]
// [Route("all")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<ListResultDto<PriceListBJDto>> GetAllAsync(Guid branchId)
// {
// var entities = await _mng.GetAllAsync(branchId);
// var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
// return new ListResultDto<PriceListBJDto>(dtos);
// }
// /// <summary>
// /// 批量导入实体列表
// /// </summary>
// /// <remarks>
// /// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改
// /// </remarks>
// /// <param name="entities">实体列表</param>
// /// <returns>是否导入成功</returns>
// [HttpPost]
// [Route("ExcelImport-Map")]
// //[Authorize(SettleAccountPermissions.PriceLists.Create)]
// virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
// {
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
// List<string> _checkls = new List<string>();
// _checkls.Add("100001");
// _checkls.Add("100053");
// _checkls.Add("100113");
// // _checkls.Add("200067");
// result = result.Where(p => _checkls.Contains(p.CustomerCode)).ToList();
// var entityList = ObjectMapper.Map<List<PriceListBJImportDto>, List<PriceListBJ>>(result);
// var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
// foreach (var itm in _ls)
// {
// itm.Update(GuidGenerator.Create(),version);
// }
// _ls=_ls.Where(p => p.Type == 20).ToList();
// await _mng.ImportAsync(_ls.ToList(), version);
// return ApplicationConsts.SuccessStr;
// }
// /// <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<PriceListBJDto> UpdateAsync(Guid id, PriceListBJDto input)
// {
// var entity = new PriceListBJ(
// );
// var _ent = await _mng.UpdateAsync(id, entity);
// var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(_ent);
// return dto;
// }
// /// <summary>
// /// 删除实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <returns>无</returns>
// [HttpDelete]
// [Route("{id}")]
// //[Authorize(SettleAccountPermissions.PriceLists.Delete)]
// virtual public async Task DeleteAsync(Guid id)
// {
// await _mng.DeleteAsync(id);
// }
// /// <summary>
// /// 按IDs删除实体列表
// /// </summary>
// /// <param name="ids">ID列表</param>
// /// <returns>是否执行成功</returns>
// [HttpPost]
// [Route("delete")]
// //[Authorize(SettleAccountPermissions.PriceLists.Delete)]
// virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
// {
// return await _mng.DeleteListAsync(ids);
// }
// /// <summary>
// /// 导出文件
// /// </summary>
// /// <param name="input"></param>
// /// <returns></returns>
// [HttpPost]
// [Route("Export")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<string> ExportAsync(PriceListRequestDto input)
// {
// IExporter _csv = new CsvExporter();
// IExporter _excel = new ExcelExporter();
// var entities = await _mng.GetListAsync(input.Filters, input.Sorting, int.MaxValue,
// 0, true);
// var dtoDetails = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJExportDto>>(entities);
// string _fileName = string.Empty;
// //声明导出容器
// byte[] result = null;
// switch (input.FileType)
// {
// case 0:
// _fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
// result = await _csv.ExportAsByteArray(dtoDetails);
// break;
// case 1:
// _fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
// result = await _excel.ExportAsByteArray(dtoDetails);
// break;
// }
// result.ShouldNotBeNull();
// //保存导出文件到服务器存成二进制
// await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto
// {
// Name = _fileName,
// Content = result
// }
// );
// return _fileName;
// }
#endregion
} }
} }

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -5,6 +5,7 @@ using System.Diagnostics.Contracts;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.Shared.DomainBase; using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.Prices namespace Win.Sfs.SettleAccount.Entities.Prices
@ -21,7 +22,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 销售价格 /// 销售价格
/// </summary> /// </summary>
public class PriceList : FullAuditedAggregateRootBase<Guid> public class PriceList : AuditedAggregateRoot<Guid>
{ {
public PriceList() public PriceList()
{ } { }
@ -155,7 +156,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 备件价格 /// 备件价格
/// </summary> /// </summary>
public class PriceListBJ : FullAuditedAggregateRootBase<Guid> public class PriceListBJ : AuditedAggregateRoot<Guid>
{ {
public PriceListBJ() public PriceListBJ()
{ } { }

338
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

@ -1,338 +0,0 @@
using EFCore.BulkExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.DomainBase;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Prices
{
public class PriceListManager : DomainService
{
/// <summary>
/// 销售价格仓储
/// </summary>
private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceList, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> _versionRepository;
protected PriceListManager() { }
public PriceListManager(
INormalEfCoreRepository<PriceList, Guid> priceListRepository,
ISettleAccountBranchEfCoreRepository<PriceList, Guid> repository,
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> versionRepository
)
{
_priceListRepository = priceListRepository;
_versionRepository = versionRepository;
_repository = repository;
}
public virtual async Task<PriceList> GetAsync(Guid id)
{
return await _repository.GetAsync(id);
}
public virtual List<PriceList> GetPriceList(string version)
{
var entities = _repository.Where(p => p.Version == version);
return entities.ToList();
}
public virtual async Task<List<PriceList>> GetListAsync(
List<FilterCondition> filters,
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), filters, sorting, maxResultCount,
skipCount);
return entities;
}
public virtual async Task<List<PriceListVersion>> GetVersionListAsync(
List<FilterCondition> filters,
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var entities = await _versionRepository.GetListByFilterAsync(GuidGenerator.Create(), filters, sorting, maxResultCount,
skipCount);
return entities;
}
public async Task<long> GetCountAsync(List<FilterCondition> p_filter
, Guid branchId)
{
return await _repository.GetCountByFilterAsync(branchId, p_filter);
}
/// <summary>
/// 导入
/// </summary>
public virtual async Task<List<string>> ImportAsync(List<PriceList> entities, string version)
{
List<string> _errorList = new List<string>();
//写校验在这里
var lus = entities.Select(p => p.LU).ToList();
var pricelist = await _priceListRepository.GetListAsync(p => lus.Contains(p.LU));
var update = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
where item1.Price != item2.Price && item1.BeginTime == item2.BeginTime && item1.EndTime == item1.EndTime
select new PriceList(item2.Id, item2.LU, item1.Price, item2.BeginTime, item2.EndTime, item2.ClientCode, item2.Date, item2.ContractNo);
//新日期
var updateNewDate = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
where item1.BeginTime != item2.BeginTime || item1.EndTime != item2.EndTime
select item1;
update = update.Concat(updateNewDate);
if (update.Any())
{
await _repository.GetDbContext().BulkUpdateAsync(update.ToList());
}
//新零件号
var addNewLu = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
into temp
from item3 in temp.DefaultIfEmpty()
where item3 == null
select item1;
if (addNewLu.Any())
{
await _repository.GetDbContext().BulkInsertAsync(addNewLu.ToList());
}
return _errorList;
}
public virtual async Task<PriceList> CreateAsync(PriceList input)
{
var entity = new PriceList(
GuidGenerator.Create(), input.BeginTime, input.EndTime, input.Price, input.MaterialCode, input.Type,input.ParentId,input.Version,input.CustomerCode
);
return await _repository.InsertAsync(entity);
}
public virtual async Task<PriceList> UpdateAsync(Guid id, PriceList input)
{
var entity = await _repository.GetAsync(id);
entity.Set(
input.BeginTime, input.EndTime, input.Price, input.MaterialCode, input.Type,input.CustomerCode
);
return await _repository.UpdateAsync(entity);
}
public virtual async Task DeleteAsync(Guid id)
{
await _repository.DeleteAsync(id);
}
public virtual async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _repository.DeleteListAsync(ids);
}
public virtual async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _repository.GetCountAsync(branchId);
}
public virtual async Task<List<PriceList>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId);
return entities;
}
}
public class PriceListManagerBJ : DomainService
{
/// <summary>
/// 备件价格仓储
/// </summary>
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _priceListBJRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<PriceListVersionBJ, Guid> _versionRepository;
protected PriceListManagerBJ() { }
public PriceListManagerBJ(
INormalEfCoreRepository<PriceListBJ, Guid> priceListBJRepository,
ISettleAccountBranchEfCoreRepository<PriceListBJ, Guid> repository,
ISettleAccountBranchEfCoreRepository<PriceListVersionBJ, Guid> versionRepository
)
{
_priceListBJRepository = priceListBJRepository;
_versionRepository = versionRepository;
_repository = repository;
}
public virtual async Task<PriceListBJ> GetAsync(Guid id)
{
return await _repository.GetAsync(id);
}
public virtual List<PriceListBJ> GetPriceList(string version)
{
var entities = _repository.Where(p => p.Version == version);
return entities.ToList();
}
public virtual async Task<List<PriceListBJ>> GetListAsync(
List<FilterCondition> filters,
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), filters, sorting, maxResultCount,
skipCount);
return entities;
}
public virtual async Task<List<PriceListVersionBJ>> GetVersionListAsync(
List<FilterCondition> filters,
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var entities = await _versionRepository.GetListByFilterAsync(GuidGenerator.Create(), filters, sorting, maxResultCount,
skipCount);
return entities;
}
public async Task<long> GetCountAsync(List<FilterCondition> p_filter
, Guid branchId)
{
return await _repository.GetCountByFilterAsync(branchId, p_filter);
}
/// <summary>
/// 导入
/// </summary>
public virtual async Task<List<string>> ImportAsync(List<PriceListBJ> entities, string version)
{
List<string> _errorList = new List<string>();
//写校验在这里
var lus = entities.Select(p => p.LU).ToList();
var pricelist = await _priceListBJRepository.GetListAsync(p => lus.Contains(p.LU));
var update = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
where item1.Price != item2.Price && item1.BeginDate == item2.BeginDate && item1.EndDate == item1.EndDate
select new PriceListBJ(item2.Id, item2.LU, item1.Price, item2.BeginDate, item2.EndDate, item2.ClientCode, item2.Date, item2.ContractNo);
if (update.Any())
{
await _repository.GetDbContext().BulkUpdateAsync(update.ToList());
}
//新零件号
var addNewLu = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
into temp
from item3 in temp.DefaultIfEmpty()
where item3 == null
select item1;
//新日期
var addNewDate = from item1 in entities
join item2 in pricelist
on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode }
where item1.BeginDate != item2.BeginDate || item1.EndDate != item2.EndDate
select item1;
var add = addNewLu.Concat(addNewDate);
if (add.Any())
{
await _repository.GetDbContext().BulkInsertAsync(add.ToList());
}
return _errorList;
}
public virtual async Task<PriceListBJ> CreateAsync(PriceListBJ input)
{
var entity = new PriceListBJ(
GuidGenerator.Create(), input.BeginDate, input.EndDate, input.Price, input.MaterialCode, input.Type, input.ParentId, input.Version, input.CustomerCode
);
return await _repository.InsertAsync(entity);
}
public virtual async Task<PriceListBJ> UpdateAsync(Guid id, PriceListBJ input)
{
var entity = await _repository.GetAsync(id);
entity.Set(
input.BeginDate, input.EndDate, input.Price, input.MaterialCode, input.Type, input.CustomerCode
);
return await _repository.UpdateAsync(entity);
}
public virtual async Task DeleteAsync(Guid id)
{
await _repository.DeleteAsync(id);
}
public virtual async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _repository.DeleteListAsync(ids);
}
public virtual async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _repository.GetCountAsync(branchId);
}
public virtual async Task<List<PriceListBJ>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId);
return entities;
}
}
}

14
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.cs

@ -1,4 +1,4 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations namespace Win.Sfs.SettleAccount.Migrations
@ -37,12 +37,12 @@ namespace Win.Sfs.SettleAccount.Migrations
oldType: "nvarchar(450)", oldType: "nvarchar(450)",
oldNullable: true); oldNullable: true);
migrationBuilder.UpdateData( //migrationBuilder.UpdateData(
table: "Set_JobItem", // table: "Set_JobItem",
keyColumn: "Id", // keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), // keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" }, // columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "89ee40808b37440e89bc3e3c9c0312a7", "库存余额同步" }); // values: new object[] { "89ee40808b37440e89bc3e3c9c0312a7", "库存余额同步" });
migrationBuilder.UpdateData( migrationBuilder.UpdateData(
table: "Set_JobItem", table: "Set_JobItem",

5774
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.Designer.cs

File diff suppressed because it is too large

294
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.cs

@ -0,0 +1,294 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308311 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BranchId",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "Enabled",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "Remark",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "BranchId",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "Enabled",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "Remark",
table: "Set_PriceList");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "d12f27a181f54465b338dd2401a08b6e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "d9f3e1d0603c46479198f5baad678663");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "20cdc48f0766480d9c7a70b390ce0f9f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "7da7c559aba84699ae1c6c6fa0a5dc59");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "20c50e67224d4595986559438cd975ad");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "366afac45e0e485d8f43e53346442ad2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "662702ee66444ca08ef7190b6ad1e8f3");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "8e44067496fa43c085d2cf3bc2ed8779");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "7fd5fef49685400fb7254abbfd3754a1");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "42aed6aa66044a06ab92e8bf2d882cb2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "c2cbd6a620fe4fd08d3f021939d31509");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "BranchId",
table: "Set_PriceListBJ",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "Set_PriceListBJ",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "Set_PriceListBJ",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "Enabled",
table: "Set_PriceListBJ",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "Set_PriceListBJ",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "Set_PriceListBJ",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "BranchId",
table: "Set_PriceList",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "Set_PriceList",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "Set_PriceList",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "Enabled",
table: "Set_PriceList",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "Set_PriceList",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "Set_PriceList",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "89ee40808b37440e89bc3e3c9c0312a7");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "b9efd317f87e4288841ddcd9fef8f6a2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "862d578df0fe406995bc827f9feaae60");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "dc1523b4145f4c60a1e9543aa36da361");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "76d675a5b6d644ef8ec3358006afcb36");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "658f74bf334f4a34a3fb10eaf00a840a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "1f52b09ccce24e3fb30c5549b19b23e4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "5ebb150f3f9e4ccd89d5fab0a6dde4e4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "71311c84551343b099c049672a4c421f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "681ede5c262642f1a02d7a67dbd83d1b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "eb2e56c9379e4cb0b0f0f5f0bc8d4292");
}
}
}

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

@ -4453,7 +4453,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "681ede5c262642f1a02d7a67dbd83d1b", ConcurrencyStamp = "42aed6aa66044a06ab92e8bf2d882cb2",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4463,7 +4463,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "89ee40808b37440e89bc3e3c9c0312a7", ConcurrencyStamp = "d12f27a181f54465b338dd2401a08b6e",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4473,7 +4473,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "b9efd317f87e4288841ddcd9fef8f6a2", ConcurrencyStamp = "d9f3e1d0603c46479198f5baad678663",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4483,7 +4483,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "1f52b09ccce24e3fb30c5549b19b23e4", ConcurrencyStamp = "662702ee66444ca08ef7190b6ad1e8f3",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4493,7 +4493,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "862d578df0fe406995bc827f9feaae60", ConcurrencyStamp = "20cdc48f0766480d9c7a70b390ce0f9f",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4503,7 +4503,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "76d675a5b6d644ef8ec3358006afcb36", ConcurrencyStamp = "20c50e67224d4595986559438cd975ad",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4513,7 +4513,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "dc1523b4145f4c60a1e9543aa36da361", ConcurrencyStamp = "7da7c559aba84699ae1c6c6fa0a5dc59",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4523,7 +4523,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "eb2e56c9379e4cb0b0f0f5f0bc8d4292", ConcurrencyStamp = "c2cbd6a620fe4fd08d3f021939d31509",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4533,7 +4533,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "658f74bf334f4a34a3fb10eaf00a840a", ConcurrencyStamp = "366afac45e0e485d8f43e53346442ad2",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4543,7 +4543,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "71311c84551343b099c049672a4c421f", ConcurrencyStamp = "7fd5fef49685400fb7254abbfd3754a1",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4553,7 +4553,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "5ebb150f3f9e4ccd89d5fab0a6dde4e4", ConcurrencyStamp = "8e44067496fa43c085d2cf3bc2ed8779",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -5297,9 +5297,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("BeginTime") b.Property<DateTime>("BeginTime")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<int>("BusinessType") b.Property<int>("BusinessType")
.HasColumnType("int"); .HasColumnType("int");
@ -5330,17 +5327,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("Date") b.Property<DateTime>("Date")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<DateTime>("EndTime") b.Property<DateTime>("EndTime")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
@ -5348,12 +5334,6 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)") .HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<string>("LU") b.Property<string>("LU")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -5375,9 +5355,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<decimal>("Price") b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("int"); .HasColumnType("int");
@ -5398,9 +5375,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("BeginDate") b.Property<DateTime>("BeginDate")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ClientCode") b.Property<string>("ClientCode")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -5428,17 +5402,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("Date") b.Property<DateTime>("Date")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<DateTime>("EndDate") b.Property<DateTime>("EndDate")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
@ -5446,12 +5409,6 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)") .HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<string>("LU") b.Property<string>("LU")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -5473,9 +5430,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<decimal>("Price") b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("int"); .HasColumnType("int");

8
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

@ -121,10 +121,10 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode, SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode,
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode, SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode,
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode, SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode,
CustomerPartCode = notHaveSaHaveSe.CustomerPartCode, CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = notHaveSaHaveSe.PartCodeDesc, PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = notHaveSaHaveSe.FactoryPartCode, FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = notHaveSaHaveSe.ReplaceFactoryPartCode ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
}).ToList(); }).ToList();
return secondMatchHaveSaHaveSes; return secondMatchHaveSaHaveSes;
} }

Loading…
Cancel
Save