yu.wu 3 years ago
parent
commit
5ed54dfb98
  1. 15275
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211202.txt
  2. 6493
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211203.txt
  3. 14
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformCreateDto.cs
  4. 72
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformDto.cs
  5. 72
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformDtoBase.cs
  6. 85
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformExportDto.cs
  7. 85
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs
  8. 81
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformRequestDto.cs
  9. 100
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformVersionDtoBase.cs
  10. 91
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/IBT_Car_PlatformAppService.cs
  11. 6
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Permissions/SettleAccountPermissionDefinitionProvider.cs
  12. 10
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Permissions/SettleAccountPermissions.cs
  13. 316
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs
  14. 119
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  15. 98
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  16. 132
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BT_Car/BT_Car_Platform.cs
  17. 47
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BT_Car/BT_Car_PlatformVersion.cs
  18. 39
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs
  19. 55
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  20. 50
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  21. 5
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  22. 20
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs
  23. 116
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs
  24. 52
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  25. 7
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/OutputService.cs
  26. 1
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  27. 91
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs
  28. 139
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs
  29. 12
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
  30. 20
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs
  31. 16
      src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

15275
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211202.txt

File diff suppressed because it is too large

6493
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211203.txt

File diff suppressed because it is too large

14
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformCreateDto.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformCreateDto : BT_Car_PlatformDtoBase, IBranch<Guid>
{
public virtual Guid BranchId { get; set; }
}
}

72
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformDto.cs

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DtoBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformDto : AuditedEntityDtoBase<Guid>
{
/// <summary>
///工厂
/// </summary>
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
public string Supplier { get; set; }
/// <summary>
/// 存储地点
/// </summary>
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
public string StorageLocationDesc { get; set; }
}
}

72
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformDtoBase.cs

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DtoBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformDtoBase : CreateOrUpdateEntityDtoBase<Guid>
{
/// <summary>
///工厂
/// </summary>
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
public string Version { set; get; }
/// <summary>
/// 类型:CP7报废和索赔两种
/// </summary>
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
public string Supplier { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
public string StorageLocationDesc { get; set; }
}
}

85
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformExportDto.cs

@ -0,0 +1,85 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformExportDto
{
/// <summary>
///工厂
/// </summary>
[ExporterHeader(DisplayName = "工厂")]
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
[ExporterHeader(DisplayName = "外部看板编号")]
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
[ExporterHeader(DisplayName = "看板编号")]
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
[ExporterHeader(DisplayName = "物料凭证号")]
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
[ExporterHeader(DisplayName = "会计年度")]
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
[ExporterHeader(DisplayName = "期间")]
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
[ExporterHeader(DisplayName = "版本号")]
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>
[ExporterHeader(DisplayName = "看板号")]
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
[ExporterHeader(DisplayName = "物料号")]
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
[ExporterHeader(DisplayName = "验收单日期")]
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
[ExporterHeader(DisplayName = "供应商")]
public string Supplier { get; set; }
/// <summary>
/// 存储地点
/// </summary>
[ExporterHeader(DisplayName = "存储地点")]
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
[ExporterHeader(DisplayName = "存储地点描述")]
public string StorageLocationDesc { get; set; }
}
}

85
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs

@ -0,0 +1,85 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformImportDto
{
/// <summary>
///工厂
/// </summary>
[ImporterHeader(Name = "工厂")]
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
[ImporterHeader(Name = "外部看板编号")]
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
[ImporterHeader(Name = "看板编号")]
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
[ImporterHeader(Name = "物料凭证号")]
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
[ImporterHeader(Name = "会计年度")]
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
[ImporterHeader(Name = "期间")]
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
[ImporterHeader(Name = "版本号")]
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>
[ImporterHeader(Name = "看板号")]
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
[ImporterHeader(Name = "物料号")]
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
[ImporterHeader(Name = "验收单日期")]
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
[ImporterHeader(Name = "供应商")]
public string Supplier { get; set; }
/// <summary>
/// 存储地点
/// </summary>
[ImporterHeader(Name = "存储地点")]
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
[ImporterHeader(Name = "存储地点描述")]
public string StorageLocationDesc { get; set; }
}
}

81
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformRequestDto.cs

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DtoBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformRequestDto : RequestDtoBase
{
/// <summary>
///工厂
/// </summary>
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
public string Supplier { get; set; }
/// <summary>
/// 存储地点
/// </summary>
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
public string StorageLocationDesc { get; set; }
public virtual Guid ParentId { get; set; }
public virtual Guid BranchId { get; set; }
public virtual Guid UserId { get; set; }
public virtual int FileType { get; set; }
}
}

100
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformVersionDtoBase.cs

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared;
using Win.Sfs.Shared.DtoBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
/// <summary>
/// SettleAccountVersion
/// </summary>
public class BT_Car_PlatformVersionDtoBase : CreateOrUpdateEntityDtoBase<Guid>
{
public string Year { get; private set; }
/// <summary>
/// 期间
/// </summary>
public string Period { get; private set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; private set; }
/// <summary>
/// 客户号
/// </summary>
public string CustomerCode { private set; get; }
}
public class BT_Car_PlatformVersionDto : AuditedEntityDtoBase<Guid>, IBranch<Guid>
{
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
public string Period { get; set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 客户号
/// </summary>
public string CustomerCode { set; get; }
public Guid BranchId { get; set; }
}
public class BT_Car_PlatformVersionCreateDto : BT_Car_PlatformVersionDtoBase
{ }
public class BT_Car_PlatformVersionUpdateDto : BT_Car_PlatformVersionDtoBase
{ }
public class BT_Car_PlatformVersionRequestDto : RequestDtoBase, IBranch<Guid>
{
public string Year { get; private set; }
/// <summary>
/// 期间
/// </summary>
public string Period { get; private set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; private set; }
/// <summary>
/// 客户号
/// </summary>
public string CustomerCode { private set; get; }
public Guid BranchId { get; set; }
}
public class BT_Car_PlatformVersionImportDto
{
public string Year { get; private set; }
/// <summary>
/// 期间
/// </summary>
public string Period { get; private set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; private set; }
/// <summary>
/// 客户号
/// </summary>
public string CustomerCode { private set; get; }
}
}

