Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
8a82ae0964
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  3. 84
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs
  4. 98
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  5. 129
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  6. 122
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  7. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  8. 399
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  9. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs
  10. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs
  11. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  12. 3
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  13. 4991
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727011426_202307270001.Designer.cs
  14. 58
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727011426_202307270001.cs
  15. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs

@ -75,7 +75,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
public string LU { get; set; }
/// <summary>
/// 物料描述
/// </summary>
public string MaterialDesc { get; set; }

8
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -1,4 +1,4 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
@ -215,12 +215,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///扩展字段3
/// </summary>
[Display(Name = "扩展字段3")]
public string Extend3 { get; set; }
public DateTime BeginDate { get; set; }
/// <summary>
///扩展字段4
/// </summary>
[Display(Name = "扩展字段4")]
public string Extend4 { get; set; }
public DateTime EndDate { get; set; }
}
public class INVOICE_WAIT_DETAIL_REQ_DTO : RequestInputBase
@ -328,7 +328,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class INVOICE_MAP_GROUPRequestDto : PagedAndSortedResultRequestDto
public class INVOICE_MAP_GROUP_REQ_DTO : PagedAndSortedResultRequestDto
{
public int Version { get; set; }
[Display(Name = "发票号")]

84
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs

@ -1,4 +1,4 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
@ -64,46 +65,51 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class PUB_CAN_SA_DETAIL_DTO : EntityDto<Guid>
{
public class PUB_CAN_SA_DETAIL_DTO : EntityDto<Guid>
{
/// <summary>
///关联结算单号
/// </summary>
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; }
/// <summary>
///工厂地点
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; }
/// <summary>
///业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
[Display(Name ="期间")]
public int Version { get; set; }
[Display(Name = "价格")]
public decimal Price { get; set; }
[Display(Name = "发票分组号")]
public string BillNum { get; set; }
[Display(Name = "下线日期")]
public DateTime SettleDate { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
[Display(Name = "发票分组号")]
public string LU { get; set; }
[Display(Name = "")]
public string PN { get; set; }
[Display(Name = "键值")]
public string KeyCode { get; set; }
[Display(Name = "结算数量")]
public decimal Qty { get; set; }
[Display(Name = "结算分组号")]
public string GroupNum { get; set; }
/// <summary>
///关联结算单号
/// </summary>
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; }
/// <summary>
///工厂地点
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; }
/// <summary>
///业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "价格")]
public decimal Price { get; set; }
[Display(Name = "发票分组号")]
public string BillNum { get; set; }
[Display(Name = "下线日期")]
public DateTime SettleDate { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
[Display(Name = "发票分组号")]
public string LU { get; set; }
[Display(Name = "")]
public string PN { get; set; }
[Display(Name = "键值")]
public string KeyCode { get; set; }
[Display(Name = "结算数量")]
public decimal Qty { get; set; }
[Display(Name = "结算分组号")]
public string GroupNum { get; set; }
[Display(Name = "金额")]
public decimal Amt { get; set; }
public string MaterialDesc { set; get; }
}
}

