|
|
@ -117,8 +117,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
invbillnum: string.Empty, |
|
|
|
partcode: itm.PartCode, |
|
|
|
pobillnum:string.Empty |
|
|
|
|
|
|
|
|
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
@ -126,8 +124,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); |
|
|
|
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
|
|
|
|
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
|
|
|
|
|
|
|
|
|
|
|
|
List<PriceList> priceList = new List<PriceList>(); |
|
|
|
if (inv.BusinessType == EnumBusinessType.BeiJian) |
|
|
|
{ |
|
|
@ -327,14 +323,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
/// <returns></returns>
|
|
|
|
public virtual async Task<IActionResult> ReissueInvoiceListExt(List<PUB_ADJ_DETAIL_DTO> p_list) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var result = await _adjservice.CheckImport(p_list); |
|
|
|
if (result != "OK") |
|
|
|
{ |
|
|
|
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result }); |
|
|
|
} |
|
|
|
|
|
|
|
var first = p_list.FirstOrDefault(); |
|
|
|
var invbillnum = first.InvBillNum; |
|
|
|
var invBilllist = new List<INVOICE_REPEAT_DTO>(); |
|
|
@ -344,7 +337,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调整表无数据!", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
|
|
|
|
//if (mappingList != null && mappingList.Count() > 0)
|
|
|
|
//{
|
|
|
@ -439,9 +431,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
|
{ |
|
|
|
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); |
|
|
|
|
|
|
|
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities); |
|
|
|
|
|
|
|
var invlist = ls.Select(p => p.InvbillNum).Distinct(); |
|
|
|
foreach (var itm in invlist) |
|
|
|
{ |
|
|
@ -497,7 +487,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
|
|
|
|
//}
|
|
|
|
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invBilllist }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -505,14 +494,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
[UnitOfWork(false)] |
|
|
|
public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var result = await _adjservice.CheckImport(p_list); |
|
|
|
if (result != "OK") |
|
|
|
{ |
|
|
|
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result }); |
|
|
|
} |
|
|
|
|
|
|
|
var first = p_list.FirstOrDefault(); |
|
|
|
var invbillnum = first.InvBillNum; |
|
|
|
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>(); |
|
|
@ -522,16 +508,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调整表无数据!", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
|
|
|
|
//if (mappingList != null && mappingList.Count() > 0)
|
|
|
|
//{
|
|
|
|
var version = int.Parse(DateTime.Now.ToString("yyyymm")); |
|
|
|
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
|
|
|
|
var inv = await GetInvoiceGroupByInvBillNum(invbillnum); |
|
|
|
|
|
|
|
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum); |
|
|
|
|
|
|
|
if (settle == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400"); |
|
|
@ -565,11 +548,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
qty: itm.Qty, |
|
|
|
price: itm.Price, |
|
|
|
businessType: itm.BusinessType, |
|
|
|
|
|
|
|
settleDate: itm.SettleDate, |
|
|
|
groupNum: itm.GroupNum, |
|
|
|
invGroupNum: itm.InvGroupNum, |
|
|
|
|
|
|
|
invbillnum: string.Empty, |
|
|
|
partcode: itm.PartCode, |
|
|
|
pobillnum: string.Empty |
|
|
@ -617,55 +598,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
|
{ |
|
|
|
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); |
|
|
|
|
|
|
|
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities); |
|
|
|
|
|
|
|
invBilllist.AddRange(ls.ToList()); |
|
|
|
|
|
|
|
|
|
|
|
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
|
|
|
|
//foreach (var itm in invlist)
|
|
|
|
//{
|
|
|
|
// var invBill = new INVOICE_REPEAT_DTO();
|
|
|
|
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
|
|
|
|
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
|
|
|
|
// var tax = inv.Tax;//税率
|
|
|
|
// var amt = entitylist.Sum(p => p.Amt);//税前
|
|
|
|
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
|
|
|
|
// var realamt = Math.Round(amt * tax, 2);//税额
|
|
|
|
// invBill.Amt = amt;
|
|
|
|
// invBill.TaxAmt = taxamt;
|
|
|
|
// invBill.Tax = tax;
|
|
|
|
// invBill.BusinessType = inv.BusinessType;
|
|
|
|
// invBill.DETAIL = invls;
|
|
|
|
// invBill.RealAmt = realamt;
|
|
|
|
// invBilllist.Add(invBill);
|
|
|
|
//}
|
|
|
|
} |
|
|
|
else//二次开票
|
|
|
|
{ |
|
|
|
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); |
|
|
|
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities); |
|
|
|
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
|
|
|
|
//foreach (var itm in invlist)
|
|
|
|
//{
|
|
|
|
// var invBill = new INVOICE_REPEAT_DTO();
|
|
|
|
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
|
|
|
|
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
|
|
|
|
// var tax = inv.Tax;//税率
|
|
|
|
// var amt = entitylist.Sum(p => p.Amt);//税前
|
|
|
|
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
|
|
|
|
// var realamt = Math.Round(amt * tax, 2);//税额
|
|
|
|
// invBill.Amt = amt;
|
|
|
|
// invBill.TaxAmt = taxamt;
|
|
|
|
// invBill.Tax = tax;
|
|
|
|
// invBill.BusinessType = inv.BusinessType;
|
|
|
|
// invBill.DETAIL = invls;
|
|
|
|
// invBill.RealAmt = realamt;
|
|
|
|
// invBilllist.Add(invBill);
|
|
|
|
//}
|
|
|
|
invBilllist.AddRange(ls.ToList()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|