修复销售订单查询报错的问题
This commit is contained in:
@@ -772,7 +772,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
|
||||
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
|
||||
{
|
||||
throw new Exception("没有数据需要弃审");
|
||||
throw new Exception("没有数据需要删除");
|
||||
}
|
||||
|
||||
var strCode = "";
|
||||
@@ -839,6 +839,226 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交工作流(单号)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cCode">单号</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/SubmintWf/Code")]
|
||||
public async Task<BaseResult<string>> SubmintWf(string cAccId, string cCardNum, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},单号:{cCode}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin) || baseLogin == null)
|
||||
{
|
||||
_logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.SubmintWf(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCode, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "提交工作流失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交工作流(ID)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="voucherId">单据ID</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/SubmintWf/ID")]
|
||||
public async Task<BaseResult<string>> SubmintWf(string cAccId, string cCardNum, long voucherId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},ID:{voucherId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
_logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.SubmintWf(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherId, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "提交工作流失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交工作流(批量)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/PU/{cCardNum}/SubmintWf")]
|
||||
public async Task<BaseResult<List<BaseResult<string>>>> SubmintWf(string cAccId, string cCardNum, [FromBody] STInput input, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
throw new Exception("参数不能为空");
|
||||
}
|
||||
|
||||
var cCodes = input.cCode;
|
||||
|
||||
var voucherIds = input.voucherId;
|
||||
|
||||
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
|
||||
{
|
||||
throw new Exception("没有数据需要提交工作流");
|
||||
}
|
||||
|
||||
var strCode = "";
|
||||
var strId = "";
|
||||
|
||||
var apiType = cCodes == null || cCodes.Count <= 0 ? 1 : 0;
|
||||
|
||||
if (cCodes != null && cCodes.Count > 0)
|
||||
{
|
||||
strCode = string.Join(",", cCodes);
|
||||
}
|
||||
|
||||
if (voucherIds != null && voucherIds.Count > 0)
|
||||
{
|
||||
strId = string.Join(",", voucherIds);
|
||||
}
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},单号:{strCode},ID:{strId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
_logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
_logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
var result = apiType == 0
|
||||
? await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCodes, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml)
|
||||
: await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherIds, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var res = new BaseResult<List<BaseResult<string>>>()
|
||||
{
|
||||
bSuccess = true,
|
||||
message = "提交工作流完成",
|
||||
result = result
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<List<BaseResult<string>>> { bSuccess = false, message = ex.Message, result = null };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询特定单据部分
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user