yu.wu 3 years ago
parent
commit
50bac78385
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs
  3. 322
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs
  4. 326
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs
  5. 36
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  6. 171
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  7. 9
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs
  8. 7
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs
  9. 11
      src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs
  10. 85
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  11. 163
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs
  12. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleFisDiffDetailDapperRepository.cs
  13. 159
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs
  14. 175
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  15. 20
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/OutputService.cs
  16. 8
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs
  17. 139
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleFisDiffExportService.cs

2
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSKanBan/IWMSVWKanBanAppService.cs

@ -21,7 +21,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMSKanBan
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
Task<string> WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode); // Task<string> WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode);

4
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/WMSSparePart/IWMSSparePartAppService.cs

@ -17,8 +17,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMSSparePart
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
Task<string> WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, //Task<string> WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId,
string year, string period, string version, string customerCode); // string year, string period, string version, string customerCode);
/// <summary> /// <summary>
/// 按ID获取唯一实体 /// 按ID获取唯一实体

322
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs

@ -0,0 +1,322 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Guids;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.WMSKanBan;
using Win.Sfs.Shared.Filter;
using Shouldly;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.SettleAccount.CommonManagers;
using Volo.Abp;
using Microsoft.AspNetCore.Http;
using Win.Sfs.SettleAccount.ExcelImporter;
using EFCore.BulkExtensions;
using Win.Sfs.SettleAccount.ExportReports;
using Volo.Abp.Domain.Repositories;
using Win.Sfs.SettleAccount.Constant;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
{
/// <summary>
/// 大众看板发货明细
/// </summary>
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
//[AllowAnonymous]
[Route("api/settleaccount/WMSVWKanBan")]
public class WMSKanBanAppService : SettleAccountApplicationBase<WMSKanBanSettle>, IWMSVWKanBanAppService
{
private readonly IGuidGenerator _guidGenerator;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<WMSKanBanVersion, Guid> _versionRepository;
private readonly ISettleAccountBranchEfCoreRepository<WMSKanBanSettle, Guid> _repository;
/// <summary>
/// 构建方法
/// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public WMSKanBanAppService(IGuidGenerator guidGenerator,
ISettleAccountBranchEfCoreRepository<WMSKanBanVersion, Guid> versionRepository,
ISettleAccountBranchEfCoreRepository<WMSKanBanSettle, Guid> repository,
IDistributedCache<WMSKanBanSettle> 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> WMSVWKanBanUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode)
{
if (string.IsNullOrEmpty(version))
{
throw new BusinessException("版本不能空,必须传入!");
}
List<WMSVWKanBanImportDto> listImport = new List<WMSVWKanBanImportDto>();
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<WMSVWKanBanImportDto>(files, _excelImportService);
var entityList = ObjectMapper.Map<List<WMSVWKanBanImportDto>, List<WMSKanBanSettle>>(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.Kanban, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), Kanban = p.Key.Kanban, MaterialCode = p.Key.MaterialCode });
foreach (var itm in _group)
{
if (itm.Count > 1)
{
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板条码号{1}有重复数据,请检查!", itm.MaterialCode, itm.Kanban), string.Empty));
}
}
var _id = GuidGenerator.Create();
var _bomList = new List<WMSKanBanVersion>();
_bomList.Add(new WMSKanBanVersion(_id, branchId, year, period, version, customerCode));
foreach (var itm in entityList)
{
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id);
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
await _repository.GetDbContext().BulkInsertAsync<WMSKanBanSettle>(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<WMSVWKanBanDto> GetAsync(Guid id)
{
var result = await GetFromCacheAsync(id);
var dto = ObjectMapper.Map<WMSKanBanSettle, WMSVWKanBanDto>(result);
return dto;
}
private async Task<WMSKanBanSettle> GetFromCacheAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return result;
}
private async Task<long> GetCountAsync(WMSVWKanBanRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
private async Task<long> GetCountAsync(WMSVWKanBanVersionRequestDto 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(WMSVWKanBanRequestDto 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(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanExportDto>>(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<WMSVWKanBanDto>> GetListAsync(WMSVWKanBanRequestDto 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<WMSVWKanBanDto>(0, new List<WMSVWKanBanDto>());
}
var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanDto>>(entities);
return new PagedResultDto<WMSVWKanBanDto>(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<WMSVWKanBanDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<WMSKanBanSettle>, List<WMSVWKanBanDto>>(entities);
return new ListResultDto<WMSVWKanBanDto>(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<WMSVWKanBanVersionDto>> GetVersionListAsync(WMSVWKanBanVersionRequestDto 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<WMSKanBanVersion>, List<WMSVWKanBanVersionDto>>(entities);
return new PagedResultDto<WMSVWKanBanVersionDto>(totalCount, dtos);
}
}
}

326
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs

@ -0,0 +1,326 @@
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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
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.Entities.WMSSparePart;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.Filter;
using Shouldly;
namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
{
/// <summary>
/// 大众备件服务
/// </summary>
[Route("api/settleaccount/WMSSparePart")]
public class WMSSparePartAppService : SettleAccountApplicationBase<WMSSparePart>, IWMSSparePartAppService
{
private readonly IGuidGenerator _guidGenerator;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<WMSSparePartVersion, Guid> _versionRepository;
private readonly ISettleAccountBranchEfCoreRepository<WMSSparePart, Guid> _repository;
/// <summary>
/// 构建方法
/// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public WMSSparePartAppService(IGuidGenerator guidGenerator,
ISettleAccountBranchEfCoreRepository<WMSSparePartVersion, Guid> versionRepository,
ISettleAccountBranchEfCoreRepository<WMSSparePart, Guid> repository,
IDistributedCache<WMSSparePart> 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> WMSSparePartUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode)
{
if (string.IsNullOrEmpty(version))
{
throw new BusinessException("版本不能空,必须传入!");
}
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<WMSSparePartImportDto>(files, _excelImportService);
var entityList = ObjectMapper.Map<List<WMSSparePartImportDto>, List<WMSSparePart>>(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.LineNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), LineNumber = p.Key.LineNumber, MaterialCode = p.Key.MaterialCode });
foreach (var itm in _group)
{
if (string.IsNullOrEmpty(itm.MaterialCode))
{
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的行号为{0}的物料代码为空,请检查!", itm.LineNumber), string.Empty));
}
}
var _id = GuidGenerator.Create();
var _bomList = new List<WMSSparePartVersion>();
_bomList.Add(new WMSSparePartVersion(_id, branchId, year, period, version, customerCode));
foreach (var itm in entityList)
{
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version);
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
await _repository.GetDbContext().BulkInsertAsync<WMSSparePart>(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<WMSSparePartDto> GetAsync(Guid id)
{
var result = await GetFromCacheAsync(id);
var dto = ObjectMapper.Map<WMSSparePart, WMSSparePartDto>(result);
return dto;
}
private async Task<WMSSparePart> GetFromCacheAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return result;
}
private async Task<long> GetCountAsync(WMSSparePartRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
private async Task<long> GetCountAsync(WMSSparePartVersionRequestDto 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(WMSSparePartRequestDto input)
{
if (string.IsNullOrEmpty(input.Version))
{
throw new BusinessException("版本不能空,必须传入!");
}
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<WMSSparePart>, List<WMSSparePartExportDto>>(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<WMSSparePartDto>> GetListAsync(WMSSparePartRequestDto 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<WMSSparePartDto>(0, new List<WMSSparePartDto>());
}
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<WMSSparePart>, List<WMSSparePartDto>>(entities);
return new PagedResultDto<WMSSparePartDto>(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<WMSSparePartDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<WMSSparePart>, List<WMSSparePartDto>>(entities);
return new ListResultDto<WMSSparePartDto>(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<WMSSparePartVersionDto>> GetVersionListAsync(WMSSparePartVersionRequestDto 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<WMSSparePartVersion>, List<WMSSparePartVersionDto>>(entities);
return new PagedResultDto<WMSSparePartVersionDto>(totalCount, dtos);
}
}
}

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

@ -55,10 +55,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
ISettleAccountBranchEfCoreRepository<SettlementPartVersion, Guid> settlementPartVersionrepository, ISettleAccountBranchEfCoreRepository<SettlementPartVersion, Guid> settlementPartVersionrepository,
ISettleAccountBranchEfCoreRepository<FISVersion, Guid> fisVersionrepository, ISettleAccountBranchEfCoreRepository<FISVersion, Guid> fisVersionrepository,
ISettleAccountBranchEfCoreRepository<ItemInvoicePriceVersion, Guid> itemInvoicePriceVersionrepository, ISettleAccountBranchEfCoreRepository<ItemInvoicePriceVersion, Guid> itemInvoicePriceVersionrepository,
//ISettleAccountBranchEfCoreRepository<Material, Guid> materialRepository,
//ISettleAccountBranchEfCoreRepository<InvoiceSettledDiff, Guid> repository,
//ISettleAccountBranchEfCoreRepository<InvoiceSettledDiffVersion, Guid> versionRepository,
//IDistributedCache<InvoiceSettledDiff> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
//ISnowflakeIdGenerator snowflakeIdGenerator, //ISnowflakeIdGenerator snowflakeIdGenerator,
//ICommonManager commonManager, //ICommonManager commonManager,
@ -197,7 +194,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
/// <summary> /// <summary>
/// 导入功能 /// 1.大众发票与结算核对汇总表
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
@ -225,14 +222,14 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" });
customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() });
var _taskid = await _service.ExportEnqueueAsync("结算与开票数据对比", ExportExtentsion.Excel, CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("大众发票与结算核对汇总表", ExportExtentsion.Excel, CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) =>
{ {
}); });
return _taskid; return _taskid;
} }
/// <summary> /// <summary>
/// 导入功能 /// 3.大众准时化结算数量差异比对表
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
@ -254,9 +251,34 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
} }
/// <summary>
///6.大众准时化未结差异比对表
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("UnSettleDiffExport-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnSettleDiffExportServiceMake(string version, string materialCode, string begin, string end)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode });
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = begin });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end });
var _taskid = await _service.ExportEnqueueAsync("大众准时化未结差异比对表", ExportExtentsion.Excel, CurrentUser, typeof(UnSettleDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}

171
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -1739,6 +1739,166 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService">
<summary>
大众看板发货明细
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.#ctor(Volo.Abp.Guids.IGuidGenerator,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanVersion,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanSettle,System.Guid},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanSettle},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.WMS_KanBan.WMSKanBanAppService.WMSVWKanBanUploadExcelImport(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.WMS_KanBan.WMSKanBanAppService.GetAsync(System.Guid)">
<summary>
按ID获取唯一实体
</summary>
<remarks>
返回实体全部属性
</remarks>
<param name="id">ID</param>
<returns>实体DTO</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.ExportAsync(Win.Sfs.SettleAccount.Entities.WMSKanBan.WMSVWKanBanRequestDto)">
<summary>
导出文件
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.GetListAsync(Win.Sfs.SettleAccount.Entities.WMSKanBan.WMSVWKanBanRequestDto)">
<summary>
根据筛选条件获取实体列表
</summary>
<remarks>
请求条件包括:筛选条件列表,排序条件,数据数量,页码
</remarks>
<param name="input">请求条件</param>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.GetTotalCountAsync(System.Guid)">
<summary>
获取实体总数
</summary>
<returns>实体总数</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.GetAllAsync(System.Guid)">
<summary>
获取全部实体列表
</summary>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.DeleteAsync(System.Guid)">
<summary>
删除实体
</summary>
<param name="id">ID</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanAppService.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.WMS_KanBan.WMSKanBanAppService.GetVersionListAsync(Win.Sfs.SettleAccount.Entities.WMSKanBan.WMSVWKanBanVersionRequestDto)">
<summary>
版本列表查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService">
<summary>
大众备件服务
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.#ctor(Volo.Abp.Guids.IGuidGenerator,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartVersion,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePart,System.Guid},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePart},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.WMS_SparePart.WMSSparePartAppService.WMSSparePartUploadExcelImport(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.WMS_SparePart.WMSSparePartAppService.GetAsync(System.Guid)">
<summary>
按ID获取唯一实体
</summary>
<remarks>
返回实体全部属性
</remarks>
<param name="id">ID</param>
<returns>实体DTO</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.ExportAsync(Win.Sfs.SettleAccount.Entities.WMSSparePart.WMSSparePartRequestDto)">
<summary>
导出文件
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.GetListAsync(Win.Sfs.SettleAccount.Entities.WMSSparePart.WMSSparePartRequestDto)">
<summary>
根据筛选条件获取实体列表
</summary>
<remarks>
请求条件包括:筛选条件列表,排序条件,数据数量,页码
</remarks>
<param name="input">请求条件</param>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.GetTotalCountAsync(System.Guid)">
<summary>
获取实体总数
</summary>
<returns>实体总数</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.GetAllAsync(System.Guid)">
<summary>
获取全部实体列表
</summary>
<returns>实体DTO列表</returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.DeleteAsync(System.Guid)">
<summary>
删除实体
</summary>
<param name="id">ID</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePartAppService.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.WMS_SparePart.WMSSparePartAppService.GetVersionListAsync(Win.Sfs.SettleAccount.Entities.WMSSparePart.WMSSparePartVersionRequestDto)">
<summary>
版本列表查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Win.Sfs.SettleAccount.FISes.FISAppService"> <member name="T:Win.Sfs.SettleAccount.FISes.FISAppService">
<summary> <summary>
区域相关应用服务 区域相关应用服务
@ -2289,18 +2449,25 @@
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary> <summary>
导入功能 1.大众发票与结算核对汇总表
</summary> </summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param> <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleFisDiffExportMake(System.String,System.String,System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleFisDiffExportMake(System.String,System.String,System.String,System.String)">
<summary> <summary>
导入功能 3.大众准时化结算数量差异比对表
</summary> </summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param> <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettleDiffExportServiceMake(System.String,System.String,System.String,System.String)">
<summary>
6.大众准时化未结差异比对表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledPartAndErpPartPriceDiffMake(System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledPartAndErpPartPriceDiffMake(System.String,System.String)">
<summary> <summary>
结算总成和ERP总成价格对比 结算总成和ERP总成价格对比

9
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs

@ -3,9 +3,18 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
namespace Win.Sfs.SettleAccount.Entities namespace Win.Sfs.SettleAccount.Entities
{ {
public class CacheManager
{
public static List<Material> CacheMaterials { set; get; }
public static List<PriceList> CachePriceList { set; get; }
}
public interface ISettleAccountEntityBase public interface ISettleAccountEntityBase
{ {
public string Version { set; get; } public string Version { set; get; }

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

@ -12,14 +12,11 @@ namespace Win.Sfs.SettleAccount.Entities.UnSettle
{ {
[ExporterHeader(DisplayName = "结算平台未结数量 ")] [ExporterHeader(DisplayName = "结算平台未结数量 ")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
[ExporterHeader(DisplayName = "漏结标识 ")] [ExporterHeader(DisplayName = "漏结标识 ")]
public string Flag { set; get; } public string Flag { set; get; }
[ExporterHeader(DisplayName = "漏结期间 ")] [ExporterHeader(DisplayName = "漏结期间 ")]
public string UNSettleVersion { set; get; } public string UnSettleVersion { set; get; }
[ExporterHeader(DisplayName = "说明 ")] [ExporterHeader(DisplayName = "说明 ")]
public string Remark { set; get; } public string Remark { set; get; }

11
src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Reports namespace Win.Sfs.SettleAccount.Reports
{ {
public class ReportDetailBase public class ReportDetailBase
{ {
[ExporterHeader(DisplayName = "交货单号 ")] [ExporterHeader(DisplayName = "交货单号 ")]
@ -17,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Reports
public string KENNCode { set; get; } public string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")] [ExporterHeader(DisplayName = "底盘号")]
public string ChassisNumber { set; get; } public string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "M100交货状态 ")] [ExporterHeader(DisplayName = "交货状态 ")]
public string WmsState { set; get; } public string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")] [ExporterHeader(DisplayName = "物料号")]
public string SapMaterialCode { set; get; } public string SapMaterialCode { set; get; }
@ -26,13 +27,15 @@ namespace Win.Sfs.SettleAccount.Reports
[ExporterHeader(DisplayName = "客户物料 ")] [ExporterHeader(DisplayName = "客户物料 ")]
public string MaterialCode { set; get; } public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料 ")] [ExporterHeader(DisplayName = "组件组物料 ")]
public string ParentMaterialCode { set; get; } public string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述 ")] [ExporterHeader(DisplayName = "组件组物料描述 ")]
public string ParentMaterialDesc { set; get; } public string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")] [ExporterHeader(DisplayName = "物料组(车型) ")]
public string MaterialGroup { set; get; } public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
} }

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

@ -0,0 +1,85 @@
using Dapper;
using Magicodes.ExporterAndImporter.Core;
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.Entities;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
/// <summary>
/// 主数据Dapper表
/// </summary>
public class ErpPartDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public ErpPartDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual List<T> GetDiffReport<T>(List<T> childList) where T : ReportDetailBase, new()
{
List<Material> _materialList = new List<Material>();
List<PriceList> _priceList = new List<PriceList>();
if (CacheManager.CacheMaterials != null)
{
_materialList = CacheManager.CacheMaterials;
}
else
{
_materialList = DbConnection.Query<Material>("select * from set_material").ToList();
}
if (CacheManager.CachePriceList != null)
{
_priceList = CacheManager.CachePriceList;
}
else
{
_priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
}
List<T> _list = new List<T>();
foreach (var itm in childList)
{
var parentMaterial = new T();
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;
}
}
}

163
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs

@ -20,74 +20,117 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob
public virtual List<InvoiceSettledDiff> GetInvoiceSettledDiffReportList(string version,string year, string tablename ,string materialcode) public virtual List<InvoiceSettledDiff> GetInvoiceSettledDiffReportList(string version,string year, string tablename ,string materialcode)
{ {
//string str = string.Empty;
//str += " where 1=1 ";
////if (!string.IsNullOrEmpty(year)) // string sqlString =
////{ //"SELECT \n" + string.Format(" '{0}' as Version ,", version) + "\n" +
//// str += string.Format(" and year='{0}' ", year); //" b.*,\n" +
////} //" ISnull(\n" +
//if (!string.IsNullOrEmpty(version)) //" c.Qty,\n" +
//{ //" IsNull( d.qty, 0 )) SettleQty,\n" +
// str += string.Format(" and version='{0}' ", version); //"CASE\n" +
//} //" \n" +
//" WHEN e.Type = 'CP7报废' THEN\n" +
//" isnull( e.Qty, 0 ) ELSE 0 \n" +
//// string sqlString = "select "+ string.Format(" {0} as Version ,",version) + "a.MaterialCode,isnull(b.qty,0) InvoiceQty,isnull(c.qty,0) SettleQty, (isnull(b.qty,0)-isnull(c.qty,0)) as DiffQty from (\n" + //" END AS CP7ScrapQty,\n" +
//// " select distinct MaterialCode from( \n"+ //"CASE\n" +
////"select distinct MaterialCode from Set_Invoice {0}\n" + //" \n" +
//// "union all\n" + //" WHEN e.Type = '索赔' THEN\n" +
//// "select distinct MaterialCode from {1} {0}\n" + //" isnull( e.Qty, 0 ) ELSE 0 \n" +
//// ") temp \n"+ //" END AS ClaimQty,\n" +
//// ") as a\n" + //" (\n" +
//// "left join\n" + //" b.InvoiceQty - ISnull(\n" +
//// "\n" + //" c.Qty,\n" +
//// "(select SUM(QTY) qty,MaterialCode from Set_Invoice {0} GROUP BY MaterialCode) b on a.MaterialCode=b.MaterialCode\n" + //" IsNull( d.qty, 0 ))) DiffQty,\n" +
//// "\n" + //" Isnull( f.Price, 0 ) SalePrice,\n" +
//// "left join\n" + //" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
//// "(select SUM(QTY) qty,MaterialCode from {1} {0} GROUP BY MaterialCode) c on a.MaterialCode=c.MaterialCode"; //" '' AS SapMaterialCode \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" Factory, MaterialCode,\n" +
//" SUM( QTY ) InvoiceQty,\n" +
//" sum( amt ) InvoiceAmt,\n" +
//" sum( amt )/ sum( Qty ) InvoicePrice \n" +
//" FROM\n" +
//" Set_Invoice \n" +
//" WHERE\n" +
//" version = '{0}' \n" +
//" GROUP BY\n" +
//" MaterialCode,Factory \n" +
//" ) b\n" +
//" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode";
string sqlString = string sqlString =
"SELECT \n" + string.Format(" '{0}' as Version ,", version) + "\n" + "SELECT\n" +
" b.*,\n" + " temp1.*, temp1.InvoicePrice - Isnull( temp2.Price, 0 ) DiffPrice , \n" +
" ISnull(\n" + " temp2.Price SalePrice\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 )) SettleQty,\n" +
"CASE\n" +
" \n" +
" WHEN e.Type = 'CP7报废' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS CP7ScrapQty,\n" +
"CASE\n" +
" \n" +
" WHEN e.Type = '索赔' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS ClaimQty,\n" +
" (\n" +
" b.InvoiceQty - ISnull(\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 ))) DiffQty,\n" +
" Isnull( f.Price, 0 ) SalePrice,\n" +
" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
" '' AS SapMaterialCode \n" +
"FROM\n" + "FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" Factory, MaterialCode,\n" + string.Format(" '{0}' as Version ,", version)+"\n" +
" SUM( QTY ) InvoiceQty,\n" + " b.*,\n" +
" sum( amt ) InvoiceAmt,\n" + " ISnull(\n" +
" sum( amt )/ sum( Qty ) InvoicePrice \n" + " c.Qty,\n" +
" IsNull( d.qty, 0 )) SettleQty,\n" +
" CASE\n" +
" \n" +
" WHEN e.Type = 'CP7报废' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS CP7ScrapQty,\n" +
" CASE\n" +
" \n" +
" WHEN e.Type = '索赔' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS ClaimQty,\n" +
" (\n" +
" b.InvoiceQty - ISnull(\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 ))) DiffQty,\n" +
//" Isnull( f.Price, 0 ) SalePrice,\n" +
//" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
" g.MaterialCode AS SapMaterialCode,\n" +
" g.MaterialDesc AS MaterialDesc \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" Factory,\n" +
" MaterialCode,\n" +
" SUM( QTY ) InvoiceQty,\n" +
" sum( amt ) InvoiceAmt,\n" +
" sum( amt )/ sum( Qty ) InvoicePrice \n" +
" FROM\n" +
" Set_Invoice \n" +
" WHERE\n" +
" version = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Factory \n" +
" ) b\n" +
" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" +
" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode\n" +
" LEFT JOIN Set_material g ON b.MaterialCode = g.CustomerPartCode \n" +
" ) temp1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" + " FROM\n" +
" Set_Invoice \n" + " Set_PriceList \n" +
" WHERE\n" + " WHERE\n" +
" version = '{0}' \n" + " version =(\n" +
" GROUP BY\n" + " SELECT\n" +
" MaterialCode,Factory \n" + " max( version ) \n" +
" ) b\n" + " FROM\n" +
" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" + " Set_PriceListVersion \n" +
" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" + " )) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode";

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleFisDiffDetailDapperRepository.cs

@ -46,6 +46,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string SapCode { set; get; } public string SapCode { set; get; }
} }
[ExcelExporter(Name = "未结汇总", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
public class SettleFisDiffSum public class SettleFisDiffSum
{ {

159
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs

@ -32,6 +32,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
/// <summary>
/// 6.大众准时化未结差异比对表
/// </summary>
public class UnSettleDiffDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency public class UnSettleDiffDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{ {
public UnSettleDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) public UnSettleDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
@ -44,71 +47,125 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string str1 = "where 1=1 "; string str1 = "where 1=1 ";
string sql1 = "SELECT\n" +
" a.MaterialCode,\n" + string sql1 = "SELECT\n" +
" a.KENNCode,\n" + " a.MaterialCode,\n" +
" a.ChassisNumber,\n" + " a.KENNCode,\n" +
" a.qty unsettleQty,\n" + " a.ChassisNumber,\n" +
" b.qty \n" + " a.qty UNSettleQty,\n" +
" a.Cp5Time \n"+ " b.qty,\n" +
" a.CP5A CP5Time,\n" +
"FROM\n" + " c.MaterialCode SapMaterialCode,\n" +
" Set_unsettle a\n" + " c.MaterialDesc MaterialDesc,\n" +
" LEFT JOIN (\n" + " a.model Factory \n" +
" SELECT\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" sum( qty ) qty \n" +
" FROM\n" +
" Set_fis \n" +
" WHERE\n" +
" state = 0 \n" +
" OR state = 4 \n" +
" GROUP BY\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2 \n" +
" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" AND a.KENNCode = b.KENNCode {0}";
string sql2 =
"SELECT\n" +
" a.*,\n" +
" b.Qty unsettleQty \n" +
"FROM\n" + "FROM\n" +
" (\n" + " Set_unsettle a\n" +
" LEFT JOIN (\n" +
" SELECT\n" + " SELECT\n" +
" WMSState,\n" +
" WMSBillNum,\n" +
" ItemCode,\n" + " ItemCode,\n" +
" KENNCode,\n" + " KENNCode,\n" +
" ChassisNumber2,\n" + " ChassisNumber2,\n" +
" sum( qty ) qty,\n" + " sum( qty ) qty \n" +
" ErpMaterialCode,\n" +
" ChassisNumber \n" +
" FROM\n" + " FROM\n" +
" Set_fis \n" + " Set_fis \n" +
" WHERE\n" + " WHERE\n" +
" state = 0 \n" + " state = 0 \n" +
" OR state = 4 \n" +
" GROUP BY\n" + " GROUP BY\n" +
" ItemCode,\n" + " ItemCode,\n" +
" KENNCode,\n" + " KENNCode,\n" +
" ChassisNumber2,\n" + " ChassisNumber2,\n" +
" WMSState,\n" + " Model \n" +
" WMSBillNum,\n" + " ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" ErpMaterialCode,\n" + " AND a.MaterialCode = b.ItemCode \n" +
" ChassisNumber \n" + " AND a.KENNCode = b.KENNCode\n" +
" Cp5Time \n" + " LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode {0}";
" ) a\n" +
" LEFT JOIN Set_unsettle b ON a.ChassisNumber2 = b.ChassisNumber \n" +
" AND b.MaterialCode = a.ItemCode \n" +
" AND a.KENNCode = b.KENNCode {0}"; string sql2 =
"SELECT\n" +
" t1.*,\n" +
" t1.Qty * T2.Price AMT,\n" +
" T2.Price,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 )) DiffQty,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 ))* isnull( t2.Price, 0 ) DiffPrice \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.WMSState,\n" +
" temp1.WMSBillNum,\n" +
" temp1.MaterialCode,\n" +
" temp1.KENNCode,\n" +
" temp1.ChassisNumber2,\n" +
" temp1.Qty,\n" +
" temp1.ChassisNumber,\n" +
" temp1.CP5Time,\n" +
" temp1.UnSettleQty,\n" +
" temp1.SapMaterialCode,\n" +
" temp1.MaterialDesc,\n" +
" temp1.MaterialGroup,\n" +
" temp2.MaterialCode AS ParentSapMaterialCode,\n" +
" temp2.MaterialDesc AS ParentMaterialDesc \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.WMSState,\n" +
" a.WMSBillNum,\n" +
" a.MaterialCode,\n" +
" a.KENNCode,\n" +
" a.ChassisNumber2,\n" +
" a.Qty,\n" +
" a.ParentCode,\n" +
" a.ChassisNumber,\n" +
" a.CP5Time,\n" +
" b.Qty AS UnSettleQty,\n" +
" C.MaterialCode AS SapMaterialCode,\n" +
" C.MaterialDesc,\n" +
" C.EstimateTypeDesc AS MaterialGroup \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" WMSState,\n" +
" WMSBillNum,\n" +
" ItemCode AS MaterialCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" SUM( Qty ) AS Qty,\n" +
" ErpMaterialCode AS ParentCode,\n" +
" ChassisNumber,\n" +
" CP5Time \n" +
" FROM\n" +
" Set_fis \n" +
" WHERE\n" +
" ( State = 0 ) \n" +
" GROUP BY\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" WMSState,\n" +
" WMSBillNum,\n" +
" ErpMaterialCode,\n" +
" ChassisNumber,\n" +
" CP5Time \n" +
" ) AS a\n" +
" LEFT OUTER JOIN Set_Unsettle AS b ON a.ChassisNumber2 = b.ChassisNumber \n" +
" AND b.MaterialCode = a.MaterialCode \n" +
" AND a.KENNCode = b.KENNCode\n" +
" LEFT OUTER JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN Set_material AS temp2 ON temp1.ParentCode = temp2.CustomerPartCode \n" +
" ) t1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" MaterialCode,\n" +
" Price \n" +
" FROM\n" +
" Set_PriceList \n" +
"WHERE\n" +
" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.MaterialCode = t2.MaterialCode";
string _sql = string.Empty; string _sql = string.Empty;

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

@ -11,18 +11,23 @@ using Dapper;
using Win.Sfs.SettleAccount.FISes; using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto;
using Win.Sfs.SettleAccount.Entities.UnSettle; using Win.Sfs.SettleAccount.Entities.UnSettle;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
/// <summary>
/// 7.大众准时化未结明细表(包含漏结,漏结要有标识)
/// </summary>
public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{ {
//ERP总成开票报表
public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }
public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version,string materialCode,string materialGroup,string sapCode) public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{ {
string str = string.Empty; string str = string.Empty;
@ -30,7 +35,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
if (!string.IsNullOrEmpty(begin)) if (!string.IsNullOrEmpty(begin))
{ {
str += string.Format(" and beginTime>'{0}' ",begin); str += string.Format(" and beginTime>'{0}' ", begin);
} }
if (!string.IsNullOrEmpty(end)) if (!string.IsNullOrEmpty(end))
{ {
@ -38,81 +43,113 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
if (!string.IsNullOrEmpty(materialCode)) if (!string.IsNullOrEmpty(materialCode))
{ {
str += string.Format(" and MaterialCode='{0}' ", materialCode); str += string.Format(" and ItemCode='{0}' ", materialCode);
} }
if (!string.IsNullOrEmpty(materialGroup)) if (!string.IsNullOrEmpty(materialGroup))
{ {
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
} }
if (!string.IsNullOrEmpty(sapCode)) //if (!string.IsNullOrEmpty(sapCode))
{ //{
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); // str += string.Format(" and SapCode='{0}' ", materialGroup);
} //}
var sqlString = var sqlString =
" SELECT\n" + "SELECT\n" +
" A.*,\n" + " A.*,\n" +
" C.Price,\n" + " C.Price,\n" +
" ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT \n" + " ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT,\n" +
"FROM\n" + " B.EstimateTypeDesc MaterialGroup,\n" +
" (\n" + " B.MaterialDesc MaterialDesc,\n" +
" SELECT DISTINCT\n" + " d.MaterialDesc ParentMaterialDesc \n" +
" '' WMSState,\n" + "FROM\n" +
" '' UnSettleVersion,\n" + " (\n" +
" '' WMSBillNum,\n" + " SELECT\n" +
" BeginTime CP5Time,\n" + " WMSState,\n" +
" ErpMaterialCode MaterialCode,\n" + " WMSBillNum,\n" +
" ChassisNumber,\n" + " UnSettleVersion,\n" +
" KENNCode,\n" + " BeginTime CP5Time,\n" +
" 1 QTY,\n" + " ItemCode MaterialCode,\n" +
" ErpMaterialCode ParentMaterialCode,\n" + " ChassisNumber,\n" +
" '' FLAG \n" + " KENNCode,\n" +
" FROM\n" + " QTY,\n" +
" Set_fis \n" + " ErpMaterialCode ParentSapMaterialCode,\n" +
" WHERE\n" + " '' FLAG \n" +
" 1 = 1 \n" + " FROM\n" +
" AND STATE = 0 {0} UNION ALL\n" + " Set_fis {0} \n" +
" SELECT\n" + " WHERE\n" +
" WMSState,\n" + " 1 = 1 \n" +
" UnSettleVersion,\n" + " AND STATE = 0 UNION ALL\n" +
" WMSBillNum,\n" + " SELECT\n" +
" BeginTime CP5Time,\n" + " WMSState,\n" +
" ItemCode MaterialCode,\n" + " UnSettleVersion,\n" +
" ChassisNumber,\n" + " WMSBillNum,\n" +
" KENNCode,\n" + " BeginTime CP5Time,\n" +
" QTY,\n" + " ItemCode MaterialCode,\n" +
" ErpMaterialCode,\n" + " ChassisNumber,\n" +
" '' FLAG \n" + " KENNCode,\n" +
" FROM\n" + " QTY,\n" +
" [Set_fis] \n" + " ErpMaterialCode ParentSapMaterialCode,\n" +
" WHERE\n" + " 'L' FLAG \n" +
" 1 = 1 \n" + " FROM\n" +
" AND STATE = 0 {0} UNION ALL\n" + " Set_fis {0} \n" +
" SELECT\n" + " WHERE\n" +
" WMSState,\n" + " 1 = 1 \n" +
" UnSettleVersion,\n" + " AND STATE = 4 \n" +
" WMSBillNum,\n" + " ) A\n" +
" BeginTime CP5Time,\n" + " LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode\n" +
" ItemCode MaterialCode,\n" + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode\n" +
" ChassisNumber,\n" + " LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode";
" KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode,\n" +
" 'L' FLAG \n" +
" FROM\n" +
" [Set_fis] \n" +
" WHERE\n" +
" 1 = 1 \n" + var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
" AND STATE = 4 {0}\n" + var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
" ) A\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode";
string _sql = string.Format(sqlString, str);
string _sql = string.Format(sqlString, version);
; ;
var _query = DbConnection.Query<UnSettleDetailReport>(_sql); var _query = DbConnection.Query<UnSettleDetailReport>(_sql);
return _query.ToList();
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;
} }
} }
} }

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

@ -57,8 +57,26 @@ namespace SettleAccount.Job.Services
_taskjobRepository.UpdateTaskJob(Id, _task); _taskjobRepository.UpdateTaskJob(Id, _task);
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
} }
public void Export<T1,T2>(Guid Id, string fileName, List<T1> p_list, List<T2> p_list1) where T1 : class, new()
where T2: class, new()
{
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter
.Append(p_list, "sheet1")
.SeparateBySheet()
.Append(p_list1)
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(fileName, result.Result, true);
var _task = new Win.Sfs.SettleAccount.Entities.TaskJob() { DownFileName = fileName };
_taskjobRepository.UpdateTaskJob(Id, _task);
//保存导出文件到服务器存成二进制
}

8
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs

@ -70,8 +70,12 @@ namespace SettleAccount.Job.Services
SalePrice =itm. SalePrice , SalePrice =itm. SalePrice ,
DiffPrice =itm. DiffPrice , DiffPrice =itm. DiffPrice ,
SapMaterialCode =itm.SapMaterialCode , SapMaterialCode =itm.SapMaterialCode ,
Factory = itm.Factory MaterialDesc=itm.MaterialDesc,
Factory = itm.Factory,

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

@ -1,5 +1,8 @@
using System; using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -12,12 +15,18 @@ using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
/// <summary>
/// 3.大众准时化结算数量差异比对表
/// </summary>
public class SettleFisDiffExportService : ITransientDependency, IExportJob public class SettleFisDiffExportService : ITransientDependency, IExportJob
{ {
private readonly SettleFisDiffDetailDapperRepository _dapper; private readonly SettleFisDiffDetailDapperRepository _dapper;
private readonly OutputService _outputService; private readonly OutputService _outputService;
public SettleFisDiffExportService(SettleFisDiffDetailDapperRepository dapper, OutputService outputService) public SettleFisDiffExportService(SettleFisDiffDetailDapperRepository dapper, OutputService outputService)
{ {
_dapper = dapper; _dapper = dapper;
@ -33,7 +42,7 @@ namespace SettleAccount.Job.Services.Report
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _list= _dapper.GetReportList(version, materialCode, begin,end); var _list= _dapper.GetReportList(version, materialCode, begin,end);
_list.GroupBy(p => new { p.MaterialCode,p.SapCode }).Select(p =>new SettleFisDiffSum var _ls= _list.GroupBy(p => new { p.MaterialCode,p.SapCode }).Select(p =>new SettleFisDiffSum
{ {
MaterialCode= p.Key.MaterialCode, MaterialCode= p.Key.MaterialCode,
@ -46,18 +55,132 @@ namespace SettleAccount.Job.Services.Report
}); });
//_outputService.Export(id, string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()),_list.ToList(),_ls.ToList());
_outputService.Export<SettleFisDiffSum>(id, string.Format("大众准时化结算数量合计_{0}.xlsx", Guid.NewGuid().ToString()), _ls.ToList());
_outputService.Export<SettleFisDiffDetail>(id,string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
/// <summary>
/// 将数个Excel文件中的第一个工作表合并至一个Excel文件中
/// </summary>
/// <param name="excelFilePaths">需要合并的数个Excel文件路径</param>
/// <param name="desFilePath">合并成的一个Excel文件路径</param>
private void MergeExcels(string[] excelFilePaths, string desFilePath)
{
XSSFWorkbook mergeWorkBook = new XSSFWorkbook();
for (int i = 0; i < excelFilePaths.Length; i++)
{
if (File.Exists(excelFilePaths[i]))
{
using (FileStream fs = new FileStream(excelFilePaths[i], FileMode.Open, FileAccess.Read, FileShare.Write))
{
XSSFWorkbook tmpWorkBook = new XSSFWorkbook(fs);
XSSFSheet tmpSheet = tmpWorkBook.GetSheetAt(0) as XSSFSheet;
if (excelFilePaths[i].Contains("当月结算表"))
{
IRow row = null;
for (int j = 2; j < tmpSheet.PhysicalNumberOfRows && tmpSheet.GetRow(j) != null; j++)/*j=1 从索引的第一行开始过滤掉表头*/
{
row = tmpSheet.GetRow(j);
try
{
if (!string.IsNullOrWhiteSpace(row.GetCell(1).ToString()))/*验证数值非空*/
{
//cell.CSS("color:red;font-weight:bold;font-size:11;font-name:宋体;border-type:thin;")
/*修改样式关键代码*/
ICellStyle style = tmpWorkBook.CreateCellStyle();
style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Orange.Index;
style.FillPattern = FillPattern.SolidForeground;
style.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Orange.Index;
style.BorderTop = BorderStyle.Thin;//上
style.BorderBottom = BorderStyle.Thin;//下
style.BorderLeft = BorderStyle.Thin;//左
style.BorderRight = BorderStyle.Thin;//右
style.VerticalAlignment = VerticalAlignment.Center;
style.Alignment = HorizontalAlignment.Center;
IFont font = tmpWorkBook.CreateFont();
font.FontHeightInPoints = 10; // 字体大小 直接对应Excel中的字体大小
font.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
font.IsBold = true;//加粗
style.SetFont(font);
/*修改指定单元格样式 如果要修改行样式则需要将row.Cells.Count循环出来,挨个设置!*/
for (int g = 0; g < row.Cells.Count; g++)
{
row.Cells[g].CellStyle = style;
}
row.RowStyle = style;
if (row.GetCell(1).ToString() == "核算表不存在")
{
ICellStyle style1 = tmpWorkBook.CreateCellStyle();
style1.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
style1.FillPattern = FillPattern.SolidForeground;
style1.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
style1.BorderTop = BorderStyle.Thin;//上
style1.BorderBottom = BorderStyle.Thin;//下
style1.BorderLeft = BorderStyle.Thin;//左
style1.BorderRight = BorderStyle.Thin;//右
style1.VerticalAlignment = VerticalAlignment.Center;
style1.Alignment = HorizontalAlignment.Center;
IFont font1 = tmpWorkBook.CreateFont();
font1.FontHeightInPoints = 10; // 字体大小 直接对应Excel中的字体大小
font1.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
font1.IsBold = true;//加粗
font1.Color = NPOI.HSSF.Util.HSSFColor.White.Index;
style1.SetFont(font);
//style.fon
//HSSFFont font = workbookAll.CreateFont();
//font.FontHeightInPoints = 9; // 字体大小 直接对应Excel中的字体大小
//font.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
//font.Boldweight = HSSFFont.BOLDWEIGHT_BOLD;//加粗
//style.SetFont(font);
/*修改指定单元格样式 如果要修改行样式则需要将row.Cells.Count循环出来,挨个设置!*/
for (int g = 0; g < row.Cells.Count; g++)
{
row.Cells[g].CellStyle = style1;
}
row.RowStyle = style1;
}
/*重新修改文件指定单元格样式*/
}
}
catch
{ }
}
}
tmpSheet.CopyTo(mergeWorkBook, Path.GetFileNameWithoutExtension(excelFilePaths[i]), true, true);
}
}
/* 考虑数据量,此处可以限制最多可以合并工作表的数量 */
//if (mergeWorkBook.NumberOfSheets >= 200)
//{
// break;
//}
}
if (mergeWorkBook.NumberOfSheets != 0)
{
FileStream fsDesFile = new FileStream(desFilePath, FileMode.OpenOrCreate, FileAccess.Write);
mergeWorkBook.Write(fsDesFile);
fsDesFile.Close();
mergeWorkBook.Close();
}
else
{
mergeWorkBook.Close();
}
}
_outputService.Export<SettleFisDiffDetail>(id,string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
} }
} }

Loading…
Cancel
Save