Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
8a7cef051d
  1. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_PD_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  3. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  4. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  5. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  6. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  7. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  8. 57
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  9. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

18
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_PD_DTO.cs

@ -136,22 +136,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 替换生产码 /// 替换生产码
/// </summary> /// </summary>
public string REPN { get; set; } public string REPN { get; set; }
/// <summary>
/// 键值
/// </summary>
public string KeyCode { get; set; }
/// <summary>
/// 扩展字段1
/// </summary>
public string Extend1 { get; set; }
/// <summary>
/// 扩展字段2
/// </summary>
public string Extend2 { get; set; }
/// <summary>
/// 扩展字段3
/// </summary>
public string Extend3 { get; set; }
/// <summary> /// <summary>
/// 客户零件号 /// 客户零件号
/// </summary> /// </summary>

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

@ -255,13 +255,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary> /// <summary>
///零件号 ///零件号
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "客户零件号")]
public string LU { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
///零件号 ///零件号
/// </summary> /// </summary>
[Display(Name = "客户零件号")] [Display(Name = "零件号")]
public string PartCode { get; set; } public string PartCode { get; set; }

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

@ -30,6 +30,7 @@ using Win.Abp.Snowflakes;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Volo.Abp; using Volo.Abp;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Volo.Abp.Uow;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
@ -81,15 +82,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[UnitOfWork(false)]
public async override Task<IActionResult> GenerateInvoice([FromBody] string invbillNum) public async override Task<IActionResult> GenerateInvoice([FromBody] string invbillNum)
{ {
var main =await _bbacMng.GetMainAsync(invbillNum); var main =await _bbacMng.GetMainAsync(invbillNum);
if (main != null) if (main != null)
{ {
if (main.State != SettleBillState.) if (main.State != SettleBillState.)
{ {
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" }); return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });

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

@ -70,6 +70,13 @@ namespace SettleAccount.Bases
public virtual string Site { get; set; } public virtual string Site { get; set; }
public virtual void SetId(Guid guid)
{
Id = guid;
}
} }

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -46,6 +46,9 @@ public class BBAC_CAN_SA : SA_CAN_BASE_MAIN
Site = site; Site = site;
BusinessType = businessType; BusinessType = businessType;
} }
} }
[Display(Name = "BBAC可结算导入明细")] [Display(Name = "BBAC可结算导入明细")]

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -64,6 +64,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N"); var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new BBAC_CAN_SA(); var _entity = new BBAC_CAN_SA();
_entity.SetId(Guid.NewGuid());
_entity.BillNum = billNumber; _entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber; _entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month; _entity.Version = DateTime.Now.Year + DateTime.Now.Month;

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

@ -76,6 +76,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.State = SettleBillState.; _entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty; _entity.SettleBillNum = string.Empty;
_entity.BusinessType = p_list.FirstOrDefault().BusinessType; _entity.BusinessType = p_list.FirstOrDefault().BusinessType;
_entity.SetId(Guid.NewGuid());
var _entityList = new List<HBPO_CAN_SA_DETAIL>(); var _entityList = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm in p_list) foreach (var itm in p_list)
{ {

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

@ -1282,14 +1282,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
if (invoiceMap.Keys.Count > 0) if (invoiceMap.Keys.Count > 0)
{ {
var groupList = new List<INVOICE_MAP_GROUP>(); var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>(); var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>(); var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>(); var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>(); var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>(); var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和 foreach (var itm in invoiceMap)//分组影响和
{ {
var key = itm.Key;//发票票号 var key = itm.Key;//发票票号
@ -1311,21 +1309,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
adjdetails.Add(detail); 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,p.LU })
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 .Select(itm => new
{ {
PartCode = itm.Key.PartCode, PartCode = itm.Key.PartCode,
InvGroupNum = itm.Key.InvGroupNum, InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.PartCode, LU = itm.Key.LU,
ContactDocID = itm.Key.ContractDocID, ContactDocID = itm.Key.ContractDocID,
Price = itm.Key.Price, Price = itm.Key.Price,
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), 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, BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate EndDate = itm.Key.EndDate
}) }).ToList();
.ToList();
decimal amt = detailDtos.Sum(k => k.Amt); decimal amt = detailDtos.Sum(k => k.Amt);
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2);
var mapList = new List<INVOICE_MAP_GROUP>(); var mapList = new List<INVOICE_MAP_GROUP>();
@ -1373,10 +1369,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
detailList.AddRange(_entityDetailList); detailList.AddRange(_entityDetailList);
} }
var innotls = new List<INVOICE_NOT_SETTLE>(); var innotls = new List<INVOICE_NOT_SETTLE>();
var sq = dtos.Where(p => itm.Value.Contains(p.GroupNum)).GroupBy(p => new { p.LU, p.GroupNum })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = itm.Key, GroupNum = p.Key.GroupNum });
foreach (var sitm in sq)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: sitm.GroupNum,
lU: sitm.LU,
lU1: sitm.LU,
extend1: string.Empty,
extend2: string.Empty,
qty: sitm.Qty,
p_invbillnum: itm.Key
));
}
if (p_notlist != null && p_notlist.Count > 0) if (p_notlist != null && p_notlist.Count > 0)
{ {
var groupnum = itm.Value; var groupnum = itm.Value;
var notls = p_notlist.Where(p=>groupnum.Contains(p.GroupNum)).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 notls = p_notlist.Where(p => groupnum.Contains(p.GroupNum)).GroupBy(p => new { p.GroupNum, p.LU })
.Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = itm.Key });
foreach (var nitm in notls) foreach (var nitm in notls)
{ {
innotls.Add(new INVOICE_NOT_SETTLE( innotls.Add(new INVOICE_NOT_SETTLE(
@ -1384,12 +1399,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
version: p_version, version: p_version,
invGroupNum: p_InvGroupNum, invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum, settleGroupNum: nitm.GroupNum,
lU: string.Empty, lU: nitm.LU,
lU1: nitm.LU, lU1: nitm.LU,
extend1: string.Empty, extend1: string.Empty,
extend2: string.Empty, extend2: string.Empty,
qty: nitm.Qty, qty: nitm.Qty,
p_invbillnum:itm.Key p_invbillnum: itm.Key
)); ));
} }
if (innotls.Count > 0) if (innotls.Count > 0)
@ -1408,9 +1423,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invGroupNum: p_InvGroupNum, invGroupNum: p_InvGroupNum,
state: SettleBillState., state: SettleBillState.,
invoiceBillState: InvoiceBillState., invoiceBillState: InvoiceBillState.,
tax: 0, tax: 0,
parent: string.Empty, parent: string.Empty,
preTaxDiff: 0, preTaxDiff: 0,
taxDiff: 0, taxDiff: 0,
clientCode: string.Empty, clientCode: string.Empty,
realAmt: 0 realAmt: 0
@ -1418,18 +1433,26 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invlist.Add(invbill); invlist.Add(invbill);
} }
if (salist.Count > 0)
{
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
string str = $" EXEC [p_Invoice_generation_change] @invbillnum = {"'" + key + "'"},@groupNum = {"'" + string.Join(",", ls) + "'"},@businessType = NULL";
await _repository.DbContext.Database.ExecuteSqlRawAsync(str);
}
// await _repository.DbContext.BulkUpdateAsync(salist,new BulkConfig() { BatchSize=10000 });
}
await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList); await _repository.DbContext.BulkInsertAsync(detailList);
if (salist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0) if (adjlist.Count > 0)
{ {
await _repository.DbContext.BulkUpdateAsync(adjlist); await _repository.DbContext.BulkUpdateAsync(adjlist);

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

@ -95,6 +95,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N"); var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA(); var _entity = new PUB_CAN_SA();
_entity.SetId(Guid.NewGuid());
_entity.BillNum = billNumber; _entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber; _entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month; _entity.Version = DateTime.Now.Year + DateTime.Now.Month;
@ -134,6 +135,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{ {
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N"); var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA(); var _entity = new PUB_CAN_SA();
_entity.SetId(Guid.NewGuid());
_entity.BillNum = billNumber; _entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber; _entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month; _entity.Version = DateTime.Now.Year + DateTime.Now.Month;

Loading…
Cancel
Save