Browse Source

不可结算增加买单件导出功能

master
zhouhongjun 10 months ago
parent
commit
7658bfd4be
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
  2. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
  3. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
  4. 95
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  5. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

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

@ -57,7 +57,7 @@ export default function (businessType, type) {
title: "是否退货",
type: "boolean",
},
isMaidan: {
isMaiDan: {
title: "是否买单",
type: "boolean",
},

24
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs

@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Bases;
@ -58,9 +59,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 厂内零件号
/// </summary>
public string PartCode { get; set; }
/// <summary>
///是否退货
/// </summary>
[ExporterHeader(DisplayName = "是否退货")]
public string IsReturn { get; set; }
/// <summary>
/// 是否是买单件
/// </summary>
[ExporterHeader(DisplayName = "是否是买单件")]
public bool IsMaiDan { get; set; }
}
public class BBAC_NOT_SA_DETAIL_EXP_DTO
public class BBAC_NOT_SA_DETAIL_EXP_DTO:EntityDto<Guid>
{
/// <summary>
@ -84,9 +95,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "是否退货")]
public string IsReturn { get; set; }
/// <summary>
/// 是否退货
/// 是否是买单件
/// </summary>
[ExporterHeader(DisplayName = "是否退货")]
[ExporterHeader(DisplayName = "是否是买单件")]
public bool IsMaiDan { get; set; }
[ExporterHeader(DisplayName = "原始生产码")]
public string RealPN { get; set; }
/// <summary>
/// 版本
/// </summary>
[ExporterHeader(DisplayName = "版本")]
public int Version { get; set; }
[ExporterHeader(DisplayName = "单价")]
public decimal Price { get; set; }

27
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs

@ -9,8 +9,10 @@ using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Bases;
using ShardingCore.Extensions;
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases.DomainServices;
@ -58,21 +60,23 @@ namespace Win.Sfs.SettleAccount.Bases
{
var entiy = input.Filters.Where(p => p.Column == "businessType").FirstOrDefault();
var value = entiy.Value;
if (value == "JisBBAC")
{
input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianBBAC" });
}
else
{
input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianHBPO" });
}
//if (value == "JisBBAC")
//{
// input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianBBAC" });
//}
//else
//{
// input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianHBPO" });
//}
input.Filters.Remove(entiy);
}
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false);
var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys);
return new PagedResultDto<TEntityDetailDto>(totalCount, dtos);
}
/// <summary>
@ -87,7 +91,10 @@ namespace Win.Sfs.SettleAccount.Bases
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailExportDto>>(entities);
var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TEntityDetailExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;

95
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -1,9 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Security.Policy;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@ -12,6 +22,8 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
@ -37,6 +49,89 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_bbacNotMng = bbacNotMng;
}
[HttpPost]
//[Route("export")]
public override async Task<string> ExportAsync(BBAC_NOT_SA_DETAIL_REQ_DTO input)
{
var ls = input.Filters.Where(p => p.Column == "businessType").ToList();
if (ls.Count > 0)
{
var entiy = input.Filters.Where(p => p.Column == "businessType").FirstOrDefault();
var value = entiy.Value;
input.Filters.Remove(entiy);
}
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<BBAC_NOT_SA_DETAIL>, List<BBAC_NOT_SA_DETAIL_EXP_DTO>>(entities);
var inner = from d in entities
join p in dtoDetails on d.Id equals p.Id
select
new BBAC_NOT_SA_DETAIL_EXP_DTO()
{
SettleBillNum=d.SettleBillNum,
Site=d.Site,
Category=p.Category,
IsReturn=p.IsReturn,
IsMaiDan=p.IsMaiDan,
RealPN = d.GetProperty("RealPN", ""),
InvGroupNum=p.InvGroupNum,
SettleDate = d.SettleDate,
LU = d.LU,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
KeyCode = d.KeyCode,
Price = p.Price,
};
//dtoDetails.ForEach(dtoDetail =>
//{
// var item= entities.FirstOrDefault(e => e.Id == dtoDetail.Id);
// dtoDetail.RealPN = item.GetProperty("RealPN", "");
//});
var classDisplayName = typeof(BBAC_NOT_SA_DETAIL_EXP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(BBAC_NOT_SA_DETAIL_EXP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;
//switch (input.FileType)
//{
// case 0:
// result = await _csv.ExportAsByteArray(dtoDetails).ConfigureAwait(false);
// break;
// case 1:
// result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false);
// break;
//}
result = await _excel.ExportAsByteArray(inner.ToList()).ConfigureAwait(false);
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
).ConfigureAwait(false);
return _fileName;
}
[HttpPost]
public override async Task<IActionResult> GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input)
{

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

@ -480,6 +480,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
if (bbacNotSaDetails.Count > 0)
{
bbacNotSaDetails.ForEach(bbacNotSaDetail =>
{
if(bbacNotSaDetail.BusinessType==EnumBusinessType.MaiDanJianBBAC)
{
bbacNotSaDetail.IsMaiDan = true;
}
});
await _bbacNotSaDetailRepository.DbContext.BulkInsertAsync(bbacNotSaDetails).ConfigureAwait(false);
}
if (materialRelationships.Count > 0)

Loading…
Cancel
Save