Browse Source

更新版本

master
zhaoxinyu 11 months ago
parent
commit
272a79092f
  1. 5
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 95
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  3. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

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

@ -5,12 +5,7 @@
"ConnectionStrings": { "ConnectionStrings": {
"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=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;",
"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;",
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" "questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;"

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

@ -57,7 +57,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary> /// </summary>
private readonly ExChangeCenterDbContext _exChangeCenterDbContext; private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
private readonly GlobalConfigOptions _globalConfigOptions; private readonly GlobalConfigOptions _globalConfigOptions;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
@ -157,8 +156,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
select itm1; select itm1;
invoiceGrpDetails = query.ToList(); invoiceGrpDetails = query.ToList();
} }
if (invoiceGrpDetails.Any()) if (invoiceGrpDetails.Any())
{ {
var tedSaInvs = new List<TED_SAS_INVOICE>(); var tedSaInvs = new List<TED_SAS_INVOICE>();
@ -211,14 +208,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//} //}
invdetials.Add(inv); invdetials.Add(inv);
} }
} }
foreach (var itm in _detail) foreach (var itm in _detail)
{ {
var inv = new INVOICE_WAIT_DETAIL(); var inv = new INVOICE_WAIT_DETAIL();
var first= invoiceGrpDetailsCopy.FirstOrDefault(p=>p.PartCode==itm.PartCode); var first= invoiceGrpDetailsCopy.FirstOrDefault(p=>p.PartCode==itm.PartCode);
inv.InjectFrom(first); inv.InjectFrom(first);
inv.LU = itm.LU; inv.LU = itm.LU;
@ -237,10 +231,7 @@ 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];
@ -268,18 +259,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
LINE = (i + 1).ToString() LINE = (i + 1).ToString()
}); });
} }
var tedsaInvs1 = JsonConvert.DeserializeObject<List<TED_SAS_INVOICE>>(JsonConvert.SerializeObject(tedSaInvs));
var invbefore = invoiceGrp.TaxAmt + invoiceGrp.TaxDiff;
var a = tedsaInvs1.Sum(p => p.InvoiceNetAmount); var tedsaInvs1 = JsonConvert.DeserializeObject<List<TED_SAS_INVOICE>>(JsonConvert.SerializeObject(tedSaInvs));
//var invbefore = invoiceGrp.TaxAmt + invoiceGrp.TaxDiff;
var b=tedsaInvs1.Sum(p => p.InvoiceTaxAmount); var invbefore = invoiceGrp.RealAmt + invoiceGrp.TaxDiff;//
var invafter = a + b; var invafter = tedsaInvs1.Sum(p => p.InvoiceTaxAmount);
var invdiff = invbefore - invafter; var invdiff = invbefore - invafter;
var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1");
var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2"); //invoiceGrp.RealAmt + invoiceGrp.TaxDiff-invafter;
line2.InvoiceTaxAmount += invdiff;
line1.InvoiceTaxAmount += invoiceGrp.TaxDiff;
tedsaInvs1.FirstOrDefault().InvoiceTaxAmount += invdiff;
//var a = tedsaInvs1.Sum(p => p.InvoiceNetAmount);
//var b= tedsaInvs1.Sum(p => p.InvoiceTaxAmount);
//var invafter = a + b;
//var invdiff = invbefore - invafter;
//var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1");
//var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2");
//line2.InvoiceTaxAmount += invdiff;
//line1.InvoiceTaxAmount += invoiceGrp.TaxDiff;
//红冲发票提交QAD //红冲发票提交QAD
if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum)) if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum))
{ {
@ -381,7 +382,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
LINE = (i + 1).ToString() LINE = (i + 1).ToString()
}); });
} }
tedSaInvs.FirstOrDefault().InvoiceTaxAmount += invoiceGrp.TaxDiff;
var invbefore = invoiceGrp.RealAmt + invoiceGrp.TaxDiff;//
var invafter = tedSaInvs.Sum(p => p.InvoiceTaxAmount);
var invdiff = invbefore - invafter;
tedSaInvs.FirstOrDefault().InvoiceTaxAmount += invdiff;
//tedSaInvs.FirstOrDefault().InvoiceTaxAmount += invoiceGrp.TaxDiff;
//红冲发票提交QAD //红冲发票提交QAD
if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum)) if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum))
{ {
@ -410,7 +418,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
return; return;
} }
if (p_detail != null && p_detail.Count > 0) if (p_detail != null && p_detail.Count > 0)
{ {
var _detail = p_detail.ToList(); var _detail = p_detail.ToList();
@ -456,10 +463,6 @@ 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")
{ {
@ -502,19 +505,30 @@ 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.RealAmt + invoiceGrp.TaxDiff;//
var invafter = tedsaInvs1.Sum(p => p.InvoiceNetAmount) + tedsaInvs1.Sum(p => p.InvoiceTaxAmount); var invafter = tedsaInvs1.Sum(p => p.InvoiceTaxAmount);
var invdiff = invbefore - invafter; var invdiff = invbefore - invafter;
var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1"); tedsaInvs1.FirstOrDefault().InvoiceTaxAmount += invdiff;
var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2"); //invbefore= invafter +x;
line2.InvoiceTaxAmount += invdiff; //var line1 = tedsaInvs1.FirstOrDefault(p => p.LINE == "1");
line1.InvoiceTaxAmount += invoiceGrp.TaxDiff; //var line2 = tedsaInvs1.FirstOrDefault(p => p.LINE == "2");
////line2.InvoiceTaxAmount += invdiff;
//line1.InvoiceTaxAmount += invdiff;
//红冲发票提交QAD //红冲发票提交QAD
if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum)) if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum))
{ {
await SubmitToQadHongChongAsync(invoiceGrp.ParentInvbillNum,_detail).ConfigureAwait(false); await SubmitToQadHongChongAsync(invoiceGrp.ParentInvbillNum,_detail).ConfigureAwait(false);
} }
await _exChangeCenterDbContext.BulkInsertAsync(new List<TEA_TASK_SUB>() { teaTaskSub }).ConfigureAwait(false); await _exChangeCenterDbContext.BulkInsertAsync(new List<TEA_TASK_SUB>() { teaTaskSub }).ConfigureAwait(false);
foreach (var itm in tedsaInvs1)
{
itm.InvoiceQuatity = -itm.InvoiceQuatity;
itm.InvoiceNetAmount = -itm.InvoiceNetAmount;
itm.InvoiceTaxAmount=-itm.InvoiceTaxAmount;
}
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 });
@ -577,10 +591,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//红冲发票提交QAD //红冲发票提交QAD
if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum)) if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum))
{ {
await SubmitToQadHongChongAsync(invoiceGrp.ParentInvbillNum).ConfigureAwait(false); await SubmitToQadHongChongAsync(invoiceGrp.ParentInvbillNum).ConfigureAwait(false);
} }
//await _exChangeCenterDbContext.Set<TEA_TASK_SUB>().AddAsync(teaTaskSub).ConfigureAwait(false); //await _exChangeCenterDbContext.Set<TEA_TASK_SUB>().AddAsync(teaTaskSub).ConfigureAwait(false);
//await _exChangeCenterDbContext.Set<TED_SAS_INVOICE>().AddRangeAsync(tedSaInvs).ConfigureAwait(false); //await _exChangeCenterDbContext.Set<TED_SAS_INVOICE>().AddRangeAsync(tedSaInvs).ConfigureAwait(false);
@ -610,10 +621,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
Site = teaTaskSub.Site, Site = teaTaskSub.Site,
Customer = customer Customer = customer
}; };
invoiceSyncQad.SetId(teaTaskSub.TaskID); invoiceSyncQad.SetId(teaTaskSub.TaskID);
await _settleAccountDbContext.BulkInsertAsync(new List<InvoiceSyncQad>() { invoiceSyncQad }); await _settleAccountDbContext.BulkInsertAsync(new List<InvoiceSyncQad>() { invoiceSyncQad });
} }
@ -1255,13 +1263,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var first = ls.FirstOrDefault(); var first = ls.FirstOrDefault();
foreach (var inv in invlist) foreach (var inv in invlist)
{ {
var newinv1= result.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault(); var newinv1 = result.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault();
var newinv = ls.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault(); var newinv = ls.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault();
if (inv.State == SettleBillState. && inv.InvoiceState == InvoiceBillState.)
{
inv.RealnvBillNum = newinv.RealnvBillNum;
}
else
{
inv.Tax = 0.13m; inv.Tax = 0.13m;
inv.RealnvBillNum = newinv.RealnvBillNum; inv.RealnvBillNum = newinv.RealnvBillNum;
inv.TaxDiff = newinv.PreTaxDiff; inv.TaxDiff = newinv.PreTaxDiff;
inv.CreationTime = newinv1.InvoiceDate; inv.CreationTime = newinv1.InvoiceDate;
inv.FileName=newinv1.FileName; inv.FileName = newinv1.FileName;
}
} }
await _repository.DbContext.BulkUpdateAsync(invlist).ConfigureAwait(false); await _repository.DbContext.BulkUpdateAsync(invlist).ConfigureAwait(false);
await _repository.DbContext.BulkUpdateAsync(invdetail).ConfigureAwait(false); await _repository.DbContext.BulkUpdateAsync(invdetail).ConfigureAwait(false);

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -533,30 +533,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
RequestDto inputTemp = new RequestDto(); RequestDto inputTemp = new RequestDto();
//inputTemp.Filters.Add(new FilterCondition("BillTime", input.startBillTime, EnumFilterAction.BiggerThanOrEqual, EnumFilterLogic.And)); //inputTemp.Filters.Add(new FilterCondition("BillTime", input.startBillTime, EnumFilterAction.BiggerThanOrEqual, EnumFilterLogic.And));
//inputTemp.Filters.Add(new FilterCondition("BillTime", input.endBillTime, EnumFilterAction.SmallThanOrEqual, EnumFilterLogic.And)); //inputTemp.Filters.Add(new FilterCondition("BillTime", input.endBillTime, EnumFilterAction.SmallThanOrEqual, EnumFilterLogic.And));
//var entities = await _logRepository.GetListByFilterAsync(inputTemp.Filters,null,3,0).ConfigureAwait(false); //var entities = await _logRepository.GetListByFilterAsync(inputTemp.Filters,null,3,0).ConfigureAwait(false);
var beginDate = DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd") + " 00:00:00 "; var beginDate = DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd") + " 00:00:00 ";
var endDate = DateTime.Parse(input.endBillTime).ToString("yyyy/MM/dd") + " 23:59:59 "; var endDate = DateTime.Parse(input.endBillTime).ToString("yyyy/MM/dd") + " 23:59:59 ";
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
dtFormat.ShortDatePattern = "yyyy/MM/dd HH:mm:ss"; dtFormat.ShortDatePattern = "yyyy/MM/dd HH:mm:ss";
//DateTime aa= DateTime.ParseExact(DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd"), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); //DateTime aa= DateTime.ParseExact(DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd"), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
var entities = await _logRepository.Where(p => p.BillTime >= DateTime.Parse(beginDate) && p.BillTime <= DateTime.Parse(endDate)).ToListAsync(); var entities = await _logRepository.Where(p => p.BillTime >= DateTime.Parse(beginDate) && p.BillTime <= DateTime.Parse(endDate)).ToListAsync();
//IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>()); //IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
IExporter _csv = new CsvExporter(); IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter(); IExporter _excel = new ExcelExporter();
byte[] result = null; byte[] result = null;
result = await _excel.ExportAsByteArray(entities).ConfigureAwait(false); result = await _excel.ExportAsByteArray(entities).ConfigureAwait(false);
result.ShouldNotBeNull(); result.ShouldNotBeNull();
string _fileName = $"导出文件_{Guid.NewGuid().ToString()}.xlsx"; string _fileName = $"导出文件_{Guid.NewGuid().ToString()}.xlsx";
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync( await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto new SaveExcelImportInputDto
@ -664,12 +654,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//private int GetVersionByTimeSpan(DateTime p_begintime,DateTime p_endtime, string p_day) //private int GetVersionByTimeSpan(DateTime p_begintime,DateTime p_endtime, string p_day)
//{ //{
// var before = p_billtime.Year; // var before = p_billtime.Year;
// var last = before - 1; // var last = before - 1;
// DateTime lastYear = DateTime.ParseExact(string.Format("{0}-12-{1} 08:00:00", last, p_day), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);//上期时间 // DateTime lastYear = DateTime.ParseExact(string.Format("{0}-12-{1} 08:00:00", last, p_day), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);//上期时间
// DateTime beforeYear = DateTime.ParseExact(string.Format("{0}-12-{1} 07:59:59", before, p_day), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);//这期时间 // DateTime beforeYear = DateTime.ParseExact(string.Format("{0}-12-{1} 07:59:59", before, p_day), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);//这期时间
// //var result = seDetails // //var result = seDetails
// // .Select(log => // // .Select(log =>
// // { // // {
@ -1012,7 +1000,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
balance.Qty = log.ChangedQty; balance.Qty = log.ChangedQty;
} }
//更新事务分表 //更新事务分表
foreach (var item in tables) foreach (var item in tables)
{ {

Loading…
Cancel
Save