Пример #1
0
        /// <summary>
        /// Add new for case : Convert CPO to new PO
        /// </summary>
        /// <param name="pobjMasterVO"></param>
        /// <param name="pdstDetail"></param>
        /// <param name="pdstDelivery"></param>
        ///<author>TuanDM</author>

        public void UpdatePOAndDelScheduleImmediate(object pobjMasterVO, System.Data.DataSet pdstDetail, DataSet pdstDelivery, ArrayList parlCPOIDs)
        {
            //Add Master and Get returning ID
            PO_PurchaseOrderMasterDS dsPOMaster = new PO_PurchaseOrderMasterDS();

            dsPOMaster.Update(pobjMasterVO);
            var voMaster = (PO_PurchaseOrderMasterVO)pobjMasterVO;

            //Update detail
            DataSet dstPODetail = pdstDetail.Copy();
            PO_PurchaseOrderDetailDS dsPODetail = new PO_PurchaseOrderDetailDS();

            foreach (DataRow drowDetail in pdstDetail.Tables[0].Rows)
            {
                if (drowDetail.RowState == DataRowState.Added)
                {
                    drowDetail[PO_PurchaseOrderDetailTable.PURCHASEORDERMASTERID_FLD] = ((PO_PurchaseOrderMasterVO)pobjMasterVO).PurchaseOrderMasterID;
                }
            }
            dsPODetail.UpdateDataSet(pdstDetail);

            //Get PODetail DataSet which includes PURCHASEORDERDETAILID_FLD
            pdstDetail = dsPODetail.ListToGetID(((PO_PurchaseOrderMasterVO)pobjMasterVO).PurchaseOrderMasterID);

            //Create DeliverySchedule -- and add DeliverySchedule
            int intPOLineID = 0;
            PO_DeliveryScheduleDS dsDelivery = new PO_DeliveryScheduleDS();

            for (int i = 0; i < dstPODetail.Tables[0].Rows.Count; i++)
            {
                DataRow[] drowSameDelivery = pdstDelivery.Tables[0].Select(ITM_ProductTable.PRODUCTID_FLD + "='" + dstPODetail.Tables[0].Rows[i][ITM_ProductTable.PRODUCTID_FLD].ToString() + "'");

                intPOLineID = (int)pdstDetail.Tables[0].Select(PO_PurchaseOrderDetailTable.LINE_FLD + "='" + dstPODetail.Tables[0].Rows[i][PO_PurchaseOrderDetailTable.LINE_FLD].ToString() + "'")[0][PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD];
                DataSet dstNewDelPO  = dsDelivery.GetDeliverySchedule(intPOLineID);
                int     intbaseCount = dstNewDelPO.Tables[0].Rows.Count;
                for (int j = 0; j < drowSameDelivery.Length; j++)
                {
                    int k = GetIndexForDeliveryLine(dstNewDelPO, (DateTime)drowSameDelivery[j][PO_DeliveryScheduleTable.SCHEDULEDATE_FLD]);
                    if (k > -1)
                    {
                        dstNewDelPO.Tables[0].Rows[k][PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD] = (decimal)dstNewDelPO.Tables[0].Rows[k][PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD] + (decimal)drowSameDelivery[j][PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD];
                    }
                    else
                    {
                        drowSameDelivery[j][PO_DeliveryScheduleTable.PURCHASEORDERDETAILID_FLD] = intPOLineID;
                        drowSameDelivery[j][PO_DeliveryScheduleTable.DELIVERYLINE_FLD]          = j + 1 + intbaseCount;
                        dstNewDelPO.Tables[0].ImportRow(drowSameDelivery[j]);
                    }
                }
                dsDelivery.UpdateDataSet(dstNewDelPO);
            }

            //Update CPODetail
            MTR_CPODS dsCPO = new MTR_CPODS();

            dsCPO.SetPOMasterID(parlCPOIDs, ((PO_PurchaseOrderMasterVO)pobjMasterVO).PurchaseOrderMasterID);
        }
