/// <summary> /// /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="pFilters"></param> /// <returns></returns> static public TEntity GetMisEntity <TEntity>(List <CommonFilterModel> pFilters) where TEntity : class, new() { try { var wcfRslt = MangoWCF <TEntity> .GetList(pFilters); if (null != wcfRslt && null != wcfRslt.Data && 0 < wcfRslt.Data.Count) { return(wcfRslt.Data.First()); } else { C_WMS.Data.Utility.MyLog.Instance.Warning("{0}.{1}<{2}>({3}),没有获取到实体(wcfRslt={4}, wcfRslt.RetInt={5}, wcfRslt.RETData={6}, wcfRslt.Debug={7}), Filter debug:\r\n{8}", MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, typeof(TEntity), pFilters, wcfRslt, wcfRslt?.RetInt, wcfRslt?.RETData, wcfRslt?.Debug, Utility.CWmsDataUtility.GetDebugInfo_MisFilter(pFilters)); return(null); } } catch (Exception ex) { C_WMS.Data.Utility.MyLog.Instance.Warning(ex, "!!Exception in {0}.{1}<{2}>({3}),Filters debug:\r\n{4}", MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, typeof(TEntity), pFilters, Utility.CWmsDataUtility.GetDebugInfo_MisFilter(pFilters)); return(null); } }
/// <summary> /// 根据过滤条件查询Mis实体,若执行成功则返回实体数量,否则返回TError.WCF_RunError或-1。 /// </summary> /// <param name="pFilters"></param> /// <param name="pOutList">返回查询到Mis实体列表,若执行失败则返回Count为0的List</param> /// <param name="pErrMsg"></param> /// <returns></returns> static public int GetMisOrderList <T>(List <CommonFilterModel> pFilters, out List <T> pOutList, out string pErrMsg) where T : class, new() { int err = TError.WCF_RunError.Int(); var wcfRslt = MangoWCF <T> .GetList(pFilters); if (null != wcfRslt && null != wcfRslt.Data) { C_WMS.Data.Utility.MyLog.Instance.Info("在{0}中,根据过滤条件获取的{2}实体数量为{1}", MethodBase.GetCurrentMethod().Name, wcfRslt.Data.Count, typeof(T)); pErrMsg = (0 == wcfRslt.Data.Count) ? string.Format("在{0}中,根据过滤条件获取的Mis实体数量为0,DEBUG: {1}", MethodBase.GetCurrentMethod().Name, wcfRslt.Debug) : string.Empty; } else { pErrMsg = string.Format("在{0}中,根据过滤条件获取{2}实体失败, DEBUG: {1}", MethodBase.GetCurrentMethod().Name, wcfRslt?.Debug, typeof(T)); } pOutList = (null != wcfRslt?.Data) ? wcfRslt.Data.ToList() : new List <T>(1); C_WMS.Data.Utility.MyLog.Instance.Info("在{0}中,根据过滤条件获取的{3}实体完成, pOutList={1}, Count={2}", MethodBase.GetCurrentMethod().Name, pOutList, pOutList?.Count, typeof(T)); err = (0 == pOutList.Count) ? -1 : pOutList.Count; if (!string.IsNullOrEmpty(pErrMsg)) { C_WMS.Data.Utility.MyLog.Instance.Error(pErrMsg); } return((null == wcfRslt) ? TError.WCF_RunError.Int() : wcfRslt.RetInt.Int()); }