Browse Source

Merge branch 'master' of http://dev.ccwin-in.com:3000/BoXu.Zheng/BeiJinSettleAccount

master
wanggang 1 year ago
parent
commit
c16706e06c
  1. 2
      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. 70
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

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

@ -430,8 +430,6 @@ 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)
{ {
} }

70
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;
@ -199,7 +200,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
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.ExtraProperties["DeliveryIndexNumber"].ToSqlValue();
//bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号 //bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号 //bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
//bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码 //bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
@ -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,39 +432,52 @@ 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.MaiDanJianHBPO)
{
if (hbpom != null)
{
_excel.Append(hbpom, "发票结算分组对应");
}
if (unsettle != null)
{
_excel.Append(unsettle, "未结零件汇总");
}
}
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC) if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC)
{ {
_excel.Append(unsettle, "未结零件结算汇总"); _excel.Append(unsettle, "未结零件结算汇总");
} }
if (first.BusinessType == EnumBusinessType.JisHBPO) //jis业务,发票分组对应关系,未结数据,调整数据
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{ {
_excel.Append(unsettle, "未结零件列表");
}
foreach (var itm in entities) foreach (var itm in entities)
{ {
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList(); var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
@ -465,7 +497,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
RealInvBillNum = p.Key.RealInvBillNum, RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate, InvDate = p.Key.InvDate,
InvBillNum = p.Key.InvBillNum, InvBillNum = p.Key.InvBillNum,
InvGroupNum = p.Key.InvGroupNum, InvGroupNum = p.Key.InvGroupNum,
Qty = p.Sum(itm => itm.Qty) Qty = p.Sum(itm => itm.Qty)
@ -491,7 +522,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var lineC = lsC.Count; var lineC = lsC.Count;
var lineN = lsN.Count; var lineN = lsN.Count;
List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>(); List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
for (int i = 0; i < 10000; i++) for (int i = 0; i < 10000; i++)
{ {
INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO(); INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO();
@ -532,13 +562,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
ls[i].SettleGroupNum = disList[i]; ls[i].SettleGroupNum = disList[i];
} }
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{
_excel.Append(ls, "结算分组零件" + itm.InvbillNum); _excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}
} }
else//其他业务发票调整数据
{
foreach (var itm in entities)
{
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