98
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -32,6 +32,104 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases
{
public class TMEP_INV
{
public string LU { set; get; }
public string ContractDocID { set; get; }
public decimal Amt { set; get; }
public decimal Qty { set; get; }
public decimal Price { set; get; }
/// <summary>
/// 开始日期
/// </summary>
public DateTime BeginDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public DateTime EndDate { get; set; }
}
public class TEMP_CAN_SA_DETAIL
{
/// <summary>
///关联结算单号
/// </summary>
public string SettleBillNum { get; set; }
/// <summary>
///工厂地点
/// </summary>
public string Site { get; set; }
/// <summary>
/// 版本
/// </summary>
public int Version { get; set; }
/// <summary>
/// 单价
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 结算单号(发票分组号)
/// </summary>
public string BillNum { get; set; }
/// <summary>
/// 结算日期
/// </summary>
public DateTime SettleDate { get; set; }
/// <summary>
///发票组号
/// </summary>
public string InvGroupNum { get; set; }
/// <summary>
/// 零件号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 物料描述
/// </summary>
public string MaterialDesc { get; set; }
/// <summary>
/// 生产号
/// </summary>
public string PN { get; set; }
/// <summary>
/// 结算数量
/// </summary>
public decimal Qty { get; set; }
/// <summary>
/// 结算分组号
/// </summary>
public string GroupNum { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal Amt { get; set; }
/// <summary>
/// 合同号
/// </summary>
public string ContractDocID { set; get; }
/// <summary>
/// 开始日期
/// </summary>
public DateTime BeginDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public DateTime EndDate { get; set; }
}
public abstract class CAN_SA_SERVICE<TEntity, TEntityDto, TEntityDetail, TEntityDetailDto, TRequestMainInput, TRequestDetailInput, TEntityDetailExportDto> : BASE_SERVICE
where TEntity : SA_CAN_BASE_MAIN
where TEntityDetail:SA_CAN_BASE

129
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -23,17 +23,14 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
using System.Text.Json;
using Newtonsoft.Json;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
public class TMEP_INV
{
public string LU { set; get; }
public string ContractDocID { set; get; }
public decimal Amt { set; get; }
public decimal Qty { set; get; }
public decimal Price { set; get; }
}
@ -55,6 +52,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
>
{
private readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly BBAC_CAN_SA_MNG _bbacMng;
@ -63,11 +63,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IExcelImportAppService excelImportService,
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
BBAC_CAN_SA_MNG bbacMng,
INV_MNG invmng) : base(repository, excelImportService, detailRepository, invmng)
BBAC_CAN_SA_MNG bbacMng,
INV_MNG invmng,
INormalEfCoreRepository<PriceList, Guid> priceRepository
) : base(repository, excelImportService, detailRepository, invmng)
{
_notRepository = notRepository;
_bbacMng = bbacMng;
_priceRepository = priceRepository;
}
/// <summary>
@ -88,17 +91,61 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
var notList = _notRepository.Where(p => groupNumList.Contains(p.GroupNum)).ToList();//不能结算
var dtos = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
dtos.ForEach(dto =>
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var priceList=_priceRepository.ToList();//价格单
var inner = from d in dto1s
join p in priceList on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select d;
var left= from d in dto1s join p in inner on new { d.LU,d.PN } equals new {p.LU,p.PN}
into temp from tm in temp.DefaultIfEmpty()//校验错误项
where tm ==null
select d;
List<ERR_EXP_DTO> errorList=new List<ERR_EXP_DTO>();
foreach (var error in left)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode=error.LU, CustomCode="业务类别BBAC", Version=main.Version.ToString(), Message="LU:{0}PN:{1},下线日期:{2}没有对应区间销售价格表!" });
}
if(errorList.Count()>0)
{
return await ExportErrorReportAsync(errorList);
}
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
dto.Amt = Math.Round(dto.Price * dto.Qty, 2);
});
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty*p.Price,2),
ContractDocID = d.ContractDocID,
BeginDate=p.BeginTime,
EndDate=p.EndTime
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (input.BillNum.Substring(0, 1) != "C")//一次开票
if (input.BillNum.Substring(0, 1) == "C")//一次开票
{
// dtos = dtos.OrderBy(p => p.SettleDate).ToList();
var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).OrderBy(p=>p.Amt);
var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).OrderBy(p => p.Amt);
Dictionary<string, decimal> dic = new Dictionary<string, decimal>();//原本
Dictionary<string, decimal> copyDic = new Dictionary<string, decimal>();//变换数组副本
foreach (var itm in _query.ToList())
@ -153,21 +200,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>();
// string str = JsonConvert.SerializeObject(invoiceMap);
// string str = JsonConvert.SerializeObject(invoiceMap);
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.ContractDocID })
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.ContractDocID, p.BeginDate, p.EndDate })
.Select(itm => new
{
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.LU,
ContactDocID = itm.Key.ContractDocID,
Price = itm.Key.Price,
Amt =itm.Sum(p=>p.Amt),
Qty = itm.Sum(k => k.Qty)
Amt = itm.Sum(p => p.Amt),
Qty = itm.Sum(k => k.Qty),
BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate
})
.ToList();
decimal amt = detailDtos.Sum(k => k.Amt);
@ -208,8 +257,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
pRICE: detail.Price,
extend1: detail.ContactDocID,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
beginDate: detail.BeginDate,
endDate: detail.EndDate
));
}
if (_entityDetailList.Count > 0)
@ -259,16 +309,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else//二次开票
{
var groups1 = dtos.GroupBy(p => new { p.LU, p.ContractDocID, p.Price }).Select(p => new TMEP_INV
var groups1 = dtos.GroupBy(p => new { p.LU, p.ContractDocID, p.Price, p.BeginDate, p.EndDate }).Select(p => new TMEP_INV
{
BeginDate=p.Key.BeginDate, EndDate=p.Key.EndDate,
LU = p.Key.LU,
ContractDocID = p.Key.ContractDocID,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
Price = p.Key.Price
}).ToList();//汇总记录不出现重复值
var groups = dtos.GroupBy(p => new { p.LU, p.ContractDocID, p.Price }).Select(p => new TMEP_INV
var groups = dtos.GroupBy(p => new { p.LU, p.ContractDocID, p.Price, p.BeginDate, p.EndDate }).Select(p => new TMEP_INV
{
BeginDate = p.Key.BeginDate,
EndDate = p.Key.EndDate,
LU = p.Key.LU,
ContractDocID = p.Key.ContractDocID,
Amt = p.Sum(itm => itm.Amt),
@ -278,7 +331,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
Dictionary<string, List<TMEP_INV>> invoiceMap = new Dictionary<string, List<TMEP_INV>>();//发票和发票明细关系
foreach (var group in groups)
{
int i = groups1.Count(p => p.LU == group.LU && p.ContractDocID == group.ContractDocID);
int i = groups1.Count(p => p.LU == group.LU
&& p.ContractDocID == group.ContractDocID
&&p.BeginDate==group.BeginDate
&&p.EndDate==group.EndDate
);
if (i > 0)
{
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
@ -287,7 +344,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
int partCount = 0;
foreach (var group1 in groups1)
{
if (group.LU == group1.LU && group1.ContractDocID == group.ContractDocID)
if (group.LU == group1.LU && group1.ContractDocID == group.ContractDocID
&& group.BeginDate == group1.BeginDate
&& group.EndDate == group1.EndDate
)
{
tempList.Add(group1);
partCount++;//符合条件加入到零件中
@ -308,9 +369,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invoiceMap.Add(invoiceBillNum, tempList);
var query = from itm in groups1
join itm1 in tempList
on new { itm.LU, itm.ContractDocID } equals new { itm1.LU, itm1.ContractDocID } into temp
from tm in temp
select new TMEP_INV { LU = itm.LU, ContractDocID = itm.ContractDocID, Amt = itm.Amt, Qty = itm.Qty };
on new { itm.LU, itm.ContractDocID,itm.BeginDate,itm.EndDate } equals new { itm1.LU, itm1.ContractDocID, itm1.BeginDate, itm1.EndDate } into temp
from tm in temp where tm==null
select new TMEP_INV
{ LU = itm.LU, ContractDocID = itm.ContractDocID,
Amt = itm.Amt, Qty = itm.Qty,BeginDate=itm.BeginDate,
EndDate=itm.EndDate
};
groups1 = query.ToList();
}
}
@ -340,8 +405,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
pRICE: detail.Price,
extend1: detail.ContractDocID,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
beginDate: detail.BeginDate,
endDate: detail.EndDate
));
}
if (_entityDetailList.Count > 0)

122
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -16,6 +16,8 @@ using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -38,17 +40,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
>
{
private INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly HBPO_CAN_SA_MNG _hbpoMng;
public HBPO_CAN_SA_SERVICE(INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository,
IExcelImportAppService excelImportService,
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository,
INV_MNG invmng,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
HBPO_CAN_SA_MNG hbpoMng
HBPO_CAN_SA_MNG hbpoMng,
INormalEfCoreRepository<PriceList, Guid> priceRepository
) : base(repository, excelImportService, detailRepository, invmng)
{
_priceRepository = priceRepository;
_notRepository = notRepository;
_hbpoMng = hbpoMng;
}
@ -63,29 +66,69 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
var main =await _hbpoMng.GetMainAsync(input.BillNum);
if (main != null)
{
if (await _hbpoMng.SetForwardState(main, SettleBillState.))
{
var entitys = await _hbpoMng.GetDetalListAsync(input.BillNum);
if (await _hbpoMng.SetForwardState(main, SettleBillState.))
{
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var notList = _notRepository.Where(p => groupNumList.Contains(p.InvGroupNum)).ToList();//不能结算
var dtos = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var priceList = _priceRepository.ToList();//价格单
var inner = from d in dto1s
join p in priceList on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select d;
var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
dtos.ForEach(dto =>
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
foreach (var error in left)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = "业务类别HBPO", Version = main.Version.ToString(), Message = "LU:{0}PN:{1},下线日期:{2}没有对应区间销售价格表!" });
}
if (errorList.Count() > 0)
{
dto.Amt = Math.Round(dto.Price * dto.Qty, 2);
});
return await ExportErrorReportAsync(errorList);
}
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
BeginDate = p.BeginTime,
EndDate = p.EndTime
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (input.BillNum.Substring(0, 1) != "C")//一次开票
if (input.BillNum.Substring(0, 1) == "C")//一次开票
{
var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) });
Dictionary<string, decimal> dic = new Dictionary<string, decimal>();//原本
@ -113,13 +156,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invoiceGroupNumList.Add(itm.Key);
continue;
}
var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
luList.AddRange(grouplist);
luList = luList.Distinct().ToList();
if (luList.Count > 20)//累加零件不超过20种
{
continue;
}
//var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
//luList.AddRange(grouplist);
//luList = luList.Distinct().ToList();
//if (luList.Count > 20)//累加零件不超过20种
//{
// continue;
//}
sum += _itm1.Value;
if (sum > 10000000)
{
@ -145,14 +188,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price })
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price,p.BeginDate,p.EndDate })
.Select(itm => new
{
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.LU,
Price = itm.Key.Price,
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),
Qty = itm.Sum(k => k.Qty)
Qty = itm.Sum(k => k.Qty),
BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate
})
.ToList();
decimal amt = detailDtos.Sum(k => k.Amt);
@ -194,8 +239,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
pRICE: detail.Price,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
beginDate:detail.BeginDate,
endDate:detail.EndDate
));
}
if (_entityDetailList.Count > 0)
@ -246,24 +291,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else//二次开票
{
var groups1 = dtos.GroupBy(p => new { p.LU, p.Price }).Select(p => new TMEP_INV
var groups1 = dtos.GroupBy(p => new { p.LU, p.Price,p.BeginDate,p.EndDate }).Select(p => new TMEP_INV
{
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
Price = p.Key.Price
Price = p.Key.Price,
BeginDate=p.Key.BeginDate,
EndDate=p.Key.EndDate
}).ToList();//汇总记录不出现重复值
var groups = dtos.GroupBy(p => new { p.LU, p.Price }).Select(p => new TMEP_INV
var groups = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate }).Select(p => new TMEP_INV
{
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
Price = p.Key.Price
Price = p.Key.Price,
BeginDate = p.Key.BeginDate,
EndDate = p.Key.EndDate
}).ToList();//汇总记录不出现重复值
Dictionary<string, List<TMEP_INV>> invoiceMap = new Dictionary<string, List<TMEP_INV>>();//发票和发票明细关系
foreach (var group in groups)
{
int i = groups1.Count(p => p.LU == group.LU && p.ContractDocID == group.ContractDocID);
int i = groups1.Count(p => p.LU == group.LU &&p.BeginDate==group.BeginDate && p.EndDate==group.EndDate );
if (i > 0)
{
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
@ -272,7 +322,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
int partCount = 0;
foreach (var group1 in groups1)
{
if (group.LU == group1.LU && group1.ContractDocID == group.ContractDocID)
if (group.LU == group1.LU && group.BeginDate == group1.BeginDate && group.EndDate == group1.EndDate)
{
tempList.Add(group1);
partCount++;//符合条件加入到零件中
@ -293,9 +343,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invoiceMap.Add(invoiceBillNum, tempList);
var query = from itm in groups1
join itm1 in tempList
on new { itm.LU, itm.ContractDocID } equals new { itm1.LU, itm1.ContractDocID } into temp
from tm in temp
select new TMEP_INV { LU = itm.LU, ContractDocID = itm.ContractDocID, Amt = itm.Amt, Qty = itm.Qty };
on new { itm.LU, itm.BeginDate,itm.EndDate} equals new { itm1.LU, itm1.BeginDate, itm1.EndDate } into temp
from tm in temp where tm==null
select new TMEP_INV { LU = itm.LU, Amt = itm.Amt, Qty = itm.Qty ,BeginDate=itm.BeginDate,EndDate=itm.EndDate };
groups1 = query.ToList();
}
}
@ -323,10 +374,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
bussiessType: EnumBusinessType.BBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContractDocID,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
beginDate: detail.BeginDate,
endDate: detail.EndDate
));
}
if (_entityDetailList.Count > 0)
@ -365,7 +416,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.BBAC,
businessType: EnumBusinessType.HBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
@ -380,7 +431,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
}
}
}
}

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -30,9 +30,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository;
private readonly CAN_SA_MNG<PUB_CAN_SA,PUB_CAN_SA_DETAIL> _pubMng;
private readonly CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> _bbacMng;
private readonly CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> _hbpoMng;
private readonly PUB_CAN_SA_MNG _pubMng;
private readonly BBAC_CAN_SA_MNG _bbacMng;
private readonly HBPO_CAN_SA_MNG _hbpoMng;
private readonly INV_MNG _invMng;
//private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly IExcelImportAppService _excelImportService;
@ -43,9 +43,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
IExcelImportAppService excelImportService,
CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng,
CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng,
CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng,
PUB_CAN_SA_MNG pubMng,
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
INV_MNG invMng
)
{

399
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
@ -8,7 +11,10 @@ using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
using static Win.Sfs.SettleAccount.SettleAccountPermissions;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@ -29,12 +35,403 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
PUB_CAN_SA_DETAIL_EXP_DTO
>
{
public PUB_CAN_SA_SERVICE(INormalEfCoreRepository<PUB_CAN_SA, Guid> repository, IExcelImportAppService excelImportService, INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> detailRepository, INV_MNG invmng) : base(repository, excelImportService, detailRepository, invmng)
private readonly PUB_CAN_SA_MNG _pubMng;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
public PUB_CAN_SA_SERVICE(INormalEfCoreRepository<PUB_CAN_SA, Guid> repository,
IExcelImportAppService excelImportService,
INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository,
INV_MNG invmng,
PUB_CAN_SA_MNG pubMng) : base(repository, excelImportService, detailRepository, invmng)
{
_pubMng = pubMng;
_priceRepository = priceRepository;
_pricebjRepository = pricebjRepository;
}
[HttpPost]
public async override Task<string> GenerateInvoice(PUB_CAN_SA_REQ_DTO input)
{
var main = await _pubMng.GetMainAsync(input.BillNum);
if (main != null)
{
if (await _pubMng.SetForwardState(main, SettleBillState.))
{
var entitys = await _pubMng.GetDetalListAsync(input.BillNum);
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
List<PriceList> priceList=new List<PriceList>();
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var priceListbj = _pricebjRepository.ToList();//价格单
foreach (var itm in priceListbj)
{
priceList.Add(new PriceList() {LU=itm.LU,BeginTime=itm.BeginDate,EndTime=itm.EndDate });
}
}
else
{
priceList = _priceRepository.ToList();//价格单
}
var inner = from d in dto1s
join p in priceList on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select d;
var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
foreach (var error in left)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = "", Version = main.Version.ToString(), Message = "LU:{0}PN:{1},下线日期:{2}没有对应区间销售价格表!" });
}
if (errorList.Count() > 0)
{
return await ExportErrorReportAsync(errorList);
}
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
BeginDate = p.BeginTime,
EndDate = p.EndTime
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (input.BillNum.Substring(0, 1) == "C")//一次开票
{
var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) });
Dictionary<string, decimal> dic = new Dictionary<string, decimal>();//原本
Dictionary<string, decimal> copyDic = new Dictionary<string, decimal>();//变换数组副本
foreach (var itm in _query.ToList())
{
dic.Add(itm.GroupNum, itm.Amt);
copyDic.Add(itm.GroupNum, itm.Amt);
}
Dictionary<string, List<string>> invoiceMap = new Dictionary<string, List<string>>();
foreach (var itm in dic)
{
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号
List<string> List = new List<string>();
decimal sum = itm.Value;//初始分组合计金额
List<string> luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组
{
foreach (var _itm1 in copyDic)
{
if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化
{
invoiceGroupNumList.Add(itm.Key);
continue;
}
//var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
//luList.AddRange(grouplist);
//luList = luList.Distinct().ToList();
//if (luList.Count > 20)//累加零件不超过20种
//{
// continue;
//}
sum += _itm1.Value;
if (sum > 10000000)
{
break;
}
invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
}
invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系
foreach (var rem in invoiceGroupNumList)//移除
{
copyDic.Remove(rem);
}
}
}
if (invoiceMap.Keys.Count > 0)
{
var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>();
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.BeginDate, p.EndDate })
.Select(itm => new
{
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.LU,
Price = itm.Key.Price,
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),
Qty = itm.Sum(k => k.Qty),
BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate
})
.ToList();
decimal amt = detailDtos.Sum(k => k.Amt);
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2);
var mapList = new List<INVOICE_MAP_GROUP>();
foreach (var groupnum in ls)
{
mapList.Add(new INVOICE_MAP_GROUP(
guid: GuidGenerator.Create(),
version: main.Version,
invbillNum: key,
invGroupNum: main.InvGroupNum,
settleGroupNum: groupnum,
amt: 0,
extend1: string.Empty,
extend2: string.Empty
)
);
}
if (mapList.Count > 0)
{
groupList.AddRange(mapList);
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in detailDtos)
{
_entityDetailList.Add(
new INVOICE_WAIT_DETAIL(
guid: GuidGenerator.Create(),
version: main.Version,
invbillNum: key,
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.HBPO,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
// var notls = notList.GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) });
//var innotls = new List<INVOICE_NOT_SETTLE>();
//foreach (var nitm in notls)
//{
// innotls.Add(new INVOICE_NOT_SETTLE(
// guid: GuidGenerator.Create(),
// version: main.Version,
// invGroupNum: main.InvGroupNum,
// settleGroupNum: nitm.GroupNum,
// lU: string.Empty,
// lU1: nitm.LU,
// extend1: string.Empty,
// extend2: string.Empty,
// qty: nitm.Qty
// ));
//}
//if (innotls.Count > 0)
//{
// notDetialList.AddRange(innotls);
//}
var invbill = new INVOICE_GRP
(guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
invbillNum: key,
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
);
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
await _repository.DbContext.BulkInsertAsync(notDetialList);
}
}
else//二次开票
{
var groups1 = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate }).Select(p => new TMEP_INV
{
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
Price = p.Key.Price,
BeginDate = p.Key.BeginDate,
EndDate = p.Key.EndDate
}).ToList();//汇总记录不出现重复值
var groups = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate }).Select(p => new TMEP_INV
{
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
Price = p.Key.Price,
BeginDate = p.Key.BeginDate,
EndDate = p.Key.EndDate
}).ToList();//汇总记录不出现重复值
Dictionary<string, List<TMEP_INV>> invoiceMap = new Dictionary<string, List<TMEP_INV>>();//发票和发票明细关系
foreach (var group in groups)
{
int i = groups1.Count(p => p.LU == group.LU && p.BeginDate == group.BeginDate && p.EndDate == group.EndDate);
if (i > 0)
{
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
List<TMEP_INV> tempList = new List<TMEP_INV>();
decimal sum = group.Amt;//初始合计金额
int partCount = 0;
foreach (var group1 in groups1)
{
if (group.LU == group1.LU && group.BeginDate == group1.BeginDate && group.EndDate == group1.EndDate)
{
tempList.Add(group1);
partCount++;//符合条件加入到零件中
continue;
}
partCount++;
if (partCount > 30)
{
continue;
}
if (sum > 10000000)
{
break;
}
sum += group1.Amt;
tempList.Add(group1);
}
invoiceMap.Add(invoiceBillNum, tempList);
var query = from itm in groups1
join itm1 in tempList
on new { itm.LU, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate } into temp
from tm in temp
where tm == null
select new TMEP_INV { LU = itm.LU, Amt = itm.Amt, Qty = itm.Qty, BeginDate = itm.BeginDate, EndDate = itm.EndDate };
groups1 = query.ToList();
}
}
if (invoiceMap.Count > 0)
{
var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>();
foreach (var group in invoiceMap)
{
var key = group.Key;//发票票号
var ls = group.Value;//发票明细
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in ls)
{
_entityDetailList.Add(
new INVOICE_WAIT_DETAIL(
guid: GuidGenerator.Create(),
version: main.Version,
invbillNum: key,
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.BBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
decimal amt = detailList.Sum(k => k.Amt);
decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2);
var contractList = ls.Select(p => p.ContractDocID).Distinct();
var _groupList = dtos.GroupBy(p => new { p.GroupNum })
.Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct();
List<INVOICE_MAP_GROUP> group1 = new List<INVOICE_MAP_GROUP>();
foreach (var en in _groupList)
{
group1.Add(
new INVOICE_MAP_GROUP(
guid: GuidGenerator.Create(),
version: main.Version,
invbillNum: key,
invGroupNum: main.InvGroupNum,
settleGroupNum: en.GroupNum,
amt: en.Amt,
extend1: string.Empty,
extend2: string.Empty));
}
if (group1.Count > 0)
{
groupList.AddRange(group1);
}
var invbill = new INVOICE_GRP
(guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
invbillNum: key,
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
);
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
//await _repository.DbContext.BulkInsertAsync(notDetialList);
}
}
}
}
}
return ApplicationConsts.SuccessStr;
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs

