Exemple #1
0
        static public int GetV_Order <TOrderType, TMangoOrderType, THandler>(List <CommonFilterModel> pFilters, out IEnumerable <TOrderType> pOutList, out string pErrMsg) where TOrderType : class, new()
        {
            int err = TError.WCF_RunError.Int();
            List <TMangoOrderType> orderList = null;

            try
            {
                if (0 >= (err = MangoFactory.GetV_Order(pFilters, out orderList, out pErrMsg)) || null == orderList)
                {
                    pOutList = null;
                    pErrMsg  = string.Format("CWmsDataFactory.GetV_Order<{0}, {1}, {2}>列表失败, err={3}, orderList={4}, errMsg={5}", typeof(TOrderType), typeof(TMangoOrderType), typeof(THandler), err, orderList, pErrMsg);
                    C_WMS.Data.Utility.MyLog.Instance.Warning(pErrMsg);
                    return(err);
                }
                else
                {
                    MethodInfo methodInfo = typeof(THandler).GetMethod("NewOrder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);
                    pOutList = orderList.Select(order => methodInfo.Invoke(null, new object[] { (order as IMangoOrderBase)?.GetId() }) as TOrderType);
                    err      = Enumerable.Count(pOutList);
                    pErrMsg  = (0 < err) ? string.Empty : string.Format("");
                    return(err);
                }
            }
            catch (Exception ex)
            {
                if (null != orderList)
                {
                    orderList.Clear();
                }
                pOutList = null;
                pErrMsg  = string.Format("CWmsDataFactory.GetV_Order<{0}, {1}, {2}>发生异常,FilterDebug={3}", typeof(TOrderType), typeof(TMangoOrderType), typeof(THandler), Utility.CWmsDataUtility.GetDebugInfo_MisFilter(pFilters));
                Data.Utility.MyLog.Instance.Error(ex, pErrMsg);
                return(TError.Post_NoChange.Int());
            }
        }
Exemple #2
0
 /// <summary>
 /// return the sub-delivery order of pOrder, or null if failed.
 /// </summary>
 /// <param name="pOrder">object of sub-stockout order.</param>
 /// <returns></returns>
 public IMangoOrderBase GetSubDeliveryOrder(MangoSubStockoutOrder pOrder)
 {
     if (null == pOrder)
     {
         C_WMS.Data.Utility.MyLog.Instance.Warning("MangoSubStockoutOrderHandler.GetSubDeliveryOrder(), invalid null param.");
         return(null);
     }
     try
     {
         string errMsg = string.Empty;
         MangoSubDeliveryOrder        retOrder = null;
         List <MangoSubDeliveryOrder> sdList   = null;
         int err = MangoFactory.GetV_Order(NewFilter_GetDeliveryOrder(pOrder), out sdList, out errMsg);
         if (1 == err)
         {
             retOrder = sdList[0];
         }
         else
         {
             C_WMS.Data.Utility.MyLog.Instance.Warning("MangoSubStockoutOrderHandler.GetSubDeliveryOrder({0}), failed in retrieving sub-delivery order. err={1}, errMsg={2}", pOrder, err, errMsg);
         }
         if (null != sdList)
         {
             sdList.Clear();
         }
         return(retOrder);
     }
     catch (Exception ex)
     {
         C_WMS.Data.Utility.MyLog.Instance.Warning(ex, "Exception in MangoSubStockoutOrderHandler.GetSubDeliveryOrder({0})", pOrder);
         return(null);
     }
 }