using Tiger.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Rhea.Common;
using System.Net;
using System.Linq;
using Newtonsoft.Json;
using Tiger.IBusiness;
using Microsoft.AspNetCore.Http;
using Tiger.Model.Minsun;
using Org.BouncyCastle.Asn1.Tsp;
using Tiger.Model.Entitys.MES.Position;
using Apache.NMS.ActiveMQ.Commands;
using System.Security.Cryptography;
using System.Diagnostics;
using Tiger.Model.Entitys.MES.U9C;
using Newtonsoft.Json.Linq;
namespace Tiger.Business.MES
{
public partial class MES_U9C : IMES_U9C
{
public static string U9CAuthLoginUrl { get; set; } = "http://172.16.80.20/U9C/webapi/OAuth2/AuthLogin";
///
/// 入库单接口
///
///
///
public async Task RcvRptDocCreate(RcvRptDocCreateInput input)
{
Logger.Interface.Info($"/**\r\n *进入入库单接口....\r\n */\r\n"); //固定写法
var action = new ApiAction();
try
{
JObject json = new JObject();
json["CompleteList"] = new JArray(); // 创建一个空的JArray
JObject moKey = new JObject();
moKey["DocNo"] = input.WorkOrder;
JObject Wh = new JObject();
Wh["Code"] = input.WhCode;
json["CompleteList"]["Wh"] = Wh;
JObject DescFlexField = new JObject();
DescFlexField["PrivateDescSeg1"] = input.PkgQty;
json["CompleteList"]["DescFlexField"] = DescFlexField;
JObject Item = new JObject();
Item["Code"] = input.ItemCode;
json["CompleteList"]["Item"] = Item;
json["CompleteList"]["CompleteQty"] = input.CompleteQty;
json["CompleteList"]["OutputType"] = input.OutputType;
json["CompleteList"]["StorageType"] = input.StorageType;
json["CompleteList"]["DocState"] = input.DocState;
var response = await HttpHelper.PostAsync(U9CAuthLoginUrl, json);
var result = JsonConvert.DeserializeObject(response.Message);
Logger.Interface.Info($"生成入库单接口提交Json: {json},返回Json: {response.Message}");
var db = Biz.Db;
var dbTran = db.UseTran(() =>
{
});
if (!dbTran.IsSuccess)
{
action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
Logger.Interface.Error(action.Message);
}
Logger.Interface.Info($"生成入库单成功");
}
catch (System.Exception ex)
{
action.CatchExceptionWithLog(ex, "生成入库单异常");
}
Logger.Interface.Info($"/* 入库单接口结束 */\r\n"); //固定写法
return action;
}
}
}