Browse Source

更新版本

master
zhaoxinyu 9 months ago
parent
commit
be6ada57fa
  1. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs

@ -99,18 +99,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
var bbac_not_list= query.Select(p => p.b).ToList();
if(bbac_can_list.Count>0)
{
notlist.AddRange(bbac_not_list);
var t1 = bbac_can_list.GroupBy(p => p.LU).Select(p => new { LU = p.Key, Amt = p.Sum(itm => itm.Qty * itm.Price) }).OrderByDescending(p => p.Amt).ToList();
var part_group_big = t1.Where(p=> p.Amt >= 10000000).ToList();
var part_group_small = t1.Where(p=> p.Amt < 10000000).ToList();
if (part_group_big.Count > 0)
{
foreach (var itm in part_group_big)
{
var ls = bbac_can_list.Where(p => p.LU == itm.LU).ToList();
decimal sum = 0;
List<BBAC_CAN_SA_DETAIL> details = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm1 in ls)
{
if (sum > 10000000)
{
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa = new BBAC_CAN_SA();
bbac_sa.SetId(Guid.NewGuid());
@ -122,13 +125,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbac_sa.Site = "1040";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls)
foreach (var itm2 in details)
{
itm2.SetBillNum(billNum);
itm2.SetGroupNum(billNum);
billDetails.Add(itm2);
}
details = new List<BBAC_CAN_SA_DETAIL>();
sum = 0;
}
var _detailEntity = new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode,
version: itm1.Version,
billNum: billNum,
billNum: string.Empty,
settleBillNum: itm1.SettleBillNum,
lU: itm1.LU,
pN: itm1.PN,
@ -139,14 +149,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
isReturn: itm1.IsReturn,
settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum,
invGroupNum: billNum,
invGroupNum: string.Empty,
contactid: itm1.ContractDocID,
invbillnum: string.Empty,
partcode: itm1.PartCode
);
_detailEntity.RealPartCode = itm1.RealPartCode;
billDetails.Add(_detailEntity);
details.Add(_detailEntity);
sum += (itm1.Qty * itm1.Price);
}
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new BBAC_CAN_SA();
bbac_sa1.SetId(Guid.NewGuid());
bbac_sa1.BillNum = billNum1;
bbac_sa1.InvGroupNum = billNum1;
bbac_sa1.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa1.State = SettleBillState.;
bbac_sa1.SettleBillNum = string.Empty;
bbac_sa1.Site = "1040";
bbac_sa1.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa1);
foreach (var detail in details)
{
billDetails.Add(detail);
}
}
}
if (part_group_small.Count > 0)
@ -437,6 +464,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
foreach (var itm in part_group_big)
{
var ls = hbpo_can_list.Where(p => p.LU == itm.LU).ToList();
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa = new HBPO_CAN_SA();
@ -446,7 +477,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "1046";
bbac_sa.Site = "104T";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls)
@ -486,7 +517,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "1046";
bbac_sa.Site = "104T";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls)

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -130,6 +130,14 @@ namespace SettleAccount.Domain.BQ
{
}
public void SetBillNum(string bill)
{
BillNum = bill;
}
public void SetGroupNum(string bill)
{
GroupNum= bill;
}
public BBAC_CAN_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, bool isReturn,
DateTime settleDate, string groupNum, string invGroupNum

Loading…
Cancel
Save