Пример #2
0
        //**************************************************************************
        ///    <Description>
        ///       Update Delivery Schedule - DataSet
        ///    </Description>
        ///    <Inputs>
        ///
        ///    </Inputs>
        ///    <Outputs>
        ///       DataSet
        ///    </Outputs>
        ///    <Returns>
        ///       DataSet
        ///    </Returns>
        ///    <Authors>
        ///       THIENHD
        ///    </Authors>
        ///    <History>
        ///       March, 9 2005
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************

        public void UpdateDeliveryDataSet(DataSet pdstDeliverySchedule, int pintPurchaseOrderDetailID)
        {
            PO_DeliveryScheduleDS objPO_DeliveryScheduleDS = new PO_DeliveryScheduleDS();

            objPO_DeliveryScheduleDS.UpdateDataSet(pdstDeliverySchedule);
        }
Пример #3
0
        public void UpdateScheduleForImport(DataSet pdstData)
        {
            PO_DeliveryScheduleDS dsDelivery = new PO_DeliveryScheduleDS();

            dsDelivery.UpdateDataSet(pdstData);
        }
Пример #4
0
        /// <summary>
        /// Add new for case : Convert CPO to new PO
        /// </summary>
        /// <param name="pobjMasterVO"></param>
        /// <param name="pdstDetail"></param>
        /// <param name="pdstDelivery"></param>
        ///<author>TuanDM</author>

        public int AddPOAndDelScheduleImmediate(object pobjMasterVO, System.Data.DataSet pdstDetail, DataSet pdstDelivery, ArrayList parlCPOIDs)
        {
            //Add Master and Get returning ID
            PO_PurchaseOrderMasterDS dsPOMaster = new PO_PurchaseOrderMasterDS();
            int intMasterID = dsPOMaster.AddAndReturnID(pobjMasterVO);

            //Add detail
            foreach (DataRow drowDetail in pdstDetail.Tables[0].Rows)
            {
                drowDetail[PO_PurchaseOrderDetailTable.PURCHASEORDERMASTERID_FLD] = intMasterID;
            }
            PO_PurchaseOrderDetailDS dsPODetail = new PO_PurchaseOrderDetailDS();

            dsPODetail.UpdateDataSet(pdstDetail);

            //Get PODetail DataSet which includes PURCHASEORDERDETAILID_FLD
            pdstDetail = dsPODetail.ListToGetID(intMasterID);

            //Create DeliverySchedule -- and add DeliverySchedule
            int intPOLineID = 0;
            int i           = 0;
            PO_DeliveryScheduleDS dsDelivery = new PO_DeliveryScheduleDS();

            while (i++ < pdstDetail.Tables[0].Rows.Count)
            {
                DataSet dstNewDelPO = pdstDelivery.Clone();

                DataRow[] drowSameDelivery = pdstDelivery.Tables[0].Select(ITM_ProductTable.PRODUCTID_FLD + "='" + pdstDetail.Tables[0].Rows[i - 1][ITM_ProductTable.PRODUCTID_FLD].ToString() + "'");

                intPOLineID = (int)pdstDetail.Tables[0].Rows[i - 1][PO_DeliveryScheduleTable.PURCHASEORDERDETAILID_FLD];
                foreach (DataRow t in drowSameDelivery)
                {
                    int k = GetIndexForDeliveryLine(dstNewDelPO, (DateTime)t[PO_DeliveryScheduleTable.SCHEDULEDATE_FLD]);
                    if (k > -1)
                    {
                        dstNewDelPO.Tables[0].Rows[k][PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD] = (decimal)dstNewDelPO.Tables[0].Rows[k][PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD] + (decimal)t[PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD];
                        t[PO_DeliveryScheduleTable.PURCHASEORDERDETAILID_FLD] = intPOLineID;
                    }
                    else
                    {
                        t[PO_DeliveryScheduleTable.PURCHASEORDERDETAILID_FLD] = intPOLineID;
                        t[PO_DeliveryScheduleTable.DELIVERYLINE_FLD]          = dstNewDelPO.Tables[0].Rows.Count + 1;
                        dstNewDelPO.Tables[0].ImportRow(t);
                    }
                }
                dsDelivery.UpdateDataSet(dstNewDelPO);
            }
            //Update CPODetail
            MTR_CPODS dsCPO = new MTR_CPODS();

            if (parlCPOIDs.Count > 0)
            {
                if (Convert.ToInt32(parlCPOIDs[0]) > 0)
                {
                    dsCPO.SetPOMasterID(parlCPOIDs, intMasterID);
                }
                else
                {
                    dsCPO.SetPOMasterIDForDCPDetail(parlCPOIDs, intMasterID);
                }
            }

            return(intMasterID);
        }