学 赵 1 year ago
parent
commit
b0ac96296a
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  3. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -148,13 +148,13 @@ public class PriceListImportDto
/// 开始时间
/// </summary>
[ImporterHeader(Name = "*Valid From")]
public string ValidFrom { get; set; }
public DateTime ValidFrom { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[ImporterHeader(Name = "*Valid To")]
public string ValidTo { get; set; }
public DateTime ValidTo { get; set; }
/// <summary>
/// 客户编码

39
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<BBAC_SA>
//结算分组号
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<BBAC_SA>
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<BBAC_SA>
#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<BBAC_SA>
}
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<BBAC_SA>
private async Task<(List<BBAC_SA> bbacSas, List<BBAC_SA_DETAIL> bbacSaDetails, List<BBAC_CAN_SA> bbacCanSas, List<BBAC_CAN_SA_DETAIL> bbacCanSaDetails, List<BBAC_NOT_SA_DETAIL> bbacNotSaDetails)> GetBBACSaDelItemsAsync(Guid id)
{
//结算主表
List<BBAC_SA> bbacSas = new List<BBAC_SA>();
var bbacSas = new List<BBAC_SA>();
//结算明细
List<BBAC_SA_DETAIL> bbacSaDetails = new List<BBAC_SA_DETAIL>();
var bbacSaDetails = new List<BBAC_SA_DETAIL>();
//可结算主表
List<BBAC_CAN_SA> bbacCanSas = new List<BBAC_CAN_SA>();
var bbacCanSas = new List<BBAC_CAN_SA>();
//可结算明细
List<BBAC_CAN_SA_DETAIL> bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>();
var bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>();
//不可结算
List<BBAC_NOT_SA_DETAIL> bbacNotSaDetails = new List<BBAC_NOT_SA_DETAIL>();
var bbacNotSaDetails = new List<BBAC_NOT_SA_DETAIL>();
var bbacSaEntity = await _bbacSaRepository.FindAsync(id).ConfigureAwait(false);
if (bbacSaEntity != null)
{
@ -476,7 +481,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
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);

15
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -1,15 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
@ -19,8 +17,8 @@ using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Prices
{
namespace Win.Sfs.SettleAccount.Entities.Prices;
/// <summary>
/// 备件价格
/// </summary>
@ -150,5 +148,4 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
#endregion
}
}

Loading…
Cancel
Save