104 lines
3.2 KiB
C#
104 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ADODB;
|
|
using log4net;
|
|
using UFIDA.U8.Audit.ServiceProxy;
|
|
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
|
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
|
using UFSoft.U8.Framework.ContextSrv;
|
|
using UFSoft.U8.Framework.LoginContext;
|
|
|
|
namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
|
{
|
|
public class ServiceProxy
|
|
{
|
|
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
|
|
|
public bool IsFlowEnabled(BaseLogin login, string bizObjectId, string eventId)
|
|
{
|
|
var auditServiceProxy = new AuditServiceProxy();
|
|
var errMsg = "";
|
|
var res = auditServiceProxy.IsFlowEnabled(bizObjectId, eventId, login._productContext.calledContext, ref errMsg);
|
|
|
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
|
{
|
|
throw new Exception(errMsg);
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
public BaseResult<string> SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode)
|
|
{
|
|
try
|
|
{
|
|
var auditServiceProxy = new AuditServiceProxy();
|
|
var isWFControled = false;
|
|
var errMsg = "";
|
|
var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWFControled, ref errMsg);
|
|
|
|
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
|
{
|
|
throw new Exception(errMsg);
|
|
}
|
|
|
|
if (!isWFControled && !string.IsNullOrWhiteSpace(errMsg))
|
|
{
|
|
throw new Exception(errMsg);
|
|
}
|
|
|
|
if (!isWFControled)
|
|
{
|
|
throw new Exception("当前单据无法进入工作流");
|
|
}
|
|
|
|
return new BaseResult<string>()
|
|
{
|
|
bSuccess = res,
|
|
message = "提交成功",
|
|
result = "提交成功",
|
|
voucherId = voucherId,
|
|
voucherCode = voucherCode
|
|
};
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logInfo.Error($"审批流异常:{ex.Message}", ex);
|
|
return new BaseResult<string>()
|
|
{
|
|
bSuccess = false, message = "提交失败", voucherCode = voucherCode, voucherId = voucherId,
|
|
result = ex.Message
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
public string GetBizObjectId(Connection conn,string cCardNum)
|
|
{
|
|
var rst = new Recordset();
|
|
|
|
|
|
var strSql = $"SELECT cHeadBusObjectId FROM dbo.vouchers WHERE CardNumber='{cCardNum}'";
|
|
|
|
rst.Open(strSql,conn);
|
|
|
|
if (rst.EOF || rst.BOF)
|
|
{
|
|
throw new Exception($"未查询到单据类型编码{cCardNum}的配置信息");
|
|
}
|
|
|
|
rst.MoveFirst();
|
|
|
|
var res = $"{rst.Fields["cHeadBusObjectId"].Value}";
|
|
|
|
rst.Close();
|
|
|
|
return res;
|
|
}
|
|
}
|
|
}
|