コード例 #1
0
ファイル: Storage.cs プロジェクト: vuongthai91/ERP-CMR-DMS
        /// <summary>
        /// Create storage for qty types that don't exist and return specified qty type
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="M_Locator_ID"></param>
        /// <param name="M_Product_ID"></param>
        /// <param name="M_AttributeSetInstance_ID"></param>
        /// <param name="trx"></param>
        /// <returns></returns>
        public static Storage.Record GetCreateRecord(Ctx ctx, int M_Locator_ID,
                                                     int M_Product_ID, int M_AttributeSetInstance_ID, Trx trx)
        {
            List <MStorage> details = new List <MStorage>();

            // create storage for all qty types
            foreach (var qtyType in X_Ref_Quantity_Type.Get())
            {
                MStorage detail = MStorage.GetCreate(ctx, M_Locator_ID, M_Product_ID,
                                                     M_AttributeSetInstance_ID, trx);//M_AttributeSetInstance_ID, qtyType, trx);
                detail.Save(trx);
                details.Add(detail);
            }
            return(new Storage.Record(details));
        }
コード例 #2
0
        /*  public static Map<X_Ref_Quantity_Type, MStorageDetail> getAllForUpdate(
         *      Ctx ctx, int M_Locator_ID, int M_Product_ID,
         *      int M_AttributeSetInstance_ID,
         *      Set<X_Ref_Quantity_Type> updateQtyTypes, Trx trx) {
         *      Map<X_Ref_Quantity_Type, MStorageDetail> storageDetails = new HashMap<X_Ref_Quantity_Type, MStorageDetail>();
         *      for (X_Ref_Quantity_Type qtyType : X_Ref_Quantity_Type.values()) {
         *              MStorageDetail store = MStorageDetail.Get(ctx, M_Locator_ID,
         *                              M_Product_ID, M_AttributeSetInstance_ID, qtyType,
         *                              (updateQtyTypes == null ? false : updateQtyTypes
         *                                              .contains(qtyType)), trx);
         *              storageDetails.put(qtyType, store);
         *      }
         *      return storageDetails;
         * }*/
        public static Dictionary <String, MStorageDetail> GetAllForUpdate(Ctx ctx, int M_Locator_ID, int M_Product_ID,
                                                                          int M_AttributeSetInstance_ID, List <String> updateQtyTypes, Trx trx)
        {
            Dictionary <String, MStorageDetail> storageDetails = new Dictionary <String, MStorageDetail>();
            //Array qtyType = Enum.GetValues(typeof(X_Ref_Quantity_Type.X_Ref_Quantity_TypeEnum));
            Array qtyType = X_Ref_Quantity_Type.Get().ToArray();

            for (int i = 0; i < qtyType.Length; i++)
            {
                MStorageDetail store = MStorageDetail.Get(ctx, M_Locator_ID,
                                                          M_Product_ID, M_AttributeSetInstance_ID, qtyType.GetValue(i).ToString(),
                                                          (updateQtyTypes == null ? false : updateQtyTypes.Contains(qtyType.GetValue(i).ToString())), trx);
                //storageDetails.put(qtyType, store);
                storageDetails[qtyType.GetValue(i).ToString()] = store;
            }
            return(storageDetails);
        }
コード例 #3
0
ファイル: Storage.cs プロジェクト: vuongthai91/ERP-CMR-DMS
        /// <summary>
        /// Create storage for qty types that don't exist and return specified qty type
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="M_Locator_ID"></param>
        /// <param name="M_Product_ID"></param>
        /// <param name="M_AttributeSetInstance_ID"></param>
        /// <param name="qtyTypeToGet"></param>
        /// <param name="trx"></param>
        /// <returns></returns>
        public static MStorage GetCreateDetails(Ctx ctx, int M_Locator_ID,
                                                int M_Product_ID, int M_AttributeSetInstance_ID, String qtyTypeToGet, Trx trx)
        {
            MStorage detailToGet = null;

            // create storage for all qty types
            foreach (var qtyType in X_Ref_Quantity_Type.Get())
            {
                MStorage detail = MStorage.GetCreate(ctx, M_Locator_ID, M_Product_ID,
                                                     M_AttributeSetInstance_ID, trx);// M_AttributeSetInstance_ID, qtyType, trx);
                detail.Save(trx);
                if (qtyType == qtyTypeToGet)
                {
                    detailToGet = detail;
                }
            }
            return(detailToGet);
        }
コード例 #4
0
        public static String GetEnum(String value)
        {
            foreach (var v in X_Ref_Quantity_Type.Get())
            {
                if (v.ToString().Equals(value))
                {
                    return(v);
                }
            }
            return(null);

            /*
             * Array values = Enum.GetValues(typeof(X_Ref_Quantity_Type));
             * for (int i = 0; i < values.Length; i++)
             * {
             *  if (values.GetValue(i).ToString() == test)
             *  {
             *      return X_Ref_Quantity_TypeEnum;
             *  }
             * }
             * return null;
             */
        }
コード例 #5
0
        public static Boolean IsValid(String test)
        {
            foreach (var v in X_Ref_Quantity_Type.Get())
            {
                if (v.ToString().Equals(test))
                {
                    return(true);
                }
            }
            return(false);

            /*
             * Array values = Enum.GetValues(typeof(X_Ref_Quantity_Type));
             * for (int i = 0; i < values.Length; i++)
             * {
             *  if (values.GetValue(i).ToString() == test)
             *  {
             *      return true;
             *  }
             * }
             * return false;
             */
        }