学 赵 1 year ago
parent
commit
8daf0c7e3d
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-item.js
  2. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/index.js
  3. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan-detail.js
  4. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js
  5. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js
  6. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js
  7. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/log.js
  8. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js
  9. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
  11. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  12. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  13. 62
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  14. 303
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs
  15. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  16. 275
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  17. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs
  18. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  19. 338
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  20. 90
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  21. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  22. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.cs
  23. 5774
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.Designer.cs
  24. 294
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831082843_20230831-1.cs
  25. 68
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  26. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  27. 44
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  28. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  29. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  30. 33
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  31. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  32. 64
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs
  33. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-item.js

@ -35,7 +35,7 @@ export default {
if (props.schema.hidden) {
return false;
}
if (props.schema.readOnly && (props.mode === "create" || props.mode === "update")) {
if (props.schema.hidden && (props.mode === "create" || props.mode === "update")) {
return false;
}
return true;

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/index.js

@ -7,7 +7,7 @@ export default {
},
name: "AppForm",
template: html`<div v-loading="loading">
<el-form ref="formRef" :model="model" label-width="auto" :inline="inline">
<el-form ref="formRef" :model="model" label-width="auto" :inline="inline" @keyup.enter.native="submit">
<template v-if="schema && schema.properties">
<template v-for="(value, prop) in getProperties(schema.properties)">
<app-form-item :parentSchema="schema" :schema="value" v-model="model" :prop="prop" :mode="mode" :errors="errors" />

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan-detail.js

@ -21,6 +21,10 @@ const schema = {
type: "string",
input: "dateTime",
},
price: {
title: "价格",
type: "number",
},
lu: {
title: "客户零件号",
type: "string",

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js

@ -28,7 +28,7 @@ export default function (businessType) {
let service;
if (businessType === "JisBBAC") {
service = "bbac_can_sa_service";
} else if (businessType === "JisHBPO") {
} else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
service = "hbpo_can_sa_service";
} else {
service = "pub_can_sa_service";

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js

@ -111,6 +111,13 @@ export default function () {
value: null,
readOnly: true,
},
{
logic: "and",
column: "custPartCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js

@ -80,6 +80,13 @@ export default function () {
value: null,
readOnly: true,
},
{
logic: "and",
column: "custPartCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/log.js

@ -87,6 +87,13 @@ export default function () {
value: null,
readOnly: true,
},
{
logic: "and",
column: "custPartCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js

@ -17,7 +17,7 @@ export default {
if (item.path === "sync") {
const url = config.edit.syncUrl;
const method = config.edit.syncMethod;
await appListRef.value.action(async () => await request(url, route.meta.businessType, { method }), `确认手动同步吗?`);
await appListRef.value.onClick(async () => await request(url, route.meta.businessType, { method }), `确认手动同步吗?`);
}
};
return { appListRef, config, onCommand };

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

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

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -75,13 +76,15 @@ public class CompareService : ApplicationService
[HttpPost]
public async Task<string> SaSeCompare(SaSeCompareRequestDto saSeCompareRequestDto)
{
var isWuLiuRole = CurrentUser.IsInRole("物流") == true ? "物流" : "";
var businessTypeDisplayName = saSeCompareRequestDto.BusinessType.ToString();
var attributeOfType = saSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
var projectName = $"{isWuLiuRole}{businessTypeDisplayName}结算与发运数据对比";
var customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version });

6
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.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
@ -29,7 +30,7 @@ public class HandSeSyncAppService : ApplicationService
/// </summary>
[HttpPost]
[UnitOfWork(IsDisabled = true)]
public virtual async Task SyncAsync([FromBody] EnumBusinessType businessType)
public virtual async Task<IActionResult> SyncAsync([FromBody] EnumBusinessType businessType)
{
using var scope = this._applicationServices.CreateScope();
IInvocable seSyncAppService = businessType switch
@ -42,8 +43,9 @@ public class HandSeSyncAppService : ApplicationService
EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongHBPOSeSyncAppService>(),
EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(),
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);
return new JsonResult(new { code = 200, message = "同步成功" });
}
}

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -27,6 +27,7 @@ using Microsoft.Extensions.Logging;
using RestSharp.Extensions;
using SettleAccount.Job.SignalR;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
@ -118,12 +119,12 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
transaction.Commit();
return Task.CompletedTask;
}
throw new Exception("备份程序正在运行");
throw new UserFriendlyException("备份程序正在运行", "500");
}
catch
catch(Exception ex)
{
transaction.Rollback();
throw;
throw new UserFriendlyException(ex.ToString(), "500");
}
}
@ -501,7 +502,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
catch (Exception ex)
{
this._logger.LogError(ex.ToString());
throw;
throw new UserFriendlyException(ex.ToString(), "500");
}
}

62
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -12,6 +12,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Omu.ValueInjecter;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -49,7 +50,8 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
[NonAction]
public async Task Invoke(IServiceProvider serviceProvider)
{
for (var i = 0; i < 100; i++)
var batchSize = 1000;
for (var i = 0; i < 1000; i++)
{
var sw = new Stopwatch();
sw.Start();
@ -68,7 +70,9 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
{
break;
}
var messages = context.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(1000).ToList();
var messages = context.Set<VmiMessage>()
//.AsNoTracking()
.Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(batchSize).ToList();
var repo = context.Set<VmiBalance>();
foreach (var message in messages)
{
@ -101,17 +105,41 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
o.factory == log.factory &&
o.Configcode == log.Configcode);
if (balance == null)
{
{//不存在库存记录
//新建库存记录
balance = new VmiBalance();
if (log.LogType == VmiLogType.Type300)
{//反结算入库,重建库存
var logHistory = context.Set<VmiLog>().AsNoTracking().FirstOrDefault(
o => o.LogType == VmiLogType.Type100 &&
o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType &&
o.VinCode == log.VinCode &&
o.ErpToLoc == log.ErpToLoc &&
o.OrderNum == log.OrderNum &&
o.factory == log.factory &&
o.Configcode == log.Configcode);
if (logHistory != null)
{
balance.InjectFrom(logHistory);
}
else
{
balance.InjectFrom(log);
await repo.AddAsync(balance).ConfigureAwait(false);
log.InjectFrom(balance);
}
}
else
{
balance.InjectFrom(log);
}
balance.Qty = log.ChangedQty;
await repo.AddAsync(balance).ConfigureAwait(false);
}
else
{//存在库存记录
var logType = log.LogType;
var qty = balance.Qty;// + log.ty
var currentQty = balance.Qty;// + log.ty
if (logType == VmiLogType.Type100)
{
//发运入库,负库存字段需要更新
@ -129,20 +157,20 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
//调整入库,更新库存和其他字段
balance.InjectFrom(log);
}
// 更新库存
balance.Qty = qty;
if (balance.Qty == decimal.Zero)
{
//删除0库存
repo.Remove(balance);
}
if (logType == VmiLogType.Type100 && balance.Qty < decimal.Zero && log.Qty > 0)
if (logType == VmiLogType.Type100 && balance.Qty < decimal.Zero)
{
//添加负库存补货记录
var log2 = new VmiReplenished();
log2.InjectFrom(log);
await context.Set<VmiReplenished>().AddAsync(log2).ConfigureAwait(false);
}
// 更新库存
balance.Qty = currentQty + log.ChangedQty;
if (balance.Qty == decimal.Zero)
{
//删除0库存
repo.Remove(balance);
}
}
message.isConsumed = true;
}
@ -153,12 +181,12 @@ public class VmiAsyncBalanceService : Controller, IApplicationService, IJobServi
{
this._logger.LogError(ex.ToString());
transaction.Rollback();
throw;
throw new UserFriendlyException(ex.ToString(), "500");
}
finally
{
sw.Stop();
this._logger.LogInformation($"结束,耗时 ${sw.ElapsedMilliseconds / 1000 / 60}分钟");
this._logger.LogInformation($"处理{batchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒");
}
}
}

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>
private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository;
private readonly PriceListManager _priceListManager;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly TaskJobService _service;
public PriceListAppService(
INormalEfCoreRepository<PriceList, Guid> priceListRepository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManager priceListManager,
TaskJobService service,
IDistributedCache<PriceList> cache,
IExcelImportAppService excelImportService,
@ -51,7 +49,6 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
{
_priceListRepository = priceListRepository;
_mapRepository = mapRepository;
_priceListManager = priceListManager;
_service = service;
}
@ -90,7 +87,7 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
var query = from item1 in entityList
join item2 in entityList
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;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
@ -105,7 +102,28 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
}
#endregion
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())
{
await _priceListRepository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
@ -126,10 +144,10 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
public virtual async Task<string> ExportAsync(RequestDto input)
{
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);
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();
//保存导出文件到服务器存成二进制
@ -139,7 +157,7 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
Name = fileName,
Content = result
}
);
).ConfigureAwait(false);
return fileName;
}
#endregion
@ -149,11 +167,11 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// 获取列表
/// </summary>
[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 totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys);
var entities = await _priceListRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _priceListRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entities);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos);
}
@ -161,18 +179,18 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// 删除
/// </summary>
[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>
[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
}

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>
{
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly PriceListManagerBJ _priceListManagerBJ;
public PriceListAppServiceBJ(
INormalEfCoreRepository<PriceListBJ, Guid> repository,
PriceListManagerBJ priceListManagerBJ,
IDistributedCache<PriceListBJ> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -41,7 +39,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
_priceListManagerBJ = priceListManagerBJ;
}
#region 导入、导出
@ -70,7 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var query = from item1 in entityList
join item2 in entityList
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;
var repeat = query.Distinct().ToList();
foreach (var item in query)
@ -85,7 +82,28 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
#endregion
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())
{
await _repository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
@ -125,255 +143,12 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[HttpPost]
public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
}
#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
}
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs

@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.MaterialRelationships;
namespace Win.Sfs.SettleAccount.Entities.TaskJobs;
@ -41,7 +43,11 @@ public class JobAppService: ApplicationService
[UnitOfWork(false)]
public virtual async Task<PagedResultDto<JobDto>> GetListAsync(JobRequestDto input)
{
var lists = await _service.GetListAsync(input);
if (CurrentUser.IsInRole("物流") && input.Name.Contains("对比"))
{
input.Name = "物流" + input.Name;
}
var lists = await _service.GetListAsync(input).ConfigureAwait(false);
return new PagedResultDto<JobDto>(lists.Count, lists);
}

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

90
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs

@ -303,7 +303,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -318,6 +318,19 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 直供件BBAC结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportZhiGongJianBBACWuLiu : PubSaSeCompareDetailExportZhiGongJianBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 直供件HBPO结算与发运对比明细
/// </summary>
@ -411,7 +424,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -426,6 +439,19 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 直供件HBPO结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu : PubSaSeCompareDetailExportZhiGongJianHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 买单件BBAC结算与发运对比明细
/// </summary>
@ -521,7 +547,7 @@ public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -536,6 +562,19 @@ public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExpo
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 买单件BBAC结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportMaiDanJianBBACWuLiu : PubSaSeCompareDetailExportMaiDanJianBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 买单件HBPO结算与发运对比明细
/// </summary>
@ -631,7 +670,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -646,6 +685,19 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 买单件HBPO结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu : PubSaSeCompareDetailExportMaiDanJianHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 备件结算与发运对比明细
/// </summary>
@ -740,7 +792,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -755,6 +807,19 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 备件结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportBeiJianWuLiu : PubSaSeCompareDetailExportBeiJian
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 印度件结算与发运对比明细
/// </summary>
@ -848,7 +913,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -862,3 +927,16 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
[ExporterHeader(DisplayName = "ERP目标库位")]
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 印度件结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportYinDuJianWuLiu : PubSaSeCompareDetailExportYinDuJian
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}

30
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -321,7 +321,7 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// ERP销售库位
/// </summary>
@ -336,6 +336,19 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
public string ToLocCode { get; set; }
}
/// <summary>
/// JisBBAC结算、发运、Eid对比明细物流
/// </summary>
public class SaSeEdiCompareDetailExportJisBBACWuLiu : SaSeEdiCompareDetailExportJisBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// JisHBPO结算、发运、Eid对比明细
/// </summary>
@ -468,7 +481,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// ERP销售库位
/// </summary>
@ -483,6 +496,19 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
public string ToLocCode { get; set; }
}
/// <summary>
/// JisHBPO结算、发运、Eid对比明细物流
/// </summary>
public class SaSeEdiCompareDetailExportJisHBPOWuLiu : SaSeEdiCompareDetailExportJisHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>

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

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

14
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -70,7 +71,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
@ -89,8 +90,17 @@ namespace SettleAccount.Job.Services.Report
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBACWuLiu>>(ediSeSaCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBAC>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

44
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -14,6 +15,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
@ -69,27 +71,51 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var saSeEdiCompareDiffs = GetSaSeEdiCompareData(version, seStartDateTime, seEndDateTime);
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
#region 二次对比
//二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any())
{
//二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库
var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<HBPO_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<HBPO_SEC_DETAIL>().AddRange(seCDetailEntitys);
}
#endregion
#region 结算数据处理
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(ediSeSaCompareDiffs, businessType, version);
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
}
if (string.IsNullOrEmpty(pn) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.PN == pn);
saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(p => p.PN == pn);
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList();
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPO>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName);
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPOWuLiu>>(saSeEdiCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPO>>(saSeEdiCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
@ -103,7 +129,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 获取比对数据
/// </summary>
public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
public List<SaSeEdiCompareDiff> GetSaSeEdiCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()

15
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -71,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -104,9 +105,17 @@ namespace SettleAccount.Job.Services.Report
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
}
pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianBBAC>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBAC>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBAC>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

15
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -71,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -104,9 +105,17 @@ namespace SettleAccount.Job.Services.Report
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
}
pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPO>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

33
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -101,6 +101,7 @@ namespace SettleAccount.Job.Services.Report
businessTypeDisplayName = attributeOfType.Name;
}
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
var pubSaSeCompareDiffs = GetSaSeCompareData(businessType, version, DateTime.Parse(seStartDateTime), DateTime.Parse(seEndDateTime));
@ -140,28 +141,60 @@ namespace SettleAccount.Job.Services.Report
switch (businessType)
{
case EnumBusinessType.ZhiGongJianBBAC:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianBBAC>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianBBAC>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.ZhiGongJianHBPO:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianHBPO>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPO>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.BeiJian:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportBeiJianWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportBeiJianWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportBeiJian>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportBeiJian>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.YinDuJian:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportYinDuJianWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportYinDuJianWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportYinDuJian>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportYinDuJian>(items, businessTypeDisplayName);
}
}
break;
default:
break;

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

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

64
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

@ -5,9 +5,11 @@ using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Entities.SettleAccountDomain;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -71,6 +73,66 @@ namespace SettleAccount.Job.Services.Report
});
}
/// <summary>
/// 二次比对
/// </summary>
public virtual List<SaSeEdiCompareDiff> HandleSecondCompare(List<SaSeEdiCompareDiff> saSeEdiCompareDiffs, EnumBusinessType businessType)
{
//二次匹配上的记录
var secondMatchHaveSaHaveSes = new List<SaSeEdiCompareDiff>();
//有结算无发运 和 无结算有发运
var haveSaNotHaveSeUnionNotHaveSaHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi);
//有结算无发运
var haveSaNotHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi);
//无结算有发运
var notHaveSaHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi);
//二次对比(替换发运数据的厂内零件号)
var repFactoryPartCodes = haveSaNotHaveSeUnionNotHaveSaHaveSes.Select(t => t.FactoryPartCode).Distinct().ToList();
var tbRePartsRelationships = _settleAccountDbContext.Set<TB_RePartsRelationship>().Where(t => repFactoryPartCodes.Contains(t.LU)).ToList();
tbRePartsRelationships.ForEach(tbRePartsRelationship =>
{
haveSaNotHaveSeUnionNotHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t =>
{
t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU;
});
});
//获取二次比对上的数据
secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes
join haveSaNotHaveSe in haveSaNotHaveSes
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
select new SaSeEdiCompareDiff()
{
Category = EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi,
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
AssemblyCode = notHaveSaHaveSe.AssemblyCode,
InjectionCode = notHaveSaHaveSe.InjectionCode,
SAQty = haveSaNotHaveSe.SAQty,
SEQty = notHaveSaHaveSe.SEQty,
EdiQty = notHaveSaHaveSe.EdiQty,
FixPrice = haveSaNotHaveSe.FixPrice,
PN = haveSaNotHaveSe.PN,
ToLocCode = notHaveSaHaveSe.ToLocCode,
ToErpLocCode = notHaveSaHaveSe.ToErpLocCode,
EdiCustomerPartCode = notHaveSaHaveSe.EdiCustomerPartCode,
SeCustomerPartCode = notHaveSaHaveSe.SeCustomerPartCode,
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode,
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode,
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode,
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
}).ToList();
return secondMatchHaveSaHaveSes;
}
/// <summary>
/// 结算数据处理
/// 写入库位、替换零件号
@ -192,7 +254,7 @@ namespace SettleAccount.Job.Services.Report
excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出");
for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();;
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ;
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

@ -38,11 +38,17 @@ namespace SettleAccount.Job
private void CreateMapSaSeCompare()
{
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportBeiJian>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportBeiJianWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportYinDuJian>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportYinDuJianWuLiu>();
CreateMap<PubSaSeCompareDiff, PUB_SEC_DETAIL>();
}
}

Loading…
Cancel
Save