审批流CO部分完成
This commit is contained in:
@@ -102,6 +102,9 @@
|
|||||||
<HintPath>D:\U8SOFT\Workflow\Lib\UFIDA.U8.Audit.ServiceProxy.dll</HintPath>
|
<HintPath>D:\U8SOFT\Workflow\Lib\UFIDA.U8.Audit.ServiceProxy.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UFIDA.U8.Portal.MTC.Design">
|
||||||
|
<HintPath>D:\U8SOFT\Portal\UFIDA.U8.Portal.MTC.Design.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="UFSoft.U8.BO.BE">
|
<Reference Include="UFSoft.U8.BO.BE">
|
||||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll</HintPath>
|
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@@ -1,29 +1,35 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ADODB;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using UFIDA.U8.Audit.ServiceProxy;
|
using UFIDA.U8.Audit.ServiceProxy;
|
||||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||||
using UFSoft.U8.Framework.ContextSrv;
|
// ReSharper disable IdentifierTypo
|
||||||
using UFSoft.U8.Framework.LoginContext;
|
|
||||||
|
|
||||||
namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 工作流
|
||||||
|
/// </summary>
|
||||||
public class ServiceProxy
|
public class ServiceProxy
|
||||||
{
|
{
|
||||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
private readonly ILog _logInfo = LogManager.GetLogger("_logInfo");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #是否启用审批流#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="bizObjectId"></param>
|
||||||
|
/// <param name="eventId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
public bool IsFlowEnabled(BaseLogin login, string bizObjectId, string eventId)
|
public bool IsFlowEnabled(BaseLogin login, string bizObjectId, string eventId)
|
||||||
{
|
{
|
||||||
var auditServiceProxy = new AuditServiceProxy();
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
var errMsg = "";
|
var errMsg = "";
|
||||||
var res = auditServiceProxy.IsFlowEnabled(bizObjectId, eventId, login._productContext.calledContext, ref errMsg);
|
var res = auditServiceProxy.IsFlowEnabled(bizObjectId, eventId, login._productContext.calledContext, ref errMsg);
|
||||||
|
|
||||||
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
{
|
{
|
||||||
throw new Exception(errMsg);
|
throw new Exception(errMsg);
|
||||||
}
|
}
|
||||||
@@ -31,33 +37,51 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResult<string> SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode)
|
/// <summary>
|
||||||
|
/// #提交审批流#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="bizObjectId"></param>
|
||||||
|
/// <param name="eventId"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
|
public async Task<BaseResult<string>> SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var auditServiceProxy = new AuditServiceProxy();
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
var isWFControled = false;
|
|
||||||
|
var isWfControled = false;
|
||||||
var errMsg = "";
|
var errMsg = "";
|
||||||
var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWFControled, ref errMsg);
|
|
||||||
|
var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWfControled, ref errMsg);
|
||||||
|
|
||||||
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
{
|
{
|
||||||
throw new Exception(errMsg);
|
throw new Exception(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isWFControled && !string.IsNullOrWhiteSpace(errMsg))
|
if (!isWfControled && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
{
|
{
|
||||||
throw new Exception(errMsg);
|
throw new Exception(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isWFControled)
|
if (!isWfControled)
|
||||||
{
|
{
|
||||||
throw new Exception("当前单据无法进入工作流");
|
throw new Exception("当前单据无法进入工作流");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseResult<string>()
|
if (!res)
|
||||||
{
|
{
|
||||||
bSuccess = res,
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
message = "提交成功",
|
message = "提交成功",
|
||||||
result = "提交成功",
|
result = "提交成功",
|
||||||
voucherId = voucherId,
|
voucherId = voucherId,
|
||||||
@@ -67,8 +91,11 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logInfo.Error($"审批流异常:{ex.Message}", ex);
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
return new BaseResult<string>()
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
{
|
{
|
||||||
bSuccess = false, message = "提交失败", voucherCode = voucherCode, voucherId = voucherId,
|
bSuccess = false, message = "提交失败", voucherCode = voucherCode, voucherId = voucherId,
|
||||||
result = ex.Message
|
result = ex.Message
|
||||||
@@ -76,28 +103,353 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
public string GetBizObjectId(Connection conn,string cCardNum)
|
/// #单据审核#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="cCardNum"></param>
|
||||||
|
/// <param name="action"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
/// <param name="opinion"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
|
public async Task<BaseResult<string>> Audit(BaseLogin login, string cCardNum, short action, short state, string opinion, string voucherId, string voucherCode)
|
||||||
{
|
{
|
||||||
var rst = new Recordset();
|
try
|
||||||
|
|
||||||
|
|
||||||
var strSql = $"SELECT cHeadBusObjectId FROM dbo.vouchers WHERE CardNumber='{cCardNum}'";
|
|
||||||
|
|
||||||
rst.Open(strSql,conn);
|
|
||||||
|
|
||||||
if (rst.EOF || rst.BOF)
|
|
||||||
{
|
{
|
||||||
throw new Exception($"未查询到单据类型编码{cCardNum}的配置信息");
|
var keySet = $@"<KeySet><Key name='VoucherId' value='{voucherId}'/><Key name='VoucherType' value='{cCardNum}'/><Key name='VoucherCode' value='{voucherCode}'/></KeySet>";
|
||||||
|
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
var errMsg = "";
|
||||||
|
var res = auditServiceProxy.Audit(keySet, action, state, opinion, login._productContext.calledContext, ref errMsg);
|
||||||
|
|
||||||
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
rst.MoveFirst();
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
var res = $"{rst.Fields["cHeadBusObjectId"].Value}";
|
if (!res)
|
||||||
|
{
|
||||||
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
rst.Close();
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "审核成功",
|
||||||
|
result = "审核成功",
|
||||||
|
voucherId = voucherId,
|
||||||
|
voucherCode = voucherCode
|
||||||
|
};
|
||||||
|
|
||||||
return res;
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "审核失败",
|
||||||
|
voucherCode = voucherCode,
|
||||||
|
voucherId = voucherId,
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #单据弃审#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="cCardNum"></param>
|
||||||
|
/// <param name="action"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
/// <param name="opinion"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
|
public async Task<BaseResult<string>> Abandon(BaseLogin login, string cCardNum, short action, short state, string opinion, string voucherId, string voucherCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var keySet = $@"<KeySet><Key name='VoucherId' value='{voucherId}'/><Key name='VoucherType' value='{cCardNum}'/><Key name='VoucherCode' value='{voucherCode}'/></KeySet>";
|
||||||
|
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
var errMsg = "";
|
||||||
|
var res = auditServiceProxy.Abandon(keySet, opinion, state, login._productContext.calledContext, ref errMsg);
|
||||||
|
|
||||||
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "弃审成功",
|
||||||
|
result = "弃审成功",
|
||||||
|
voucherId = voucherId,
|
||||||
|
voucherCode = voucherCode
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "审核失败",
|
||||||
|
voucherCode = voucherCode,
|
||||||
|
voucherId = voucherId,
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #流程撤销#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="cCardNum"></param>
|
||||||
|
/// <param name="bizObjectId"></param>
|
||||||
|
/// <param name="eventId"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<BaseResult<string>> RevokeAudition(BaseLogin login, string cCardNum, string bizObjectId, string eventId, string voucherId, string voucherCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
|
||||||
|
var data = "";
|
||||||
|
var errMsg = "";
|
||||||
|
|
||||||
|
var res = auditServiceProxy.RevokeAudition(bizObjectId, eventId, voucherId, cCardNum,voucherCode,ref data,login._productContext.calledContext, ref errMsg);
|
||||||
|
|
||||||
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "撤销成功",
|
||||||
|
result = "撤销成功",
|
||||||
|
voucherId = voucherId,
|
||||||
|
voucherCode = voucherCode
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "撤销失败",
|
||||||
|
voucherCode = voucherCode,
|
||||||
|
voucherId = voucherId,
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #取得审批历史进程信息#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="cCardNum"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
|
public async Task<BaseResult<string>> GetAuditedHistoryXml(BaseLogin login, string cCardNum, string voucherId, string voucherCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
|
||||||
|
var res = auditServiceProxy.GetAuditedHistoryXml(voucherId, cCardNum, login._productContext.calledContext);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(res))
|
||||||
|
{
|
||||||
|
throw new Exception("未能取得审批历史进程信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "获取成功",
|
||||||
|
result = res,
|
||||||
|
voucherId = voucherId,
|
||||||
|
voucherCode = voucherCode
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "获取失败",
|
||||||
|
voucherCode = voucherCode,
|
||||||
|
voucherId = voucherId,
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #退回提交人后重新提交#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="cCardNum"></param>
|
||||||
|
/// <param name="voucherId"></param>
|
||||||
|
/// <param name="voucherCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<BaseResult<string>> SubmitResubmitMessage(BaseLogin login, string cCardNum, string voucherId, string voucherCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
|
||||||
|
var keySet = $@"<KeySet><Key name='VoucherId' value='{voucherId}'/><Key name='VoucherType' value='{cCardNum}'/><Key name='VoucherCode' value='{voucherCode}'/></KeySet>";
|
||||||
|
|
||||||
|
var errMsg = "";
|
||||||
|
|
||||||
|
var res = auditServiceProxy.SubmitResubmitMessage(keySet, login._productContext.calledContext,ref errMsg);
|
||||||
|
|
||||||
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "提交成功",
|
||||||
|
result = "提交成功",
|
||||||
|
voucherId = voucherId,
|
||||||
|
voucherCode = voucherCode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "提交失败",
|
||||||
|
voucherCode = voucherCode,
|
||||||
|
voucherId = voucherId,
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// #取得代办任务#
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login"></param>
|
||||||
|
/// <param name="hasDone"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<BaseResult<string>> GetTasks(BaseLogin login, bool hasDone)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var auditServiceProxy = new AuditServiceProxy();
|
||||||
|
|
||||||
|
var errMsg = "";
|
||||||
|
|
||||||
|
var res = auditServiceProxy.GetTasks(hasDone, login._productContext.calledContext, ref errMsg);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(errMsg))
|
||||||
|
{
|
||||||
|
throw new Exception(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(res))
|
||||||
|
{
|
||||||
|
throw new Exception("审批流发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = true,
|
||||||
|
message = "提交成功",
|
||||||
|
result = res
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||||
|
|
||||||
|
await Task.Delay(1);
|
||||||
|
|
||||||
|
return new BaseResult<string>
|
||||||
|
{
|
||||||
|
bSuccess = false,
|
||||||
|
message = "获取失败",
|
||||||
|
result = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user