91
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/IBT_Car_PlatformAppService.cs

@ -0,0 +1,91 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public interface IBT_Car_PlatformAppService
{
/// <summary>
/// 导入功能
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
Task<string> BT_Car_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId,
string year, string period, string version, string customerCode);
/// <summary>
/// 按ID获取唯一实体
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
Task<BT_Car_PlatformDto> GetAsync(Guid id);
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
Task<PagedResultDto<BT_Car_PlatformDto>> GetListAsync(BT_Car_PlatformRequestDto input);
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
Task<PagedResultDto<BT_Car_PlatformVersionDto>> GetVersionListAsync(BT_Car_PlatformVersionRequestDto input);
Task<string> ExportAsync(BT_Car_PlatformRequestDto input);
/// <summary>
/// 获取实体总数
/// </summary>
/// <returns>实体总数</returns>
Task<long> GetTotalCountAsync(Guid branchId);
///// <summary>
///// 删除实体
///// </summary>
///// <param name="id">ID</param>
///// <returns>无</returns>
Task DeleteAsync(Guid id);
/// <summary>
/// 按IDs删除实体列表
/// </summary>
/// <param name="ids">IDs</param>
/// <returns>是否执行成功</returns>
Task<bool> DeleteListAsync(List<Guid> ids);
}
}

6
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Permissions/SettleAccountPermissionDefinitionProvider.cs

@ -12,6 +12,12 @@ namespace Win.Sfs.SettleAccount
#region 派格
//一汽轿车平台导入
var bt_car = myGroup.AddPermission(SettleAccountPermissions.BT_Carlatform.Default, L("BT_Carlatform"));
bt_car.AddChild(SettleAccountPermissions.BT_Carlatform.Create, L("Create"));
bt_car.AddChild(SettleAccountPermissions.BT_Carlatform.Update, L("Update"));
bt_car.AddChild(SettleAccountPermissions.BT_Carlatform.Delete, L("Delete"));
//红旗M平台导入
var hq_m = myGroup.AddPermission(SettleAccountPermissions.HQ_MPlatform.Default, L("HQ_MPlatform"));
hq_m.AddChild(SettleAccountPermissions.HQ_MPlatform.Create, L("Create"));

10
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Permissions/SettleAccountPermissions.cs

@ -14,6 +14,16 @@ namespace Win.Sfs.SettleAccount
#region 派格
/// <summary>
/// 一汽轿车-权限
/// </summary>
public static class BT_Carlatform
{
public const string Default = GroupName + "." + nameof(BT_Carlatform);
public const string Create = Default + "." + CreateStr;
public const string Update = Default + "." + UpdateStr;
public const string Delete = Default + "." + DeleteStr;
}
/// <summary>
/// 红旗M平台导入-权限

316
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs

