Browse Source

更新版本

master
zhaoxinyu 4 months ago
parent
commit
83e7eae679
  1. 1202
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs
  2. 132
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

1202
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs

File diff suppressed because it is too large

132
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using SettleAccount.Bases;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Bases;
namespace SettleAccount.Domain.BQ
{
@ -92,4 +96,132 @@ namespace SettleAccount.Domain.BQ
{
}
}
public class InvoiceBySame<T> where T : SA_CAN_BASE, new()
{
public string InvBillNum { set; get; }
public InvoiceBySame() { }
private List<T> parts = new List<T>();
public IReadOnlyList<T> Parts => parts.AsReadOnly();
public decimal TotalAmount => parts.Sum(p => p.Price);
// public int PartCount => parts.GroupBy(p => new { p.LU, p.PartCode }).Count();
public bool CanAddPart(T part)
{
return TotalAmount + part.Price <= 10000000;
}
public void AddPart(T part)
{
if (CanAddPart(part))
{
part.InvbillNum = InvBillNum;
parts.Add(part);
}
}
}
public class InvoiceGeneratorSame<T> where T : SA_CAN_BASE, new()
{
private List<InvoiceBySame<T>> invoices = new List<InvoiceBySame<T>>();
public IReadOnlyList<InvoiceBySame<T>> Invoices => invoices.AsReadOnly();
public void GenerateInvoices(List<T> parts)
{
InvoiceBySame<T> currentInvoice = new InvoiceBySame<T>();
invoices.Add(currentInvoice);
currentInvoice.InvBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
foreach (var part in parts)
{
if (!currentInvoice.CanAddPart(part))
{
currentInvoice = new InvoiceBySame<T>();
currentInvoice.InvBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
invoices.Add(currentInvoice);
}
currentInvoice.AddPart(part);
}
}
public InvoiceGeneratorSame()
{
}
public InvoiceGeneratorSame(List<InvoiceBySame<T>> invoices)
{
this.invoices = invoices;
}
}
public class InvoiceByDiff
{
public string InvBillNum { set; get; }
public InvoiceByDiff() { }
private List<GroupPartCode> parts = new List<GroupPartCode>();
public IReadOnlyList<GroupPartCode> Parts => parts.AsReadOnly();
public decimal TotalAmount => parts.Sum(p => p.Amt);
public int PartCount => parts.GroupBy(p => new { p.LU, p.PartCode }).Count();
public bool CanAddPart(GroupPartCode part)
{
return TotalAmount + part.Amt < 10000000 && PartCount < 15;
}
public void AddPart(GroupPartCode part)
{
if (CanAddPart(part))
{
parts.Add(part);
}
}
}
public class InvoiceGeneratorDiff
{
private List<InvoiceByDiff> invoices = new List<InvoiceByDiff>();
public IReadOnlyList<InvoiceByDiff> Invoices => invoices.AsReadOnly();
public void GenerateInvoices(List<GroupPartCode> parts)
{
InvoiceByDiff currentInvoice = new InvoiceByDiff();
invoices.Add(currentInvoice);
currentInvoice.InvBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
foreach (var part in parts)
{
if (!currentInvoice.CanAddPart(part))
{
currentInvoice = new InvoiceByDiff();
currentInvoice.InvBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
invoices.Add(currentInvoice);
}
currentInvoice.AddPart(part);
}
}
public InvoiceGeneratorDiff()
{
}
public InvoiceGeneratorDiff(List<InvoiceByDiff> invoices)
{
this.invoices = invoices;
}
}
public class GroupPartCode
{
public string PartCode { set; get; }
public string InvGroupNum { set; get; }
public string LU { set; get; }
public string ContactDocID { set; get; }
public decimal Price { set; get; }
public decimal Amt { set; get; }
public decimal Tax { set; get; }
public decimal TaxAmt { set; get; }
public decimal Qty { set; get; }
public DateTime? BeginDate { set; get; }
public DateTime? EndDate { set; get; }
}
}

Loading…
Cancel
Save