@ -41,13 +41,14 @@ public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot<Guid>
[Display(Name = "扩展字段2")]
public string Extend2 { get; set; } = null!;
[Display(Name = "扩展字段3")]
public string Extend3 { get; set; } = null!;
[Display(Name = "价格开始日期")]
public DateTime BeginDate { get; set; }
[Display(Name = "价格结束日期")]
public DateTime EndDate { get; set; }
[Display(Name = "扩展字段4")]
public string Extend4 { get; set; } = null!;
public INVOICE_WAIT_DETAIL(Guid guid, int version, string invbillNum, string invGroupNum, string lU, decimal pRICE, decimal qty, decimal amt, EnumBusinessType bussiessType, string extend1, string extend2, string extend3, string extend4)
public INVOICE_WAIT_DETAIL(Guid guid, int version, string invbillNum, string invGroupNum, string lU, decimal pRICE, decimal qty, decimal amt, EnumBusinessType bussiessType, string extend1, string extend2,DateTime beginDate,DateTime endDate)
{
Id = guid;
Version = version;
@ -60,8 +61,9 @@ public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot<Guid>
BussiessType = bussiessType;
Extend1 = extend1;
Extend2 = extend2;
Extend3 = extend3;
Extend4 = extend4;
BeginDate = beginDate;
EndDate = endDate;
}
public INVOICE_WAIT_DETAIL()

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs

@ -40,7 +40,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public HBPO_CAN_SA_MNG()
{
}
/// <summary>
/// 发票正向流程
/// </summary>
/// <param name="p_entiy"></param>
/// <param name="state"></param>
/// <returns></returns>
public virtual async Task<bool> SetForwardState(HBPO_CAN_SA p_entiy, SettleBillState state)
{
if (await SetForwardState(p_entiy.InvGroupNum, state) == true)
@ -55,7 +60,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <summary>
/// 向前流程
///正向流程
/// </summary>
/// <param name="p_billNum"></param>
/// <param name="state"></param>
@ -130,7 +135,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return false;
}
/// <summary>
/// 向流程
/// 向流程
/// </summary>
/// <param name="p_billNum"></param>
/// <param name="state"></param>

18
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -25,16 +25,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> _pubMng;
private readonly CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> _bbacMng;
private readonly CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> _hbpoMng;
private readonly PUB_CAN_SA_MNG _pubMng;
private readonly BBAC_CAN_SA_MNG _bbacMng;
private readonly HBPO_CAN_SA_MNG _hbpoMng;
public INV_MNG
(
CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng,
CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng,
CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng,
//INormalEfCoreRepository<TCAN_SA, Guid> canRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
PUB_CAN_SA_MNG pubMng,
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository

3
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -997,8 +997,7 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.BussiessType).HasMaxLength(50);
b.Property(x => x.Extend1).HasMaxLength(50);
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}