@ -0,0 +1,316 @@
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
/// <summary>
/// 一汽轿车平台导入
/// </summary>
//[Authorize(SettleAccountPermissions.HQ_MPlatform.Default)]
//[AllowAnonymous]
[Route("api/settleaccount/BT_Carlatform")]
public class BT_Car_PlatformAppService : SettleAccountApplicationBase<BT_Car_Platform>, IBT_Car_PlatformAppService
{
private readonly IGuidGenerator _guidGenerator;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<BT_Car_PlatformVersion, Guid> _versionRepository;
private readonly ISettleAccountBranchEfCoreRepository<BT_Car_Platform, Guid> _repository;
/// <summary>
/// 构建方法
/// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public BT_Car_PlatformAppService(IGuidGenerator guidGenerator,
ISettleAccountBranchEfCoreRepository<BT_Car_PlatformVersion, Guid> versionRepository,
ISettleAccountBranchEfCoreRepository<BT_Car_Platform, Guid> repository,
IDistributedCache<BT_Car_Platform> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_versionRepository = versionRepository;
_guidGenerator = guidGenerator;
_excelImportService = excelImportService;
_repository = repository;
}
/// <summary>
/// 导入功能
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport")]
[DisableRequestSizeLimit]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
public async Task<string> BT_Car_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<BT_Car_PlatformImportDto>(files, _excelImportService);
var entityList = ObjectMapper.Map<List<BT_Car_PlatformImportDto>, List<BT_Car_Platform>>(result);
//删除版本
var _versionQuery = _versionRepository.Where(p => p.Version == version);
await _versionQuery.BatchDeleteAsync();
//删除明细
var _query = _repository.Where(p => p.Version == version);
await _query.BatchDeleteAsync();
//插入数据前检验
var checkList = new List<ErrorExportDto>();
var _group = entityList.GroupBy(x => new { x.KanbanNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), KanbanNumber = p.Key.KanbanNumber, MaterialCode = p.Key.MaterialCode });
foreach (var itm in _group)
{
if (string.IsNullOrEmpty(itm.KanbanNumber))
{
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.KanbanNumber), string.Empty));
}
}
var _id = GuidGenerator.Create();
var _bomList = new List<BT_Car_PlatformVersion>();
_bomList.Add(new BT_Car_PlatformVersion(_id, branchId, year, period, version, customerCode));
foreach (var itm in entityList)
{
//赋值上主键ID
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version);
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
await _repository.GetDbContext().BulkInsertAsync<BT_Car_Platform>(entityList);
await _versionRepository.GetDbContext().BulkInsertAsync(_bomList);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 按ID获取唯一实体
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<BT_Car_PlatformDto> GetAsync(Guid id)
{
var result = await GetFromCacheAsync(id);
var dto = ObjectMapper.Map<BT_Car_Platform, BT_Car_PlatformDto>(result);
return dto;
}
private async Task<BT_Car_Platform> GetFromCacheAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return result;
}
private async Task<long> GetCountAsync(BT_Car_PlatformRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
private async Task<long> GetCountAsync(BT_Car_PlatformVersionRequestDto input)
{
return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
/// <summary>
/// 导出文件
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<string> ExportAsync(BT_Car_PlatformRequestDto input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<BT_Car_Platform>, List<BT_Car_PlatformExportDto>>(entities);
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("一轿奔腾验收结算明细_{0}.csv", input.UserId.ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("一轿奔腾验收结算明细_{0}.xlsx", input.UserId.ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("list")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<BT_Car_PlatformDto>> GetListAsync(BT_Car_PlatformRequestDto input)
{
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
else
{
return new PagedResultDto<BT_Car_PlatformDto>(0, new List<BT_Car_PlatformDto>());
}
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<BT_Car_Platform>, List<BT_Car_PlatformDto>>(entities);
return new PagedResultDto<BT_Car_PlatformDto>(totalCount, dtos);
}
/// <summary>
/// 获取实体总数
/// </summary>
/// <returns>实体总数</returns>
[HttpGet]
[Route("count")]
[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _repository.GetCountAsync(branchId);
}
/// <summary>
/// 获取全部实体列表
/// </summary>
/// <returns>实体DTO列表</returns>
[HttpGet]
[Route("all")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<ListResultDto<BT_Car_PlatformDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<BT_Car_Platform>, List<BT_Car_PlatformDto>>(entities);
return new ListResultDto<BT_Car_PlatformDto>(dtos);
}
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">ID</param>
/// <returns>无</returns>
[HttpDelete]
[Route("{id}")]
/// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
virtual public async Task DeleteAsync(Guid id)
{
await _repository.DeleteAsync(id);
}
/// <summary>
/// 按IDs删除实体列表
/// </summary>
/// <param name="ids">IDs</param>
/// <returns>是否执行成功</returns>
[HttpPost]
[Route("delete")]
// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
foreach (var id in ids)
{
var entity = await GetFromCacheAsync(id);
//await Cache.DeleteAsync<SettleAccount>(id.ToString());
}
return await _repository.DeleteListAsync(ids);
}
/// <summary>
/// 版本列表查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("listversion")]
public async Task<PagedResultDto<BT_Car_PlatformVersionDto>> GetVersionListAsync(BT_Car_PlatformVersionRequestDto input)
{
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
input.SkipCount, true);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<BT_Car_PlatformVersion>, List<BT_Car_PlatformVersionDto>>(entities);
return new PagedResultDto<BT_Car_PlatformVersionDto>(totalCount, dtos);
}
}
}

119
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -88,16 +88,28 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
[Route("SettleDoorPanel")]
[DisableRequestSizeLimit]
public async Task<string> SettleDoorPanel( string materialCode, string version, string customerCode, string sapCode, string estimateTypeDesc)
public async Task<string> SettleDoorPanel(
string version,
string materialCode,
string begin,
string end,
string cp7begin,
string cp7end,
string kenncode,
string chassisNumber
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = estimateTypeDesc ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众准时化结算门板价格差异比对报表" });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(materialCode) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(begin) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(end) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(cp7begin) ? string.Empty : cp7begin });
customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(cp7end) ? string.Empty : cp7end });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) =>
{
@ -337,7 +349,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
/// <summary>
/// 大众发票与结算核对明细表
/// 2.大众发票与结算核对明细表
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
@ -373,6 +385,44 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
/// <summary>
/// 2.大众结算未发运核对明细表
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("UnInvoiceSettledDetailDiff-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnInvoiceSettledDetailDiffMake(
string version,
string materialCode,
string begin,
string end,
string cp7begin,
string cp7end,
string kenncode,
string chassisNumber
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(materialCode) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(begin) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(end) ? string.Empty : materialCode });
customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(cp7begin) ? string.Empty : cp7begin });
customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(cp7end) ? string.Empty : cp7end });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
var _taskid = await _service.ExportEnqueueAsync("大众结算未发运核对明细表", ExportExtentsion.Excel, CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 3.大众准时化结算数量差异比对表
@ -396,6 +446,59 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
/// <summary>
/// 7.大众准时化未结明细表(包含漏结,漏结要有标识)
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("UnsettledDetailReportService-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnsettledDetailReportServiceMake(string version,string customerCode,string materialGroup, string materialCode, string begin, string end,string sapCode)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(version)?version:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = !string.IsNullOrEmpty(customerCode)?version:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(materialCode)?materialCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(materialGroup)? materialGroup:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value =!string.IsNullOrEmpty(sapCode)?sapCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(materialCode)?materialCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Begin", Value = !string.IsNullOrEmpty(begin)?string.Empty: begin });
customConditionList.Add(new CustomCondition() { Name = "End", Value = !string.IsNullOrEmpty(end)?string.Empty: end });
//var _first = exportName.FirstOrDefault();
//var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
//var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
//var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
//var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
//var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
//var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var _taskid = await _service.ExportEnqueueAsync("大众准时化未结明细表", ExportExtentsion.Excel, CurrentUser, typeof(UnsettledDetailReportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
///6.大众准时化未结差异比对表

