using HH.WMS.Entitys.External;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HH.WMS.Common.Response
{
///
/// 外部请求本地 返回消息
///
public class ExternalResponse
{
public ExternalResponse()
{
this.okList = new List();
this.failList = new List();
this.tasks = new List();
}
#region 失败
///
/// 失败
///
///
///
///
///
public ExternalResponse Error(T req, string msg, List reqList = null)
{
this.success = false;
if (string.IsNullOrEmpty(msg))
{
if (failList.Any())
msg = failList[0].errMsg;
}
this.errMsg = msg;
this.errCode = this.failList.Any() ? failList[0].errCode : "";
return this;
}
public ExternalResponse ErrorList(List req, string msg, List reqList = null)
{
this.success = false;
this.errMsg = msg;
// this.WriteInterfaceLog(req, reqList);
return this;
}
#endregion
#region 成功
///
/// 成功
///
///
///
///
public ExternalResponse Ok(T req, List reqList = null)
{
this.success = true;
return this;
}
#endregion
public bool success { get; set; }
///
/// 错误码 0 正常 1
///
public string errCode { get; set; }
public string errMsg { get; set; }
public List okList { get; set; }
public List failList { get; set; }
public List tasks { get; set; }
}
}