Esempio n. 1
0
        }       //	prepare

        /// <summary>
        /// Perrform Process.
        /// </summary>
        /// <returns>Message </returns>
        protected override String DoIt()
        {
            log.Info("M_Warehouse_ID=" + _M_Warehouse_ID
                     + ", C_BPartner_ID=" + _C_BPartner_ID
                     + " - ReplenishmentCreate=" + _ReplenishmentCreate
                     + ", C_DocType_ID=" + _C_DocType_ID);
            if (_ReplenishmentCreate != null && _C_DocType_ID == 0 || _C_DocType_ID == -1)
            {
                throw new Exception("@FillMandatory@ @C_DocType_ID@");
            }


            MWarehouse wh = MWarehouse.Get(GetCtx(), _M_Warehouse_ID);

            if (wh.Get_ID() == 0)
            {
                throw new Exception("@FillMandatory@ @M_Warehouse_ID@");
            }
            if (wh.GetM_WarehouseSource_ID() > 0)
            {
                _M_WareSource = "M_WarehouseSource_ID = " + Util.GetValueOfString(wh.GetM_WarehouseSource_ID());
            }
            else
            {
                _M_WareSource = null;
            }
            //
            PrepareTable();
            FillTable(wh);
            //
            if (_ReplenishmentCreate == null)
            {
                return("OK");
            }
            //
            MDocType dt = MDocType.Get(GetCtx(), _C_DocType_ID);

            if (!dt.GetDocBaseType().Equals(_ReplenishmentCreate))
            {
                throw new Exception("@C_DocType_ID@=" + dt.GetName() + " <> " + _ReplenishmentCreate);
            }
            //

            if (_ReplenishmentCreate.Equals("POO"))
            {
                CreatePO();
            }
            else if (_ReplenishmentCreate.Equals("POR"))
            {
                CreateRequisition();
            }
            else if (_ReplenishmentCreate.Equals("MMM"))
            {
                CreateMovements();
            }
            return(_info);
        }       //	doIt