98
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -310,6 +310,86 @@
<param name="input">请求条件</param>
<returns>实体DTO列表</returns>
</member>
<member name="T:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService">
<summary>
一汽轿车平台导入
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.#ctor(Volo.Abp.Guids.IGuidGenerator,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformVersion,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_Platform,System.Guid},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_Platform},Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)">
<summary>
构建方法
</summary>
<param name="guidGenerator">构建UID</param>
<param name="repository">仓储接口</param>
<param name="cache">缓存</param>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.BT_Car_PlatformUploadExcelImport(Microsoft.AspNetCore.Http.IFormFileCollection,System.Guid,System.String,System.String,System.String,System.String)">
<summary>
导入功能
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.GetAsync(System.Guid)">
<summary>
按ID获取唯一实体
</summary>
<remarks>
返回实体全部属性
</remarks>
<param name="id">ID</param>
<returns>实体DTO</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.ExportAsync(Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformRequestDto)">
<summary>
导出文件
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.GetListAsync(Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformRequestDto)">
<summary>
根据筛选条件获取实体列表
</summary>
<remarks>
请求条件包括:筛选条件列表,排序条件,数据数量,页码
</remarks>
<param name="input">请求条件</param>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.GetTotalCountAsync(System.Guid)">
<summary>
获取实体总数
</summary>
<returns>实体总数</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.GetAllAsync(System.Guid)">
<summary>
获取全部实体列表
</summary>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.DeleteAsync(System.Guid)">
<summary>
删除实体
</summary>
<param name="id">ID</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.DeleteListAsync(System.Collections.Generic.List{System.Guid})">
<summary>
按IDs删除实体列表
</summary>
<param name="ids">IDs</param>
<returns>是否执行成功</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformAppService.GetVersionListAsync(Win.Sfs.SettleAccount.Entities.BT_Car.BT_Car_PlatformVersionRequestDto)">
<summary>
版本列表查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Win.Sfs.SettleAccount.Entities.CarMaterialConfigTables.CarMaterialConfigAppService">
<summary>
区域相关应用服务
@ -2566,7 +2646,7 @@
<param name="repository">仓储接口</param>
<param name="cache">缓存</param>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleDoorPanel(System.String,System.String,System.String,System.String,System.String)">
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleDoorPanel(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
大众准时化结算门板价格差异比对报表
</summary>
@ -2657,7 +2737,14 @@
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
大众发票与结算核对明细表
2.大众发票与结算核对明细表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnInvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
2.大众结算未发运核对明细表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
@ -2669,6 +2756,13 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnsettledDetailReportServiceMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
7.大众准时化未结明细表(包含漏结,漏结要有标识)
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettleDiffExportServiceMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
6.大众准时化未结差异比对表

132
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BT_Car/BT_Car_Platform.cs

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_Platform : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase
{
public BT_Car_Platform()
{ }
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version)
{
Period = peroid;
Year = year;
Id = guid;
Version = version;
BranchId = branchId;
}
public BT_Car_Platform(Guid Id, string materialVoucherNo, string externalKanbanNumber,
string kanbanNumber, string year, string factory, DateTime acceptanceDate,
string period, string version, string kanBan, string supplier, string storageLocation, string storageLocationDesc,
string materialCode) : base(Id)
{
MaterialVoucherNo = materialVoucherNo;
KanbanNumber = kanbanNumber;
ExternalKanbanNumber = externalKanbanNumber;
Year = year;
Factory = factory;
AcceptanceDate = acceptanceDate;
Period = period;
Version = version;
MaterialCode = materialCode;
BTCarKanBan = kanBan;
Supplier = supplier;
StorageLocation = storageLocation;
StorageLocationDesc = storageLocationDesc;
}
//验收单号 外部单号 物料凭证号 物料凭证日期 物料凭证记账日期 看板编号 外部看板编号 物料号 物料描述 数量 单价 金额
//工厂 备注 创建者 创建时间 修改人 修改时间 公司 验收单号 外部单号 发票号 会计年度 金额 计划员 存储地点
//存储地点描述 状态 验收单日期 供应商 录入人 录入人描述 看板号
/// <summary>
///工厂
/// </summary>
[Display(Name = "工厂")]
public string Factory { get; set; }
/// <summary>
///外部看板编号
/// </summary>
[Display(Name = "外部看板编号")]
public string ExternalKanbanNumber { get; set; }
/// <summary>
///看板编号
/// </summary>
[Display(Name = "看板编号")]
public string KanbanNumber { get; set; }
/// <summary>
///物料凭证号
/// </summary>
[Display(Name = "物料凭证号")]
public string MaterialVoucherNo { get; set; }
/// <summary>
///会计年度
/// </summary>
[Display(Name = "会计年度")]
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
[Display(Name = "版本号")]
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>
[Display(Name = "看板号")]
public string BTCarKanBan { set; get; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
public string MaterialCode { get; set; }
/// <summary>
/// 验收单日期
/// </summary>
[Display(Name = "验收单日期")]
public DateTime AcceptanceDate { get; set; }
/// <summary>
/// 供应商
/// </summary>
[Display(Name = "供应商")]
public string Supplier { get; set; }
/// <summary>
/// 存储地点
/// </summary>
[Display(Name = "存储地点")]
public string StorageLocation { get; set; }
/// <summary>
/// 存储地点描述
/// </summary>
[Display(Name = "存储地点描述")]
public string StorageLocationDesc { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Extend { set; get; }
}
}

47
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BT_Car/BT_Car_PlatformVersion.cs

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.BT_Car
{
public class BT_Car_PlatformVersion : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase
{
public BT_Car_PlatformVersion()
{ }
public string Year { get; private set; }
/// <summary>
/// 期间
/// </summary>
public string Period { get; private set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 客户号
/// </summary>
public string CustomerCode { private set; get; }
public BT_Car_PlatformVersion(
Guid id,
Guid branchId,
string year, string period, string version, string customerCode) : base(id)
{
BranchId = branchId;
Year = year;
Period = period;
Version = version;
CustomerCode = customerCode;
}
}
}

39
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs

@ -10,6 +10,45 @@ namespace Win.Sfs.SettleAccount.Entities.UnSettle
{
public class UnSettleDetailReport:ReportDetailBase
{
[ExporterHeader(DisplayName = "交货单号 ")]
public override string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期 ")]
public override DateTime CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public override string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public override string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "交货状态 ")]
public override string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public override string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述 ")]
public override string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料 ")]
public override string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料 ")]
public override string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述 ")]
public override string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")]
public override string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public override decimal Amt { set; get; }
[ExporterHeader(DisplayName = "结算日期")]
public override DateTime CP7Time { set; get; }
[ExporterHeader(DisplayName = "开票单价")]
public override decimal InvoicePrice { set; get; }
[ExporterHeader(DisplayName = "结算平台未结数量 ")]
public decimal Qty { set; get; }

55
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -69,6 +69,7 @@ using Win.Sfs.SettleAccount.Entities.WMS_KanBan;
using Win.Sfs.SettleAccount.Entities.WMS_SparePart;
using Win.Sfs.SettleAccount.Entities.HQ_H;
using Win.Sfs.SettleAccount.Entities.HQ_M;
using Win.Sfs.SettleAccount.Entities.BT_Car;
namespace Win.Sfs.SettleAccount
{
@ -311,6 +312,9 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureHQM(options);
builder.ConfigureHQMVersion(options);
//一汽轿车
builder.ConfigureBTCar(options);
builder.ConfigureBTCarVersion(options);
#endregion
@ -318,6 +322,53 @@ namespace Win.Sfs.SettleAccount
#region PG-派格
/// <summary>
/// 一汽轿车-导入
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureBTCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BT_Car_Platform>(b =>
{
b.ToTable($"{options.TablePrefix}_BT_Car_Platform", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BTCarKanBan).IsRequired().HasMaxLength(150);//必填项
b.Property(x => x.MaterialVoucherNo).HasMaxLength(150);
b.Property(x => x.Factory).HasMaxLength(50);
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150);
b.Property(x => x.ExternalKanbanNumber).HasMaxLength(50);
b.Property(x => x.KanbanNumber).HasMaxLength(150);
b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Year).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Supplier).HasMaxLength(50);
b.Property(x => x.StorageLocation).HasMaxLength(50);
b.Property(x => x.StorageLocationDesc).HasMaxLength(150);
//创建组合索引
b.HasIndex(x => new { x.Version, x.KanbanNumber, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
});
}
private static void ConfigureBTCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SparePartVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_BT_Car_PlatformVersion", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
});
}
/// <summary>
/// 红旗工厂M平台验收结算明细-导入
@ -354,7 +405,7 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHQMVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SparePartVersion>(b =>
builder.Entity<HQ_M_PlatformVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_HQ_M_PlatformVersion", options.Schema);
b.ConfigureByConvention();
@ -402,7 +453,7 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHQHVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SparePartVersion>(b =>
builder.Entity<HQ_H_PlatformVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_HQ_H_PlatformVersion", options.Schema);
b.ConfigureByConvention();

50
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

@ -20,6 +20,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public string KENNCode { set; get; }
public string ChassisNumber { set; get; }
public string ErpMaterialCode { set; get; }
}
public class InvoiceSettleDiff
{
@ -69,7 +70,47 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
if (isNotHistoryPart == true)
{
var _list = DbConnection.Query<SettleInfo>(string.Format("select distinct ChassisNumber, kenncode from Set_Settle where version < '{0}'", isNotHistoryPart)).ToList();
var str = "SELECT\n" +
" temp2.ErpMaterialCode,\n" +
" temp2.OrderBillNum KENNCode ,\n" +
" temp2.ChassisNumber\n" +
" FROM\n" +
" (\n" +
" SELECT DISTINCT\n" +
" ErpMaterialCode,\n" +
" b.OrderBillNum, \n" +
" " +
"b.KENNCode,\n" +
" b.ChassisNumber2, \n" +
" b.ChassisNumber \n" +
" FROM\n" +
" Set_fis b\n" +
" INNER JOIN set_settle a ON a.KENNCode = b.KENNCode \n" +
" AND a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" WHERE\n" +
" a.Version = '{0}' \n" +
" ) temp1\n" +
" INNER JOIN (\n" +
" SELECT DISTINCT\n" +
" ErpMaterialCode,\n" +
" d.OrderBillNum, \n" +
" d.KENNCode,\n" +
" d.ChassisNumber2 ,\n" +
" d.ChassisNumber \n" +
" FROM\n" +
" Set_fis d\n" +
" INNER JOIN set_settle c ON c.KENNCode = d.KENNCode \n" +
" AND c.ChassisNumber = d.ChassisNumber2 \n" +
" AND c.MaterialCode = d.ItemCode \n" +
" WHERE\n" +
" c.Version < '{0}' \n" +
" ) temp2 ON temp1.ChassisNumber2 = temp2.ChassisNumber2 \n" +
" AND temp1.ErpMaterialCode = temp2.ErpMaterialCode \n" +
" AND temp1.KENNCode = temp2.KENNCode";
var _list = DbConnection.Query<SettleInfo>(string.Format(str, version)).ToList();
@ -79,8 +120,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
join itm3 in _materialList on itm1.ParentSapMaterialCode equals itm3.MaterialCode into temp2
from tm2 in temp2.DefaultIfEmpty(new Material())
join itm4 in _list
on new { itm1.ChassisNumber, itm1.KENNCode } equals new { itm4.ChassisNumber, itm4.KENNCode } into temp3
from tm3 in temp3
on new { itm1.ChassisNumber, itm1.KENNCode, itm1.ParentSapMaterialCode } equals new { itm4.ChassisNumber, itm4.KENNCode, ParentSapMaterialCode = itm4.ErpMaterialCode } into temp3
from tm3 in temp3.DefaultIfEmpty()
where tm3 == null
select new T
{
@ -126,7 +167,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
ParentMaterialDesc = itm1.ParentMaterialDesc,
Price = tm1.SapPrice,
Amt = tm1.SapPrice,
MaterialGroup = tm2.EstimateTypeDesc
MaterialGroup = tm2.EstimateTypeDesc,
CP7Time = itm1.CP7Time,
};
tmpList = query.ToList();

5
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs

@ -142,10 +142,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" b.YEAR,\n" +
" b.KENNCode,\n" +
" a.OrderBillNum Kenncode,\n" +
" b.MaterialCode,\n" +
" b.Model,\n" +
" b.ChassisNumber,\n" +
" a.ChassisNumber,\n" +
" a.Qty,\n" +
" a.BeginTime CP5Time,\n" +
" a.ChassisNumber2,\n" +
@ -193,3 +193,4 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}

20
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs

@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public class SettleDoorPanelExport
{
[ExporterHeader(DisplayName = "物料组(车型)")]
public string EstimateTypeDesc { set; get; }
public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public string SAPCode { set; get; }
@ -99,4 +99,22 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal InvoiceDiffPrice { set; get; }
}
public class SettleDoorPanelSumExport
{
// 期间 物料组 价格差异总金额
[ExporterHeader(DisplayName = "期间")]
public string Version { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "价格差异总金额")]
public decimal InvoiceDiffPrice { set; get; }
}
}

