Browse Source

更新程序

master
学 赵 1 year ago
parent
commit
6f9def3594
  1. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  2. 87
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  4. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  5. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
  6. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  7. 590
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs
  9. 5404
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230811013305_202308110001.Designer.cs
  10. 44
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230811013305_202308110001.cs
  11. 7
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

3
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -71,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Bases
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
BBAC_CAN_SA_MNG bbacMng, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, HBPO_CAN_SA_MNG hbpoMng,
PUB_CAN_SA_MNG pubMng, PUB_CAN_SA_MNG pubMng,
@ -204,7 +205,7 @@ namespace Win.Sfs.SettleAccount.Bases
} }
[HttpPost] [HttpPost]
[UnitOfWork(false)]
public virtual async Task<string> ReceivedAsync(List<string> p_ins) public virtual async Task<string> ReceivedAsync(List<string> p_ins)
{ {

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

@ -84,9 +84,6 @@ namespace Win.Sfs.SettleAccount.Bases
var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters); var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys); var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys);
return new PagedResultDto<TEntityDetailDto>(totalCount, dtos); return new PagedResultDto<TEntityDetailDto>(totalCount, dtos);
} }
/// <summary> /// <summary>
@ -164,10 +161,51 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param> /// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param> /// <param name="p_parentInvBillNum">原发票号</param>
protected async Task<bool> SecInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> p_tmplist, int p_version, string p_InvGroupNum, string p_parentInvBillNum,EnumBusinessType businessType) where TDetail : SA_CAN_BASE protected async Task<bool> SecInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum,EnumBusinessType businessType) where TDetail : SA_CAN_BASE
{ {
var ls= await _invmng.SecInvoice(p_list,p_adjlist,p_tmplist,p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (ls.Count > 0) List<string> invlist = new List<string>();
switch (businessType)
{
case EnumBusinessType.MaiDanJianHBPO:
invlist = await _invmng.MakeInvoice(p_list, p_adjlist, dtos, p_version, p_InvGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.MaiDanJianBBAC:
invlist = await _invmng.MakeInvoice(p_list, p_adjlist, dtos, p_version, p_InvGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await _invmng.BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.JisBBAC:
invlist = await _invmng.SecInvoice(p_list, p_adjlist, dtos, p_version, p_InvGroupNum, string.Empty, businessType);
break;
case EnumBusinessType.JisHBPO:
invlist = await _invmng.SecInvoice(p_list, p_adjlist, dtos, p_version, p_InvGroupNum, string.Empty, businessType);
break;
case EnumBusinessType.YinDuJian:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
}
//var ls= await _invmng.SecInvoice(p_list,p_adjlist,p_tmplist,p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (invlist.Count > 0)
{ {
return true; return true;
} }
@ -186,11 +224,42 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_parentInvBillNum"></param> /// <param name="p_parentInvBillNum"></param>
/// <param name="businessType"></param> /// <param name="businessType"></param>
/// <returns></returns> /// <returns></returns>
protected async Task<bool> FirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist ,List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) where TDetail : SA_CAN_BASE protected async Task<bool> FirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist ,List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_invGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) where TDetail : SA_CAN_BASE
{
List<string> invlist = new List<string>();
switch (businessType)
{ {
case EnumBusinessType.MaiDanJianHBPO:
invlist = await _invmng. MakeInvoice(p_list, p_adjlist, dtos, p_version, p_invGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.MaiDanJianBBAC:
invlist = await _invmng.MakeInvoice(p_list, p_adjlist, dtos, p_version, p_invGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await _invmng.BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType, true);
break;
case EnumBusinessType.JisBBAC:
invlist = await _invmng.FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType);//重开可以变多张发票
break;
case EnumBusinessType.JisHBPO:
invlist = await _invmng.FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType);//重开可以变多张发票
break;
case EnumBusinessType.YinDuJian:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_invGroupNum, string.Empty, businessType, true);//重开可以变多张发票
break;
}
var ls = await _invmng.FirstInvoice(p_list,p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); if (invlist.Count > 0)
if (ls.Count > 0)
{ {
return true; return true;
} }

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -93,7 +93,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
foreach (var itm in adjlist) foreach (var itm in adjlist)
{ {
bbaclist.Add(new BBAC_CAN_SA_DETAIL( bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: itm.Id,
keyCode: itm.KeyCode, keyCode: itm.KeyCode,
version: itm.Version, version: itm.Version,
billNum: itm.InvGroupNum, billNum: itm.InvGroupNum,
@ -118,7 +118,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.ToList();//价格单
var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0) if (errorList.Count() > 0)
@ -131,6 +130,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id=d.Id,
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,
Site = d.Site, Site = d.Site,
Version = d.Version, Version = d.Version,

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

@ -5,7 +5,9 @@ using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Migrations;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
@ -43,6 +45,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository; private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
public PUB_CAN_SA_SERVICE public PUB_CAN_SA_SERVICE
(IExcelImportAppService excelImportService, (IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -121,10 +126,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (input.BillNum.Substring(0, 1) == "C")//一次开票 if (input.BillNum.Substring(0, 1) == "C")//一次开票
{ {
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType == EnumBusinessType.BeiJian) if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{ {
var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true); var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
} }
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var strs = await _invmng.BJInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos,new List<TEMP_NOT_SA_DETAIL>(),main.Version, main.InvGroupNum,string.Empty, main.BusinessType);
}
else else
{ {
await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
@ -132,10 +141,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
else//二次开票 else//二次开票
{ {
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType==EnumBusinessType.BeiJian ) if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{ {
var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true); var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
} }
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var strs = await _invmng.BJInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
}
else else
{ {
await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs

@ -128,7 +128,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
} }
if (p_config.IsMaterial == true) if (p_config.IsMaterial == true)
{ {
var materialList = await _materialRepository.ToListAsync(); var materialList = await _materialRepository.ToListAsync();
var query = from itm in partList var query = from itm in partList
join itm1 in materialList on itm equals itm1.MaterialCode join itm1 in materialList on itm equals itm1.MaterialCode

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -383,7 +383,11 @@ namespace SettleAccount.Bases
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
{ {
protected SA_CAN_BASE() { } protected SA_CAN_BASE() { }
public SA_CAN_BASE(Guid id) : base(id) { } public SA_CAN_BASE(Guid id) : base(id) { Id = id; }
/// <summary> /// <summary>
/// 期间 /// 期间

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

@ -17,6 +17,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
@ -533,7 +534,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return true; return true;
} }
else if (inv.BusinessType == EnumBusinessType.JisHBPO) else if (inv.BusinessType == EnumBusinessType.JisHBPO)
{ {
var pdlist = _pdhbpoRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单 var pdlist = _pdhbpoRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单
@ -889,6 +889,39 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
return true; return true;
} }
//public INVOICE_GRP FindAncestor(List<INVOICE_GRP> p_list,INVOICE_GRP currentNode, string invbillNum)
//{
// if (currentNode == null || currentNode.InvbillNum == invbillNum)
// {
// return currentNode;
// }
// var parentNode=p_list.Where(p => p.InvbillNum == currentNode.InvbillNum).FirstOrDefault();
// return FindAncestor(p_list, parentNode, invbillNum);
//}
//public virtual async Task<bool> IsSplittingMultipleInvoices(List<string> invs, string p_invbillnum)
//{
// _repository.Where(p=>)
//}
/// <summary> /// <summary>
/// 返回到财务审核状态 /// 返回到财务审核状态
/// </summary> /// </summary>
@ -1049,7 +1082,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var query = from itm in dtos var query = from itm in dtos
join itm1 in ls join itm1 in ls
on new { itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } on new { itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate }
join itm2 in p_list on new { itm.PartCode, itm.SettleDate } equals new { itm2.PartCode, itm2.SettleDate } join itm2 in p_list on new { itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.PartCode,itm2.PN, itm2.SettleDate }
select itm2; select itm2;
foreach (var itm in query) foreach (var itm in query)
{ {
@ -1062,7 +1095,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var query1 = from itm in dtos var query1 = from itm in dtos
join itm1 in ls join itm1 in ls
on new { itm.LU,itm.PartCode ,itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } on new { itm.LU,itm.PartCode ,itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate }
join itm2 in p_ajdlist on new { itm.PartCode, itm.SettleDate } equals new { itm2.PartCode, itm2.SettleDate } join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate }
select itm2; select itm2;
foreach (var itm in query1) foreach (var itm in query1)
@ -1167,11 +1200,217 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
public async Task<List<string>> FirstInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail : SA_CAN_BASE
{
List<string> _invls = new List<string>();
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>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
//反向查找结算数据
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in invdetails)
{
detail.InvbillNum = key;
salist.Add(detail);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
//反向查找调整数据
var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
adjdetails.Add(detail);
}
}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID })
.Select(itm => new
{
PartCode = itm.Key.PartCode,
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.PartCode,
ContactDocID = itm.Key.ContractDocID,
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: p_version,
invbillNum: key,
invGroupNum: p_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: p_version,
invbillNum: key,
invGroupNum: p_InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode: detail.PartCode
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
var innotls = new List<INVOICE_NOT_SETTLE>();
if (p_notlist != null && p_notlist.Count > 0)
{
var notls = p_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) });
foreach (var nitm in notls)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_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: businessType,
invGroupNum: p_InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0,
parent: string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
realAmt: 0
);
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
if (salist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
if (notDetialList.Count > 0)
{
await _repository.DbContext.BulkInsertAsync(notDetialList);
}
_invls = invlist.Select(p => p.InvbillNum).ToList();
}
return _invls;
}
/// <summary> /// <summary>
/// hbpojis,备件 /// hbpojis
/// </summary> /// </summary>
/// <param name="dtos">可结算明细列表</param> /// <param name="dtos">可结算明细列表</param>
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
@ -1287,7 +1526,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var query = from itm in dtos var query = from itm in dtos
join itm1 in ls join itm1 in ls
on new { LU=itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate } on new { LU=itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in details on new { itm.LU,itm.PartCode, itm.SettleDate } equals new { itm2.LU,itm2.PartCode,itm2.SettleDate } join itm2 in details on new { itm.LU,itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.LU,itm2.PartCode,itm2.PN,itm2.SettleDate }
select itm2; select itm2;
foreach (var itm in query) foreach (var itm in query)
{ {
@ -1411,7 +1650,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_parentInvBillNum"></param> /// <param name="p_parentInvBillNum"></param>
/// <param name="businessType"></param> /// <param name="businessType"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<string>> FirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) public async Task<List<string>> JITInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType,bool p_first)
where TDetail:SA_CAN_BASE where TDetail:SA_CAN_BASE
{ {
List<string> _invls = new List<string>(); List<string> _invls = new List<string>();
@ -1426,7 +1665,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
Dictionary<string, List<string>> invoiceMap = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> invoiceMap = new Dictionary<string, List<string>>();
foreach (var itm in dic) foreach (var itm in dic)
{ {
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); string invoiceBillNum = string.Empty;
if (p_first == true)
{
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
}
else
{
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
}
List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号 List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号
List<string> List = new List<string>(); List<string> List = new List<string>();
decimal sum = itm.Value;//初始分组合计金额 decimal sum = itm.Value;//初始分组合计金额
@ -1644,15 +1892,53 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
inv.InvoiceState = InvoiceBillState.; inv.InvoiceState = InvoiceBillState.;
List<string> invlist = new List<string>(); List<string> invlist = new List<string>();
if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian)
switch (inv.BusinessType)
{ {
case EnumBusinessType.MaiDanJianHBPO:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
} break;
else case EnumBusinessType.MaiDanJianBBAC:
{ invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum,inv.InvbillNum, inv.BusinessType, true);
break;
case EnumBusinessType.JisBBAC:
invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票 invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
break;
case EnumBusinessType.JisHBPO:
invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
break;
case EnumBusinessType.YinDuJian:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票
break;
} }
//if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO)
//{
// invlist = await MakeInvoice(p_list,p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
//}
//if (inv.BusinessType == EnumBusinessType.BeiJian)
//{
// invlist = await BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
//}
//else
//{
// invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
//}
if (invlist.Count == 0) if (invlist.Count == 0)
{ {
return false; return false;
@ -1670,6 +1956,258 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
return false; return false;
} }
public async Task<List<string>> BJInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType,bool p_first=true)
where TDetail : SA_CAN_BASE
{
List<string> _invls = new List<string>();
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 = string.Empty;
if (p_first == true)
{
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
}
else
{
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
}
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>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
//反向查找结算数据
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in invdetails)
{
detail.InvbillNum = key;
salist.Add(detail);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
//反向查找调整数据
var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
adjdetails.Add(detail);
}
}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID })
.Select(itm => new
{
PartCode = itm.Key.PartCode,
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.PartCode,
ContactDocID = itm.Key.ContractDocID,
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();
var query = from inv1 in invdetails
join dto1 in dtos on
new { inv1.LU, inv1.PN } equals new { dto1.LU, dto1.PN }
select new
{
PartCode = inv1.PartCode,
InvGroupNum = inv1.InvGroupNum,
LU = inv1.LU,
GroupNum=inv1.GroupNum,
Price = inv1.Price,
Amt = dto1.Amt,
Qty = dto1.Qty,
BeginDate = dto1.BeginDate,
EndDate = dto1.EndDate,
DeliveryNumber = inv1.GetProperty("DeliveryNumber", ""),//交货号
InvoiceNumber = inv1.GetProperty("InvoiceNumber", ""),//发票号
VendorCode = inv1.GetProperty("VendorCode", ""),//供应商代码
VendorName = inv1.GetProperty("VendorName", ""),//供应商名称
PurchaseOrderNumber = inv1.GetProperty("PurchaseOrderNumber", ""),//采购订单号
DeliveryIndexNumber = inv1.GetProperty("DeliveryIndexNumber", ""),//交付索引号
PartName = inv1.GetProperty("PartName", ""),//零件名称
};
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: p_version,
invbillNum: key,
invGroupNum: p_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 query.ToList())
{
var entity = new INVOICE_WAIT_DETAIL(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: key,
invGroupNum: p_InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.GroupNum,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode: detail.PartCode);
entity.SetProperty("DeliveryNumber", detail.DeliveryIndexNumber);//交货号
entity.SetProperty("VendorCode", detail.VendorCode);//供应商代码
entity.SetProperty("VendorName", detail.VendorName);//供应商名称
entity.SetProperty("PurchaseOrderNumber", "");//采购订单号
entity.SetProperty("DeliveryIndexNumber", "");//交付索引号
entity.SetProperty("PartName", "");//零件名称
_entityDetailList.Add( entity
);
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
//var innotls = new List<INVOICE_NOT_SETTLE>();
//if (p_notlist != null && p_notlist.Count > 0)
//{
// var notls = p_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) });
// foreach (var nitm in notls)
// {
// innotls.Add(new INVOICE_NOT_SETTLE(
// guid: GuidGenerator.Create(),
// version: p_version,
// invGroupNum: p_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: businessType,
invGroupNum: p_InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0,
parent: string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
realAmt: 0
);
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
if (salist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
if (notDetialList.Count > 0)
{
await _repository.DbContext.BulkInsertAsync(notDetialList);
}
_invls = invlist.Select(p => p.InvbillNum).ToList();
}
return _invls;
}
/// <summary> /// <summary>
/// 重开二次开票 /// 重开二次开票
/// </summary> /// </summary>
@ -1696,14 +2234,36 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
inv.InvoiceState = InvoiceBillState.; inv.InvoiceState = InvoiceBillState.;
List<string> invlist = new List<string>(); List<string> invlist = new List<string>();
if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian)
switch (inv.BusinessType)
{ {
case EnumBusinessType.MaiDanJianHBPO:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false);
} break;
else case EnumBusinessType.MaiDanJianBBAC:
{ invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType,false);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);
break;
case EnumBusinessType.JisBBAC:
invlist = await SecInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);
break;
case EnumBusinessType.JisHBPO:
invlist = await SecInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType); invlist = await SecInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);
break;
case EnumBusinessType.YinDuJian:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);//重开可以变多张发票
break;
} }
if (invlist.Count == 0) if (invlist.Count == 0)
{ {
return false; return false;

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs

@ -30,6 +30,7 @@ public class TMEP_INV
public class TEMP_CAN_SA_DETAIL public class TEMP_CAN_SA_DETAIL
{ {
public Guid Id { set; get; }
/// <summary> /// <summary>
///关联结算单号 ///关联结算单号
/// </summary> /// </summary>

5404
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230811013305_202308110001.Designer.cs

File diff suppressed because it is too large

44
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230811013305_202308110001.cs

@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308110001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"));
migrationBuilder.AddColumn<string>(
name: "PartCode",
table: "Set_INVOICE_WAIT_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("427dcb95-130f-40c7-8e7e-bf9cc2749dec"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "a20e124c6b89416ba16a2c424034dd37", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("427dcb95-130f-40c7-8e7e-bf9cc2749dec"));
migrationBuilder.DropColumn(
name: "PartCode",
table: "Set_INVOICE_WAIT_DETAIL");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "1d0093aa74814ffd982671a5ac362c52", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
}
}

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

@ -2579,6 +2579,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<decimal>("PRICE") b.Property<decimal>("PRICE")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Qty") b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@ -4390,10 +4393,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"), Id = new Guid("427dcb95-130f-40c7-8e7e-bf9cc2749dec"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "1d0093aa74814ffd982671a5ac362c52", ConcurrencyStamp = "a20e124c6b89416ba16a2c424034dd37",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

Loading…
Cancel
Save