Beispiel #1
0
    protected int QueryPurchaseGift()
    {
        MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(txtPURCHASE_NO.Text.Trim());

        DataTable dt = BCO.QueryGiftByPURCHASE(ParameterList);

        DataTable dtNew = ConvetGV2_DT(dt);

        Session[PageTimeStamp.Value + GridView2.ID] = dtNew;

        BindData(GridView2);

        //iResult 0:查無資料 1:有資料但全部結案 2:有資料(可能包含部分結案)
        int iResult = 2;
        if (dt.Rows.Count == 0)
            iResult = 0;
        else if (dtNew.Rows.Count == 0)
            iResult = 1;

        return iResult;
    }
Beispiel #2
0
    //檢查採購單是否有被其他未結案的在途單使用中
    private bool CheckUsePurchase()
    {
        bool bResult = false;

        MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(txtPURCHASE_NO.Text.Trim());

        DataTable dt = BCO.CheckUsePURCHASE(ParameterList);

        if (dt.Rows.Count > 0)
            bResult = true;

        return bResult;
    }
Beispiel #3
0
    //讀取在途單資料
    private void LoadOnWayData(bool bNoShowMSG)
    {
        MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(ViewState["ONWAY_NO"].ToString().Trim());

        DataTable dt = BCO.QueryMain(ParameterList);

        ErrorMsgLabel.Text = "";
        if (bNoShowMSG == false)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["MSG"]))
            {
                if (Request.QueryString["MSG"].ToString() == "SAVE")
                {
                    ErrorMsgLabel.Text = "儲存完成<BR />";
                }
                if (Request.QueryString["MSG"].ToString() == "CLOSE")
                {
                    ErrorMsgLabel.Text = "結案完成<BR />";
                }
            }
        }

        if (dt.Rows.Count > 0)
        {
            txtONWAY_NO.Text = dt.Rows[0]["ONWAY_NO"].ToString().Trim();
            txtONWAY_DATE.Text = dt.Rows[0]["ONWAY_DATE"].ToString().Trim();
            txtUPDATEDATE.Text = dt.Rows[0]["UPDATEDATE"].ToString().Trim().Substring(0, 10);
            hdfOLD_UPDATEDATE.Value = dt.Rows[0]["UPDATEDATE"].ToString().Trim();
            txtPURCHASE_NO.Text = dt.Rows[0]["PURCHASE_NO"].ToString().Trim();
            SLP_VendorBase1.Text = dt.Rows[0]["Vendor"].ToString().Trim();
            SLP_UPDATEUID.Text = dt.Rows[0]["UPDATEUID"].ToString().Trim();

            if (dt.Rows[0]["STATUS"].ToString().Trim() == "75")
                txtStatus.Text = "已結案";
            else
                txtStatus.Text = "未結案";

            int iItems = QueryOnWayDetail(ViewState["ONWAY_NO"].ToString().Trim());
            int iGifts = QueryOnWayGift(ViewState["ONWAY_NO"].ToString().Trim());

            //檢查日結           
            //CheckVendorAccountClose BCO_CHECK = new CheckVendorAccountClose(ConntionDB);
            //if (BCO_CHECK.CheckVendorCloseStaus(DateTime.Now.ToString("yyyyMMdd")) == "1")
            //{
            //    btnDel.Visible = false;
            //    btnEdit.Visible = false;
            //    btnClose.Visible = false;
            //    ErrorMsgLabel.Text += "在途日 " + DateTime.Now.ToString("yyyyMMdd") + " 已日結,不可新增在途單。<BR>";

            //}
            if ((iItems == 1) || (iGifts == 1))
            {
                btnDel.Visible = false;
                //btnEdit.Visible = false;
                //btnClose.Visible = false;             
                if (ViewState["Mode"].ToString() == "View")
                    ErrorMsgLabel.Text += "”明細已有結案”不可刪除。<BR>";
            }
            if (txtStatus.Text == "已結案")
            {
                btnDel.Visible = false;
                btnEdit.Visible = false;
                btnClose.Visible = false;
                ErrorMsgLabel.Text = "在途單已結案不能再修改及刪除。<BR>";
            }
            GV_Visible(true);
        }
        else
        {
            txtONWAY_NO.Text = ViewState["ONWAY_NO"].ToString().Trim();
            txtONWAY_DATE.Text = "";
            txtUPDATEDATE.Text = "";
            txtPURCHASE_NO.Text = "";
            SLP_VendorBase1.Text = "";
            SLP_UPDATEUID.Text = "";
            txtStatus.Text = "";
            btnDel.Visible = false;
            btnEdit.Visible = false;
            btnClose.Visible = false;
            btnPrint.Visible = false;
            GV_Visible(false);
            ErrorMsgLabel.Text = "此筆資料已被其他使用者刪除,請點選上一筆/下一筆鈕繼續查詢";
        }

    }
Beispiel #4
0
    protected int QueryOnWayDetail(string strONWAY_NO)
    {
        MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(strONWAY_NO);

        DataTable dt = BCO.QueryItem(ParameterList);

        DataTable dtNew = ConvetGV1_DT(dt);

        Session[PageTimeStamp.Value + GridView1.ID] = dtNew;

        BindData(GridView1);

        //iResult 0:查無資料 1:有資料(有包含結案資料) 2:有資料(無結案過資料)
        int iResult = 2;
        if (dtNew.Rows.Count == 0)
        {
            iResult = 0;
        }
        else
        {
            for (int i = 0; i < dtNew.Rows.Count; i++)
            {
                if (dtNew.Rows[i]["CLOSE_TYPE"].ToString() != "")
                {
                    iResult = 1;
                    break;
                }
            }
        }

        return iResult;

    }
