Commit 27709f74 authored by liudong1993's avatar liudong1993

1 画途 删除附件凭证

parent f1b8fcb0
......@@ -858,5 +858,47 @@ namespace REBORN.Module.FinanceModule
}
}
#endregion
#region 删除单据凭证
/// <summary>
/// 删除附件凭证
/// </summary>
/// <param name="frId"></param>
/// <param name="voucherId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string DelFinanceVorcherInos(int frId, string voucherId, UserInfo userInfo)
{
var vlist = voucherRepository.GetList(new RB_Voucher() { VoucherType = 0, FinanceId = frId });
if (vlist.Count() <= 1) { return "凭证附件数小于等于1,无法删除"; }
var vmodel = vlist.Where(x => x.Content.Contains(voucherId)).FirstOrDefault();
if (vmodel == null) { return "凭证附件不存在"; }
bool flag = voucherRepository.Delete(vmodel) > 0;
if (flag)
{
Model.Entity.Log.RB_Finance_Infochange_Log logModel = new Model.Entity.Log.RB_Finance_Infochange_Log
{
LogId = 0,
RB_Branch_id = 0,
RB_Group_id = userInfo.RB_Group_id,
UpdateBy = userInfo.EmployeeId,
UpdateDate = DateTime.Now,
ResourceId = frId,
StartValue = $"删除附件【{vmodel.Content}】",
Type = Common.Enum.Log.TemplateEnum.Process,
EndValue = "",
Description = ""
};
RB_Finance_InfoChange_LogRepository.Insert(logModel);
return "";
}
else {
return "删除失败";
}
}
#endregion
}
}
......@@ -4369,5 +4369,43 @@ namespace REBORN.Services.FinanceService
}
#endregion
#region 删除单据附件凭证
/// <summary>
/// 有权限的可以删除凭证
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public virtual ApiResult DelFinanceVorcherInos(RequestParm request)
{
var userInfo = CacheManager.User.RbUserCache.GetUserLoginInfo(request.uid);
if (userInfo != null && userInfo.RB_Post_Id > 0)
{
string actionMenu = CacheManager.User.RbUserCache.GetUserActionMenu(userInfo.RB_Post_Id);
if (!(!string.IsNullOrEmpty(actionMenu) && actionMenu.Contains("F_DelFinanceVoucher")))
{
return ApiResult.Failed("没有权限操作");
}
}
JObject parms = JObject.Parse(request.msg.ToString());
string VoucherId = parms.GetStringValue("VoucherId");
int FrId = parms.GetInt("FrId", 0);
if (string.IsNullOrEmpty(VoucherId) || FrId <= 0)
{
return ApiResult.ParamIsNull();
}
VoucherId = Path.GetFileName(VoucherId);
string msg = module.DelFinanceVorcherInos(FrId, VoucherId, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
#endregion
}
}
\ No newline at end of file
......@@ -2184,6 +2184,13 @@
"checkFormRepeatSubmit": true,
"url": ""
},
{
"cmd": "Financial_post_DelFinanceVorcherInos", //删除单据附件
"fullName": "REBORN.Services.FinanceService.FinancialService",
"method": "DelFinanceVorcherInos",
"checkFormRepeatSubmit": true,
"url": ""
},
{
"cmd": "Financial_post_GetFinanceRefundEnumService", //获取退款枚举类型
"fullName": "REBORN.Services.FinanceService.FinancialService",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment