Browse Source

更新版本

master
zhaoxinyu 11 months ago
parent
commit
d862713251
  1. 5
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 77
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  3. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs
  4. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs

5
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -6,7 +6,10 @@
"Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", "Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
//"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", //"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"SettleAccountService": "Server=10.60.101.83;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"ExChangeCenterService": "Server=dev.ccwin-in.com,13326;Database=ExChangeCenter;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", "ExChangeCenterService": "Server=dev.ccwin-in.com,13326;Database=ExChangeCenter;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", "WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;",

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

@ -142,6 +142,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var invoiceGrpDetails = _settleAccountDbContext.Set<INVOICE_WAIT_DETAIL>().AsNoTracking() var invoiceGrpDetails = _settleAccountDbContext.Set<INVOICE_WAIT_DETAIL>().AsNoTracking()
.Where(t => t.InvbillNum == invbillNum) .Where(t => t.InvbillNum == invbillNum)
.ToList(); .ToList();
var invoiceGrpDetailsCopy = JsonConvert.DeserializeObject<List<INVOICE_WAIT_DETAIL>>(JsonConvert.SerializeObject(invoiceGrpDetails));
var invmaidanlist= await _bbacMng.GetOnlyMaiDanAsync(invbillNum);
if (invmaidanlist != null && invmaidanlist.Count() > 0)
{
var query = from itm1 in invoiceGrpDetails
join itm2 in invmaidanlist
on new { PartCode = itm1.PartCode, ContractDocID = itm1.Extend1 }
equals new { PartCode = itm2.PartCode, itm2.ContractDocID }
into temp
from j in temp.DefaultIfEmpty()
where j == null
select itm1;
invoiceGrpDetails = query.ToList();
}
if (invoiceGrpDetails.Any()) if (invoiceGrpDetails.Any())
{ {
var tedSaInvs = new List<TED_SAS_INVOICE>(); var tedSaInvs = new List<TED_SAS_INVOICE>();
@ -177,11 +194,38 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
else else
{ {
if (itm.Qty > first.Qty) if (itm.Qty >= first.Qty)
{ {
inv.Qty = itm.Qty - first.Qty;//发票总数中去除 inv.Qty = itm.Qty - first.Qty;//发票总数中去除
inv.Amt = Math.Round(itm.Qty * itm.PRICE, 2); inv.Amt = Math.Round((itm.Qty - first.Qty) * itm.PRICE, 2);
}
//inv.BussiessType = EnumBusinessType.MaiDanJianBBAC;
//if (invoiceGrp.Site == "1046")
//{
// inv.Extend2 = "CC16";
//}
//if (invoiceGrp.Site == "1040")
//{
// inv.Extend2 ="CC11";
//}
invdetials.Add(inv);
} }
}
foreach (var itm in _detail)
{
var inv = new INVOICE_WAIT_DETAIL();
var first= invoiceGrpDetailsCopy.FirstOrDefault(p=>p.PartCode==itm.PartCode);
inv.InjectFrom(first);
inv.LU = itm.LU;
inv.PartCode = itm.RealPartCode;
inv.Qty = itm.Qty;
inv.PRICE = first.PRICE;
inv.Amt = Math.Round(itm.Qty * first.PRICE, 2);
inv.Extend1 = itm.ContractDocID;
inv.BussiessType = EnumBusinessType.MaiDanJianBBAC; inv.BussiessType = EnumBusinessType.MaiDanJianBBAC;
if (invoiceGrp.Site == "1046") if (invoiceGrp.Site == "1046")
{ {
@ -192,9 +236,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
inv.Extend2 = "CC11"; inv.Extend2 = "CC11";
} }
invdetials.Add(inv); invdetials.Add(inv);
}
} }
for (var i = 0; i < invdetials.Count; i++) for (var i = 0; i < invdetials.Count; i++)
{ {
var invoiceGrpDetail = invdetials[i]; var invoiceGrpDetail = invdetials[i];
@ -224,7 +269,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var tedsaInvs1 = JsonConvert.DeserializeObject<List<TED_SAS_INVOICE>>(JsonConvert.SerializeObject(tedSaInvs)); var tedsaInvs1 = JsonConvert.DeserializeObject<List<TED_SAS_INVOICE>>(JsonConvert.SerializeObject(tedSaInvs));
var invbefore = invoiceGrp.TaxAmt + invoiceGrp.TaxDiff; var invbefore = invoiceGrp.TaxAmt + invoiceGrp.TaxDiff;
var invafter = tedsaInvs1.Sum(p => p.InvoiceNetAmount) + tedsaInvs1.Sum(p => p.InvoiceTaxAmount);
var a = tedsaInvs1.Sum(p => p.InvoiceNetAmount);
var b=tedsaInvs1.Sum(p => p.InvoiceTaxAmount);
var invafter = a + b;
var invdiff = invbefore - invafter; var invdiff = invbefore - invafter;
var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1"); var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1");
var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2"); var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2");
@ -239,7 +288,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _exChangeCenterDbContext.BulkInsertAsync(tedsaInvs1).ConfigureAwait(false); await _exChangeCenterDbContext.BulkInsertAsync(tedsaInvs1).ConfigureAwait(false);
invoiceGrp.State = SettleBillState.QAD; invoiceGrp.State = SettleBillState.QAD;
await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp }); await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp });
await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode, invoiceGrp.CreationTime).ConfigureAwait(false);
//await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false); //await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false);
// var retryPolicyAsync = Policy.Handle<Exception>().WaitAndRetryAsync(new[] { // var retryPolicyAsync = Policy.Handle<Exception>().WaitAndRetryAsync(new[] {
@ -299,6 +348,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
invoiceGrpDetail.SetProperty("ErpToLoc", $"C{invoiceGrp.ClientCode}"); invoiceGrpDetail.SetProperty("ErpToLoc", $"C{invoiceGrp.ClientCode}");
} }
if (invoiceGrpDetail.BussiessType == EnumBusinessType.ZhiGongJianHBPO)
{
invoiceGrpDetail.SetProperty("ErpToLoc", $"C{invoiceGrp.ClientCode}");
}
if (invoiceGrpDetail.BussiessType == EnumBusinessType.YinDuJian) if (invoiceGrpDetail.BussiessType == EnumBusinessType.YinDuJian)
{ {
invoiceGrpDetail.SetProperty("ErpToLoc", "CC001"); invoiceGrpDetail.SetProperty("ErpToLoc", "CC001");
@ -337,7 +390,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _exChangeCenterDbContext.BulkInsertAsync(tedSaInvs).ConfigureAwait(false); await _exChangeCenterDbContext.BulkInsertAsync(tedSaInvs).ConfigureAwait(false);
invoiceGrp.State = SettleBillState.QAD; invoiceGrp.State = SettleBillState.QAD;
await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp }); await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp });
await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode, invoiceGrp.CreationTime).ConfigureAwait(false);
} }
} }
@ -402,6 +455,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
inv.Qty = itm.Qty - first.Qty;//发票总数中去除 inv.Qty = itm.Qty - first.Qty;//发票总数中去除
inv.Amt = Math.Round(itm.Qty * itm.PRICE, 2); inv.Amt = Math.Round(itm.Qty * itm.PRICE, 2);
} }
inv.BussiessType = EnumBusinessType.MaiDanJianBBAC; inv.BussiessType = EnumBusinessType.MaiDanJianBBAC;
if (invoiceGrp.Site == "1046") if (invoiceGrp.Site == "1046")
{ {
@ -460,7 +517,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _exChangeCenterDbContext.BulkInsertAsync(tedsaInvs1).ConfigureAwait(false); await _exChangeCenterDbContext.BulkInsertAsync(tedsaInvs1).ConfigureAwait(false);
invoiceGrp.State = SettleBillState.QAD; invoiceGrp.State = SettleBillState.QAD;
await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp }); await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp });
await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode,invoiceGrp.CreationTime).ConfigureAwait(false);
} }
} }
else else
@ -533,7 +590,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _exChangeCenterDbContext.BulkInsertAsync(tedSaInvs).ConfigureAwait(false); await _exChangeCenterDbContext.BulkInsertAsync(tedSaInvs).ConfigureAwait(false);
invoiceGrp.State = SettleBillState.QAD; invoiceGrp.State = SettleBillState.QAD;
await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp }); await _repository.DbContext.BulkUpdateAsync(new List<INVOICE_GRP>() { invoiceGrp });
await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode,invoiceGrp.CreationTime).ConfigureAwait(false);
} }
} }
@ -542,9 +599,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 构建发票同步Qad状态表数据 /// 构建发票同步Qad状态表数据
/// </summary> /// </summary>
private async Task BindInvoiceSyncQadAsync(TEA_TASK_SUB teaTaskSub, string invoiceNumber, string sasInvoiceNumber, string customer) private async Task BindInvoiceSyncQadAsync(TEA_TASK_SUB teaTaskSub, string invoiceNumber, string sasInvoiceNumber, string customer,DateTime dateTime)
{ {
var invoiceSyncQad = new InvoiceSyncQad(teaTaskSub.TaskID, invoiceNumber, sasInvoiceNumber) var invoiceSyncQad = new InvoiceSyncQad(teaTaskSub.TaskID, invoiceNumber, sasInvoiceNumber,dateTime)
{ {
TableName = teaTaskSub.TableName, TableName = teaTaskSub.TableName,

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

@ -73,11 +73,12 @@ namespace SettleAccount.Domain.BQ
} }
public InvoiceSyncQad(Guid taskId, string invoiceNumber, string sasInvoiceNumber) public InvoiceSyncQad(Guid taskId, string invoiceNumber, string sasInvoiceNumber,DateTime dateTime)
{ {
TaskId = taskId; TaskId = taskId;
InvoiceNumber = invoiceNumber; InvoiceNumber = invoiceNumber;
SasInvoiceNumber = sasInvoiceNumber; SasInvoiceNumber = sasInvoiceNumber;
CreationTime = dateTime;
} }
public void SetId(Guid p_id) public void SetId(Guid p_id)

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs

@ -5,8 +5,10 @@ using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SkiaSharp;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.CurrentBranch;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
@ -269,8 +271,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
.GroupBy(p=>new { p.PartCode ,p.ContractDocID }).Select(p=> new BBAC_CAN_SA_DETAIL { Qty=p.Sum(itm=>itm.Qty),PartCode=p.Key.PartCode,ContractDocID=p.Key.ContractDocID }).ToListAsync(); .GroupBy(p=>new { p.PartCode ,p.ContractDocID }).Select(p=> new BBAC_CAN_SA_DETAIL { Qty=p.Sum(itm=>itm.Qty),PartCode=p.Key.PartCode,ContractDocID=p.Key.ContractDocID }).ToListAsync();
} }
public virtual async Task<List<BBAC_CAN_SA_DETAIL>> GetOnlyMaiDanAsync(string p_invbillnum)
{
var a=_detailRepository.Where(p => p.InvbillNum == p_invbillnum && p.BusinessType != EnumBusinessType.JisBBAC);
var b= _detailRepository.Where(p => p.InvbillNum == p_invbillnum && p.BusinessType == EnumBusinessType.JisBBAC);
var result = (from itm1 in a
join itm2 in b
on new { itm1.PartCode, itm1.ContractDocID } equals new { itm2.PartCode, itm2.ContractDocID }
into joinTable
from j in joinTable.DefaultIfEmpty()
where j == null
select new BBAC_CAN_SA_DETAIL { PartCode= itm1.PartCode,ContractDocID= itm1.ContractDocID }).Distinct();
return result.ToList();
}
} }
} }

Loading…
Cancel
Save