Beispiel #5
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        MaintainPurchaseOrder bcop = new MaintainPurchaseOrder(ConntionDB);
        bool IsAcceptOK = bcop.CheckPurchaseIsACCEPT(this.txtPURCHASE_NO.Text);
        if (IsAcceptOK)
        {

            ErrorMsgLabel.Text = "該筆已有驗收單資料,不可進行刪除!!";
            return;
        }
        else
        {

            //CheckVendorAccountClose BCO_CHECK = new CheckVendorAccountClose(ConntionDB);
            //if (BCO_CHECK.CheckVendorCloseStaus(txtONWAY_DATE.Text.Replace("/", "")) == "1")
            //{
            //    ErrorMsgLabel.Text = "在途日 " + txtONWAY_DATE.Text.Replace("/", "") + " 已日結,不可刪除在途單。";
            //    return;
            //}
            //else
            //{
            try
            {

                DataTable dt1 = (DataTable)Session[PageTimeStamp.Value + GridView1.ID];
                DataTable dt2 = (DataTable)Session[PageTimeStamp.Value + GridView2.ID];

                string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

                bool bResult = false;

                //0.Item DataTable
                //1.Gift DataTable        
                //2.ONWAY_NO                        
                //3.UPDATEDATE
                //4.UPDATEUID            
                //5.OLD_UPDATEDATE
                //6.OLD_UPDATEUID            
                ParameterList.Clear();
                ParameterList.Add(dt1);                         //0
                ParameterList.Add(dt2);                         //1            
                ParameterList.Add(txtONWAY_NO.Text);            //2
                ParameterList.Add(strNowDate);                  //3
                ParameterList.Add(Session["UID"].ToString());   //4
                ParameterList.Add(hdfOLD_UPDATEDATE.Value);     //5
                ParameterList.Add(SLP_UPDATEUID.Text);          //6

                bResult = BCO.DeleteGoodsInTransit(ParameterList);

                Response.Redirect("PUR051.aspx?Code=PUR05", false);
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }
            finally { }

            //}
        }
    }
