Browse Source

提交

master
学 赵 2 months ago
parent
commit
912f28f1c3
  1. 16
      code/src/Modules/BaseService/BaseService.Host/BaseServiceHostModule.cs
  2. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  3. 117
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  4. 177
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs
  5. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

16
code/src/Modules/BaseService/BaseService.Host/BaseServiceHostModule.cs

@ -1,4 +1,4 @@
using BaseService.EntityFrameworkCore; using BaseService.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
@ -46,7 +46,7 @@ namespace BaseService
typeof(AbpPermissionManagementHttpApiModule), typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementHttpApiModule), typeof(AbpTenantManagementHttpApiModule),
typeof(AbpIdentityHttpApiModule), typeof(AbpIdentityHttpApiModule),
// typeof(BaseDataHttpApiModule), //typeof(BaseDataHttpApiModule),
//typeof(BaseDataApplicationContractsModule), //typeof(BaseDataApplicationContractsModule),
//typeof(SettleAccountHttpApiModule), //typeof(SettleAccountHttpApiModule),
typeof(AbpAspNetCoreSerilogModule) typeof(AbpAspNetCoreSerilogModule)
@ -101,9 +101,7 @@ namespace BaseService
context.Services.Configure<IdentityOptions>(options => context.Services.Configure<IdentityOptions>(options =>
{ {
options.User.RequireUniqueEmail = true; options.User.RequireUniqueEmail = true;
//options.Lockout.AllowedForNewUsers = true; options.Lockout.AllowedForNewUsers = true;
//options.Lockout.MaxFailedAccessAttempts = 2;
options.Password.RequireDigit = false; options.Password.RequireDigit = false;
options.Password.RequireLowercase = false; options.Password.RequireLowercase = false;
options.Password.RequireNonAlphanumeric = false; options.Password.RequireNonAlphanumeric = false;
@ -217,8 +215,9 @@ namespace BaseService
.ConventionalControllers .ConventionalControllers
.Create(typeof(BaseServiceApplicationModule).Assembly, opts .Create(typeof(BaseServiceApplicationModule).Assembly, opts
=> =>
{ opts.RootPath = "base"; }) {
; opts.RootPath = "base";
});
}); });
} }
@ -232,7 +231,6 @@ namespace BaseService
app.UseCors(DefaultCorsPolicyName); app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication(); app.UseAuthentication();
app.UseMultiTenancy(); app.UseMultiTenancy();
app.Use(async (ctx, next) => app.Use(async (ctx, next) =>
{ {
var currentPrincipalAccessor = ctx.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>(); var currentPrincipalAccessor = ctx.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>();
@ -255,11 +253,9 @@ namespace BaseService
{ {
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Identity Service API"); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Identity Service API");
}); });
app.UseAuditing(); app.UseAuditing();
app.UseAbpSerilogEnrichers(); app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints(); app.UseConfiguredEndpoints();
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
using (var scope = context.ServiceProvider.CreateScope()) using (var scope = context.ServiceProvider.CreateScope())

49
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -833,6 +833,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "状态")] [Display(Name = "状态")]
public string Extend1 { get; set; } public string Extend1 { get; set; }
[Display(Name = "扩展")]
public string Extend2 { get; set; }
} }
@ -863,6 +865,53 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "结算零件号")] [Display(Name = "结算零件号")]
public string SettleLU { get; set; } public string SettleLU { get; set; }
[Display(Name = "可结算数量")]
public string SettleQty { get; set; }
/// <summary>
///可结算零件号
/// </summary>
[Display(Name = "不结算零件号")]
public string NotSettleLU { get; set; }
[Display(Name = "不可结数量")]
public string Qty { get; set; }
}
public class INVOICE_NOT_SETTLE_EXT_DTO1
{
[Display(Name = "金税发票")]
public string RealInvBillNum { get; set; }
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
[Display(Name = "发票号")]
public string InvBillNum { get; set; }
/// <summary>
///发票分组号
/// </summary>
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
/// <summary>
///结算分组号
/// </summary>
[Display(Name = "结算分组号")]
public string SettleGroupNum { get; set; }
/// <summary>
///可结算零件号
/// </summary>
[Display(Name = "结算零件号")]
public string SettleLU { get; set; }
[Display(Name = "SA号")]
public string SA { get; set; }
[Display(Name = "可结算数量")] [Display(Name = "可结算数量")]
public string SettleQty { get; set; } public string SettleQty { get; set; }
/// <summary> /// <summary>

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

@ -1201,6 +1201,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false); var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);//不可结 var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);//不可结
var adjs = await _adjRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);//调整数据 var adjs = await _adjRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);//调整数据
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);//调整数据DTO var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);//调整数据DTO
var notquery = from itm in sdtos var notquery = from itm in sdtos
@ -1216,6 +1220,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
LU = itm.LU, LU = itm.LU,
Qty = itm.Qty, Qty = itm.Qty,
Extend1 = itm.Extend1, Extend1 = itm.Extend1,
Extend2 = itm.Extend2
}; };
var mquery = from itm in mdtos var mquery = from itm in mdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
@ -1436,6 +1442,97 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO)
{ {
foreach (var itm in entities) foreach (var itm in entities)
{
if (first.BusinessType == EnumBusinessType.JisBBAC && first.InvGroupNum.Substring(0, 1) == "N")
{
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
var lsC = nolist.Where(p => p.Extend1 == "可结算")
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
p.Extend2
}).Select(p => new INVOICE_NOT_SETTLE_DTO()
{
LU = p.Key.LU,
RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate,
InvBillNum = p.Key.InvBillNum,
InvGroupNum = p.Key.InvGroupNum,
Extend2 = p.Key.Extend2,
Qty = p.Sum(itm => itm.Qty)
}).ToList();
var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList()
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO()
{
LU = p.Key.LU,
RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate,
InvBillNum = p.Key.InvBillNum,
InvGroupNum = p.Key.InvGroupNum,
Qty = p.Sum(itm => itm.Qty)
}).ToList();
var lineC = lsC.Count;
var lineN = lsN.Count;
List<INVOICE_NOT_SETTLE_EXT_DTO1> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO1>();
for (int i = 0; i < 10000; i++)
{
INVOICE_NOT_SETTLE_EXT_DTO1 invnot = new INVOICE_NOT_SETTLE_EXT_DTO1();
invnot.RealInvBillNum = string.Empty;
invnot.InvDate = null;
invnot.InvBillNum = string.Empty;
invnot.InvGroupNum = string.Empty;
invnot.SettleGroupNum = string.Empty;
invnot.SettleLU = string.Empty;
invnot.SA = string.Empty;
invnot.SettleQty = null;
invnot.NotSettleLU = string.Empty;
invnot.Qty = string.Empty;
ls.Add(invnot);
}
var entity = nolist.FirstOrDefault();
var disList = mgroup.Select(p => p.SettleGroupNum).Distinct().ToList();
for (int i = 0; i < lineC; i++)//更新可结信息
{
ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].SA = lsC[i].Extend2;
ls[i].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
}
for (int i = 0; i < lineN; i++)//更新不可结信息
{
ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
// ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].NotSettleLU = lsN[i].LU;
ls[i].Qty = lsN[i].Qty == null ? string.Empty : lsN[i].Qty.ToString();
}
for (int i = 0; i < disList.Count; i++)//更新结算分组
{
ls[i].SettleGroupNum = disList[i];
}
_excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}
else
{ {
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList(); var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
@ -1448,6 +1545,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
p.InvDate, p.InvDate,
p.InvBillNum, p.InvBillNum,
p.InvGroupNum, p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO() }).Select(p => new INVOICE_NOT_SETTLE_DTO()
{ {
LU = p.Key.LU, LU = p.Key.LU,
@ -1487,6 +1585,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invnot.InvGroupNum = string.Empty; invnot.InvGroupNum = string.Empty;
invnot.SettleGroupNum = string.Empty; invnot.SettleGroupNum = string.Empty;
invnot.SettleLU = string.Empty; invnot.SettleLU = string.Empty;
invnot.SettleQty = null; invnot.SettleQty = null;
invnot.NotSettleLU = string.Empty; invnot.NotSettleLU = string.Empty;
invnot.Qty = string.Empty; invnot.Qty = string.Empty;
@ -1500,6 +1599,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ls[i].InvDate = entity.InvDate; ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum; ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum; ls[i].InvGroupNum = entity.InvGroupNum;
//ls[i].SA = bbac.FirstOrDefault(p => p.InvbillNum == entity.InvBillNum && p.LU == lsC[i].LU).Extend1;
// ls[i].SettleGroupNum = entity.SettleGroupNum; // ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].SettleLU = lsC[i].LU; ls[i].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString(); ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
@ -1522,6 +1622,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet(); _excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
} }
} }
}
else//其他业务发票调整数据 else//其他业务发票调整数据
{ {
foreach (var itm in entities) foreach (var itm in entities)
@ -1548,9 +1649,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
var entities = await _invMng.GetMainListAsync(p_invGroupNum).ConfigureAwait(false); var entities = await _invMng.GetMainListAsync(p_invGroupNum).ConfigureAwait(false);
var entity = entities.FirstOrDefault(); var entity = entities.FirstOrDefault();
bool state = await _invMng.Reject(p_invGroupNum).ConfigureAwait(false); bool state = await _invMng.Reject(p_invGroupNum).ConfigureAwait(false);
if (state == true) if (state == true)
{ {
@ -1606,7 +1704,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
newmain.ExtraProperties.TryAdd("InvBillNum", details.FirstOrDefault().InvbillNum); newmain.ExtraProperties.TryAdd("InvBillNum", details.FirstOrDefault().InvbillNum);
newmain.ExtraProperties.TryAdd("IsReturn", "是"); newmain.ExtraProperties.TryAdd("IsReturn", "是");
var _dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false); var _dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false);
foreach (var item in details) foreach (var item in details)
{ {
item.BillNum = billNum; item.BillNum = billNum;
@ -1614,11 +1711,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
await _dbcontext.BulkInsertAsync(new List<Tmain>() { newmain }).ConfigureAwait(false); await _dbcontext.BulkInsertAsync(new List<Tmain>() { newmain }).ConfigureAwait(false);
await _dbcontext.BulkUpdateAsync(details).ConfigureAwait(false); await _dbcontext.BulkUpdateAsync(details).ConfigureAwait(false);
} }
[UnitOfWork(false)] [UnitOfWork(false)]
[HttpPost] [HttpPost]
public virtual async Task<IActionResult> ReturnAsync(INVOICE_GRP_DTO p_dto) public virtual async Task<IActionResult> ReturnAsync(INVOICE_GRP_DTO p_dto)
@ -1660,8 +1753,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var detial=dbcontext.Set<INVOICE_WAIT_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList(); var detial=dbcontext.Set<INVOICE_WAIT_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList();
var notsettle=dbcontext.Set<INVOICE_NOT_SETTLE>().Where(p => p.InvBillNum == p_dto.InvbillNum).ToList(); var notsettle=dbcontext.Set<INVOICE_NOT_SETTLE>().Where(p => p.InvBillNum == p_dto.InvbillNum).ToList();
var detialext = dbcontext.Set<INVOICE_DETAIL_EXT>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList(); var detialext = dbcontext.Set<INVOICE_DETAIL_EXT>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList();
dbcontext.BulkDelete(invList); dbcontext.BulkDelete(invList);
dbcontext.BulkDelete(invgourp); dbcontext.BulkDelete(invgourp);
dbcontext.BulkDelete(detial); dbcontext.BulkDelete(detial);
@ -1670,10 +1761,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
dbcontext.BulkDelete(detialext); dbcontext.BulkDelete(detialext);
} }
} }
return new JsonResult(new { Code = 200, Message = "退回成功" }); ; return new JsonResult(new { Code = 200, Message = "退回成功" }); ;
} }
@ -1715,13 +1803,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
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);
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
} }
} }

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

@ -671,6 +671,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
foreach (var inv in invList) foreach (var inv in invList)
{ {
var partlist = inv.Parts; var partlist = inv.Parts;
if (partlist.Count > 0) if (partlist.Count > 0)
{ {
var query = from itm in partlist var query = from itm in partlist
@ -719,7 +723,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
groupList.AddRange(mapList); groupList.AddRange(mapList);
} }
var innotls = new List<INVOICE_NOT_SETTLE>(); var innotls = new List<INVOICE_NOT_SETTLE>();
var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
//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})
.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)
{ {
@ -808,63 +817,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
invbill.LastModificationTime = DateTime.Now; invbill.LastModificationTime = DateTime.Now;
invlist.Add(invbill); invlist.Add(invbill);
#endregion #endregion
}
}
}
smalllist = smalllist.OrderBy(p => p.Amt).ToList();
_invls= GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
//smalllist = smalllist.OrderBy(p => p.Amt).ToList(); //}
//var gener1 = new InvoiceGeneratorDiff(); //else
//gener1.GenerateInvoices(smalllist);
//var invList1 = gener1.Invoices;
//foreach (var inv in invList1)//小于1000W的开票
//{ //{
// var partlist = inv.Parts; // var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
// var query = from part in p_list
// join part1 in partlist on
// new { part.InvGroupNum, part.PartCode, part.LU, part.Price } equals new { part1.InvGroupNum, part1.PartCode, part1.LU, part1.Price }
// select part;
// var entityList = query.ToList();
// foreach (var entity in entityList)
// {
// entity.InvbillNum = inv.InvBillNum;
// }
// salist.AddRange(entityList);
// if (partlist.Count > 0)
// {
// decimal amt = partlist.Sum(k => k.Amt);//金额
// decimal txtAmt = partlist.Sum(k => k.TaxAmt);//税后金额
// decimal realAmt = partlist.Sum(k => k.Tax);//税额
// var invoicegroupls = entityList.Select(p => p.GroupNum);
// var mapList = new List<INVOICE_MAP_GROUP>();
// foreach (var groupnum in invoicegroupls)
// {
// mapList.Add(new INVOICE_MAP_GROUP(
// guid: GuidGenerator.Create(),
// version: p_version,
// invbillNum: inv.InvBillNum,
// invGroupNum: p_InvGroupNum,
// settleGroupNum: groupnum,
// amt: 0,
// extend1: string.Empty,
// extend2: string.Empty
// )
// );
// }
// if (mapList.Count > 0)
// {
// groupList.AddRange(mapList);
// }
// var innotls = new List<INVOICE_NOT_SETTLE>();
// var sq = entityList.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)
// { // {
@ -878,7 +836,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
// extend1: "可结算", // extend1: "可结算",
// extend2: string.Empty, // extend2: string.Empty,
// qty: sitm.Qty, // qty: sitm.Qty,
// p_invbillnum: sitm.InvBillNum // p_invbillnum: inv.InvBillNum
// )); // ));
// } // }
// if (innotls.Count > 0) // if (innotls.Count > 0)
@ -886,9 +844,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
// notDetialList.AddRange(innotls); // notDetialList.AddRange(innotls);
// } // }
// #region 发票明细
// List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); // List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
// foreach (var detail in partlist) // foreach (var detail in detailDtos)
// { // {
// _entityDetailList.Add( // _entityDetailList.Add(
// new INVOICE_WAIT_DETAIL( // new INVOICE_WAIT_DETAIL(
@ -903,8 +861,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
// pRICE: detail.Price, // pRICE: detail.Price,
// extend1: detail.ContactDocID, // extend1: detail.ContactDocID,
// extend2: string.Empty, // extend2: string.Empty,
// beginDate: detail.BeginDate.Value, // beginDate: detail.BeginDate,
// endDate: detail.EndDate.Value, // endDate: detail.EndDate,
// partcode: detail.PartCode // partcode: detail.PartCode
// )); // ));
// } // }
@ -912,6 +870,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
// { // {
// detailList.AddRange(_entityDetailList); // detailList.AddRange(_entityDetailList);
// } // }
// #endregion
// #region 发票
// var invbill = new INVOICE_GRP // var invbill = new INVOICE_GRP
// ( // (
// guid: GuidGenerator.Create(), // guid: GuidGenerator.Create(),
@ -950,51 +910,34 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
// invbill.CreationTime = DateTime.MinValue; // invbill.CreationTime = DateTime.MinValue;
// invbill.LastModificationTime = DateTime.Now; // invbill.LastModificationTime = DateTime.Now;
// invlist.Add(invbill); // invlist.Add(invbill);
// } // #endregion
//} //}
}
}
_dbcontext.BulkInsert(invlist);
_dbcontext.BulkInsert(groupList);
_dbcontext.BulkInsert(detailList);
if (adjlist.Count > 0)
{
_dbcontext.BulkInsert(adjlist);
}
if (notDetialList.Count > 0)
{
_dbcontext.BulkInsert(notDetialList);
}
_invls = invlist.Select(p => p.InvbillNum).ToList();
//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(); if (smalllist.Count > 0)
// foreach (var itm in detailext) {
// { smalllist = smalllist.OrderBy(p => p.Amt).ToList();
// itm.SetId(GuidGenerator.Create()); _invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
// itm.CreationTime = DateTime.Now; }
// }
// _dbcontext.BulkInsert(detailext);
//}
//_dbcontext.BulkInsert(invlist);
//_dbcontext.BulkInsert(groupList);
//_dbcontext.BulkInsert(detailList);
//if (adjlist.Count > 0)
//{
// _dbcontext.BulkInsert(adjlist);
//}
//if (notDetialList.Count > 0)
//{
// _dbcontext.BulkInsert(notDetialList);
//}
//_invls = invlist.Select(p => p.InvbillNum).ToList();
} }
return _invls; return _invls;
} }
@ -1058,6 +1001,40 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
groupList.AddRange(mapList); groupList.AddRange(mapList);
} }
var innotls = new List<INVOICE_NOT_SETTLE>(); var innotls = new List<INVOICE_NOT_SETTLE>();
if (entityList is List<BBAC_CAN_SA_DETAIL>)
{
var entityList1 = entityList as List<BBAC_CAN_SA_DETAIL>;
var sq = entityList1.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum,p.ContractDocID })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum,SA=p.Key.ContractDocID });
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: sitm.SA,
qty: sitm.Qty,
p_invbillnum: sitm.InvBillNum
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
}
else
{
var sq = entityList.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum }) var sq = entityList.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)
@ -1081,6 +1058,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in partlist) foreach (var detail in partlist)
{ {

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -263,6 +263,7 @@ namespace Win.Sfs.SettleAccount
private void CreateMapINVOICE_NOT_SETTLE() private void CreateMapINVOICE_NOT_SETTLE()
{ {
CreateMap<INVOICE_NOT_SETTLE, INVOICE_NOT_SETTLE_DTO>().ReverseMap(); CreateMap<INVOICE_NOT_SETTLE, INVOICE_NOT_SETTLE_DTO>().ReverseMap();
CreateMap<INVOICE_NOT_SETTLE, INVOICE_NOT_SETTLE_REQ_DTO>().ReverseMap(); CreateMap<INVOICE_NOT_SETTLE, INVOICE_NOT_SETTLE_REQ_DTO>().ReverseMap();

Loading…
Cancel
Save