116
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs

@ -0,0 +1,116 @@
using Dapper;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
/// <summary>
///3.大众准时化结算数量差异比对表
/// </summary>
public class UnInvoiceSettledDetailDiffDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public UnInvoiceSettledDetailDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public virtual List<InvoiceSettledDetailDiff> GetDetailDiffReportList(string version, string materialCode, string begin, string end ,string cp7begin,string cp7end,string kennCode,string chassisNumber)
{
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>();
string condition = " where 1=1 ";
if (!string.IsNullOrEmpty(materialCode))
{
condition += string.Format(" d.MaterialCode='{0}' ", materialCode);
}
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" a.BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" a.BeginTime<='{0}' ", end);
}
if (!string.IsNullOrEmpty(cp7begin))
{
condition += string.Format(" B.cp7Time>='{0}' ", cp7begin);
}
if (!string.IsNullOrEmpty(cp7end))
{
condition += string.Format(" B.cp7Time<='{0}' ", cp7end);
}
if (!string.IsNullOrEmpty(kennCode))
{
condition += string.Format(" B.kenncode='{0}' ", kennCode);
}
if (!string.IsNullOrEmpty(chassisNumber))
{
condition += string.Format(" B.chassisNumber='{0}' ", chassisNumber);
}
string str =
"SELECT\n" +
" temp1.*,\n" +
" TEMP2.Price,(\n" +
" Isnull( temp2.Price, 0 ) * isnull( temp1.SettledQty, 0 )) Amt \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.YEAR,\n" +
" a.Kenncode,\n" +
" a.MaterialCode,\n" +
" a.Model,\n" +
" a.ChassisNumber,\n" +
" isnull( b.Qty, 0 ) Qty,\n" +
" a.CP5A CP5Time,\n" +
" a.CP7 CP7Time,\n" +
" a.QTY SettledQty,\n" +
" '' ParentSapMaterialCode,\n" +
" '' WMSState,\n" +
" '' WMSBillNum,\n" +
" d.MaterialCode SapMaterialCode,\n" +
" d.MaterialDesc MaterialDesc,\n" +
" d.EstimateTypeDesc MaterialGroup,\n" +
" '' ParentMaterialDesc,\n" +
" c.InvoicePrice,\n" +
" ( c.InvoicePrice * a.qty ) InvoiceAmt,\n" +
" ( c.InvoicePrice * a.Qty ) SettleAmt,\n" +
" a.Qty - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" +
" 0 DiffSettleInvQty,\n" +
" a.Qty InvoiceQty \n" +
" FROM\n" +
" ( SELECT * FROM set_settle WHERE version = '202110' ) a\n" +
" LEFT JOIN Set_fis b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.KENNCode = b.KENNCode \n" +
" AND a.MaterialCode = b.ItemCode\n" +
" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '202110' GROUP BY materialcode ) c ON a.MaterialCode = c.MaterialCode\n" +
" LEFT JOIN set_material d ON a.MaterialCode = d.CustomerPartCode \n" +
" WHERE\n" +
" b.Qty IS NULL \n" +
" ) temp1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) AND type = 10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode";
var _sql = string.Format(str, version,condition);
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list=_query.ToList();
return _list;
}
}
}