Beispiel #6
0
    protected void btnClose_Click(object sender, EventArgs e)
    {
        try
        {

            DataTable dt1 = (DataTable)Session[PageTimeStamp.Value + GridView1.ID];
            DataTable dt2 = (DataTable)Session[PageTimeStamp.Value + GridView2.ID];

            if ((dt1.Rows.Count == 0) && (dt2.Rows.Count == 0))
            {
                ErrorMsgLabel.Text = "無明細資料可供結案。";
            }
            else if (ViewState["Mode"].ToString().Trim() == "View")
            {

                string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string strONWAY_NO = txtONWAY_NO.Text;
                MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

                //0.Item DataTable
                //1.Gift DataTable       
                //2.ONWAY_NO
                //3.ONWAY_DATE               
                //4.UPDATEDATE
                //5.UPDATEUID
                //6.STATUS   
                //7.OLD_UPDATEDATE
                //8.OLD_UPDATEUID

                ParameterList.Clear();
                ParameterList.Add(dt1);                       //0
                ParameterList.Add(dt2);                       //1       
                ParameterList.Add(strONWAY_NO);               //2
                ParameterList.Add(strNowDate);                //3
                ParameterList.Add(strNowDate);                //4
                ParameterList.Add(Session["UID"].ToString()); //5
                ParameterList.Add("75");                      //6
                ParameterList.Add(hdfOLD_UPDATEDATE.Value);   //7             
                ParameterList.Add(SLP_UPDATEUID.Text.Trim()); //8                

                bool bResult = BCO.CloseGoodsInTransit(ParameterList);

                Reload_Page("View", "CLOSE", strONWAY_NO);
            }
            else
            {
                ErrorMsgLabel.Text = "結案狀態錯誤,無法結案!";
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Beispiel #7
0
    private void RunReport(ReportType RType)
    {
        try
        {
            ErrorMsgLabel.Text = "";
            #region 取得資料
            MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);
            DataTable dt = new DataTable();

            ParameterList.Clear();
            ParameterList.Add(ViewState["ONWAY_NO"].ToString());
            dt = BCO.PrintGoodsInTransit(ParameterList);

            if (dt.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "查無資料";
                return;
            }
            else
            {
                #region 匯出報表
                ExportReport(dt, RType);
                #endregion
            }

            #endregion
        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }
    }
Beispiel #8
0
    private void SaveData()
    {
        try
        {

            if ((Session[PageTimeStamp.Value + GridView1.ID] == null) && (Session[PageTimeStamp.Value + GridView2.ID] == null))
            {
                ErrorMsgLabel.Text = "無明細資料可供儲存,無法存檔。";
                return;
            }

            GV1_To_Cache();
            GV2_To_Cache();

            DataTable dt1 = (DataTable)Session[PageTimeStamp.Value + GridView1.ID];
            DataTable dt2 = (DataTable)Session[PageTimeStamp.Value + GridView2.ID];

            if ((FilterDT(dt1).Rows.Count == 0) && (FilterDT(dt2).Rows.Count == 0))
            {
                ErrorMsgLabel.Text = "無明細資料可供儲存,無法存檔。";
                return;
            }

            //CheckVendorAccountClose BCO_CHECK = new CheckVendorAccountClose(ConntionDB);
            //if (BCO_CHECK.CheckVendorCloseStaus(txtONWAY_DATE.Text.Replace("/", "")) == "1")
            //{
            //    ErrorMsgLabel.Text = "在途日 " + txtONWAY_DATE.Text.Replace("/", "") + " 已日結,不可新增在途單。";
            //    return;
            //}

            string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            string strONWAY_NO = string.Empty;
            MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);
            bool bResult = false;

            switch (ViewState["Mode"].ToString().Trim())
            {
                case "Insert":
                    //0.Item DataTable
                    //1.Gift DataTable        
                    //2.VENDOR
                    //3.PURCHASE_NO
                    //4.ONWAY_DATE
                    //5.CREATEDATE
                    //6.CREATEUID
                    //7.UPDATEDATE
                    //8.UPDATEUID
                    //9.STATUS
                    //out ONWAY_NO

                    ParameterList.Clear();
                    ParameterList.Add(dt1); //0
                    ParameterList.Add(dt2); //1
                    ParameterList.Add(SLP_VendorBase1.Text.Trim()); //2
                    ParameterList.Add(txtPURCHASE_NO.Text.Trim());  //3
                    ParameterList.Add(strNowDate); //4
                    ParameterList.Add(strNowDate); //5
                    ParameterList.Add(Session["UID"].ToString()); //6
                    ParameterList.Add(strNowDate); //7
                    ParameterList.Add(Session["UID"].ToString()); //8
                    ParameterList.Add("25");  //9

                    bResult = BCO.CreateGoodsInTransit(ParameterList, out strONWAY_NO, null);
                    break;
                case "Edit":
                    //0.Item DataTable
                    //1.Gift DataTable       
                    //2.ONWAY_NO
                    //3.ONWAY_DATE               
                    //4.UPDATEDATE
                    //5.UPDATEUID
                    //6.STATUS   
                    //7.OLD_UPDATEDATE
                    //8.OLD_UPDATEUID

                    ParameterList.Clear();
                    ParameterList.Add(dt1); //0
                    ParameterList.Add(dt2); //1       
                    ParameterList.Add(txtONWAY_NO.Text); //2
                    ParameterList.Add(strNowDate);       //3
                    ParameterList.Add(strNowDate);       //4
                    ParameterList.Add(Session["UID"].ToString()); //5
                    ParameterList.Add("25");                      //6
                    ParameterList.Add(hdfOLD_UPDATEDATE.Value);   //7             
                    ParameterList.Add(SLP_UPDATEUID.Text.Trim()); //8                

                    bResult = BCO.UpdateGoodsInTransit(ParameterList);
                    strONWAY_NO = txtONWAY_NO.Text;

                    break;
            }
            //ErrorMsgLabel.Text = "儲存完成";
            //Response.Redirect("PUR052.aspx?Code=PUR05&Mode=View&MSG=SAVE&ONWAY_NO=" + strONWAY_NO, false);
            Reload_Page("View", "SAVE", strONWAY_NO);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
        ///新增驗收單
        /// *表頭參數:
        //(0)[@UserID]
        //(1)[@CreateDate]
        //(2)[@驗收日期]
        //(3)[@驗收時間]
        //(4)[@採購單號]
        //(5)[@廠商送貨單號]
        //(6)[@發票號碼]
        //(7)[@供應商]
        //(8)[@應稅總額]
        //(9)[@未稅總額]
        //(10)[@稅額]
        //*明細資料集參數:
        //(0)[@商品條碼]
        //(1)[@品號]
        //(2)[@期別]
        //(3)[@採購數量]
        //(4)[@預進日期]
        //(5)[@總驗收數]
        //(6)[@驗收數量]
        //(7)[@成本價]
        //(8)[@零售價]
        //(9)[@1包裝數]
        //(10)[@單品重量]
        //(11)[@單品長度]
        //(12)[@單品寬度]
        //(13)[@單品高度]
        //(14)[@包裝重量]
        //(15)[@包裝長度]
        //(16)[@包裝寬度]
        //(17)[@包裝高度]  
        //(18)[@商品來源]
        //(19)[@製造日期]
        //(20)[@保存期限]
        //(21)[@有效日期]
        //(22)[@允收日期]
        //*品質檢驗資料集
        //(1)[@品號]
        //(2)[@期別]
        //(3)[@檢查項目]
        //(4)[@是否正常]
        //(5)[@異常說明]
        //*贈品明細資料集參數:
        //(1)[@商品條碼]
        //(2)[@品號]
        //(3)[@期別]
        //(4)[@虛擬品號]
        //(5)[@採購數量]
        //(6)[@總驗收數]
        //(7)[@驗收數量]
        //(8)[@1包裝數]
        //(9)[@單品重量]
        //(10)[@單品長度]
        //(11)[@單品寬度]
        //(12)[@單品高度]
        //(13)[@包裝重量]
        //(14)[@包裝長度]
        //(15)[@包裝寬度]
        //(16)[@包裝高度] 
        /// <summary>
        /// 建立驗收單
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="dtDetls"></param>
        /// <param name="dtGifts"></param>
        /// <param name="RootDBT"></param>
        /// <param name="AcceptNo"></param>
        /// <param name="Statue"></param>
        /// <param name="ErrorItem"></param>
        public bool CreateAccept(ArrayList ParameterList, DataTable dtDetls, DataTable dtGifts, DbTransaction RootDBT, out string AcceptNo, out string Statue, out string ErrorItem)
        {
            bool IsRootTranscation = false;

            //檢查商品和贈品是不是都驗收了,未驗收結案才能繼續
            ErrorItem = string.Empty;
            AcceptNo = string.Empty;
            Statue = string.Empty;

            int PID = -1;

            try
            {
                string UserID = ParameterList[0].ToString();
                string UpdateDate = ParameterList[1].ToString();
                string AcceptDate = ParameterList[2].ToString();
                string AcceptTime = ParameterList[3].ToString();
                string PurchaseNo = ParameterList[4].ToString();
                string WaybillNo = ParameterList[5].ToString();
                string InvoiceNo = ParameterList[6].ToString();
                string Vender = ParameterList[7].ToString();
                string TaxAmt = ParameterList[8].ToString();
                string UtaxAmt = ParameterList[9].ToString();
                string Tax = ParameterList[10].ToString();



                DBO.MaintainAcceptDBO VGIDBO = new DBO.MaintainAcceptDBO(ref USEDB);
                DBO.MaintainAcceptQualityCheck VGIQC = new DBO.MaintainAcceptQualityCheck(strConn);
                PURDBO.MaintainGoodsInTransit PURDB = new PURDBO.MaintainGoodsInTransit(strConn);
                IVMDBO.MaintainStockInOut IVMDB = new IVMDBO.MaintainStockInOut(strConn);

                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                //新增主檔
                ArrayList InsertParameter = new ArrayList();
                InsertParameter.Clear();
                InsertParameter.Add(UserID);
                InsertParameter.Add(UpdateDate);
                InsertParameter.Add(AcceptDate);
                InsertParameter.Add(AcceptTime);
                InsertParameter.Add(PurchaseNo);
                InsertParameter.Add(WaybillNo);
                InsertParameter.Add(InvoiceNo);
                InsertParameter.Add(Vender);
                InsertParameter.Add(TaxAmt);
                InsertParameter.Add(UtaxAmt);
                InsertParameter.Add(Tax);

                VGIDBO.CreateAcceptMain(InsertParameter, DBT, out PID, out AcceptNo);

                //新增明細

                DataTable dtStockIn = new DataTable();
                dtStockIn.Columns.Add("LocateNo");
                dtStockIn.Columns.Add("LocateSec");
                dtStockIn.Columns.Add("Item");
                dtStockIn.Columns.Add("Period");
                dtStockIn.Columns.Add("In_Qty");
                dtStockIn.Columns.Add("Cost");

                //取得入庫暫存儲區、儲格
                string LocateNo = "";
                string LocateSec = "";

                LocateSec = VGIDBO.GetStockInTempLocateSec();

                if (LocateSec == string.Empty)
                {
                    throw new Exception("無法取得入庫暫存儲區或儲位");
                }
                else
                {
                    LocateNo = LocateSec.Substring(0, 1);
                }

                #region 商品明細
                //barcode
                //item
                //period
                //purchase_Qty
                //In_Date
                //TAcc_Qty
                //Acc_Qty
                //Cost
                //Price
                //Package_Unit
                //S_Weight
                //S_Length
                //S_Width
                //S_Height
                //P_Weight
                //P_Length
                //P_Width
                //P_Height
                //Product_Source
                //Produce_Date
                //Reserved_Period
                //Valid_Date
                //AllowAccept_Date
                //Old_Qty
                //RowState

                for (int i = 0; i < dtDetls.Rows.Count; i++)
                {
                    int DetlID = -1;

                    string Barcode = dtDetls.Rows[i]["barcode"].ToString();
                    string Item = dtDetls.Rows[i]["item"].ToString();
                    string Period = dtDetls.Rows[i]["period"].ToString();
                    string PurchaseQty = dtDetls.Rows[i]["purchase_Qty"].ToString();
                    string In_Date = dtDetls.Rows[i]["In_Date"].ToString();
                    string TotalAcceptQty = dtDetls.Rows[i]["TAcc_Qty"].ToString();
                    string AcceptQty = dtDetls.Rows[i]["Acc_Qty"].ToString();

                    int accept_days = -1;
                    int out_days = -1;

                    //取得入庫單明細資料
                    DataRow drStockIn = dtStockIn.NewRow();
                    drStockIn["LocateNo"] = LocateNo;
                    drStockIn["LocateSec"] = LocateSec;
                    drStockIn["Item"] = Item;
                    drStockIn["Period"] = Period;
                    drStockIn["In_Qty"] = AcceptQty;
                    drStockIn["Cost"] = dtDetls.Rows[i]["Cost"].ToString();
                    dtStockIn.Rows.Add(drStockIn);

                    //寫入明細檔資料,逐筆寫入
                    InsertParameter.Clear();
                    InsertParameter.Add(UserID);
                    InsertParameter.Add(UpdateDate);
                    InsertParameter.Add(PID);
                    InsertParameter.Add(AcceptNo);
                    InsertParameter.Add(Barcode);                                       //BarCode
                    InsertParameter.Add(Item);                                          //Item
                    InsertParameter.Add(Period);                                        //Period
                    InsertParameter.Add(AcceptQty);                                     //AcceptQty
                    InsertParameter.Add(dtDetls.Rows[i]["Cost"].ToString());            //Cost
                    InsertParameter.Add(dtDetls.Rows[i]["Price"].ToString());           //Price
                    InsertParameter.Add(dtDetls.Rows[i]["Package_Unit"].ToString());    //Package_Unit
                    InsertParameter.Add(dtDetls.Rows[i]["S_Weight"].ToString());        //S_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["S_Length"].ToString());        //S_Length
                    InsertParameter.Add(dtDetls.Rows[i]["S_Width"].ToString());         //S_Width
                    InsertParameter.Add(dtDetls.Rows[i]["S_Height"].ToString());        //S_Height
                    InsertParameter.Add(dtDetls.Rows[i]["P_Weight"].ToString());        //P_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["P_Length"].ToString());        //P_Length
                    InsertParameter.Add(dtDetls.Rows[i]["P_Width"].ToString());         //P_Width
                    InsertParameter.Add(dtDetls.Rows[i]["P_Height"].ToString());        //P_Height
                    InsertParameter.Add(dtDetls.Rows[i]["Product_Source"]);             //Product_Source
                    InsertParameter.Add(dtDetls.Rows[i]["Produce_Date"]);               //Produce_Date
                    InsertParameter.Add(dtDetls.Rows[i]["Reserved_Period"]);            //Reserved_Period
                    InsertParameter.Add(dtDetls.Rows[i]["Valid_Date"]);                 //Valid_Date
                    InsertParameter.Add(dtDetls.Rows[i]["AllowAccept_Date"]);           //AllowAccept_Date

                    VGIDBO.CreateAcceptDetl(InsertParameter, DBT, out DetlID);

                    //寫入商品檢驗結果
                    InsertParameter.Clear();
                    InsertParameter.Add(UserID);
                    InsertParameter.Add(UpdateDate);
                    InsertParameter.Add(DetlID);
                    InsertParameter.Add(AcceptNo);
                    InsertParameter.Add(Item);
                    InsertParameter.Add(Period);

                    VGIQC.CreateQualityCheck(InsertParameter, DBT);

                    //若該商品品項的[@總驗收數]+[@驗收數量]>=[採購數量],則呼叫[MaintainPurchaseOrder.ClosePurchaseOrderDetail]
                    if (int.Parse(TotalAcceptQty) + int.Parse(AcceptQty) >= int.Parse(PurchaseQty))
                    {
                        InsertParameter.Clear();
                        InsertParameter.Add(UserID);
                        InsertParameter.Add(PurchaseNo);
                        InsertParameter.Add(Item);
                        InsertParameter.Add(Period);
                        //VirtualCode = Item
                        InsertParameter.Add(Item);
                        ClosePurchaseOrderDetail(InsertParameter, DBT);
                    }

                    //依傳入的明細資料集參數,將正常品資料回寫生效中(enable=1)的商品屬性檔(VDS_ITM_PERIOD_PROFILE)的下列欄位
                    InsertParameter.Clear();
                    InsertParameter.Add(Item);
                    InsertParameter.Add(Period);
                    InsertParameter.Add(dtDetls.Rows[i]["Package_Unit"].ToString());    //Package_Unit
                    InsertParameter.Add(dtDetls.Rows[i]["S_Weight"].ToString());        //S_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["S_Length"].ToString());        //S_Length
                    InsertParameter.Add(dtDetls.Rows[i]["S_Width"].ToString());         //S_Width
                    InsertParameter.Add(dtDetls.Rows[i]["S_Height"].ToString());        //S_Height
                    InsertParameter.Add(dtDetls.Rows[i]["P_Weight"].ToString());        //P_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["P_Length"].ToString());        //P_Length
                    InsertParameter.Add(dtDetls.Rows[i]["P_Width"].ToString());         //P_Width
                    InsertParameter.Add(dtDetls.Rows[i]["P_Height"].ToString());        //P_Height
                    InsertParameter.Add(AcceptDate);
                    InsertParameter.Add(AcceptQty);
                    InsertParameter.Add(dtDetls.Rows[i]["Valid_Date"].ToString());      //Valid_Date
                    InsertParameter.Add(dtDetls.Rows[i]["AllowAccept_Date"].ToString());//AllowAccept_Date
                    UpdateItmPeriodProfile(UserID, UpdateDate, InsertParameter, DBT, out accept_days, out out_days);

                    //呼叫[MaintainGoodsInTransit.UpdateGoodsInTrainsitByGoodsReceive],傳入[@品號],[@期別],[@虛擬品號],[@採購單號],[@驗收量](若品項為正常品,則[@虛擬品號]=[@品號]),更新在途量,若未找到相對應的在途單資料,表示未開立在途單,不需更新
                    InsertParameter.Clear();
                    InsertParameter.Add(PurchaseNo);
                    InsertParameter.Add(Item);
                    InsertParameter.Add(Period);
                    InsertParameter.Add(Item);
                    InsertParameter.Add(AcceptQty);
                    PURDB.UpdateGoodsInTrainsitByGoodsReceive(InsertParameter, DBT);

                    #region 贈品明細

                    //Barcode           商品條碼
                    //Item              品號
                    //Period            期別
                    //Virtual_Code      虛擬品號
                    //purchase_Qty      採購數量
                    //TAcc_Qty          總驗收數
                    //Accept_Qty        驗收數量
                    //accept_accqty
                    //Old_Qty           驗收數量(原始
                    //Package_Unit      1包裝數
                    //S_Weight          單品重量
                    //S_Length          單品長度
                    //S_Width           單品寬度
                    //S_Height          單品高度
                    //P_Weight          包裝重量
                    //P_Length          包裝長度
                    //P_Width           包裝寬度
                    //P_Height          包裝高度
                    //RowState          包裝高度

                    //寫入贈品明細
                    for (int x = 0; x < dtGifts.Rows.Count; x++)
                    {
                        string GiftBarcode = dtGifts.Rows[x]["Barcode"].ToString();
                        string GiftItem = dtGifts.Rows[x]["Item"].ToString();
                        string GiftPeriod = dtGifts.Rows[x]["Period"].ToString();
                        string GiftVirtualCode = dtGifts.Rows[x]["Virtual_Code"].ToString();
                        string GiftTotalAcceptQty = dtGifts.Rows[x]["accept_accqty"].ToString(); //總驗收量
                        string GiftAcceptQty = dtGifts.Rows[x]["Accept_Qty"].ToString();         //驗收數量
                        string GiftAcceptQty_Old = dtGifts.Rows[x]["Old_Qty"].ToString();
                        string GiftPurchaseQty = dtGifts.Rows[x]["purchase_Qty"].ToString();     //採購數量

                        if (Barcode == GiftBarcode && Item == GiftItem && Period == GiftPeriod)
                        {
                            InsertParameter.Clear();
                            InsertParameter.Add(UserID);                                        //0
                            InsertParameter.Add(UpdateDate);                                    //1
                            InsertParameter.Add(DetlID);                                        //2
                            InsertParameter.Add(dtGifts.Rows[x][0].ToString());                 //3  Barcode
                            InsertParameter.Add(GiftItem);                                      //4  Item
                            InsertParameter.Add(GiftPeriod);                                    //5  Period
                            InsertParameter.Add(GiftVirtualCode);                               //6  VirtualCode
                            InsertParameter.Add(AcceptNo);                                      //7
                            InsertParameter.Add(dtGifts.Rows[x]["purchase_Qty"].ToString());    //8  PurchaseQty
                            InsertParameter.Add(dtGifts.Rows[x]["Accept_Qty"].ToString());      //9  AcceptQty
                            InsertParameter.Add(dtGifts.Rows[x]["Package_Unit"].ToString());    //10 PackageUnit
                            InsertParameter.Add(dtGifts.Rows[x]["S_Weight"].ToString());        //11 SWeight
                            InsertParameter.Add(dtGifts.Rows[x]["S_Length"].ToString());        //12 SLength
                            InsertParameter.Add(dtGifts.Rows[x]["S_Width"].ToString());         //13 SWidth
                            InsertParameter.Add(dtGifts.Rows[x]["S_Height"].ToString());        //14 SHeigh
                            InsertParameter.Add(dtGifts.Rows[x]["P_Weight"].ToString());        //15 PWeight
                            InsertParameter.Add(dtGifts.Rows[x]["P_Length"].ToString());        //16 PLength
                            InsertParameter.Add(dtGifts.Rows[x]["P_Width"].ToString());         //17 PWidth
                            InsertParameter.Add(dtGifts.Rows[x]["P_Height"].ToString());        //18 PHeigh

                            VGIDBO.CreateAcceptGift(InsertParameter, DBT);

                            //若該贈品品項的[@總驗收數]+[@驗收數量]>=[採購數量],則呼叫[MaintainPurchaseOrder.ClosePurchaseOrderDetail]
                            if (int.Parse(GiftTotalAcceptQty) + int.Parse(GiftAcceptQty) >= int.Parse(GiftPurchaseQty))
                            {
                                InsertParameter.Clear();
                                InsertParameter.Add(UserID);            //0
                                InsertParameter.Add(PurchaseNo);        //1
                                InsertParameter.Add(GiftItem);          //2
                                InsertParameter.Add(GiftPeriod);        //3
                                InsertParameter.Add(GiftVirtualCode);   //4

                                ClosePurchaseOrderDetail(InsertParameter, DBT);
                            }

                            //依傳入的贈品明細資料集參數,將贈品資料回寫贈品屬性檔(VDS_MKT_GIFT_PROFILE)的下列欄位
                            InsertParameter.Clear();
                            InsertParameter.Add(UserID);                                        //0
                            InsertParameter.Add(UpdateDate);                                    //1
                            InsertParameter.Add(GiftItem);                                      //2  Item
                            InsertParameter.Add(GiftPeriod);                                    //3  Period
                            InsertParameter.Add(GiftVirtualCode);                               //4  VirtualCode
                            InsertParameter.Add(dtGifts.Rows[x]["Package_Unit"].ToString());    //5  PackageUnit
                            InsertParameter.Add(dtGifts.Rows[x]["S_Weight"].ToString());        //6  SWeight
                            InsertParameter.Add(dtGifts.Rows[x]["S_Length"].ToString());        //7  SLength
                            InsertParameter.Add(dtGifts.Rows[x]["S_Width"].ToString());         //8  SWidth
                            InsertParameter.Add(dtGifts.Rows[x]["S_Height"].ToString());        //9  SHeigh
                            InsertParameter.Add(dtGifts.Rows[x]["P_Weight"].ToString());        //10 PWeight
                            InsertParameter.Add(dtGifts.Rows[x]["P_Length"].ToString());        //11 PLength
                            InsertParameter.Add(dtGifts.Rows[x]["P_Width"].ToString());         //12 PWidth
                            InsertParameter.Add(dtGifts.Rows[x]["P_Height"].ToString());        //13 PHeigh
                            InsertParameter.Add(AcceptDate);                                    //14
                            InsertParameter.Add(dtGifts.Rows[x]["Accept_Qty"].ToString());      //15
                            InsertParameter.Add(accept_days);                                   //16
                            InsertParameter.Add(out_days);                                      //17

                            //UpdateGiftProfile(UserID, UpdateDate, accept_days, out_days, InsertParameter,DBT);

                            DBO.MaintainAcceptDBO dbo = new DBO.MaintainAcceptDBO(ref USEDB);
                            dbo.UpdateMktGiftProfile(InsertParameter, DBT);

                            //呼叫[MaintainGoodsInTransit.UpdateGoodsInTrainsitByGoodsReceive],傳入[@品號],[@期別],[@虛擬品號],[@採購單號],[@驗收量](若品項為正常品,則[@虛擬品號]=[@品號]),更新在途量,若未找到相對應的在途單資料,表示未開立在途單,不需更新
                            InsertParameter.Clear();
                            InsertParameter.Add(PurchaseNo);            //0
                            InsertParameter.Add(GiftItem);              //1
                            InsertParameter.Add(GiftPeriod);            //2
                            InsertParameter.Add(GiftVirtualCode);       //3
                            InsertParameter.Add(Convert.ToString(int.Parse(GiftAcceptQty_Old) - int.Parse(GiftAcceptQty)));         //4
                            PURDB.UpdateGoodsInTrainsitByGoodsReceive(InsertParameter, DBT);
                        }


                    }

                    #endregion

                    //判斷該品項是否需產生新的期別
                    //(1)該品項的期別(period)若不為[000000]且定期出刊(select attribute from vds_itm_item where item=[@item] , attribute的值為=1表示定期出刊),則需需產生下一期別資料
                    //(2)產生新期別的步驟如下:
                    //*檢查該品項期別是否已產生下一期期別資料(select count(*) from vds_itm_period_main where item=@item and period=lpad(to_char(to_number(@period) +(select period_step from vds_itm_item where item=@item)),6,'0')),若尚未產生,則呼叫[MaintainSKUPeriod.ProcessAddNextPeriod]產生新的期別資料,傳入資料參數如[新增下一期別.doc]文件所述
                    InsertParameter.Clear();
                    InsertParameter.Add(Item);
                    InsertParameter.Add(Period);
                    string V_Next = VGIDBO.CheckNextPeriod(InsertParameter);

                    if (V_Next == "1")
                    {
                        string Msg = "";
                        string Result = "";
                        InsertParameter.Clear();
                        InsertParameter.Add(AcceptNo);
                        InsertParameter.Add(UserID);
                        InsertParameter.Add(DateTime.Now);
                        VGIDBO.AddNextPeriod(InsertParameter, DBT, out Msg, out Result);
                        if (Result != "1")
                        {
                            throw new Exception("新增下一期別發生錯誤" + Msg);
                        }
                    }
                }

                #endregion

                //建立入庫單
                //取得入庫單主檔資料 >輸入變數 0.CheckFreeze_Flag(預設1) 1.ReasonNo 2.ADJNo 3.SourceNo 4.UserID
                //(0)Flag
                //(1)出入庫原因 (InOut_Reason_No)=S1
                //(2)調整單號 (Adjust_No)=null
                //(3)來源單號 (Source_No)=[@驗收單號]
                //(4)使用者
                InsertParameter.Clear();
                InsertParameter.Add("1");
                InsertParameter.Add("S1");
                InsertParameter.Add("");
                InsertParameter.Add(AcceptNo);
                InsertParameter.Add(UserID);
                IVMDB.CreateStockIn(InsertParameter, dtStockIn, DBT);

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

                return true;

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion
            }

        }
Beispiel #10
0
        public bool UpdateAccept_2(ArrayList ParameterList, DataTable dtDetls, DataTable dtGifts, DbTransaction RootDBT, out string Statue, out string ErrorItem, out string ErrMsg)
        {
            bool IsRootTranscation = false;

            ErrorItem = string.Empty;
            Statue = string.Empty;
            ErrMsg = string.Empty;

            int ID = -1;
            int PID = -1;
            string Result = "";

            try
            {
                string UserID = ParameterList[0].ToString();
                string UpdateDate = ParameterList[1].ToString();
                string AcceptNo = ParameterList[2].ToString();
                string AcceptDate = ParameterList[3].ToString();
                string PurchaseNo = ParameterList[4].ToString();
                string WaybillNo = ParameterList[5].ToString();
                string InvoiceNo = ParameterList[6].ToString();
                string TaxAmt = ParameterList[7].ToString();
                string UtaxAmt = ParameterList[8].ToString();
                string Tax = ParameterList[9].ToString();

                DBO.MaintainAcceptDBO VGIDBO = new DBO.MaintainAcceptDBO(ref USEDB);
                DBO.MaintainAcceptQualityCheck VGIQC = new DBO.MaintainAcceptQualityCheck(strConn);
                PURDBO.MaintainGoodsInTransit PURDB = new PURDBO.MaintainGoodsInTransit(strConn);
                IVMDBO.MaintainStockInOut IVMDB = new IVMDBO.MaintainStockInOut(strConn);

                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                ArrayList InsertParameter = new ArrayList();

                #region 商品明細
                //barcode
                //item
                //period
                //purchase_Qty
                //In_Date
                //TAcc_Qty
                //Acc_Qty
                //Cost
                //Price
                //Package_Unit
                //S_Weight
                //S_Length
                //S_Width
                //S_Height
                //P_Weight
                //P_Length
                //P_Width
                //P_Height
                //Product_Source
                //Produce_Date
                //Reserved_Period
                //Valid_Date
                //AllowAccept_Date
                //Old_Qty
                //RowState

                for (int i = 0; i < dtDetls.Rows.Count; i++)
                {
                    int DetlID = -1;

                    string Barcode = dtDetls.Rows[i]["barcode"].ToString();
                    string Item = dtDetls.Rows[i]["item"].ToString();
                    string Period = dtDetls.Rows[i]["period"].ToString();
                    string In_Date = dtDetls.Rows[i]["In_Date"].ToString();
                    string PurchaseQty = dtDetls.Rows[i]["purchase_Qty"].ToString();
                    string TotalAcceptQty = dtDetls.Rows[i]["TAcc_Qty"].ToString();
                    string AcceptQty = dtDetls.Rows[i]["Acc_Qty"].ToString();
                    string OLDQty = dtDetls.Rows[i]["Old_Qty"].ToString();
                    string DFlag = dtDetls.Rows[i]["RowState"].ToString();

                    int accept_days = -1;
                    int out_days = -1;

                    //寫入明細檔資料,逐筆寫入
                    InsertParameter.Clear();
                    InsertParameter.Add(UserID);
                    InsertParameter.Add(UpdateDate);
                    InsertParameter.Add(AcceptNo);
                    InsertParameter.Add(Barcode); //BarCode
                    InsertParameter.Add(Item); //Item
                    InsertParameter.Add(Period); //Period
                    InsertParameter.Add(AcceptQty); //NewQty
                    InsertParameter.Add(dtDetls.Rows[i]["Cost"].ToString());            //Cost
                    InsertParameter.Add(dtDetls.Rows[i]["Price"].ToString());           //Price
                    InsertParameter.Add(dtDetls.Rows[i]["Package_Unit"].ToString());    //Package_Unit
                    InsertParameter.Add(dtDetls.Rows[i]["S_Weight"].ToString());        //S_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["S_Length"].ToString());        //S_Length
                    InsertParameter.Add(dtDetls.Rows[i]["S_Width"].ToString());         //S_Width
                    InsertParameter.Add(dtDetls.Rows[i]["S_Height"].ToString());        //S_Height
                    InsertParameter.Add(dtDetls.Rows[i]["P_Weight"].ToString());        //P_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["P_Length"].ToString());        //P_Length
                    InsertParameter.Add(dtDetls.Rows[i]["P_Width"].ToString());         //P_Width
                    InsertParameter.Add(dtDetls.Rows[i]["P_Height"].ToString());        //P_Height
                    InsertParameter.Add(dtDetls.Rows[i]["Product_Source"].ToString());  //Product_Source
                    InsertParameter.Add(dtDetls.Rows[i]["Produce_Date"].ToString());    //Produce_Date
                    InsertParameter.Add(dtDetls.Rows[i]["Reserved_Period"].ToString()); //Reserved_Period
                    InsertParameter.Add(dtDetls.Rows[i]["Valid_Date"].ToString());      //Valid_Date
                    InsertParameter.Add(dtDetls.Rows[i]["AllowAccept_Date"].ToString());//AllowAccept_Date
                    InsertParameter.Add(DFlag); //23.FLAG 
                    InsertParameter.Add(dtDetls.Rows[i]["UPDATEDATE"]);                 //OLD UPDATEDATE
                    InsertParameter.Add(dtDetls.Rows[i]["UPDATEUID"]);                  //OLD UPDATEUID

                    VGIDBO.UpdateAcceptDetl_2(InsertParameter, DBT, out DetlID);

                    //依傳入的明細資料集參數,將正常品資料回寫生效中(enable=1)的商品屬性檔(VDS_ITM_PERIOD_PROFILE)的下列欄位
                    InsertParameter.Clear();
                    InsertParameter.Add(Item);
                    InsertParameter.Add(Period);
                    InsertParameter.Add(dtDetls.Rows[i]["Package_Unit"].ToString());    //Package_Unit
                    InsertParameter.Add(dtDetls.Rows[i]["S_Weight"].ToString());        //S_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["S_Length"].ToString());        //S_Length
                    InsertParameter.Add(dtDetls.Rows[i]["S_Width"].ToString());         //S_Width
                    InsertParameter.Add(dtDetls.Rows[i]["S_Height"].ToString());        //S_Height
                    InsertParameter.Add(dtDetls.Rows[i]["P_Weight"].ToString());        //P_Weight
                    InsertParameter.Add(dtDetls.Rows[i]["P_Length"].ToString());        //P_Length
                    InsertParameter.Add(dtDetls.Rows[i]["P_Width"].ToString());         //P_Width
                    InsertParameter.Add(dtDetls.Rows[i]["P_Height"].ToString());        //P_Height
                    InsertParameter.Add(AcceptDate);
                    InsertParameter.Add(AcceptQty); //NewQty
                    InsertParameter.Add(dtDetls.Rows[i]["Valid_Date"].ToString());      //Valid_Date
                    InsertParameter.Add(dtDetls.Rows[i]["AllowAccept_Date"].ToString());//AllowAccept_Date
                    //23.FLAG 
                    //24 OldQty
                    UpdateItmPeriodProfile_2(UserID, UpdateDate, InsertParameter, DBT, out accept_days, out out_days);

                    #region 贈品明細

                    //Barcode           商品條碼        
                    //Item              品號               
                    //Period            期別             
                    //Virtual_Code      虛擬品號   
                    //purchase_Qty      採購數量   
                    //GiftName                  
                    //Accept_Qty        驗收數量     
                    //accept_accqty     總驗收數   
                    //Old_Qty           驗收數量(原始)
                    //SQty              剩餘數量           
                    //Package_Unit      1包裝數    
                    //S_Weight          單品重量       
                    //S_Length          單品長度       
                    //S_Width           單品寬度        
                    //S_Height          單品高度       
                    //P_Weight          包裝重量       
                    //P_Length          包裝長度       
                    //P_Width           包裝寬度        
                    //P_Height          包裝高度       
                    //UPDATEUID                 
                    //UPDATEDATE                
                    //RowState          "U";               

                    if (DFlag == "U")
                    {
                        //更新贈品明細
                        for (int x = 0; x < dtGifts.Rows.Count; x++)
                        {
                            string GiftBarcode = dtGifts.Rows[x]["Barcode"].ToString();
                            string GiftItem = dtGifts.Rows[x]["Item"].ToString();
                            string GiftPeriod = dtGifts.Rows[x]["Period"].ToString();
                            string GiftVirtualCode = dtGifts.Rows[x]["Virtual_Code"].ToString();
                            string GFlag = dtGifts.Rows[x]["RowState"].ToString();
                            string GiftTotalAcceptQty = dtGifts.Rows[x]["accept_accqty"].ToString();
                            string GiftAcceptQty = dtGifts.Rows[x]["Accept_Qty"].ToString();
                            string GiftAcceptQty_Old = dtGifts.Rows[x]["Old_Qty"].ToString();
                            string GiftPurchaseQty = dtGifts.Rows[x]["purchase_Qty"].ToString();

                            if (Barcode == GiftBarcode && Item == GiftItem && Period == GiftPeriod)
                            {
                                InsertParameter.Clear();
                                InsertParameter.Add(UserID);                                    //0
                                InsertParameter.Add(UpdateDate);                                //1
                                InsertParameter.Add(DetlID);                                    //2
                                InsertParameter.Add(dtGifts.Rows[x]["Barcode"].ToString());     //3  Barcode
                                InsertParameter.Add(GiftItem);                                  //4  Item
                                InsertParameter.Add(GiftPeriod);                                //5  Period
                                InsertParameter.Add(GiftVirtualCode);                           //6  VirtualCode
                                InsertParameter.Add(AcceptNo);                                  //7
                                InsertParameter.Add(dtGifts.Rows[x]["purchase_Qty"].ToString());//8  PurchaseQty
                                InsertParameter.Add(dtGifts.Rows[x]["Accept_Qty"].ToString());  //9  AcceptQty
                                InsertParameter.Add(dtGifts.Rows[x]["Package_Unit"].ToString());//10 PackageUnit
                                InsertParameter.Add(dtGifts.Rows[x]["S_Weight"].ToString());    //11 SWeight
                                InsertParameter.Add(dtGifts.Rows[x]["S_Length"].ToString());    //12 SLength
                                InsertParameter.Add(dtGifts.Rows[x]["S_Width"].ToString());     //13 SWidth
                                InsertParameter.Add(dtGifts.Rows[x]["S_Height"].ToString());    //14 SHeigh
                                InsertParameter.Add(dtGifts.Rows[x]["P_Weight"].ToString());    //15 PWeight
                                InsertParameter.Add(dtGifts.Rows[x]["P_Length"].ToString());    //16 PLength
                                InsertParameter.Add(dtGifts.Rows[x]["P_Width"].ToString());     //17 PWidth
                                InsertParameter.Add(dtGifts.Rows[x]["P_Height"].ToString());    //18 PHeigh
                                InsertParameter.Add(dtGifts.Rows[x]["RowState"].ToString());    //19 RowState
                                InsertParameter.Add(dtGifts.Rows[x]["UPDATEDATE"]);             //20 OLD UPDATEDATE
                                InsertParameter.Add(dtGifts.Rows[x]["UPDATEUID"]);              //21 OLD UPDATEUID

                                VGIDBO.UpdateAcceptGift_2(InsertParameter, DBT);

                                if (GFlag == "U")
                                {
                                    //依傳入的贈品明細資料集參數,將贈品資料回寫贈品屬性檔(VDS_MKT_GIFT_PROFILE)的下列欄位
                                    InsertParameter.Clear();
                                    InsertParameter.Add(UserID);                                    //0
                                    InsertParameter.Add(UpdateDate);                                //1
                                    InsertParameter.Add(GiftItem);                                  //2  Item
                                    InsertParameter.Add(GiftPeriod);                                //3  Period
                                    InsertParameter.Add(GiftVirtualCode);                           //4  VirtualCode
                                    InsertParameter.Add(dtGifts.Rows[x]["Package_Unit"].ToString());//5  PackageUnit
                                    InsertParameter.Add(dtGifts.Rows[x]["S_Weight"].ToString());    //6  SWeight
                                    InsertParameter.Add(dtGifts.Rows[x]["S_Length"].ToString());    //7  SLength
                                    InsertParameter.Add(dtGifts.Rows[x]["S_Width"].ToString());     //8  SWidth
                                    InsertParameter.Add(dtGifts.Rows[x]["S_Height"].ToString());    //9  SHeigh
                                    InsertParameter.Add(dtGifts.Rows[x]["P_Weight"].ToString());    //10 PWeight
                                    InsertParameter.Add(dtGifts.Rows[x]["P_Length"].ToString());    //11 PLength
                                    InsertParameter.Add(dtGifts.Rows[x]["P_Width"].ToString());     //12 PWidth
                                    InsertParameter.Add(dtGifts.Rows[x]["P_Height"].ToString());    //13 PHeigh
                                    InsertParameter.Add(AcceptDate);                                //14
                                    InsertParameter.Add(dtGifts.Rows[x]["Accept_Qty"].ToString());  //15 accept_qty
                                    InsertParameter.Add(accept_days);                               //16
                                    InsertParameter.Add(out_days);                                  //17

                                    DBO.MaintainAcceptDBO dbo = new DBO.MaintainAcceptDBO(ref USEDB);
                                    dbo.UpdateMktGiftProfile_2(InsertParameter, DBT);
                                }
                            }
                        }
                    }

                    #endregion
                }

                #endregion

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

                return true;

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion
            }
        }
Beispiel #11
0
    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB);

        ParameterList.Clear();
        //0
        if (chkLike.Checked == true)
            ParameterList.Add("%" + txtONWAY_NO.Text.Trim() + "%");
        else
            ParameterList.Add(txtONWAY_NO.Text.Trim());
        //1
        if (chkLike.Checked == true)
            ParameterList.Add("%" + txtPURCHASE_NO.Text.Trim() + "%");
        else
            ParameterList.Add(txtPURCHASE_NO.Text.Trim());

        ParameterList.Add(EmptyPara(SLP_SLPDateRange1.StartDate.Trim(), SLP_SLPDateRange1.EndDate.Trim()));  //2
        ParameterList.Add(EmptyPara(SLP_SLPDateRange1.EndDate.Trim(), SLP_SLPDateRange1.StartDate.Trim()));  //3
        ParameterList.Add(this.SLP_EnumBase1.Text.Trim());      //4
        ParameterList.Add(SLP_VendorBase1.Text.Trim());         //5
        ParameterList.Add(EmptyPara(SLP_SLPDateRange2.StartDate.Trim(), SLP_SLPDateRange2.EndDate.Trim()));  //6
        ParameterList.Add(EmptyPara(SLP_SLPDateRange2.EndDate.Trim(), SLP_SLPDateRange2.StartDate.Trim()));  //7
        ParameterList.Add(SLP_User1.Text.Trim());               //8        
        ParameterList.Add(EmptyPara(SLP_SLPDateRange3.StartDate.Trim(), SLP_SLPDateRange3.EndDate.Trim()));  //9
        ParameterList.Add(EmptyPara(SLP_SLPDateRange3.EndDate.Trim(), SLP_SLPDateRange3.StartDate.Trim()));  //10
        ParameterList.Add(SLP_User2.Text.Trim());               //11
        ParameterList.Add(SLP_SKU1.Text.Trim());                //12
        ParameterList.Add(SLP_ItemPeriod1.Text.Trim());         //13
        ParameterList.Add(EmptyPara(SLP_SLPDateRange4.StartDate.Trim(), SLP_SLPDateRange4.EndDate.Trim()));  //9
        ParameterList.Add(EmptyPara(SLP_SLPDateRange4.EndDate.Trim(), SLP_SLPDateRange4.StartDate.Trim()));  //10
        ParameterList.Add(SLP_CodeFile1.Text.Trim());           //16
        ParameterList.Add(TextBoxRowCountLimit.Text.Trim());    //17

        DataTable dt = BCO.QueryByFind(ParameterList);
        ViewState[PageTimeStamp.Value] = dt;

        ErrorMsgLabel.Text = "";

        if (dt.Rows.Count > 0)
        {
            GridView1.PageSize = (TextBoxPagesize.Text == "") ? 20 : (int.Parse(TextBoxPagesize.Text) < 0) ? 20 : int.Parse(TextBoxPagesize.Text);
            BindData();
        }
        else
        {
            ErrorMsgLabel.Text = "查無資料";
            GridView1.DataSource = null;
            GridView1.DataBind();
        }
    }