Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
102b9ccde1
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  2. 28
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
  3. 244
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -429,9 +429,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}; };
var dtos = q.ToList(); var dtos = q.ToList();
var testls = dtos.Where(p => string.IsNullOrEmpty(p.LU)).ToList();
if (dtos != null && dtos.Count > 0) if (dtos != null && dtos.Count > 0)
{ {
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 if (invbillnum.Substring(0, 3) == "INV")//一次开票重开

28
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs

@ -31,34 +31,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BBAC_PD_DETAIL_REQ_DTO, BBAC_PD_DETAIL_EXP_DTO> BBAC_PD_DETAIL_REQ_DTO, BBAC_PD_DETAIL_EXP_DTO>
{ {
//[HttpPost]
//public virtual async Task<string> RejectAsync(List<string> p_list)
//{
// var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
// customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisBBAC.ToString() });
// customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
// var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
// var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
// if (lst.Count() > 0)
// {
// throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交", "400");
// }
// foreach (var item in ls)
// {
// item.State = SettleBillState.已提交扣减;
// }
// await _repository.DbContext.BulkUpdateAsync(ls);
// var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
// {
// });
// return _taskid;
//}
public BBAC_PD_SERVICE(INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<BBAC_PD, Guid> repository, VmiAppService vimservice, INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> detailRepository, TaskJobService service) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository, service) public BBAC_PD_SERVICE(INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<BBAC_PD, Guid> repository, VmiAppService vimservice, INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> detailRepository, TaskJobService service) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository, service)
{ {
} }

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

@ -11,6 +11,7 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Writers;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using ShardingCore.Extensions; using ShardingCore.Extensions;
using Shouldly; using Shouldly;
@ -198,12 +199,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
bj.LU = itm.LU; bj.LU = itm.LU;
bj.PartCode = itm.PartCode; bj.PartCode = itm.PartCode;
bj.PRICE = itm.PRICE; bj.PRICE = itm.PRICE;
//bj.InvGroupNum = itm.InvGroupNum; bj.InvGroupNum = itm.InvGroupNum;
//bj.DeliveryNumber= itm.GetProperty("DeliveryNumber", "");//交货号 bj.DeliveryNumber =itm.ExtraProperties["DeliveryIndexNumber"].ToSqlValue();
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号 //bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号
//bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码 //bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
//bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称 //bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
//bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称
//bj.PurchaseOrderNumber = itm.GetProperty("PurchaseOrderNumber", "");//采购订单号 //bj.PurchaseOrderNumber = itm.GetProperty("PurchaseOrderNumber", "");//采购订单号
//bj.DeliveryIndexNumber = itm.GetProperty("DeliveryIndexNumber", "");//交付索引号 //bj.DeliveryIndexNumber = itm.GetProperty("DeliveryIndexNumber", "");//交付索引号
//bj.PartName = itm.GetProperty("PartName", "");//零件名称 //bj.PartName = itm.GetProperty("PartName", "");//零件名称
@ -338,10 +340,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) }); .Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) });
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList();
} }
if (first.BusinessType == EnumBusinessType.JisHBPO)
{
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
}
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC) if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC)
{ {
@ -349,7 +348,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO) if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{ {
entity.INVOICE_MAP_GROUP = mdtos; List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
foreach (var itm in m)
{
maidan.Add(new MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO() {
Extend1=itm.Extend1,
InvGroupNum=itm.InvGroupNum,
SettleGroupNum=itm.SettleGroupNum
});
}
entity.MAIDAN_HBPO_INVOICE_MAP_GROUP = maidan;
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>();
foreach (var itm in notquery.ToList())
{
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() {
GroupNum=itm.InvGroupNum,
LU=itm.LU,
PN=itm.Extend1,
});
}
} }
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList(); entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList();
@ -413,132 +432,148 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbac = invdetail.INVOICE_WAIT_DETAIL_BBAC;//BBACJIS明细 var bbac = invdetail.INVOICE_WAIT_DETAIL_BBAC;//BBACJIS明细
var bj = invdetail.INVOICE_WAIT_DETAIL_BJ;//备件明细 var bj = invdetail.INVOICE_WAIT_DETAIL_BJ;//备件明细
var unsettle = invdetail.UNSETTLED_DETAIL;//全部未结明细 var unsettle = invdetail.UNSETTLED_DETAIL;//全部未结明细
var hbpom = invdetail.MAIDAN_HBPO_INVOICE_MAP_GROUP;//买单HBPO分组对应
var hbpounsettle = invdetail.MAIDAN_HBPO_UNSETTLED_DETAIL;//买单HBPO未结
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
//发票明细 #region 发票明细
if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC) if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
{ {
_excel.Append(bbac, "发票明细"); _excel.Append(bbac, "发票明细");
} }
else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian) else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{ {
_excel.Append(bj, "发票明细"); _excel.Append(bj, "发票明细");
} }
else else
{ {
_excel.Append(detail, "发票明细"); _excel.Append(detail, "发票明细");
} }
#endregion
// 发票分组
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO) if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{ {
_excel.Append(m, "发票结算分组对应");//发票分组对应结算号 _excel.Append(m, "发票结算分组对应");//发票分组对应结算号
} }
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC ) if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{ {
_excel.Append(unsettle, "未结零件结算汇总"); if (hbpom != null)
{
_excel.Append(hbpom, "发票结算分组对应");
}
if (unsettle != null)
{
_excel.Append(unsettle, "未结零件汇总");
}
} }
if (first.BusinessType == EnumBusinessType.JisHBPO) if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC)
{ {
_excel.Append(unsettle, "未结零件列表"); _excel.Append(unsettle, "未结零件结算汇总");
} }
//jis业务,发票分组对应关系,未结数据,调整数据
foreach (var itm in entities) if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{ {
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList(); foreach (var itm in entities)
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); {
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
var lsC = nolist.Where(p => p.Extend1 == "可结算") var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
.GroupBy(p => new var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
{ var lsC = nolist.Where(p => p.Extend1 == "可结算")
p.LU, .GroupBy(p => new
p.RealInvBillNum, {
p.InvDate, p.LU,
p.InvBillNum, p.RealInvBillNum,
p.InvGroupNum, p.InvDate,
}).Select(p => new INVOICE_NOT_SETTLE_DTO() p.InvBillNum,
{ p.InvGroupNum,
LU = p.Key.LU, }).Select(p => new INVOICE_NOT_SETTLE_DTO()
RealInvBillNum = p.Key.RealInvBillNum, {
InvDate = p.Key.InvDate, LU = p.Key.LU,
InvBillNum = p.Key.InvBillNum, RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate,
InvGroupNum = p.Key.InvGroupNum, InvBillNum = p.Key.InvBillNum,
Qty = p.Sum(itm => itm.Qty) InvGroupNum = p.Key.InvGroupNum,
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() }).ToList();
{ var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList()
LU = p.Key.LU, .GroupBy(p => new
RealInvBillNum = p.Key.RealInvBillNum, {
InvDate = p.Key.InvDate, p.LU,
InvBillNum = p.Key.InvBillNum, p.RealInvBillNum,
InvGroupNum = p.Key.InvGroupNum, p.InvDate,
Qty = p.Sum(itm => itm.Qty) p.InvBillNum,
}).ToList(); p.InvGroupNum,
var lineC = lsC.Count;
var lineN = lsN.Count;
List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
for (int i = 0; i < 10000; i++) }).Select(p => new INVOICE_NOT_SETTLE_DTO()
{ {
INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO(); LU = p.Key.LU,
invnot.RealInvBillNum = string.Empty; RealInvBillNum = p.Key.RealInvBillNum,
invnot.InvDate = null; InvDate = p.Key.InvDate,
invnot.InvBillNum = string.Empty; InvBillNum = p.Key.InvBillNum,
invnot.InvGroupNum = string.Empty; InvGroupNum = p.Key.InvGroupNum,
invnot.SettleGroupNum = string.Empty; Qty = p.Sum(itm => itm.Qty)
invnot.SettleLU = string.Empty; }).ToList();
invnot.SettleQty = null; var lineC = lsC.Count;
invnot.NotSettleLU = string.Empty; var lineN = lsN.Count;
invnot.Qty = string.Empty; List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
ls.Add(invnot); for (int i = 0; i < 10000; i++)
} {
var entity = nolist.FirstOrDefault(); INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO();
var disList = mgroup.Select(p => p.SettleGroupNum).Distinct().ToList(); invnot.RealInvBillNum = string.Empty;
for (int i = 0; i < lineC; i++)//更新可结信息 invnot.InvDate = null;
{ invnot.InvBillNum = string.Empty;
ls[i].RealInvBillNum = entity.RealInvBillNum; invnot.InvGroupNum = string.Empty;
ls[i].InvDate = entity.InvDate; invnot.SettleGroupNum = string.Empty;
ls[i].InvBillNum = entity.InvBillNum; invnot.SettleLU = string.Empty;
ls[i].InvGroupNum = entity.InvGroupNum; invnot.SettleQty = null;
// ls[i].SettleGroupNum = entity.SettleGroupNum; invnot.NotSettleLU = string.Empty;
ls[i].SettleLU = lsC[i].LU; invnot.Qty = string.Empty;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString(); ls.Add(invnot);
} }
for (int i = 0; i < lineN; i++)//更新不可结信息 var entity = nolist.FirstOrDefault();
{ var disList = mgroup.Select(p => p.SettleGroupNum).Distinct().ToList();
ls[i].RealInvBillNum = entity.RealInvBillNum; for (int i = 0; i < lineC; i++)//更新可结信息
ls[i].InvDate = entity.InvDate; {
ls[i].InvBillNum = entity.InvBillNum; ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum; ls[i].InvDate = entity.InvDate;
// ls[i].SettleGroupNum = entity.SettleGroupNum; ls[i].InvBillNum = entity.InvBillNum;
ls[i].NotSettleLU = lsN[i].LU; ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].Qty = lsN[i].Qty == null ? string.Empty : lsN[i].Qty.ToString(); // ls[i].SettleGroupNum = entity.SettleGroupNum;
} ls[i].SettleLU = lsC[i].LU;
for (int i = 0; i < disList.Count; i++)//更新结算分组 ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
{ }
ls[i].SettleGroupNum = disList[i]; 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();
} }
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO) }
else//其他业务发票调整数据
{
foreach (var itm in entities)
{ {
_excel.Append(ls, "结算分组零件" + itm.InvbillNum); var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
} }
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
} }
var result = _excel.ExportAppendDataAsByteArray(); var result = _excel.ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
@ -622,7 +657,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
inv.RealnvBillNum = newinv.RealnvBillNum; inv.RealnvBillNum = newinv.RealnvBillNum;
// inv.RealAmt = newinv.RealAmt; // inv.RealAmt = newinv.RealAmt;
inv.TaxDiff = newinv.PreTaxDiff; inv.TaxDiff = newinv.PreTaxDiff;
// inv.ClientCode = newinv.ClientCode; // inv.ClientCode = newinv.ClientCode;
} }
foreach (var detail in invdetail) foreach (var detail in invdetail)

Loading…
Cancel
Save