52
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -55,12 +55,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//}
var sqlString =
"SELECT\n" +
" temp1.*,\n" +
" temp2.Price,\n" +
" ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" A.*,\n" +
" C.Price,\n" +
" ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT,\n" +
" B.EstimateTypeDesc MaterialGroup,\n" +
" B.MaterialDesc MaterialDesc,\n" +
" d.MaterialDesc ParentMaterialDesc \n" +
" d.MaterialDesc ParentMaterialDesc,\n" +
" B.MaterialCode SapMaterialCode \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
@ -70,7 +75,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
" KENNCode,\n" +
" OrderBillNum KENNCode,,\n" +
" QTY,\n" +
" ErpMaterialCode ParentSapMaterialCode,\n" +
" '' FLAG \n" +
@ -86,7 +91,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
" KENNCode,\n" +
" OrderBillNum KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode ParentSapMaterialCode,\n" +
" 'L' FLAG \n" +
@ -97,8 +102,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND STATE = 4 \n" +
" ) A\n" +
" LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode\n" +
" LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode";
" LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode \n" +
" ) temp1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
@ -106,8 +112,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
@ -117,37 +123,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _list = _query.ToList();
var _ls = _list.Where(p=>p.Flag!="L").GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
foreach (var itm in _ls)
{
var parentMaterial = new UnSettleDetailReport();
parentMaterial.WmsBillNum = itm.WmsBillNum;
parentMaterial.CP5Time = itm.CP5Time;
parentMaterial.KENNCode = itm.KENNCode;
parentMaterial.ChassisNumber = itm.ChassisNumber;
parentMaterial.WmsState = itm.WmsState;
parentMaterial.SapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.MaterialDesc = itm.ParentMaterialDesc;
parentMaterial.MaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentSapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentMaterialDesc = itm.ParentMaterialDesc;
var _price=_priceList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_price != null)
{
parentMaterial.Price = _price.Price;
parentMaterial.Amt = _price.Price;
}
var _material=_materialList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_material != null)
{
parentMaterial.MaterialGroup = _material.EstimateTypeDesc;
}
_list.Add(parentMaterial);
}
return _list;
}

