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"
},
"ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13326;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=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;Connection Timeout=120",
"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;",
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;"
"Default": "Server=10.60.101.83;Database=BJABP;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=local;Database=ExchangeCenter;User ID=sa;Password=Microsoft2008;Trusted_Connection=False;TrustServerCertificate=True;",
"WMSBJBMPT": "Server=local;Database=ExchangeCenter;User ID=sa;Password=Microsoft2008;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;"

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 site = input.Filters.FirstOrDefault(p => p.Column == "site").Value;
if (first != null)
{
input.Filters.Remove(first);
}
if (string.IsNullOrEmpty(site))
{
throw new UserFriendlyException("地点不能为空!", "400");
}
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 query = from d in entities
join p in pricelist
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
{
a =
@ -179,7 +185,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IsMaiDan = d.IsMaiDan,
Version = d.Version,
KeyCode = d.KeyCode,
Site = "1040",
Site = site,
BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc,
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.EntityFrameworkCore;
using Minio.DataModel;
using Org.BouncyCastle.Asn1.Cmp;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using ShardingCore.Sharding.MergeContexts;
using SqlSugar;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
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);
}
else
{
@ -656,6 +656,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
smalllist.Add(itm);
}
}
var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>();
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 gener = new InvoiceGeneratorSame<TDetail>();
gener.GenerateInvoices(p_list);
var entitylist=list.ToList();
gener.GenerateInvoices(entitylist);
var invList = gener.Invoices;
foreach (var inv in invList)
{
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)
{
var query = from itm in partlist
@ -724,11 +732,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
var innotls = new List<INVOICE_NOT_SETTLE>();
//if (partlist is List<BBAC_CAN_SA_DETAIL>)
//{
var partlist1 = partlist as List<BBAC_CAN_SA_DETAIL>;
var sq = partlist1.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum})
var parlist = partlist.ToList();
if (parlist is 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 })
.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)
{
@ -817,107 +825,132 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
invbill.LastModificationTime = DateTime.Now;
invlist.Add(invbill);
#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);
}
//}
//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>();
// foreach (var detail in detailDtos)
// {
// _entityDetailList.Add(
// new INVOICE_WAIT_DETAIL(
// guid: GuidGenerator.Create(),
// version: p_version,
// invbillNum: inv.InvBillNum,
// invGroupNum: p_InvGroupNum,
// lU: detail.LU,
// qty: detail.Qty,
// bussiessType: businessType,
// amt: detail.Amt,
// pRICE: detail.Price,
// extend1: detail.ContactDocID,
// extend2: string.Empty,
// beginDate: detail.BeginDate,
// endDate: detail.EndDate,
// partcode: detail.PartCode
// ));
// }
// if (_entityDetailList.Count > 0)
// {
// detailList.AddRange(_entityDetailList);
// }
// #endregion
// #region 发票
// var invbill = new INVOICE_GRP
// (
// guid: GuidGenerator.Create(),
// realnvBillNum: string.Empty,
// invbillNum: inv.InvBillNum,
// amt: amt,
// taxAmt: txtAmt,
// fileName: string.Empty,
// businessType: businessType,
// invGroupNum: p_InvGroupNum,
// state: SettleBillState.已开票,
// invoiceBillState: InvoiceBillState.正常,
// tax: 0.13m,
// 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
//}
#region 发票明细
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in detailDtos)
{
_entityDetailList.Add(
new INVOICE_WAIT_DETAIL(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: inv.InvBillNum,
invGroupNum: p_InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContactDocID,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode: detail.PartCode
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
#endregion
#region 发票
var invbill = new INVOICE_GRP
(
guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
invbillNum: inv.InvBillNum,
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: businessType,
invGroupNum: p_InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
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(groupList);
_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)
{
_dbcontext.BulkInsert(adjlist);
@ -927,17 +960,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_dbcontext.BulkInsert(notDetialList);
}
_invls = invlist.Select(p => p.InvbillNum).ToList();
}
if (smalllist.Count > 0)
{
smalllist = smalllist.OrderBy(p => p.Amt).ToList();
_invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
}
}
return _invls;
}

Loading…
Cancel
Save