/// <summary>
 /// overriding void Dispose()
 /// </summary>
 public override void Dispose()
 {
     if (null != ProductIdList)
     {
         ProductIdList.Clear();
     }
     if (null != OwnerList)
     {
         OwnerList.Clear();
     }
 }
Example #2
0
 public OrderProductList(List <Product> productList, List <int> quantityList)
 {
     this.Id            = nextId++;
     this.ProductList   = productList;
     this.QuantityList  = quantityList;
     this.ProductIdList = new List <int>();
     foreach (Product p in ProductList)
     {
         ProductIdList.Add(p.Id);
     }
 }
        /// <summary>
        /// 创建HttpReqXml_InventoryMonitoring对象
        /// </summary>
        /// <returns></returns>
        override public HttpReqXml_InventoryMonitoring NewRequestObj()
        {
            try
            {
                _productIdList = CWmsDataFactory.GetV_ProductIds((0 == ProductIdList?.Count) ? null : ProductIdList).ToList();
                if (0 == OwnerList?.Count)
                {
                    _ownerList = CWmsDataFactory.GetV_Owners().ToList();
                }
                if (0 == ProductIdList.Count || 0 == OwnerList.Count)
                {
                    C_WMS.Data.Utility.MyLog.Instance.Warning("{0}.NewRequestObject(), no productId or owner.", GetType());
                    return(null);
                }

                var reqObj = new HttpReqXml_InventoryMonitoring();
                foreach (string id in ProductIdList)
                {
                    foreach (var owner in OwnerList)
                    {
                        var wList = CWmsDataFactory.GetV_Warehouse(owner);
                        if (!Utility.CWmsDataUtility.IEnumerableAny(wList))
                        {
                            C_WMS.Data.Utility.MyLog.Instance.Warning("{0}.NewRequestObject(), owner[{1}] has no warehouse.", GetType(), owner);
                        }
                        else
                        {
                            reqObj.items.AddRange(wList.Select(w => new HttpReqXml_InventoryMonitoring_item(w.WmsCode, owner.WOwner.WmsID, id)));
                        }
                    }
                }
                return(reqObj);
            }
            catch (Exception ex)
            {
                ProductIdList?.ForEach(id =>
                {
                    C_WMS.Data.Utility.MyLog.Instance.Warning("{0}.NewRequestObject()  Exception: Id={1}", GetType(), id);
                });
                C_WMS.Data.Utility.MyLog.Instance.Warning(ex, "{0}.NewRequestObject()发生异常", GetType());
                return(null);
            }
        }