diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs index 88cd2e10..2d0f8e4a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs @@ -45,13 +45,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs public GenerateJisInvoiceService(SettleAccountDbContext dbcontext) { _dbcontext = dbcontext; - } public string ExportFile(Guid id, List exportName, List property) { var billNum = property.Where(p => p.Name == "BillNum").FirstOrDefault().Value; var BussinessType = property.Where(p => p.Name == "BussinessType").FirstOrDefault().Value; - if (BussinessType == "JisBBAC") { var main = _dbcontext.Set().FirstOrDefault(p => p.InvGroupNum == billNum); @@ -87,7 +85,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs PartCode = d.PartCode }; var dtos = q.ToList(); - if (dtos != null && dtos.Count > 0) { if (billNum.Substring(0, 1) == "C")//一次开票 @@ -261,11 +258,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs partCount++;//符合条件加入到零件中 continue; } - partCount++; - if (partCount > 30) - { - continue; - } + //partCount++; + //if (partCount > 30) + //{ + // continue; + //} if (sum > 10000000) { break; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs index cb569a6d..21c0ae3f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs @@ -339,44 +339,79 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs } if (part_group_small.Count > 0) { + + var partlist = part_group_small.Select(p => p.LU).ToList(); - var ls = bbac_can_list.Where(p => partlist.Contains(p.LU)).ToList(); - var billNum = OrderNumberGenerator.GenerateOrderNumber("N"); - var bbac_sa = new BBAC_CAN_SA(); - bbac_sa.SetId(Guid.NewGuid()); - bbac_sa.BillNum = billNum; - bbac_sa.InvGroupNum = billNum; - bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM")); - bbac_sa.State = SettleBillState.未结状态; - bbac_sa.SettleBillNum = string.Empty; - bbac_sa.Site = "1046"; - bbac_sa.BusinessType = EnumBusinessType.JisBBAC; - billList.Add(bbac_sa); + var ls = bbac_can_list.Where(p => partlist.Contains(p.LU)).ToList(); ; + decimal sum = 0; + List details = new List(); foreach (var itm1 in ls) { + sum += (itm1.Qty * itm1.Price); + if (sum > 10000000) + { + var billNum = OrderNumberGenerator.GenerateOrderNumber("N"); + var bbac_sa = new BBAC_CAN_SA(); + bbac_sa.SetId(Guid.NewGuid()); + bbac_sa.BillNum = billNum; + bbac_sa.InvGroupNum = billNum; + bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM")); + bbac_sa.State = SettleBillState.未结状态; + bbac_sa.SettleBillNum = string.Empty; + bbac_sa.Site = "1046"; + bbac_sa.BusinessType = EnumBusinessType.JisBBAC; + billList.Add(bbac_sa); + foreach (var itm2 in details) + { + itm2.SetBillNum(billNum); + itm2.SetGroupNum(billNum); + billDetails.Add(itm2); + } + details = new List(); + sum = itm1.Qty * itm1.Price; + } var _detailEntity = new BBAC_CAN_SA_DETAIL( - guid: GuidGenerator.Create(), - keyCode: itm1.KeyCode, - version: itm1.Version, - billNum: billNum, - settleBillNum: itm1.SettleBillNum, - lU: itm1.LU, - pN: itm1.PN, - site: itm1.Site, - qty: itm1.Qty, - price: itm1.Price, - category: itm1.BusinessType, - isReturn: itm1.IsReturn, - settleDate: itm1.SettleDate, - groupNum: itm1.GroupNum, - invGroupNum: billNum, - contactid: itm1.ContractDocID, - invbillnum: string.Empty, - partcode: itm1.PartCode - ); + guid: GuidGenerator.Create(), + keyCode: itm1.KeyCode, + version: itm1.Version, + billNum: string.Empty, + settleBillNum: itm1.SettleBillNum, + lU: itm1.LU, + pN: itm1.PN, + site: itm1.Site, + qty: itm1.Qty, + price: itm1.Price, + category: itm1.BusinessType, + isReturn: itm1.IsReturn, + settleDate: itm1.SettleDate, + groupNum: itm1.GroupNum, + invGroupNum: string.Empty, + contactid: itm1.ContractDocID, + invbillnum: string.Empty, + partcode: itm1.PartCode + ); _detailEntity.RealPartCode = itm1.RealPartCode; - billDetails.Add(_detailEntity); + details.Add(_detailEntity); + } + 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 = "1046"; + bbac_sa1.BusinessType = EnumBusinessType.JisBBAC; + billList.Add(bbac_sa1); + foreach (var detail in details) + { + detail.SetBillNum(billNum1); + detail.SetGroupNum(billNum1); + billDetails.Add(detail); } + + } } }