From d5694bf2cd7bc781d0d7f7af94c96f0e62079649 Mon Sep 17 00:00:00 2001 From: mahao Date: Fri, 1 Sep 2023 15:15:09 +0800 Subject: [PATCH] up --- .../Entities/Prices/PriceListDtoBase.cs | 4 +- .../Entities/BQ/BBAC_SA_SERVICE.cs | 39 +++++++++++-------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index b1ca1613..24819e29 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -148,13 +148,13 @@ public class PriceListImportDto /// 开始时间 /// [ImporterHeader(Name = "*Valid From")] - public string ValidFrom { get; set; } + public DateTime ValidFrom { get; set; } /// /// 结束时间 /// [ImporterHeader(Name = "*Valid To")] - public string ValidTo { get; set; } + public DateTime ValidTo { get; set; } /// /// 客户编码 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 c1b64e09..6a3cc12d 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 @@ -1,17 +1,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Linq; -using System.LinqAsync; -using System.Security.Policy; using System.Threading.Tasks; -using AutoMapper; -using DocumentFormat.OpenXml.Drawing.Charts; -using DocumentFormat.OpenXml.Wordprocessing; using EFCore.BulkExtensions; -using FlexLabs.EntityFrameworkCore.Upsert.Internal; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using Volo.Abp; @@ -162,7 +154,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase //结算分组号 var bbacSaGroupNums = importBBACSaDetails.Select(t => t.GroupNum).Distinct(); //已存在的结算分组号 - var havBBACSaGroupNums = (await _bbacSaDetailRepository.GetListAsync(t => bbacSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct(); + var havBBACSaGroupNums = (await _bbacSaDetailRepository.GetListAsync(t => bbacSaGroupNums.Contains(t.GroupNum)).ConfigureAwait(false)).Select(t => t.GroupNum).Distinct(); if (havBBACSaGroupNums.Any() == true) { foreach (var item in havBBACSaGroupNums) @@ -396,7 +388,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase var importPubSaLUs = bbacSaDetails.Select(t => t.LU).Distinct(); //销售价格 var priceListEntitys = _priceListRepository.Where(t => importPubSaLUs.Contains(t.LU)).ToList(); - var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); + var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); bbacSaDetails.ForEach(bbacSaDetail => { //根据物料号、结算日期获取价格 @@ -420,6 +412,19 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase #region 添加入库 await _bbacSaRepository.InsertAsync(bbacSa).ConfigureAwait(false); + //存在买单将BBAC数据添加买单件BBAC主表数据 + if (bbacSaDetails.Any(t => t.BusinessType == EnumBusinessType.MaiDanJianBBAC)) + { + //买单件结算主表 + await _bbacSaRepository.InsertAsync(new BBAC_SA() + { + BillNum = bbacSaBillNum, + State = "0", + BusinessType = EnumBusinessType.MaiDanJianBBAC, + Site = Site, + Version = Version + }).ConfigureAwait(false); + } await _bbacSaDetailRepository.DbContext.BulkInsertAsync(bbacSaDetails).ConfigureAwait(false); if (bbacCanSaDetails.Count > 0) { @@ -443,7 +448,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase } if (materialRelationships.Count > 0) { - await _materialRelationshipRepository.InsertManyAsync(materialRelationships); + await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false); } #endregion } @@ -454,15 +459,15 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase private async Task<(List bbacSas, List bbacSaDetails, List bbacCanSas, List bbacCanSaDetails, List bbacNotSaDetails)> GetBBACSaDelItemsAsync(Guid id) { //结算主表 - List bbacSas = new List(); + var bbacSas = new List(); //结算明细 - List bbacSaDetails = new List(); + var bbacSaDetails = new List(); //可结算主表 - List bbacCanSas = new List(); + var bbacCanSas = new List(); //可结算明细 - List bbacCanSaDetails = new List(); + var bbacCanSaDetails = new List(); //不可结算 - List bbacNotSaDetails = new List(); + var bbacNotSaDetails = new List(); var bbacSaEntity = await _bbacSaRepository.FindAsync(id).ConfigureAwait(false); if (bbacSaEntity != null) { @@ -476,7 +481,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase throw new UserFriendlyException($"{bbacSaBillNum} 该单据可结算单状态无法删除!", "400"); } - bbacSas.Add(bbacSaEntity); + bbacSas = await _bbacSaRepository.GetListAsync(t => t.BillNum == bbacSaBillNum).ConfigureAwait(false); bbacSaDetails = await _bbacSaDetailRepository.GetListAsync(t => t.BillNum == bbacSaBillNum).ConfigureAwait(false); bbacCanSaDetails = await _bbacCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == bbacSaBillNum).ConfigureAwait(false); bbacNotSaDetails = await _bbacNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == bbacSaBillNum).ConfigureAwait(false);