4991
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727011426_202307270001.Designer.cs

File diff suppressed because it is too large

58
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727011426_202307270001.cs

@ -0,0 +1,58 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307270001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Extend3",
table: "Set_INVOICE_WAIT_DETAIL");
migrationBuilder.DropColumn(
name: "Extend4",
table: "Set_INVOICE_WAIT_DETAIL");
migrationBuilder.AddColumn<DateTime>(
name: "BeginDate",
table: "Set_INVOICE_WAIT_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "EndDate",
table: "Set_INVOICE_WAIT_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BeginDate",
table: "Set_INVOICE_WAIT_DETAIL");
migrationBuilder.DropColumn(
name: "EndDate",
table: "Set_INVOICE_WAIT_DETAIL");
migrationBuilder.AddColumn<string>(
name: "Extend3",
table: "Set_INVOICE_WAIT_DETAIL",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend4",
table: "Set_INVOICE_WAIT_DETAIL",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
}
}
}

14
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -2254,6 +2254,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<decimal>("Amt")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("BeginDate")
.HasColumnType("datetime2");
b.Property<int>("BussiessType")
.HasMaxLength(50)
.HasColumnType("int");
@ -2280,6 +2283,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<string>("Extend1")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -2288,14 +2294,6 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend3")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend4")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

Loading…
Cancel
Save