85 lines
2.3 KiB
C#
85 lines
2.3 KiB
C#
|
using DeviceRepair.Models;
|
|||
|
using DeviceRepair.Utils;
|
|||
|
using NLog;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using TsSFCDevice.Client.Biz.Base.Service;
|
|||
|
using TsSFCDevice.Client.Biz.Base.Utils;
|
|||
|
|
|||
|
namespace TsSFCDevice.Client.Biz.Impl
|
|||
|
{
|
|||
|
public class CustomFieldRepository
|
|||
|
{
|
|||
|
private readonly Logger log;
|
|||
|
private static CustomFieldRepository manager;
|
|||
|
|
|||
|
private IDictionary<string, string> m_ApiParameters;
|
|||
|
/// <summary>
|
|||
|
/// API输入参数
|
|||
|
/// </summary>
|
|||
|
public IDictionary<string, string> ApiParameters
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return m_ApiParameters;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
m_ApiParameters = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static CustomFieldRepository Instance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (manager == null)
|
|||
|
manager = new CustomFieldRepository();
|
|||
|
return manager;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public CustomFieldRepository()
|
|||
|
{
|
|||
|
log = LogManager.GetCurrentClassLogger();
|
|||
|
m_ApiParameters = new Dictionary<string, string>();
|
|||
|
}
|
|||
|
|
|||
|
internal string GetParameters(string cOperator = "", bool bFlag = true)
|
|||
|
{
|
|||
|
|
|||
|
return ParametersObject.GetInstance(cOperator).GetJsonSerialized(m_ApiParameters);
|
|||
|
}
|
|||
|
|
|||
|
public IList<FieldsInfo> GetDatas(string[] FieldCodes)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
IList<FieldsInfo> Data = new List<FieldsInfo>();
|
|||
|
|
|||
|
byte[] btResults = null;
|
|||
|
ApiParameters?.Clear();
|
|||
|
ApiParameters.Add("FieldCode", string.Join(",", FieldCodes));
|
|||
|
|
|||
|
var Rtn = Utility.SfcBizService.CurrentSvc.GetDatas(DeviceSvc.SysModelType.CustomField, GetParameters(), out btResults);
|
|||
|
if (Rtn.Code != 1)
|
|||
|
{
|
|||
|
throw new Exception(Rtn.Message);
|
|||
|
}
|
|||
|
DataSet dsResults = CompressionHelper.ExactDataSet(btResults);
|
|||
|
|
|||
|
return DTOHelper<FieldsInfo>.DataTableToList(dsResults.Tables[0]);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
log.Error(ex.Message, ex);
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|