コード例 #1
0
 /**
  *  Parent Constructor
  *	@param parent parent
  *	@param M_AttributeSetInstance_ID asi
  *	@param MovementQty qty
  */
 public MInOutLineMA(MInOutLine parent, int M_AttributeSetInstance_ID, Decimal MovementQty)
     : this(parent.GetCtx(), 0, parent.Get_TrxName())
 {
     SetClientOrg(parent);
     SetM_InOutLine_ID(parent.GetM_InOutLine_ID());
     //
     SetM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
     SetMovementQty(MovementQty);
 }
コード例 #2
0
 /// <summary>
 /// Shipment Line Constructor
 /// </summary>
 /// <param name="sLine">shipment line</param>
 /// <param name="dateTrx">optional date</param>
 /// <param name="qty">matched quantity</param>
 public MMatchPO(MInOutLine sLine, DateTime?dateTrx, Decimal qty)
     : this(sLine.GetCtx(), 0, sLine.Get_Trx())
 {
     SetClientOrg(sLine);
     SetM_InOutLine_ID(sLine.GetM_InOutLine_ID());
     SetC_OrderLine_ID(sLine.GetC_OrderLine_ID());
     if (dateTrx != null)
     {
         SetDateTrx(dateTrx);
     }
     SetM_Product_ID(sLine.GetM_Product_ID());
     SetM_AttributeSetInstance_ID(sLine.GetM_AttributeSetInstance_ID());
     SetQty(qty);
     SetProcessed(true);         //	auto
 }
コード例 #3
0
        /**
         *  Find/Create PO(Inv) Match
         *	@param iLine invoice line
         *	@param sLine receipt line
         *	@param dateTrx date
         *	@param qty qty
         *	@return Match Record
         */
        public static MMatchPO Create(MInvoiceLine iLine, MInOutLine sLine, DateTime?dateTrx, Decimal qty)
        {
            Trx trxName        = null;
            Ctx ctx            = null;
            int C_OrderLine_ID = 0;

            if (iLine != null)
            {
                trxName        = iLine.Get_Trx();
                ctx            = iLine.GetCtx();
                C_OrderLine_ID = iLine.GetC_OrderLine_ID();
            }
            if (sLine != null)
            {
                trxName        = sLine.Get_Trx();
                ctx            = sLine.GetCtx();
                C_OrderLine_ID = sLine.GetC_OrderLine_ID();
            }

            MMatchPO retValue = null;
            String   sql      = "SELECT * FROM M_MatchPO WHERE C_OrderLine_ID=" + C_OrderLine_ID;
            //		ArrayList list = new ArrayList();
            DataSet ds = null;

            try
            {
                ds = DB.ExecuteDataset(sql, null, trxName);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    MMatchPO mpo = new MMatchPO(ctx, dr, trxName);
                    if (qty.CompareTo(mpo.GetQty()) == 0)
                    {
                        if (iLine != null)
                        {
                            if (mpo.GetC_InvoiceLine_ID() == 0 ||
                                mpo.GetC_InvoiceLine_ID() == iLine.GetC_InvoiceLine_ID())
                            {
                                mpo.SetC_InvoiceLine_ID(iLine);
                                if (iLine.GetM_AttributeSetInstance_ID() != 0)
                                {
                                    if (mpo.GetM_AttributeSetInstance_ID() == 0)
                                    {
                                        mpo.SetM_AttributeSetInstance_ID(iLine.GetM_AttributeSetInstance_ID());
                                    }
                                    else if (mpo.GetM_AttributeSetInstance_ID() != iLine.GetM_AttributeSetInstance_ID())
                                    {
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                        if (sLine != null)
                        {
                            if (mpo.GetM_InOutLine_ID() == 0 ||
                                mpo.GetM_InOutLine_ID() == sLine.GetM_InOutLine_ID())
                            {
                                mpo.SetM_InOutLine_ID(sLine.GetM_InOutLine_ID());
                                if (sLine.GetM_AttributeSetInstance_ID() != 0)
                                {
                                    if (mpo.GetM_AttributeSetInstance_ID() == 0)
                                    {
                                        mpo.SetM_AttributeSetInstance_ID(sLine.GetM_AttributeSetInstance_ID());
                                    }
                                    else if (mpo.GetM_AttributeSetInstance_ID() != sLine.GetM_AttributeSetInstance_ID())
                                    {
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                        retValue = mpo;
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                s_log.Log(Level.SEVERE, sql, e);
            }
            //	Create New
            if (retValue == null)
            {
                if (sLine != null)
                {
                    retValue = new MMatchPO(sLine, dateTrx, qty);
                    if (iLine != null)
                    {
                        retValue.SetC_InvoiceLine_ID(iLine);
                    }
                }
                else if (iLine != null)
                {
                    retValue = new MMatchPO(iLine, dateTrx, qty);
                }
            }
            return(retValue);
        }