Browse Source

修改结算状态枚举,中文名称,修改扣减逻辑

master
学 赵 1 year ago
parent
commit
129a03af6f
  1. 48
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
  2. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

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

@ -152,8 +152,6 @@ namespace Win.Sfs.SettleAccount.Bases
throw new UserFriendlyException($"扣减单状态不是【客户已收票】状态", "400");
}
return await InvokePD(invlist,p_list, _service, false);
}
[HttpPost]
@ -193,47 +191,45 @@ namespace Win.Sfs.SettleAccount.Bases
{
throw new UserFriendlyException($"扣减单状态不是【已扣减】状态", "400");
}
return await InvokePD(invlist,p_list, _service,true);
return await InvokePD(invlist, p_list, _service, true);
}
}
/// <summary>
/// 调用扣减
/// </summary>
/// <param name="p_list"></param>
/// <param name="p_service"></param>
/// <param name="isback"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[UnitOfWork(false)]
protected async Task<string> InvokePD<T>(List<T> p_invs,List<string> p_list, TaskJobService p_service, bool isback=false) where T:PD_BASE_MAIN
/// <summary>
/// 调用扣减
/// </summary>
/// <param name="p_list"></param>
/// <param name="p_service"></param>
/// <param name="isback"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[UnitOfWork(false)]
protected async Task<string> InvokePD<T>(List<T> p_invs, List<string> p_list, TaskJobService p_service, bool isback = false) where T : PD_BASE_MAIN
{
var invlist = p_invs;
// var invlist=_repository.Where(p=>p_list.Contains(p.BillNum)).ToList();
var states= invlist.Select(p => p.State).Distinct().ToList();
// 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.)
if (first.State != SettleBillState. && first.State != SettleBillState.)
{
throw new UserFriendlyException($"当前发票状态不是【客户已收票】或【已扣减状态】不能进行出库扣减或撤销扣减操作", "400");
}
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
var first1=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 =first1.BusinessType.ToString() });
customConditionList.Add(new CustomCondition() { Name = "Type", Value = first1.BusinessType.ToString() });
if (isback == false)
{
customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
@ -243,14 +239,14 @@ 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>();
var lst = new List<TEntity>();
if (isback == false)
{
lst = ls.Where(p => (p.State == SettleBillState. || p.State == SettleBillState.)).ToList();
lst = ls.Where(p => (p.State == SettleBillState. || p.State == SettleBillState.)).ToList();
}
else
{
lst = ls.Where(p => (p.State == SettleBillState.|| p.State == SettleBillState.)).ToList();
lst = ls.Where(p => (p.State == SettleBillState. || p.State == SettleBillState.)).ToList();
}
if (lst.Count() > 0)
{
@ -260,11 +256,11 @@ namespace Win.Sfs.SettleAccount.Bases
{
if (isback == false)
{
item.State = SettleBillState.;
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
item.State = SettleBillState.;
}
}
await _repository.DbContext.BulkUpdateAsync(ls);

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

@ -42,7 +42,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
var list = billList.Split(",");
var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位");
if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian")
if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian" || type== "YinDuJian")
{
var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis
if (jisdetail != null && jisdetail.Count() > 0)

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

@ -25,10 +25,10 @@ namespace Win.Sfs.SettleAccount
= 5,
[Description("客户已收票")]
= 4,
[Description("已提交扣减")]
= 6,
[Description("已提交撤销扣减")]
= 7,
[Description("扣减进行中")]
= 6,
[Description("撤销扣减进行中")]
= 7,
[Description("已提交QAD")]
QAD = 8
}

Loading…
Cancel
Save