提交测试
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
using log4net;
|
||||
using log4net.Util;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using UFIDA.U8.Framework.Api.Common.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.AP;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.ST;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFIDA.U8.Framework.Api.Unit;
|
||||
// ReSharper disable StringLiteralTypo
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存管理
|
||||
/// </summary>
|
||||
public class STController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
@@ -31,14 +34,14 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <summary>
|
||||
/// 新增单据
|
||||
/// </summary>
|
||||
/// <param name="cAccId"></param>
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="bCheck"></param>
|
||||
/// <param name="bBeforCheckStock"></param>
|
||||
/// <param name="bIsRedVouch"></param>
|
||||
/// <param name="sAddedState"></param>
|
||||
/// <param name="bReMote"></param>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bCheck">是否控制可用量</param>
|
||||
/// <param name="bBeforCheckStock">是否检查可用量</param>
|
||||
/// <param name="bIsRedVouch">是否红字单据</param>
|
||||
/// <param name="sAddedState">传空字符串</param>
|
||||
/// <param name="bReMote">是否远程</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/ST/{cCardNum}/Insert")]
|
||||
@@ -80,9 +83,9 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = db.Queryable<SysU8VoucherDefine>().First(s => s.CardNumber == cCardNum);
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var defs = db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "H" && s.bEnable==true).ToList(); //查询表头字段配置,供后续设置字段值
|
||||
var defs = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "H" && s.bEnable==true).ToListAsync(); //查询表头字段配置,供后续设置字段值
|
||||
|
||||
var dateKey = "";
|
||||
var exchKey = "";
|
||||
@@ -103,9 +106,9 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
|
||||
Exch exch;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(exchKey) && input.ContainsKey(exchKey))
|
||||
if (!string.IsNullOrWhiteSpace(exchKey) && input.TryGetValue(exchKey, out var value))
|
||||
{
|
||||
exch = CommonHelper.GetExch(dDate, param.cAccId, $"{input[exchKey]}", baseLogin.Connection);
|
||||
exch = CommonHelper.GetExch(dDate, param.cAccId, $"{value}", baseLogin.Connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -156,7 +159,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
throw new Exception("无表体数据!");
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----获取表体字段配置");
|
||||
var defsBody = db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "B" && s.bEnable==true).ToList(); //获取表体的字段配置
|
||||
var defsBody = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "B" && s.bEnable==true).ToListAsync(); //获取表体的字段配置
|
||||
|
||||
var rowNo = 1;
|
||||
|
||||
@@ -237,59 +240,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
|
||||
var co = new USERPCO();
|
||||
|
||||
var res = await co.Insert(baseLogin, input, cCardNum, voucherInfo.VoucherType, bGetCode, codeKey, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新单据
|
||||
/// </summary>
|
||||
/// <param name="cAccId"></param>
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="bCheck"></param>
|
||||
/// <param name="bBeforCheckStock"></param>
|
||||
/// <param name="bIsRedVouch"></param>
|
||||
/// <param name="sAddedState"></param>
|
||||
/// <param name="bUpdateNeedEas"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/ST/{cCardNum}/Update")]
|
||||
public async Task<BaseResult<string>> Update(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input, bool bCheck = true, bool bBeforCheckStock = true, bool bIsRedVouch = false, string sAddedState = "", bool bUpdateNeedEas = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
var bo = new USERPCO();
|
||||
|
||||
var res = await bo.Update(baseLogin, input, "0412", "11", bCheck, bBeforCheckStock, bIsRedVouch, sAddedState,
|
||||
bUpdateNeedEas);
|
||||
var res = await co.Insert(baseLogin, input, cCardNum, voucherInfo.VoucherType, bGetCode, codeKey, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote, voucherInfo.bVerify);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user