Browse Source

销售价格添加时间

master
mahao 1 year ago
parent
commit
9fa3160f1c
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js
  2. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js
  3. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  6. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  7. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  8. 145
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  9. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  10. 165
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs
  11. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs
  12. 151
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js

@ -24,7 +24,7 @@ const schema = {
}, },
date: { date: {
title: "合同签订时间", title: "合同签订时间",
type: "DateTime", type: "string",
}, },
contractNo: { contractNo: {
title: "合同号", title: "合同号",

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js

@ -27,7 +27,7 @@ const schema = {
date: { date: {
title: "合同签订时间", title: "合同签订时间",
type: "string", type: "string",
input: "datetime", input: "string",
}, },
contractNo: { contractNo: {
title: "合同号", title: "合同号",

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -86,7 +86,7 @@ public class BBAC_SA_DETAIL_DTO : EntityDto<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs

@ -86,7 +86,7 @@ public class HBPO_SA_DETAIL_DTO : EntityDto<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -447,7 +447,7 @@ public class PUB_SA_DETAIL_DTO : AuditedAggregateRoot<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

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

@ -414,6 +414,18 @@ public class TB_PRICE_LISTDto : AuditedEntityDto<Guid>
/// </summary> /// </summary>
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { set; get; } public string Version { set; get; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
public string ContractNo { get; set; }
} }
/// <summary> /// <summary>

23
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -231,15 +231,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
public async Task<IActionResult> DeleteListAsync(List<Guid> ids) public async Task<IActionResult> DeleteListAsync(List<Guid> ids)
{ {
//结算主表 //结算主表
List<PUB_SA> pubSas = new List<PUB_SA>(); var pubSas = new List<PUB_SA>();
//结算明细 //结算明细
List<PUB_SA_DETAIL> pubSaDetails = new List<PUB_SA_DETAIL>(); var pubSaDetails = new List<PUB_SA_DETAIL>();
//可结算主表 //可结算主表
List<PUB_CAN_SA> pubCanSas = new List<PUB_CAN_SA>(); var pubCanSas = new List<PUB_CAN_SA>();
//可结算明细 //可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>(); var pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>();
//不可结算 //不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>(); var pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
foreach (var id in ids) foreach (var id in ids)
{ {
@ -649,18 +649,17 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
private async Task<(List<PUB_SA> pubSas, List<PUB_SA_DETAIL> pubSaDetails, List<PUB_CAN_SA> pubCanSas, List<PUB_CAN_SA_DETAIL> pubCanSaDetails, List<PUB_NOT_SA_DETAIL> pubNotSaDetails)> GetPubSaDelItemsAsync(Guid id) private async Task<(List<PUB_SA> pubSas, List<PUB_SA_DETAIL> pubSaDetails, List<PUB_CAN_SA> pubCanSas, List<PUB_CAN_SA_DETAIL> pubCanSaDetails, List<PUB_NOT_SA_DETAIL> pubNotSaDetails)> GetPubSaDelItemsAsync(Guid id)
{ {
//结算主表 //结算主表
List<PUB_SA> pubSas = new List<PUB_SA>(); var pubSas = new List<PUB_SA>();
//结算明细 //结算明细
List<PUB_SA_DETAIL> pubSaDetails = new List<PUB_SA_DETAIL>(); var pubSaDetails = new List<PUB_SA_DETAIL>();
//可结算主表 //可结算主表
List<PUB_CAN_SA> pubCanSas = new List<PUB_CAN_SA>(); var pubCanSas = new List<PUB_CAN_SA>();
//可结算明细 //可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>(); var pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>();
//不可结算 //不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>(); var pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false); var pubSaEntity = await _repository.FindAsync(id).ConfigureAwait(false);
//var pubSaEntity = await _repository.FindAsync(id).ConfigureAwait(false);
if (pubSaEntity != null) if (pubSaEntity != null)
{ {
//结算单据 //结算单据

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

@ -174,150 +174,5 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
return await _priceListManager.DeleteListAsync(ids); return await _priceListManager.DeleteListAsync(ids);
} }
#endregion #endregion
#region 原方法(废弃)
// /// <summary>
// /// 获取总数
// /// </summary>
// private async Task<long> GetCountAsync(PriceListRequestDto input)
// {
// return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
// }
// /// <summary>
// /// 结算总成和ERP总成价格对比
// /// </summary>
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
// /// <returns></returns>
// [HttpGet]
// [Route("BomDiffPrice-Make")]
// [DisableRequestSizeLimit]
// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
// {
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
// customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
// customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode) ? string.Empty : customerCode });
// var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
// {
// });
// return _taskid;
// }
// [HttpPost]
// [Route("job/list")]
// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// [UnitOfWork(false)]
// virtual public async Task<List<JobDto>> GetListAsync(JobRequestDto input)
// {
// return await _service.GetListAsync(input);
// }
// /// <summary>
// /// 按ID获取唯一实体
// /// </summary>
// /// <remarks>
// /// 返回实体全部属性
// /// </remarks>
// /// <param name="id">ID</param>
// /// <returns>实体DTO</returns>
// [HttpGet]
// [Route("{id}")]
// /// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PriceListDto> GetAsync(Guid id)
// {
// var result = await _priceListManager.GetAsync(id); ;
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(result);
// return dto;
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("versionlist")]
//// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListVersionDto>> GetVersionListAsync(PriceListRequestDto input)
// {
// var entities = await _priceListManager.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListVersion>, List<PriceListVersionDto>>(entities);
// return new PagedResultDto<PriceListVersionDto>(totalCount, dtos);
// }
// /// <summary>
// /// 获取实体总数
// /// </summary>
// /// <returns>实体总数</returns>
// [HttpGet]
// [Route("count")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<long> GetTotalCountAsync(Guid branchId)
// {
// return await _priceListManager.GetCountAsync(new List<FilterCondition>(), branchId);
// }
// /// <summary>
// /// 获取全部实体列表
// /// </summary>
// /// <returns>实体DTO列表</returns>
// [HttpGet]
// [Route("all")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<ListResultDto<PriceListDto>> GetAllAsync(Guid branchId)
// {
// var entities = await _priceListManager.GetAllAsync(branchId);
// var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities);
// return new ListResultDto<PriceListDto>(dtos);
// }
// /// <summary>
// /// 修改实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <param name="input">修改实体DTO</param>
// /// <returns>实体DTO</returns>
// [HttpPut]
// [Route("{id}")]
// [Authorize(SettleAccountPermissions.PriceLists.Update)]
// virtual public async Task<PriceListDto> UpdateAsync(Guid id, PriceListDto input)
// {
// var entity = new PriceList(
// );
// var _ent = await _priceListManager.UpdateAsync(id, entity);
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(_ent);
// return dto;
// }
#endregion
} }

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

@ -542,7 +542,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPriceList() private void CreateMapPriceList()
{ {
CreateMap<PriceList, TB_PRICE_LISTDto>(); CreateMap<PriceList, TB_PRICE_LISTDto>()
.ForMember(x => x.Date, y => y.MapFrom(d => d.Date.ToString("yyyy-MM-dd")));
CreateMap<PriceListImportDto, PriceList>() CreateMap<PriceListImportDto, PriceList>()
.ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo)) .ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo))
.ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice)) .ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice))
@ -1016,7 +1017,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapBBAC_SA_DETAIL() private void CreateMapBBAC_SA_DETAIL()
{ {
CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_DTO>(); CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_DTO>()
.ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>()
@ -1057,7 +1059,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapHBPO_SA_DETAIL() private void CreateMapHBPO_SA_DETAIL()
{ {
CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_DTO>(); CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_DTO>()
.ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>()
@ -1089,8 +1092,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPUB_SA_DETAIL() private void CreateMapPUB_SA_DETAIL()
{ {
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_DTO>()
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_DTO>(); .ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>()

165
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs

@ -0,0 +1,165 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisHBPO Edi与发运对比
/// </summary>
public class JisHBPOEidSeCompareReport
{
}
/// <summary>
/// JisHBPO Edi与发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class JisHBPOEidSeCompareExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
public string Category { get; set; }
/// <summary>
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// CarModeCode
/// </summary>
[Display(Name = "CarModeCode")]
[ExporterHeader(DisplayName = "CarModeCode")]
public string CarModeCode { get; set; }
/// <summary>
/// LineStationcode
/// </summary>
[Display(Name = "LineStationcode")]
[ExporterHeader(DisplayName = "LineStationcode")]
public string LineStationcode { get; set; }
/// <summary>
/// SequenceNumber
/// </summary>
[Display(Name = "SequenceNumber")]
[ExporterHeader(DisplayName = "SequenceNumber")]
public string SequenceNumber { get; set; }
/// <summary>
/// ParType
/// </summary>
[Display(Name = "ParType")]
[ExporterHeader(DisplayName = "ParType")]
public string ParType { get; set; }
/// <summary>
/// 配置码
/// </summary>
[Display(Name = "配置码")]
[ExporterHeader(DisplayName = "配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 实际发货生产号
/// </summary>
[Display(Name = "实际发货生产号")]
[ExporterHeader(DisplayName = "实际发货生产号")]
public string RealCode { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")]
[ExporterHeader(DisplayName = "生产码")]
public string PN { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Display(Name = "序列号")]
[ExporterHeader(DisplayName = "序列号")]
public string Seq { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PjsNum { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
[Display(Name = "WMS目标库位")]
[ExporterHeader(DisplayName = "WMS目标库位")]
public string ToLoc { get; set; }
/// <summary>
/// ERP目标库位
/// </summary>
[Display(Name = "ERP目标库位")]
[ExporterHeader(DisplayName = "ERP目标库位")]
public string ErpToLoc { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
[ExporterHeader(DisplayName = "物料号")]
public string MaterialNumber { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDes { get; set; }
/// <summary>
/// WMS发货数量
/// </summary>
[Display(Name = "WMS发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// EDI数量
/// </summary>
[Display(Name = "EDI数量")]
[ExporterHeader(DisplayName = "EDI数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// WMS发货与EDI数量差
/// </summary>
[Display(Name = "WMS发货与EDI数量差")]
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal DiffQty => SEQty - EdiQty;
/// <summary>
/// 客户下线时间
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime? AssemblyDate { get; set; }
/// <summary>
/// 小总成号
/// </summary>
[Display(Name = "小总成号")]
[ExporterHeader(DisplayName = "小总成号")]
public string MatchNumber { get; set; }
/// <summary>
/// 注塑码
/// </summary>
[Display(Name = "注塑码")]
[ExporterHeader(DisplayName = "注塑码")]
public string InjectionCode { get; set; }
/// <summary>
/// 是否完全匹配
/// </summary>
[Display(Name = "是否完全匹配")]
[ExporterHeader(DisplayName = "是否完全匹配")]
public string MateType { get; set; }
/// <summary>
/// 差异说明
/// </summary>
[Display(Name = "差异说明")]
[ExporterHeader(DisplayName = "差异说明")]
public string DiffDesc { get; set; }
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs

@ -27,19 +27,12 @@ namespace SettleAccount.Job.Services.Report
/// HubContext /// HubContext
/// </summary> /// </summary>
private readonly IHubContext<PageHub> _hubContext; private readonly IHubContext<PageHub> _hubContext;
/// <summary> /// <summary>
/// 文件容器 /// 文件容器
/// </summary> /// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary> /// <summary>
/// AutoMapper /// DbContext
/// </summary> /// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext; private readonly SettleAccountDbContext _settleAccountDbContext;
@ -54,7 +47,6 @@ namespace SettleAccount.Job.Services.Report
{ {
_hubContext = hubContext; _hubContext = hubContext;
_fileContainer = fileContainer; _fileContainer = fileContainer;
_objectMapper = objectMapper;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
} }

151
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs

@ -1,11 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
@ -14,25 +21,28 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob
{ {
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary> /// <summary>
/// 文件容器 /// 文件容器
/// </summary> /// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary> /// <summary>
/// AutoMapper /// DbContext
/// </summary> /// </summary>
private readonly IObjectMapper _objectMapper; private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public JisHBPOEdiSeCompareExportService( public JisHBPOEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper) SettleAccountDbContext settleAccountDbContext)
{ {
_fileContainer = fileContainer; _fileContainer = fileContainer;
_objectMapper = objectMapper; _settleAccountDbContext = settleAccountDbContext;
} }
/// <summary> /// <summary>
@ -40,7 +50,134 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{ {
return ""; var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value;
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value;
var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisHBPOEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisHBPOEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = t.Max(t => t.BillNum),
MESConfigCode = t.Max(t => t.MESConfigCode),
ShippingDate = t.Max(t => t.BillTime),
PN = t.Max(t => t.PN),
Seq = t.Max(t => t.Seq),
PjsNum = t.Max(t => t.PjsNum),
ToLoc = t.Max(t => t.ToLoc),
ErpToLoc = t.Max(t => t.ErpToLoc),
MaterialNumber = t.Max(t => t.CustPartCode),
MaterialDes = t.Max(t => t.PartDesc),
SEQty = t.Sum(t => t.Qty),
InjectionCode = t.Max(t => t.InjectionCode),
MateType = "否",
DiffDesc = "WMS有发货EDI无订单"
}).ToList();
//有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
BillNum = groupItem.Max(t => t.BillNum),
MESConfigCode = groupItem.Max(t => t.MESConfigCode),
BillTime = groupItem.Max(t => t.BillTime),
Seq = groupItem.Max(t => t.Seq),
PjsNum = groupItem.Max(t => t.PjsNum),
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc),
CustPartCode = groupItem.Max(t => t.CustPartCode),
PartDesc = groupItem.Max(t => t.PartDesc),
InjectionCode = groupItem.Max(t => t.InjectionCode)
};
var haveEdiHaveSeList = (from edi in ediGroup
join se in seGroup
on new { edi.PN, edi.LU } equals new { se.PN, se.LU }
select new JisHBPOEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = default,
LineStationcode = default,
SequenceNumber = edi.SeqNumber,
ParType = "01",
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,
Seq = se.Seq,
PjsNum = se.PjsNum,
ToLoc = se.ToLoc,
ErpToLoc = se.ErpToLoc,
MaterialNumber = se.CustPartCode,
MaterialDes = se.PartDesc,
SEQty = se.Qty,
EdiQty = edi.Qty,
AssemblyDate = default,
MatchNumber = default,
InjectionCode = se.InjectionCode,
MateType = se.Qty == edi.Qty ? "是" : "否",
DiffDesc = "WMS有发货EDI有订单"
}).ToList();
haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
ExcelExporter excelExporter = new ExcelExporter();
excelExporter
.Append(haveEdiNotHaveSeList, $"HBPOEDI数据和发货对比")
.SeparateBySheet()
.Append(notHaveEdiHaveSeList, $"HBPO发货和EDI数据对比");
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
} }
#endregion
} }
} }

Loading…
Cancel
Save