Browse Source

修改发票导出问题,反结算修改

master
学 赵 1 year ago
parent
commit
4f94c61fb2
  1. 43
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
  2. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  3. 62
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  4. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

43
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs

@ -136,23 +136,50 @@ namespace Win.Sfs.SettleAccount.Bases
[UnitOfWork(false)]
public virtual async Task<string> ApprovalPassed(List<string> p_list)
{
return await InvokePD(p_list, _service, false);
return await InvokePD(p_list, _service);
}
[HttpPost]
[UnitOfWork(false)]
public virtual async Task<string> RejectAsync(List<string> p_list)
{
return await InvokePD(p_list, _service, true);
return await InvokePD(p_list, _service);
}
/// <summary>
/// 调用扣减
/// </summary>
/// <param name="p_list"></param>
/// <param name="p_service"></param>
/// <param name="isback"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
protected async Task<string> InvokePD(List<string> p_list, TaskJobService p_service, bool isback=false)
{
var invlist=_repository.Where(p=>p_list.Contains(p.BillNum)).ToList();
var states= invlist.Select(p => p.State).Distinct().ToList();
if (states.Count > 1)
{
throw new UserFriendlyException($"发票不是同一状态", "400");
}
var first = invlist.FirstOrDefault();//发票状态
if(first.State != SettleBillState. && first.State != SettleBillState.)
{
throw new UserFriendlyException($"当前发票状态不是【客户已收票】或【已扣减状态】不能进行出库扣减或撤销扣减操作", "400");
}
if (first.State == SettleBillState.)
{
isback = false;
}
if(first.State==SettleBillState.)
{
isback = true;
}
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
var first=detailist.FirstOrDefault();
var first1=detailist.FirstOrDefault();
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
customConditionList.Add(new CustomCondition() { Name = "Type", Value =first.BusinessType.ToString() });
customConditionList.Add(new CustomCondition() { Name = "Type", Value =first1.BusinessType.ToString() });
if (isback == false)
{
customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
@ -161,7 +188,6 @@ namespace Win.Sfs.SettleAccount.Bases
{
customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "in" });
}
var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
var lst=new List<TEntity>();
if (isback == false)
@ -172,8 +198,6 @@ namespace Win.Sfs.SettleAccount.Bases
{
lst = ls.Where(p => (p.State == SettleBillState.|| p.State == SettleBillState.)).ToList();
}
if (lst.Count() > 0)
{
throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交", "400");
@ -190,8 +214,7 @@ namespace Win.Sfs.SettleAccount.Bases
}
}
await _repository.DbContext.BulkUpdateAsync(ls);
var _taskid = await p_service.ExportEnqueueAsync($"{first.BusinessType.ToString()}待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
var _taskid = await p_service.ExportEnqueueAsync($"{first1.BusinessType.ToString()}待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
{
});

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

@ -298,8 +298,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public virtual async Task<INVOICE_GRP_DETAIL_DTO> DetailQueryAsync(INVOICE_GRP_REQ_DTO input)
{
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO();
var condition = input.Filters.FirstOrDefault(p => p.Column == "invbillNum");
if( condition==null )
{
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And));
}
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false);
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
var first = invs.FirstOrDefault();
@ -552,6 +560,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList();
return entity;
}
[HttpPost]
public virtual async Task<string> ExportAsync(INVOICE_GRP_REQ_DTO input)
{
@ -599,7 +613,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IExporter _csv = new CsvExporter();
ExcelExporter _excel = new ExcelExporter();
// var materialList = await _baseservice.GetMaterialList().ConfigureAwait(false);
var condition = input.Filters.FirstOrDefault(p => p.Column == "invbillNum");
if (condition == null)
{
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And));
}
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var first = entities.FirstOrDefault();
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities);
var invdetail = await DetailQueryAsync(input).ConfigureAwait(false);

62
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -217,66 +217,78 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
_dbcontext.BulkInsert(messagelist);
_dbcontext.BulkInsert(ls, new BulkConfig() { });
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();//同步数据的发票号
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();//扣减单内容
var pdinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList();
if (pdList.Count > 0)
{
if (flag == true)
{
foreach (var item in pdList)
{
if (flag == true)
item.State = SettleBillState.;
}
foreach (var item in pdinvList)
{
item.State = SettleBillState.;
}
_dbcontext.BulkUpdate(pdList);
_dbcontext.BulkUpdate(pdinvList);
}
else
{
item.State = SettleBillState.;
_dbcontext.BulkDelete(pdList);
_dbcontext.BulkDelete(p_ls);
}
}
_dbcontext.BulkUpdate(pdList);
}
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
var bbacinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList();
if (bbacList.Count > 0)
{
if (flag == true)
{
foreach (var item in bbacList)
{
if (flag == true)
item.State = SettleBillState.;
}
foreach (var item in bbacinvList)
{
item.State = SettleBillState.;
}
_dbcontext.BulkUpdate(bbacList);
_dbcontext.BulkUpdate(bbacinvList);
}
else
{
item.State = SettleBillState.;
}
_dbcontext.BulkDelete(pdList);
_dbcontext.BulkDelete(p_ls);
}
_dbcontext.BulkUpdate(bbacList);
}
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
var hbpoinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList();//发票
if (hbpoList.Count > 0)
{
foreach (var item in hbpoList)
{
if (flag == true)
{
foreach (var item in bbacList)
{
item.State = SettleBillState.;
}
else
foreach (var item in bbacinvList)
{
item.State = SettleBillState.;
}
item.State = SettleBillState.;
}
_dbcontext.BulkUpdate(hbpoList);
_dbcontext.BulkUpdate(bbacList);
_dbcontext.BulkUpdate(bbacinvList);
}
var invoiceList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList();
if (invoiceList.Count > 0)
{
foreach (var item in invoiceList)
{
if (flag == true)
else
{
item.State = SettleBillState.;
}
_dbcontext.BulkDelete(pdList);
_dbcontext.BulkDelete(p_ls);
}
_dbcontext.BulkUpdate(invoiceList);
}
}
// _emailSender.SendAsync(e)

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -1393,7 +1393,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: string.Empty,
parent: !string.IsNullOrEmpty(p_parentInvBillNum)?p_parentInvBillNum:string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
@ -1963,7 +1963,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: string.Empty,
parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
@ -2027,7 +2027,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
if (!string.IsNullOrEmpty(p_OldInvBillNum))
{
var inv = await GetInvoiceAsync(p_OldInvBillNum).ConfigureAwait(false);
var inv = await GetInvoiceAsync(p_OldInvBillNum).ConfigureAwait(false);//获取旧发票
if (inv == null)
{
@ -2283,7 +2283,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: string.Empty,
parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,

Loading…
Cancel
Save