7
src/Modules/SettleAccount/src/SettleAccount.Job/Services/OutputService.cs

@ -71,13 +71,6 @@ namespace SettleAccount.Job.Services
public void Export<T>(Guid Id, string fileName,Dictionary<string,List<T>> p_dic) where T : class, new()
{
//string methodName = (isDesc) ? "OrderByDescendingInternal" : "OrderByInternal";
//var memberProp = typeof(T).GetProperty(propertyName);
//var method = typeof(QueryableExtension).GetMethod(methodName)?.MakeGenericMethod(typeof(T), memberProp?.PropertyType);
//var result = method?.Invoke(null, new object[] { query, memberProp });
//return (IOrderedQueryable<T>)result;
foreach (var itm in p_dic)

1
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -90,6 +90,7 @@ namespace SettleAccount.Job.Services
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
_ls.AddRange(rangeList);

91
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs

@ -1,41 +1,110 @@
using System;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class SettleDoorPanelExportService : ITransientDependency, IExportJob
{
private readonly SettleDoorPanelDapperRepository _dapper;
private readonly InvoiceSettledDetailDiffDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly OutputService _outputService;
private readonly InputService _inputService;
public SettleDoorPanelExportService(SettleDoorPanelDapperRepository dapper, OutputService outputService)
public SettleDoorPanelExportService(
IBlobContainer<MyFileContainer> fileContainer,
ErpPartDapperRepository erpdapperRepository,
InvoiceSettledDetailDiffDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
)
{
_dapper = dapper;
_fileContainer = fileContainer;
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
_dapperRepository = dapperRepository;
}
//public virtual List<SettleDoorPanelExport> GetSettleDoorPanelReportList(string purchaseOrderNo, string version, string sapCode, string matialCode)
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var estimateTypeDesc = p_list.Where(p => p.Name == "EstimateTypeDesc").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerPartCode = p_list.Where(p => p.Name == "CustomerPartCode").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value;
var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber);
var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version,true);
var erpPriceList = _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
rangeList.ForEach(p => {
p.Qty = 1;
p.InvoiceQty = 1;
p.SettledQty = 1;
p.DiffSettleFisQty = 0;
p.DiffSettleInvQty = 0;
var _first = erpPriceList.FirstOrDefault(itm => itm.SapErpPartCode == p.SapMaterialCode);
if (_first != null)
{
p.InvoicePrice = _first.SapPrice;
p.Amt = p.Price * 1;
p.InvocieAmt = p.InvoicePrice * 1;
p.SettleAmt = p.SettledQty * p.Price;
}
p.DiffPrice = p.InvoicePrice - p.Price;
});
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
}
_ls.AddRange(rangeList);
_ls = _ls.Where(p=>p.DiffPrice!=0).OrderBy(p => p.SapMaterialCode).ToList();
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var report1List = _ls.GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
.Select(t => new SettleDoorPanelExport{ MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode });
var _list = _dapper.GetSettleDoorPanelReportList(estimateTypeDesc, version, sapCode, customerPartCode);
var report2List = _ls.GroupBy(p => new {p.MaterialGroup }).Select(p=>new SettleDoorPanelSumExport { MaterialGroup= p.Key.MaterialGroup, InvoiceDiffPrice=p.Sum(itm=>itm.DiffPrice)*p.Sum(itm=>itm.Qty), Version="" });
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(report1List.ToList(), "按物料价格差异明细表")
.SeparateBySheet()
.Append(report2List.ToList(), "差异汇总验证表")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(string.Format("大众准时化结算门板价格差异比对报表_{0}.xlsx", Guid.NewGuid().ToString()), result.Result, true);
_outputService.Export<SettleDoorPanelExport>(id, string.Format("大众准时化结算门板价格差异比对报表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
// _outputService.Export<SettleDoorPanelExport>(id, string.Format("大众准时化结算门板价格差异比对报表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}

139
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs

@ -0,0 +1,139 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Repository.SettleAccount;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services
{
//物料组车型 SAP编码 零件号 结算数量 M100数量 差异总数 开票单价 差异金额
public class UnInvoiceSettledDetailSum
{
[ExporterHeader(DisplayName = "物料组车型")]
public string MaterialGroup { set; get;}
[ExporterHeader(DisplayName = "SAP编码")]
public string SapMaterailCode { set; get; }
[ExporterHeader(DisplayName = "零件号")]
public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettleQty { set; get; }
[ExporterHeader(DisplayName = "M100数量")]
public decimal FisQty { set; get; }
[ExporterHeader(DisplayName = "差异总数")]
public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "开票单价")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "差异金额")]
public decimal DiffAmt { set; get; }
}
/// <summary>
///3.大众准时化结算数量差异比对表
/// </summary>
public class UnInvoiceSettledDetailDiffExportService : ITransientDependency, IExportJob
{
private readonly UnInvoiceSettledDetailDiffDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly OutputService _outputService;
private readonly InputService _inputService;
public UnInvoiceSettledDetailDiffExportService(
IBlobContainer<MyFileContainer> fileContainer,
ErpPartDapperRepository erpdapperRepository,
UnInvoiceSettledDetailDiffDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
)
{
_fileContainer = fileContainer;
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository= erpdapperRepository;
//_repository = repository;
//_versionRepository = versionRepository;
_dapperRepository =dapperRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value;
var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
_ls=_ls.OrderBy(p => p.ChassisNumber).ThenBy(p=>p.KENNCode).ThenBy(p=>p.SapMaterialCode).ToList();
var _lsSum=_ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup }).Select(p => new UnInvoiceSettledDetailSum
{
MaterialCode = p.Key.MaterialCode,
SapMaterailCode = p.Key.SapMaterialCode,
MaterialGroup = p.Key.MaterialGroup,
SettleQty = p.Sum(itm => itm.SettledQty),
FisQty=0,
DiffQty=- p.Sum(itm => itm.SettledQty),
Price=p.Sum(itm=>itm.InvoicePrice),
DiffAmt= p.Sum(itm => itm.SettledQty)* p.Sum(itm => itm.InvoicePrice)
}).ToList();
var _sumTotal= new UnInvoiceSettledDetailSum() {
SettleQty = _lsSum.Sum(p => p.SettleQty),
DiffQty = _lsSum.Sum(p => p.DiffQty),
Price = _lsSum.Sum(p => p.Price),
DiffAmt=_lsSum.Sum(p=>p.DiffAmt)
};
_lsSum.Add(_sumTotal);
ExcelExporter _exporter = new ExcelExporter();//导出Excel
//if (_ls.Count > 500000)
//{
//}
//if (_ls.Count > 1000000)
//{
//}
//if (_ls.Count > 1500000)
//{
//}
var result = _exporter.Append(_ls, "差异明细表")
.SeparateBySheet()
.Append(_lsSum, "数量差异汇总表")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), result.Result, true);
//_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
return id.ToString();
}
}
}

