mahao
1 year ago
22 changed files with 2172 additions and 546 deletions
@ -0,0 +1,128 @@ |
|||
import version from "./version.js"; |
|||
|
|||
const stateName = { |
|||
title: "状态", |
|||
type: "string", |
|||
input: "select", |
|||
options: [ |
|||
{ label: "执行完成(任务成功)", value: "Succeeded" }, |
|||
{ label: "执行完成(任务失败)", value: "Failed" }, |
|||
{ label: "执行中", value: "Processing" }, |
|||
{ label: "等待执行", value: "Enqueued" }, |
|||
], |
|||
}; |
|||
|
|||
const schema = { |
|||
title: "数据对比", |
|||
type: "object", |
|||
properties: { |
|||
type: { |
|||
title: "版本号", |
|||
type: "string", |
|||
}, |
|||
taskId: { |
|||
title: "单据流水号", |
|||
type: "string", |
|||
}, |
|||
email: { |
|||
title: "创建人", |
|||
type: "string", |
|||
}, |
|||
createdAt: { |
|||
title: "创建时间", |
|||
type: "DateTime", |
|||
}, |
|||
remark: { |
|||
title: "说明", |
|||
type: "string", |
|||
}, |
|||
stateName, |
|||
}, |
|||
}; |
|||
|
|||
const queryUrl = "settleaccount/Job/list"; |
|||
const deleteUrl = "settleaccount/Job/delete"; |
|||
const exportUrl = "settleaccount/pub_sa_detail_service/export"; |
|||
const compareUrl = "settleaccount/edi-se-compare/bbacedi-se-compare"; |
|||
const queryMethod = "POST"; |
|||
const deleteMethod = "POST"; |
|||
const exportMethod = "POST"; |
|||
const compareMethod = "POST"; |
|||
|
|||
export default function () { |
|||
return { |
|||
query: { |
|||
url: queryUrl, |
|||
method: queryMethod, |
|||
|
|||
autoSubmit: true, |
|||
disableQueryOnLoad: true, |
|||
schema: { |
|||
title: "数据对比", |
|||
type: "object", |
|||
properties: { |
|||
type: Object.assign({ defaultSelected: true }, version), |
|||
name: { |
|||
type: "string", |
|||
default: null, |
|||
hidden: true, |
|||
}, |
|||
stateName, |
|||
filters: { |
|||
type: "array", |
|||
hidden: true, |
|||
items: { |
|||
type: "object", |
|||
properties: { |
|||
logic: { |
|||
type: "int", |
|||
}, |
|||
column: { |
|||
type: "string", |
|||
}, |
|||
action: { |
|||
type: "int", |
|||
}, |
|||
value: { |
|||
type: "string", |
|||
}, |
|||
}, |
|||
}, |
|||
default: [ |
|||
// {
|
|||
// logic: "and",
|
|||
// column: "year",
|
|||
// action: "like",
|
|||
// value: null,
|
|||
// readOnly: true,
|
|||
// },
|
|||
], |
|||
}, |
|||
skipCount: { |
|||
hidden: true, |
|||
default: 0, |
|||
}, |
|||
maxResultCount: { |
|||
hidden: true, |
|||
default: 10, |
|||
}, |
|||
sorting: { |
|||
hidden: true, |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
table: { |
|||
schema: schema, |
|||
}, |
|||
edit: { |
|||
deleteUrl, |
|||
exportUrl, |
|||
compareUrl, |
|||
deleteMethod, |
|||
exportMethod, |
|||
compareMethod, |
|||
schema: schema, |
|||
}, |
|||
}; |
|||
} |
@ -0,0 +1,128 @@ |
|||
import version from "./version.js"; |
|||
|
|||
const stateName = { |
|||
title: "状态", |
|||
type: "string", |
|||
input: "select", |
|||
options: [ |
|||
{ label: "执行完成(任务成功)", value: "Succeeded" }, |
|||
{ label: "执行完成(任务失败)", value: "Failed" }, |
|||
{ label: "执行中", value: "Processing" }, |
|||
{ label: "等待执行", value: "Enqueued" }, |
|||
], |
|||
}; |
|||
|
|||
const schema = { |
|||
title: "数据对比", |
|||
type: "object", |
|||
properties: { |
|||
type: { |
|||
title: "版本号", |
|||
type: "string", |
|||
}, |
|||
taskId: { |
|||
title: "单据流水号", |
|||
type: "string", |
|||
}, |
|||
email: { |
|||
title: "创建人", |
|||
type: "string", |
|||
}, |
|||
createdAt: { |
|||
title: "创建时间", |
|||
type: "DateTime", |
|||
}, |
|||
remark: { |
|||
title: "说明", |
|||
type: "string", |
|||
}, |
|||
stateName, |
|||
}, |
|||
}; |
|||
|
|||
const queryUrl = "settleaccount/Job/list"; |
|||
const deleteUrl = "settleaccount/Job/delete"; |
|||
const exportUrl = "settleaccount/pub_sa_detail_service/export"; |
|||
const compareUrl = "settleaccount/edi-se-compare/hbpoedi-se-compare"; |
|||
const queryMethod = "POST"; |
|||
const deleteMethod = "POST"; |
|||
const exportMethod = "POST"; |
|||
const compareMethod = "POST"; |
|||
|
|||
export default function () { |
|||
return { |
|||
query: { |
|||
url: queryUrl, |
|||
method: queryMethod, |
|||
|
|||
autoSubmit: true, |
|||
disableQueryOnLoad: true, |
|||
schema: { |
|||
title: "数据对比", |
|||
type: "object", |
|||
properties: { |
|||
type: Object.assign({ defaultSelected: true }, version), |
|||
name: { |
|||
type: "string", |
|||
default: null, |
|||
hidden: true, |
|||
}, |
|||
stateName, |
|||
filters: { |
|||
type: "array", |
|||
hidden: true, |
|||
items: { |
|||
type: "object", |
|||
properties: { |
|||
logic: { |
|||
type: "int", |
|||
}, |
|||
column: { |
|||
type: "string", |
|||
}, |
|||
action: { |
|||
type: "int", |
|||
}, |
|||
value: { |
|||
type: "string", |
|||
}, |
|||
}, |
|||
}, |
|||
default: [ |
|||
// {
|
|||
// logic: "and",
|
|||
// column: "year",
|
|||
// action: "like",
|
|||
// value: null,
|
|||
// readOnly: true,
|
|||
// },
|
|||
], |
|||
}, |
|||
skipCount: { |
|||
hidden: true, |
|||
default: 0, |
|||
}, |
|||
maxResultCount: { |
|||
hidden: true, |
|||
default: 10, |
|||
}, |
|||
sorting: { |
|||
hidden: true, |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
table: { |
|||
schema: schema, |
|||
}, |
|||
edit: { |
|||
deleteUrl, |
|||
exportUrl, |
|||
compareUrl, |
|||
deleteMethod, |
|||
exportMethod, |
|||
compareMethod, |
|||
schema: schema, |
|||
}, |
|||
}; |
|||
} |
@ -0,0 +1,101 @@ |
|||
import version from "../version"; |
|||
import { state2, state3 } from "../state"; |
|||
const schema = { |
|||
title: "财务审核", |
|||
type: "object", |
|||
properties: { |
|||
version, |
|||
realnvBillNum: { |
|||
title: "实际纸质发票号", |
|||
type: "string", |
|||
}, |
|||
invbillNum: { |
|||
title: "系统生成发票号", |
|||
type: "string", |
|||
}, |
|||
amt: { |
|||
title: "未税金额", |
|||
type: "decimal", |
|||
}, |
|||
taxAmt: { |
|||
title: "税后金额", |
|||
type: "decimal", |
|||
}, |
|||
fileName: { |
|||
title: "开票Excel文件", |
|||
type: "string", |
|||
}, |
|||
businessType: { |
|||
title: "业务类别", |
|||
type: "EnumBusinessType", |
|||
}, |
|||
state2, |
|||
}, |
|||
}; |
|||
|
|||
const queryUrl = "settleaccount/invoice_service/detail_queryUrl"; |
|||
const queryMethod = "POST"; |
|||
|
|||
export default function () { |
|||
return { |
|||
query: { |
|||
url: queryUrl, |
|||
method: queryMethod, |
|||
hasFilter: true, |
|||
schema: { |
|||
title: "财务审核", |
|||
type: "object", |
|||
properties: { |
|||
filters: { |
|||
title: "项目", |
|||
type: "array", |
|||
hidden: true, |
|||
items: { |
|||
type: "object", |
|||
properties: { |
|||
logic: { |
|||
type: "int", |
|||
}, |
|||
column: { |
|||
type: "string", |
|||
}, |
|||
action: { |
|||
type: "int", |
|||
}, |
|||
value: { |
|||
type: "string", |
|||
}, |
|||
}, |
|||
}, |
|||
default: [ |
|||
{ |
|||
logic: "and", |
|||
column: "version", |
|||
action: "equal", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
], |
|||
}, |
|||
skipCount: { |
|||
hidden: true, |
|||
default: 0, |
|||
}, |
|||
maxResultCount: { |
|||
hidden: true, |
|||
default: 10, |
|||
}, |
|||
sorting: { |
|||
hidden: true, |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
table: { |
|||
schema: schema, |
|||
}, |
|||
edit: { |
|||
schema: schema, |
|||
}, |
|||
}; |
|||
} |
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
using SettleAccount.Domain.BQ; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class BBAC_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<BBAC_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public BBAC_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public BBAC_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(BBAC_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (BBAC_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (BBAC_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(BBAC_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<BBAC_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<BBAC_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
using SettleAccount.Domain.BQ; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class HBPO_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<HBPO_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public HBPO_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public HBPO_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(HBPO_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (HBPO_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (HBPO_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(HBPO_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<HBPO_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<HBPO_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
using SettleAccount.Domain.BQ; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class PUB_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<PUB_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public PUB_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<PUB_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public PUB_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(PUB_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (PUB_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (PUB_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(PUB_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<PUB_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<PUB_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue