增加交易唯一码,方便在网络状态不佳的情况下重新获取操作结果
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using ADODB;
|
||||
using ADODB;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFSoft.U8.Framework.BizBase;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
@@ -81,32 +82,20 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
/// </summary>
|
||||
public IContextContainer callar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录参数
|
||||
/// </summary>
|
||||
public LoginParamter paramters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化生产制造上下文
|
||||
/// </summary>
|
||||
/// <param name="paramter">登录参数</param>
|
||||
/// <param name="bMon"></param>
|
||||
/// <param name="traceTimes"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public void Init(LoginParamter paramter, bool bMon = true, int traceTimes = 0)
|
||||
public void Init(LoginParamter paramter, bool bMon = true)
|
||||
{
|
||||
var lastError = "";
|
||||
|
||||
|
||||
if (traceTimes > 5)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(lastError))
|
||||
{
|
||||
throw new Exception("U8登录异常");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(lastError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
//if (!string.IsNullOrWhiteSpace(ThreadContext.ServerToken))
|
||||
@@ -121,6 +110,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
|
||||
if (paramter == null) throw new ArgumentNullException(nameof(paramter));
|
||||
|
||||
paramters = paramter;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
{
|
||||
Cryptography.m_userToken = "";
|
||||
@@ -391,14 +382,138 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error($"重试次数:{traceTimes},错误信息:{ex.Message}", ex);
|
||||
|
||||
lastError = ex.Message;
|
||||
_logInfo.Error($"U8登录失败,错误信息:{ex.Message}", ex);
|
||||
throw;
|
||||
|
||||
//Init(paramter, bMon, traceTimes + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化生产制造上下文
|
||||
/// </summary>
|
||||
/// <param name="userToken">令牌</param>
|
||||
/// <param name="bMon"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public void Init(UserTokenInfo userToken, bool bMon = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (userToken == null) throw new ArgumentNullException(nameof(userToken));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
{
|
||||
Cryptography.m_userToken = "";
|
||||
}
|
||||
|
||||
userToken.loginParamter.pDate = $"{DateTime.Today:yyyy-MM-dd}";
|
||||
userToken.loginParamter.pYearId = $"{DateTime.Today.Year}";
|
||||
|
||||
paramters = userToken.loginParamter;
|
||||
|
||||
_vbLogin = new VBLogin();
|
||||
_vbLogin.ClearError();
|
||||
|
||||
_logInfo.Debug($"VB--开始进行U8登录:{userToken.userToken}");
|
||||
|
||||
if (!_vbLogin.ConstructLogin(userToken.userToken))
|
||||
{
|
||||
_logInfo.Debug($"VB--U8登录失败,错误信息:{_vbLogin.ShareString}");
|
||||
_logInfo.Debug($"VB--开始重新进行U8登录:{userToken.loginParamter.cSrv}--{userToken.loginParamter.pUserId}--{userToken.loginParamter.pAccId}");
|
||||
|
||||
_vbLogin=new VBLogin();
|
||||
_vbLogin.ClearError();
|
||||
|
||||
|
||||
if (!_vbLogin.Login(userToken.loginParamter.pSubId, userToken.loginParamter.pAccId, userToken.loginParamter.pYearId, userToken.loginParamter.pUserId, userToken.loginParamter.pPassword, userToken.loginParamter.pDate, userToken.loginParamter.cSrv, userToken.loginParamter.cSerial) && string.IsNullOrWhiteSpace(_vbLogin.userToken))
|
||||
{
|
||||
throw new Exception($"U8登录失败---{_vbLogin.ShareString}");
|
||||
}
|
||||
}
|
||||
|
||||
_logInfo.Debug($"VB--开始创建连接对象:{_vbLogin.userToken}");
|
||||
|
||||
Connection = new Connection();
|
||||
Connection.Open(_vbLogin.UfDbName);
|
||||
|
||||
_logInfo.Debug("VB--完成登录进程");
|
||||
|
||||
if (bMon)
|
||||
{
|
||||
|
||||
_logInfo.Debug($"NET--开始进行U8登录:{_vbLogin.userToken}");
|
||||
|
||||
_netLogin = new NetLogin();
|
||||
|
||||
_productContext = _netLogin.Login("DP", _vbLogin.userToken);
|
||||
|
||||
if (_productContext == null)
|
||||
{
|
||||
_logInfo.Debug($"Net--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
|
||||
if (!_netLogin.login(userToken.loginParamter.pSubId, userToken.loginParamter.pUserId, userToken.loginParamter.pPassword, userToken.loginParamter.cSrv, userToken.loginParamter.pDate, userToken.loginParamter.pAccId, userToken.loginParamter.cSerial) && string.IsNullOrWhiteSpace(_netLogin.userToken))
|
||||
{
|
||||
#if DEBUG
|
||||
_logInfo.Debug($"Net--使用用户登录--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
#else
|
||||
throw new Exception($"Net--U8登录失败---{_netLogin.ErrDescript}");
|
||||
#endif
|
||||
}
|
||||
|
||||
_logInfo.Debug($"Net--开始进行上下文构建:{_netLogin.userToken}");
|
||||
|
||||
_productContext = _netLogin.SubLogin("DP") ?? _netLogin.Login("DP", _vbLogin.userToken);
|
||||
}
|
||||
|
||||
if (_productContext == null)
|
||||
{
|
||||
_logInfo.Debug($"Net--构建上下文--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
}
|
||||
|
||||
#region U8 18.0时需要取消注释
|
||||
_logInfo.Debug($"U8M--正在创建应用池:{_netLogin.userToken}");
|
||||
|
||||
var info = U8LoginInfo.CreateInstance(_netLogin.userToken);
|
||||
|
||||
U8LoginInfoPool.Add(_netLogin.userToken, info);
|
||||
|
||||
_logInfo.Debug($"U8M--创建应用池:{info.U8LoginToken}");
|
||||
|
||||
_logInfo.Debug($"U8M--正在设置线程登录信息:{_netLogin.userToken}");
|
||||
ThreadContext.SetLoginInfo(_netLogin.userToken);
|
||||
_logInfo.Debug($"U8M--设置线程登录信息:{_netLogin.userToken}");
|
||||
#endregion
|
||||
|
||||
#region U8 18.0时需要注释
|
||||
|
||||
//_logInfo.Debug($"Net--开始进行上下文刷新:{_productContext.calledContext.token}");
|
||||
|
||||
//ClientUserContext.Instance.RefreshContext();
|
||||
|
||||
#endregion
|
||||
|
||||
_logInfo.Debug("Net--完成生产制造登录进程");
|
||||
|
||||
_logInfo.Debug("Net--构建制造上下文");
|
||||
|
||||
callar = new DefaultContextContainer();
|
||||
|
||||
_logInfo.Debug("Net--构建制造上下文成功");
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error($"U8登录失败,错误信息:{ex.Message}", ex);
|
||||
throw;
|
||||
|
||||
//Init(paramter, bMon, traceTimes + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化登录信息
|
||||
/// </summary>
|
||||
@@ -757,9 +872,26 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
/// </summary>
|
||||
public void ShutDown()
|
||||
{
|
||||
U8LoginInfoPool.Remove(_netLogin.userToken);
|
||||
try
|
||||
{
|
||||
Connection.Close();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Connection = null;
|
||||
|
||||
try
|
||||
{
|
||||
U8LoginInfoPool.Remove(_netLogin.userToken);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ThreadContext.ServerToken = null;
|
||||
_vbLogin?.ShutDown();
|
||||
@@ -786,6 +918,27 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
return _vbLogin.get_cAcc_Id() == cAccId;
|
||||
}
|
||||
|
||||
public void ReSetConnection()
|
||||
{
|
||||
if (this.Connection != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Connection = null;
|
||||
}
|
||||
|
||||
Connection=new Connection();
|
||||
|
||||
Connection.Open(_vbLogin.UfDbName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理登录上下文
|
||||
/// </summary>
|
||||
@@ -798,5 +951,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
_netLogin?.ShutDown();
|
||||
_netLogin = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
public interface IBaseBF
|
||||
{
|
||||
BaseResult<string> Save(BaseLogin baseLogin,string cCardNum, Dictionary<string, object> input);
|
||||
BaseResult<string> Save(BaseLogin baseLogin,string cCardNum, Dictionary<string, object> input, bool bVerify = false);
|
||||
|
||||
BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs);
|
||||
BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs, bool bVerify = false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,436 @@
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFSoft.U8.Framework.BizBase;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
using UFSoft.U8.U8M.BFDispatcher;
|
||||
using UFSoft.U8.U8M.Common;
|
||||
using UFSoft.U8.U8M.DOSchema.MO;
|
||||
using UFSoft.U8.U8M.Exceptions;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M.MO
|
||||
{
|
||||
/// <summary>
|
||||
/// 补料申请单(MO39)
|
||||
/// </summary>
|
||||
public class ReplenishApply
|
||||
{
|
||||
//日志组件
|
||||
private readonly ILog _logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
/// <summary>
|
||||
/// 获取空数据源
|
||||
/// </summary>
|
||||
/// <param name="callar"></param>
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <returns></returns>
|
||||
private ReplenishApplyDs GetEmptyDs(IContextContainer callar, string cCardNum)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logInfo.Debug($"获取空数据集-----{cCardNum}");
|
||||
|
||||
var ds = MOMExecutor.BFReplenishApply_LoadData("LoadFirst", 0, "", callar);
|
||||
|
||||
if (ds == null)
|
||||
return new ReplenishApplyDs();
|
||||
|
||||
#region 清除数据集里的数据
|
||||
|
||||
_logInfo.Debug("清空数据集-----mom_replenishapplydtl_ExtraDefine");
|
||||
if (ds.Tables.Contains("mom_replenishapplydtl_ExtraDefine"))
|
||||
{
|
||||
ds.Tables["mom_replenishapplydtl_ExtraDefine"].Clear();
|
||||
}
|
||||
|
||||
_logInfo.Debug("清空数据集-----mom_replenishapply_ExtraDefine");
|
||||
|
||||
if (ds.Tables.Contains("mom_replenishapply_ExtraDefine"))
|
||||
{
|
||||
ds.Tables["mom_replenishapply_ExtraDefine"].Clear();
|
||||
}
|
||||
|
||||
_logInfo.Debug("清空数据集-----ReplenishApplyDTL,ReplenishApply");
|
||||
ds.ReplenishApplyDTL.Clear();
|
||||
ds.ReplenishApply.Clear();
|
||||
|
||||
#endregion
|
||||
|
||||
return ds;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充DataSet数据
|
||||
/// </summary>
|
||||
/// <param name="callar"></param>
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <param name="docNoParam"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
private ReplenishApplyDs GetVoucherDs(IContextContainer callar, string cCardNum, AutoDocNoGenerateParam docNoParam, Dictionary<string, object> input)
|
||||
{
|
||||
|
||||
_logInfo.Debug("获取空数据集");
|
||||
var ds = GetEmptyDs(callar, cCardNum);
|
||||
|
||||
var head = ds.ReplenishApply.NewReplenishApplyRow();
|
||||
|
||||
ds.ReplenishApply.AddReplenishApplyRow(head);
|
||||
|
||||
//_logInfo.Debug($"获取单号规则-----{cCardNum}-----{docNoParam.Paramaters.ToJson()}");
|
||||
//var hsTable = U8MCommonExecutor.BFVoucher_GetVoucherIDFormula(cCardNum, callar);
|
||||
|
||||
//_logInfo.Debug($"获取单号-----{cCardNum}-----{hsTable.ToJson()}");
|
||||
//var docNo = U8MCommonExecutor.BFVoucher_GetVoucherID(cCardNum, hsTable, false, callar);
|
||||
|
||||
var docNo = "";
|
||||
|
||||
_logInfo.Debug("BE处理中");
|
||||
var be = new UFSoft.U8.MO.BE.ReplenishApply(ds);
|
||||
|
||||
be.DocCode = "";
|
||||
|
||||
_logInfo.Debug("填充表头参数");
|
||||
var beHead = new BEHelper(be);
|
||||
|
||||
beHead.SetValue(input);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(be.DocCode))
|
||||
{
|
||||
_logInfo.Debug($"设置单号:{docNo}");
|
||||
be.DocCode = docNo;
|
||||
}
|
||||
|
||||
var bodys = input["body"] as List<Dictionary<string, object>> ?? $"{input["body"]}".ToObject<List<Dictionary<string, object>>>();
|
||||
|
||||
_logInfo.Debug("填充表体参数");
|
||||
for (var i = 0; i < bodys.Count; i++)
|
||||
{
|
||||
var body = bodys[i];
|
||||
var detail = be.ReplenishApplyDTLs[i];
|
||||
|
||||
var beBody = new BEHelper(detail, "MO39");
|
||||
|
||||
beBody.SetValue(body);
|
||||
|
||||
beBody.SetPartId();
|
||||
}
|
||||
|
||||
_logInfo.Debug($"获取数据集:{be.DataObject.ToJson()}");
|
||||
ds = (ReplenishApplyDs)be.DataObject;
|
||||
|
||||
return ds;
|
||||
}
|
||||
|
||||
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input, bool bVerify = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
|
||||
{
|
||||
IsCurrentDocNoByHand = false
|
||||
};
|
||||
|
||||
var ds = GetVoucherDs(callar, cCardNum, docNoParam, input);
|
||||
|
||||
if (ds == null)
|
||||
{
|
||||
throw new Exception("未能构建数据集");
|
||||
}
|
||||
|
||||
_logInfo.Debug($"单据编码:{cCardNum},开始保存");
|
||||
|
||||
var id = MOMExecutor.BFReplenishApply_Save(ds, docNoParam, callar);
|
||||
|
||||
if (id > 0)
|
||||
{
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", id, "", callar);
|
||||
|
||||
if (bVerify)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
MOMExecutor.BFReplenishApply_ChangeStatus(id, 1, resDs.ReplenishApply[0].Ufts, callar);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"审核时发生异常:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
_logInfo.Debug($"单据编码:{cCardNum},保存完成,id:{id},单号:{resDs.ReplenishApply[0].DocCode}");
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "保存成功", result = $"{id}", voucherCode = resDs.ReplenishApply[0].DocCode, voucherId = $"{id}" };
|
||||
}
|
||||
|
||||
throw new Exception("保存失败,U8未能返回制单结果");
|
||||
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
catch (TargetInvocationException ex)
|
||||
{
|
||||
if (ex.InnerException is U8MReferenceBENotExistException)
|
||||
{
|
||||
_logInfo.Error(ex.InnerException.Message, ex.InnerException);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.InnerException.Message };
|
||||
}
|
||||
else
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> Verify(BaseLogin baseLogin, int voucherId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (voucherId <= 0)
|
||||
throw new Exception("没有需要审核的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
|
||||
|
||||
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 1, resDs.ReplenishApply[0].Ufts, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "审核成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> Verify(BaseLogin baseLogin, string voucherCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(voucherCode))
|
||||
throw new Exception("没有需要审核的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var voucherId = MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
|
||||
|
||||
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 1, resDs.ReplenishApply[0].Ufts, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "审核成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> UnVerify(BaseLogin baseLogin, int voucherId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (voucherId <= 0)
|
||||
throw new Exception("没有需要弃审的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
|
||||
|
||||
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 2, resDs.ReplenishApply[0].Ufts, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "弃审成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> UnVerify(BaseLogin baseLogin, string voucherCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(voucherCode))
|
||||
throw new Exception("没有需要审核的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var voucherId = MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
|
||||
|
||||
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 2, resDs.ReplenishApply[0].Ufts, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "弃审成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> Delete(BaseLogin baseLogin, string cCardNum, long voucherId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (voucherId <= 0)
|
||||
throw new Exception("没有需要删除的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
|
||||
{
|
||||
IsCurrentDocNoByHand = false
|
||||
};
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById",(int)voucherId, "", callar);
|
||||
|
||||
if(resDs == null)
|
||||
throw new Exception($"未查询到单据ID为{voucherId}的单据");
|
||||
|
||||
if(resDs.ReplenishApplyDTL!=null && resDs.ReplenishApplyDTL.Count > 0)
|
||||
{
|
||||
for(var i= resDs.ReplenishApplyDTL.Count - 1; i >= 0; i--)
|
||||
{
|
||||
resDs.ReplenishApplyDTL.Rows[i].Delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resDs.ReplenishApply[0].Delete();
|
||||
|
||||
MOMExecutor.BFReplenishApply_Save(resDs, docNoParam, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "删除成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<string> Delete(BaseLogin baseLogin, string cCardNum, string voucherCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(voucherCode))
|
||||
throw new Exception("没有需要删除的数据");
|
||||
|
||||
var callar = new DefaultContextContainer();
|
||||
|
||||
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
|
||||
{
|
||||
IsCurrentDocNoByHand = false
|
||||
};
|
||||
|
||||
var voucherId= MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
|
||||
|
||||
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
|
||||
|
||||
if (resDs == null)
|
||||
throw new Exception($"未查询到单据ID为{voucherId}的单据");
|
||||
|
||||
if (resDs.ReplenishApplyDTL != null && resDs.ReplenishApplyDTL.Count > 0)
|
||||
{
|
||||
for (var i = resDs.ReplenishApplyDTL.Count - 1; i >= 0; i--)
|
||||
{
|
||||
resDs.ReplenishApplyDTL.Rows[i].Delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resDs.ReplenishApply[0].Delete();
|
||||
|
||||
MOMExecutor.BFReplenishApply_Save(resDs, docNoParam, callar);
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "删除成功", result = $"{voucherId}" };
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input)
|
||||
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input, bool bVerify = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <param name="inputs"></param>
|
||||
/// <returns></returns>
|
||||
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs)
|
||||
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs, bool bVerify = false)
|
||||
{
|
||||
|
||||
var idList = new List<int>();
|
||||
|
||||
Reference in New Issue
Block a user