Browse Source

tijiao

master
学 赵 2 months ago
parent
commit
6422ca0f8c
  1. 12
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  3. 250
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs

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

@ -3,12 +3,12 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088,http://localhost:44378" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088,http://localhost:44378"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", "Default": "Server=10.60.101.83;Database=BJABP;User ID=sa;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=10.60.101.83;Database=BQ_SA;User ID=sa;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;Connection Timeout=120", "ExChangeCenterService": "Server=local;Database=ExchangeCenter;User ID=sa;Password=Microsoft2008;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=local;Database=ExchangeCenter;User ID=sa;Password=Microsoft2008;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=WIN-33SNP5V4K0L,1433;Database=WMS_BJBMPT_2;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;"

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -157,19 +157,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
var first = input.Filters.FirstOrDefault(p => p.Column == "businessType"); var first = input.Filters.FirstOrDefault(p => p.Column == "businessType");
var site = input.Filters.FirstOrDefault(p => p.Column == "site").Value;
if (first != null) if (first != null)
{ {
input.Filters.Remove(first); input.Filters.Remove(first);
} }
if (string.IsNullOrEmpty(site))
{
throw new UserFriendlyException("地点不能为空!", "400");
}
var _dbcontext = await _detailRepository.GetDbContextAsync().ConfigureAwait(false); var _dbcontext = await _detailRepository.GetDbContextAsync().ConfigureAwait(false);
var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == "1040" && p.IsCancel == false).ToList(); var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == site && p.IsCancel == false).ToList();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var query = from d in entities var query = from d in entities
join p in pricelist join p in pricelist
on d.LU equals p.LU on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == "1040" where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == site
select new select new
{ {
a = a =
@ -179,7 +185,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IsMaiDan = d.IsMaiDan, IsMaiDan = d.IsMaiDan,
Version = d.Version, Version = d.Version,
KeyCode = d.KeyCode, KeyCode = d.KeyCode,
Site = "1040", Site = site,
BusinessType = d.BusinessType, BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc, ErpLoc = d.ErpLoc,
CreationTime = d.CreationTime, CreationTime = d.CreationTime,

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

@ -13,9 +13,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Minio.DataModel; using Minio.DataModel;
using Org.BouncyCastle.Asn1.Cmp;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using ShardingCore.Sharding.MergeContexts; using ShardingCore.Sharding.MergeContexts;
using SqlSugar;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
@ -638,8 +640,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
_invls = GenSecInvoice(ls, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); _invls = GenSecInvoice(ls, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
} }
else else
{ {
@ -656,6 +656,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
smalllist.Add(itm); smalllist.Add(itm);
} }
} }
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>();
@ -666,15 +668,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{ {
var list = p_list.Where(p => p.InvGroupNum == big.InvGroupNum && p.PartCode == big.PartCode && p.Price == big.Price && p.LU == big.LU); var list = p_list.Where(p => p.InvGroupNum == big.InvGroupNum && p.PartCode == big.PartCode && p.Price == big.Price && p.LU == big.LU);
var gener = new InvoiceGeneratorSame<TDetail>(); var gener = new InvoiceGeneratorSame<TDetail>();
gener.GenerateInvoices(p_list);
var entitylist=list.ToList();
gener.GenerateInvoices(entitylist);
var invList = gener.Invoices; var invList = gener.Invoices;
foreach (var inv in invList) foreach (var inv in invList)
{ {
var partlist = inv.Parts; var partlist = inv.Parts;
//var query = from itm in p_list join itm1 in partlist on itm.Id equals itm1.Id select itm;
foreach (var detail in partlist)
{
var entity = entitylist.FirstOrDefault(p => p.Id == detail.Id);
entity.InvbillNum = inv.InvBillNum;
salist.Add(entity);
}
if (partlist.Count > 0) if (partlist.Count > 0)
{ {
var query = from itm in partlist var query = from itm in partlist
@ -724,11 +732,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
var innotls = new List<INVOICE_NOT_SETTLE>(); var innotls = new List<INVOICE_NOT_SETTLE>();
var parlist = partlist.ToList();
//if (partlist is List<BBAC_CAN_SA_DETAIL>) if (parlist is List<BBAC_CAN_SA_DETAIL>)
//{ {
var partlist1 = partlist as List<BBAC_CAN_SA_DETAIL>; var partlist1 = parlist as List<BBAC_CAN_SA_DETAIL>;
var sq = partlist1.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum}) var sq = partlist1.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum }); .Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum });
foreach (var sitm in sq) foreach (var sitm in sq)
{ {
@ -817,107 +825,132 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
invbill.LastModificationTime = DateTime.Now; invbill.LastModificationTime = DateTime.Now;
invlist.Add(invbill); invlist.Add(invbill);
#endregion #endregion
}
else
{
var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, 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: "可结算",
extend2: string.Empty,
qty: sitm.Qty,
p_invbillnum: inv.InvBillNum
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
#region 发票明细
//} List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
//else foreach (var detail in detailDtos)
//{ {
// var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum }) _entityDetailList.Add(
// .Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum }); new INVOICE_WAIT_DETAIL(
// foreach (var sitm in sq) guid: GuidGenerator.Create(),
// { version: p_version,
// innotls.Add(new INVOICE_NOT_SETTLE( invbillNum: inv.InvBillNum,
// guid: GuidGenerator.Create(), invGroupNum: p_InvGroupNum,
// version: p_version, lU: detail.LU,
// invGroupNum: p_InvGroupNum, qty: detail.Qty,
// settleGroupNum: sitm.GroupNum, bussiessType: businessType,
// lU: sitm.LU, amt: detail.Amt,
// lU1: sitm.LU, pRICE: detail.Price,
// extend1: "可结算", extend1: detail.ContactDocID,
// extend2: string.Empty, extend2: string.Empty,
// qty: sitm.Qty, beginDate: detail.BeginDate,
// p_invbillnum: inv.InvBillNum endDate: detail.EndDate,
// )); partcode: detail.PartCode
// } ));
// if (innotls.Count > 0) }
// { if (_entityDetailList.Count > 0)
// notDetialList.AddRange(innotls); {
// } detailList.AddRange(_entityDetailList);
}
// #region 发票明细 #endregion
// List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); #region 发票
// foreach (var detail in detailDtos) var invbill = new INVOICE_GRP
// { (
// _entityDetailList.Add( guid: GuidGenerator.Create(),
// new INVOICE_WAIT_DETAIL( realnvBillNum: string.Empty,
// guid: GuidGenerator.Create(), invbillNum: inv.InvBillNum,
// version: p_version, amt: amt,
// invbillNum: inv.InvBillNum, taxAmt: txtAmt,
// invGroupNum: p_InvGroupNum, fileName: string.Empty,
// lU: detail.LU, businessType: businessType,
// qty: detail.Qty, invGroupNum: p_InvGroupNum,
// bussiessType: businessType, state: SettleBillState.,
// amt: detail.Amt, invoiceBillState: InvoiceBillState.,
// pRICE: detail.Price, tax: 0.13m,
// extend1: detail.ContactDocID, parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
// extend2: string.Empty, preTaxDiff: 0,
// beginDate: detail.BeginDate, taxDiff: 0,
// endDate: detail.EndDate, clientCode: string.Empty,
// partcode: detail.PartCode realAmt: realAmt
// )); );
// } string site = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).FirstOrDefault().Site;
// if (_entityDetailList.Count > 0) string clientCode = string.Empty;
// { switch (site)
// detailList.AddRange(_entityDetailList); {
// } case "1040":
// #endregion clientCode = "C001";
// #region 发票 break;
// var invbill = new INVOICE_GRP case "1046":
// ( clientCode = "C171";
// guid: GuidGenerator.Create(), break;
// realnvBillNum: string.Empty, default:
// invbillNum: inv.InvBillNum, clientCode = "C004";
// amt: amt, break;
// taxAmt: txtAmt, }
// fileName: string.Empty, invbill.ClientCode = clientCode;
// businessType: businessType, invbill.Site = dtos.FirstOrDefault().Site;
// invGroupNum: p_InvGroupNum, invbill.CreationTime = DateTime.MinValue;
// state: SettleBillState.已开票, invbill.LastModificationTime = DateTime.Now;
// invoiceBillState: InvoiceBillState.正常, invlist.Add(invbill);
// tax: 0.13m, #endregion
// parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty, }
// preTaxDiff: 0,
// taxDiff: 0,
// clientCode: string.Empty,
// realAmt: realAmt
// );
// string site = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).FirstOrDefault().Site;
// string clientCode = string.Empty;
// switch (site)
// {
// case "1040":
// clientCode = "C001";
// break;
// case "1046":
// clientCode = "C171";
// break;
// default:
// clientCode = "C004";
// break;
// }
// invbill.ClientCode = clientCode;
// invbill.Site = dtos.FirstOrDefault().Site;
// invbill.CreationTime = DateTime.MinValue;
// invbill.LastModificationTime = DateTime.Now;
// invlist.Add(invbill);
// #endregion
//}
} }
} }
_dbcontext.BulkInsert(invlist); _dbcontext.BulkInsert(invlist);
_dbcontext.BulkInsert(groupList); _dbcontext.BulkInsert(groupList);
_dbcontext.BulkInsert(detailList); _dbcontext.BulkInsert(detailList);
if (salist.Count > 0)
{
_dbcontext.BulkUpdate(salist);
//带库位发票
var detailext = salist.GroupBy(p => new { p.InvbillNum, p.InvGroupNum, p.PartCode, p.LU, p.Price, p.ErpLoc, p.BusinessType })
.Select(p => new INVOICE_DETAIL_EXT
{
Version = p_version,
InvbillNum = p.Key.InvbillNum,
InvGroupNum = p.Key.InvGroupNum,
PartCode = p.Key.PartCode,
PRICE = p.Key.Price,
ErpLoc = p.Key.ErpLoc,
Qty = p.Sum(k => k.Qty),
BussiessType = p.Key.BusinessType,
Amt = Math.Round(p.Sum(k => k.Qty) * p.Key.Price, 2),//税前
LU = p.Key.LU
}
).ToList();
foreach (var itm in detailext)
{
itm.SetId(GuidGenerator.Create());
itm.CreationTime = DateTime.Now;
}
_dbcontext.BulkInsert(detailext);
}
if (adjlist.Count > 0) if (adjlist.Count > 0)
{ {
_dbcontext.BulkInsert(adjlist); _dbcontext.BulkInsert(adjlist);
@ -927,17 +960,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_dbcontext.BulkInsert(notDetialList); _dbcontext.BulkInsert(notDetialList);
} }
_invls = invlist.Select(p => p.InvbillNum).ToList(); _invls = invlist.Select(p => p.InvbillNum).ToList();
} }
if (smalllist.Count > 0) if (smalllist.Count > 0)
{ {
smalllist = smalllist.OrderBy(p => p.Amt).ToList(); smalllist = smalllist.OrderBy(p => p.Amt).ToList();
_invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); _invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
} }
} }
return _invls; return _invls;
} }

Loading…
Cancel
Save