using Newtonsoft.Json.Linq; using RB_MES_API.Models; using RB_MES_API.Models.Cloud; using System.Data; namespace RB_MES_API.Controllers { /// /// 控制器间通用服务 /// public interface IShareController { /// /// POST请求备份(接收数据校验完成后备份到数据库) /// /// 接口名称 /// 访问类型 /// 传入的JSON(解密后) public void PostRequestBack(string intface, string doctype, string data); /// /// 获取枚举显示值 /// /// /// public string? GetDropDownText(int saveval); /// /// 字符串转decimal,错误时返回0 /// /// 待转换的代表数量 /// public decimal DecimalPar(string sqty); /// /// 将JSON对象转为单个对象 /// /// /// /// /// public T DataToClass(string data, ref string reason) where T : class, new(); /// /// 将JSON转为实体类 /// /// 泛型 /// Json数据包 /// 错误消息 /// public List? DataConvertClass(string data, ref string reason) where T : class; /// /// 得到查询接口的名称 /// /// 查询接口序号 /// public string? InterfaceName(int id); /// /// 得到接收接口的名称 /// /// K3单据类型ID /// public string? K3BillName(int id); /// /// 将DataTable转成XML /// /// 数据表 /// 表名 /// public string? DatatableToXml(DataTable tb, string? tbName=null); ///// ///// 沃比日志,单独作用域 ///// ///// ///// 接口类型 ///// 消息说明 ///// 消息源 ///// 是否错误 ///// 全球唯一码 //public Task _Sqllogger(int intfc, string doctypd, string mess, string sour, bool staus = false, string guid = ""); /// /// 沃比SQL日志 /// /// 接口分组 /// 接口类型 /// 消息说明 /// 消息源 /// 是否错误 /// 全球唯一码,成对出现时用于识别传递前后 public void _SqlloggerInvoke(int intfc, string doctypd, string mess, string sour, bool staus = false, string guid = ""); public void _SqllogInvoke(RBLog log); /// /// 取得查询连接字符串 /// /// 接口ID /// public string GetSelectSql(int id); /// /// 通过DataTable转为指定的实体类 /// /// 实体类 /// 输入表单 /// public List GetClassList(DataTable dataTable) where T : class, new(); /// /// 字符串64位解密 /// /// /// public string UnBase64Decode(string B64); /// /// 字符串64位加密 /// /// /// public string Base64Decode(string B64); /// /// 在目标ints中,通过组合,检验是否包含参数v /// /// 要校验的参数值范围 /// 要判断的枚举值 /// 当前设置的值 /// public bool SCombination(List ints, int v, int setv); /// /// 将目标枚举T,除exceptobj以外的参数值放入List中。注意!是参数值,不是枚举项目所在index /// /// 枚举类型 /// 排除的参数值 /// 除exceptobj以外的参数值集合 public List GetSetInts(int exceptobj) where T : struct, Enum; /// /// 将DataTable对象转为JSON,带字段名 /// /// /// /// public string ObjectToJSON(DataTable table); /// /// 判断是否批量保存成功 /// /// 需要分析的json /// 必须返回的字段 /// 如果不成功,代表错误消息;否则代表返回的字段键值对Dictionary /// public bool CloudExecuteBatchSaveStatus(string result, string needfileds, ref List> message); /// /// 判断金蝶云星空是否批量保存成功 /// /// 需要分析的json /// 必须返回的字段 /// 如果不成功,代表错误消息;否则代表返回的字段键值对 /// public bool KDCloudExecuteBatchSaveStatus(string result, string needfileds, ref int errcord, ref List> message); /// /// Cloud判断是否保存成功 /// /// /// /// public bool CloudExecuteSaveStatus(string result, ref string message); /// /// 动态生成客户端需要的对象,inputjson必须有字段名! /// /// /// FFunctionID /// FDesTableName /// 从金蝶Cloud里获取的数据集 /// 错误时返回消息 /// public List GetNewObj(int fid, string dectablename, string inputjson, ref string reason) where T : class, new(); /// /// 将子查询的返回数据按顺序赋值给对象,inputjson可以无字段名! /// /// /// 字段顺序,当inputjson无字段名时以此为准 /// 返回JSON /// 错误时返回消息 /// public List GetNewObjForChild(string fieldkeys, string inputjson, ref string reason) where T : class, new(); /// /// 将传入的JSON转为DataTable,接收到的数据可以无字段名!字段来源于r_ClumnConvert /// /// FFunctionID /// FDesTableName /// 从云星空查询到的数据列表 /// public DataTable GetInputDataTable(int fid, string DocType, string data, ref string messtr); /// /// 根据字段顺序,将JSON数据集转为DataTable,data可以无字段名!fieldkeys来源于r_CloudBillQuery /// /// 字段。格式SQL查询Select后From前的字段名,不能为空!!! /// /// 如果有错误就返回消息 /// public DataTable JsonConvertDatatable(string fieldkeys, string data, ref string messtr); /// /// JSON直接转datatable /// /// json /// 返回的错误消息 /// public DataTable JsonToDatatable(string data,ref string messtr); /// /// 将有字段名的表转为LIST,Key为字段名,Val为字段值 /// /// 数据表 /// public List> GetClassList(DataTable table); /// /// 将JArray转为Dictionary,子项必须有字段名!!! /// /// /// public List> GetClassList(JArray arrjson); /// /// 将计量单位添加到缓存 /// public void AddUnitCache(); /// /// 从缓存中读取API接口所需要的配置 /// /// 配置类 /// public Task> GetAPIList() where T : class, new(); /// /// 取有源单的推送单据类型 /// /// 推送的接口类型 /// 源单的单据类型编号 /// public string GetDesFormID(string postdoctype, string sourtype); /// /// JSON转动态对象列表 /// 真正的动态对象,注意字段要完全匹配!!! /// /// 命名空间名称 /// 模型名 /// 能转为JArray的json /// 错误消息 /// public List? DataConvertClass(string spacename, string clssname, string data, ref string reason) where T : class, new(); /// /// 实体类的必填字段校验,未写完 /// /// /// /// /// public bool CheckRequired(List ts, ref string reason); /// /// 通过系统参数获取销售价格资料ID /// /// /// public int GetSalePriceID(string reason); /// /// ASC进位算法 /// /// 源字符串 /// 总长度 /// 补位符号 /// 错误消息 /// public void ASCCarry( ref string s, int len, string coverstr); /// /// 不必等待,直接保存请求成功的备份 /// /// List public void SaveReciveData(object dataBacks); } }