12
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs

@ -27,7 +27,6 @@ namespace SettleAccount.Job.Services.Report
var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
@ -35,10 +34,6 @@ namespace SettleAccount.Job.Services.Report
var _ls = new List<UnSettleDiff>();
_ls = _dapper.GetDiffReport(int.Parse(type),year,beginTime,endTime, materialCode,sapCode);
var _id = Guid.NewGuid();
List<UnSettleDiff> _lsExport = new List<UnSettleDiff>();
//foreach (var itm in _ls)
//{
@ -58,14 +53,7 @@ namespace SettleAccount.Job.Services.Report
// //State = itm.State,
// Qty = itm.Qty,
// Version = itm.Version,
// };
// _lsExport.Add(dto);
//}
_outputService.Export<UnSettleDiff>(id, _first, _ls);

20
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -18,10 +18,17 @@ namespace SettleAccount.Job.Services.Report
private readonly UnSettledDetailDapperRepository _dapper;
private readonly OutputService _outputService;
public UnsettledDetailReportService(UnSettledDetailDapperRepository dapper, OutputService outputService)
private readonly ErpPartDapperRepository _erpDapper;
public UnsettledDetailReportService(
UnSettledDetailDapperRepository dapper,
OutputService outputService,
ErpPartDapperRepository erpDapper
)
{
_dapper = dapper;
_outputService = outputService;
_erpDapper = erpDapper;
}
@ -37,8 +44,17 @@ namespace SettleAccount.Job.Services.Report
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version,materailCode,materialGroup,sapcode);
var _ls = _list.Where(p => p.Flag != "L" ).Where(p=>p.MaterialCode!=p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst= _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p =>
{
p.Qty = 1;
}
);
_list.AddRange(_lst);
_list= _list.OrderBy(p => p.ChassisNumber).ThenBy(p => p.SapMaterialCode).ThenBy(p => p.Flag).ToList();
_outputService.Export<UnSettleDetailReport>(id, _first, _list);
return id.ToString();

16
src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -123,13 +123,25 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<InvoiceSettledDetailDiffExportService>();
}
if (key.Equals(typeof(UnSettleDiffExportService).FullName))
if (key.Equals(typeof(UnInvoiceSettledDetailDiffExportService).FullName))
{
return implementationFactory.GetService<UnSettleDiffExportService>();
return implementationFactory.GetService<UnInvoiceSettledDetailDiffExportService>();
}
if (key.Equals(typeof(UnSettleDiffExportService).FullName))
{
return implementationFactory.GetService<UnSettleDiffExportService>();
}
if (key.Equals(typeof(SettleDoorPanelExportService).FullName))
{
return implementationFactory.GetService<SettleDoorPanelExportService>();
}
if (key.Equals(typeof(UnsettledDetailReportService).FullName))
{
return implementationFactory.GetService<UnsettledDetailReportService>();
}
else
{

Loading…
Cancel
Save