From 7658bfd4be5fbdb223be18e225a4f172807dc0b0 Mon Sep 17 00:00:00 2001
From: zhouhongjun <565221961@qq.com>
Date: Wed, 17 Jan 2024 11:08:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=BB=93=E7=AE=97=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E4=B9=B0=E5=8D=95=E4=BB=B6=E5=AF=BC=E5=87=BA=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wwwroot/models/settle/detail.js | 2 +-
.../Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs | 24 ++++-
.../Bases/NOT_SA_SERVICE.cs | 27 ++++--
.../Entities/BQ/BBAC_NOT_SA_SERVICE.cs | 95 +++++++++++++++++++
.../Entities/BQ/BBAC_SA_SERVICE.cs | 9 ++
5 files changed, 143 insertions(+), 14 deletions(-)
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
index 485eb189..5ab133b6 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
+++ b/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",
},
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
index 5845e3a0..8e60e612 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
+++ b/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
/// 厂内零件号
///
public string PartCode { get; set; }
+ ///
+ ///是否退货
+ ///
+ [ExporterHeader(DisplayName = "是否退货")]
+ public string IsReturn { get; set; }
+ ///
+ /// 是否是买单件
+ ///
+ [ExporterHeader(DisplayName = "是否是买单件")]
+ public bool IsMaiDan { get; set; }
}
- public class BBAC_NOT_SA_DETAIL_EXP_DTO
+ public class BBAC_NOT_SA_DETAIL_EXP_DTO:EntityDto
{
///
@@ -84,9 +95,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "是否退货")]
public string IsReturn { get; set; }
///
- /// 是否退货
+ /// 是否是买单件
///
- [ExporterHeader(DisplayName = "是否退货")]
+ [ExporterHeader(DisplayName = "是否是买单件")]
+ public bool IsMaiDan { get; set; }
+ [ExporterHeader(DisplayName = "原始生产码")]
+ public string RealPN { get; set; }
+ ///
+ /// 版本
+ ///
+ [ExporterHeader(DisplayName = "版本")]
public int Version { get; set; }
[ExporterHeader(DisplayName = "单价")]
public decimal Price { get; set; }
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
index 6eff0ae3..7b1ef41f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
+++ b/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>(entitys);
+
+
return new PagedResultDto(totalCount, dtos);
}
///
@@ -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>(entities);
+
+
var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute()?.Name ?? typeof(TEntityDetailExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
index 4a481eac..cd5e86a0 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
+++ b/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 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>(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()?.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 GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input)
{
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
index 78003e65..bc16cd6a 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
+++ b/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)