Exemplo n.º 1
0
    /// <summary>
    /// 搜尋鈕
    /// </summary>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        DataTable Dt;
        string strMsg = string.Empty;
        string strResult = string.Empty;

        CGRModel.MaintainBackWard BCO = new PIC.VDS2G.LGT.CGR.MaintainBackWard(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add("0");
        ParameterList.Add(SLP_StoreChain.Text);

        Dt = BCO.GetUnClosedBatch(ParameterList, out strMsg, out strResult);

        if (strResult == "0")
        {
            ErrorMsgLabel.Text = strMsg;
            PanelBatch.Visible = false;
            PanelOK.Visible = false;
        }
        else
        {
            BindBatch(Dt);
            PanelBatch.Visible = true;
            btnCount.Enabled = true;
            SLP_StoreChain.ReadOnly = true;
            btnSearch.Enabled = false;
            PanelOK.Visible = false;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 計算數量鈕
    /// </summary>
    protected void btnCount_Click(object sender, EventArgs e)
    {
        try
        {
            if (chkBatchIsSelect())
            {
                string strMsg = string.Empty;
                string strResult = string.Empty;
                DataTable Dt = new DataTable();
                DataTable Dt_Error = new DataTable();

                PIC.VDS2G.LGT.CGR.MaintainBackWard BCO = new PIC.VDS2G.LGT.CGR.MaintainBackWard(ConntionDB);

                ParameterList.Clear();

                string strBatchNo = GetBatchNo();

                if (rdoType.SelectedIndex == 0) //Sorter結轉
                {
                    ParameterList.Add(SLP_StoreChain.Text);
                    ParameterList.Add(strBatchNo);
                    ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value);

                    Dt = BCO.GetSorterData(ParameterList, out strMsg, out strResult);

                    if (strResult == "0")
                    {
                        if (strMsg == "檢核結果異常" || strMsg == "無可結轉資料")
                        {
                            ParameterList.Clear();

                            ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value);

                            Dt_Error = BCO.GetErrData(ParameterList);
                            PanelError.Visible = true;
                            btnPrint.Visible = false;
                            gvError.Visible = false;
                            //CheckErrorMsg.Text = "檢核結果異常!";
                            CheckErrorMsg.Text = strMsg;


                            if (strMsg == "檢核結果異常")
                            {
                                PanelError.Visible = true;
                                btnPrint.Visible = true;
                                gvError.Visible = true;
                                BindError(Dt_Error);
                            }

                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "BatchIsClosed", "alert('" + strMsg + "');", true);
                        }
                    }
                    else
                    {
                        if (Dt.Rows.Count > 0)
                        {
                            ViewState["EnableAdjust"] = true;
                            //Bind gvDetail
                            BindDetail(Dt);
                        }
                        //顯示訊息,控制畫面
                        SetOkStatus();
                    }
                }
                else //通路退貨結轉
                {
                    ParameterList.Add(SLP_StoreChain.Text);
                    ParameterList.Add(strBatchNo);

                    Dt = BCO.GetChanRtnData(ParameterList, out strMsg, out strResult);

                    if (strResult == "1")
                    {
                        if (Dt.Rows.Count > 0)
                        {
                            ViewState["EnableAdjust"] = true;
                            //Bind gvDetail
                            BindDetail(Dt);
                        }

                        //顯示訊息,控制畫面
                        SetOkStatus();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "BatchIsClosed", "alert('" + strMsg + "');", true);
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "chkBatchIsSelect", "alert(' 無批號被選擇 ');", true);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// CRM07_1
        /// </summary>
        /// <param name="Parameter">變數集</param>
        /// <param name="Ds">回傳結果</param>
        /// <returns>回傳成功失敗</returns>
        public bool CGR02_1(ArrayList ParameterList,
                            ref DataSet Ds
                            )
        {
            bool Result = false;

            try
            {

                string strInOut_No = string.Empty;
                string strMsg = string.Empty;
                string strResult = string.Empty;
                string strMainID = string.Empty;
                string strAdjustNo = string.Empty;
                ArrayList ErrList = new ArrayList();
                ArrayList ParameterList2 = new ArrayList();

                DataTable Dt = new DataTable();

                if (Ds==null)
                {
                    Ds = new DataSet();
                }

                for (int i = Ds.Tables.Count-1; i >=0 ; i--)
                {
                    Ds.Tables.RemoveAt(i);
                }

                //PIC.VDS2G.LGT.CGR.MaintainBackWard BCO = new PIC.VDS2G.LGT.CGR.MaintainBackWard(ConntionDB);

                //ParameterList.Clear();

                //ParameterList.Add(GetIsAdjust()); //IsAdjust
                //ParameterList.Add(rdoType.SelectedValue); //Type
                //ParameterList.Add(GetBatchNo()); //BatchNos
                //ParameterList.Add(SLP_StoreChain.Text); //ChanNo
                //ParameterList.Add(Session["UID"].ToString()); //CreateID 
                //ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value); //V_TIMESTAMP

                //Dt = BCO.CreateBackWard(ParameterList, DBT, Dt_Adjust, out strInOut_No, out strMsg, out strResult, out strMainID, out strAdjustNo, out ErrList);

                CGRModel.MaintainBackWard BCO = new CGRModel.MaintainBackWard(ConntionDB);

                ParameterList2.Clear();

                for (int i = 0; i < ParameterList.Count; i++)
                {
                    if (i < ParameterList.Count - 1)
                    {                        
                        ParameterList2.Add(ParameterList[i]);
                    }
                }

                string DetailSelectXML = ParameterList[ParameterList.Count - 1].ToString();

                DataSet DetailDs = new DataSet();

                if (DetailSelectXML != "")
                {
                    #region 使用XML轉回DataSet

                    System.IO.StringReader sr = new System.IO.StringReader(DetailSelectXML);
                    DetailDs.ReadXml(sr);

                    #endregion
                }

                DataTable Dt_Adjust = null;

                if (DetailDs.Tables.Count > 0)
                {
                    Dt_Adjust = DetailDs.Tables[0];
                }

                Dt = BCO.CreateBackWard(ParameterList2, 
                                        null, 
                                        Dt_Adjust, 
                                        out strInOut_No, 
                                        out strMsg, 
                                        out strResult, 
                                        out strMainID, 
                                        out strAdjustNo, 
                                        out ErrList
                                        );

                //Dt.TableName = "ResultDt";                
                //Ds.Merge(Dt.DataSet);

                #region DtResult  DrResult DrResult2

                DataTable DtResult = new DataTable("ResultDt");

                DtResult.Columns.Add("BACKWARD_NO");

                if (Dt.Rows.Count > 0)
                {
                    DataRow DrResult = DtResult.NewRow();

                    DrResult["BACKWARD_NO"] = Dt.Rows[0]["BACKWARD_NO"].ToString();

                    DtResult.Rows.Add(DrResult);

                    DataRow DrResult2 = DtResult.NewRow();

                    DrResult2["BACKWARD_NO"] = Dt.Rows[Dt.Rows.Count-1]["BACKWARD_NO"].ToString();

                    DtResult.Rows.Add(DrResult2);
                }

                #endregion

                Ds.Tables.Add(DtResult);

                #region DtInOutNo  strInOut_No

                DataTable DtInOutNo = new DataTable("InOutNoDt");

                DtInOutNo.Columns.Add("strInOut_No");

                DataRow DrInOutNo = DtInOutNo.NewRow();

                DrInOutNo["strInOut_No"] = strInOut_No;

                DtInOutNo.Rows.Add(DrInOutNo);

                #endregion
                
                Ds.Tables.Add(DtInOutNo);

                #region DtStrMsg  strMsg

                DataTable DtStrMsg = new DataTable("strMsg");

                DtStrMsg.Columns.Add("strMsg");

                DataRow DrStrMsg = DtStrMsg.NewRow();

                DrStrMsg["strMsg"] = strMsg;

                DtStrMsg.Rows.Add(DrStrMsg);

                #endregion

                Ds.Tables.Add(DtStrMsg);

                #region DtStrResult  strResult

                DataTable DtStrResult = new DataTable("strResult");

                DtStrResult.Columns.Add("strResult");

                DataRow DrStrResult = DtStrResult.NewRow();

                DrStrResult["strResult"] = strResult;

                DtStrResult.Rows.Add(DrStrResult);

                #endregion

                Ds.Tables.Add(DtStrResult);

                #region DtStrMainID  strMainID

                DataTable DtStrMainID = new DataTable("strMainID");

                DtStrMainID.Columns.Add("strMainID");

                DataRow DrStrMainID = DtStrMainID.NewRow();

                DrStrMainID["strMainID"] = strMainID;

                DtStrMainID.Rows.Add(DrStrMainID);

                #endregion

                Ds.Tables.Add(DtStrMainID);

                #region DtStrAdjustNo  strAdjustNo

                DataTable DtStrAdjustNo = new DataTable("strAdjustNo");

                DtStrAdjustNo.Columns.Add("strAdjustNo");

                DataRow DrStrAdjustNo = DtStrAdjustNo.NewRow();

                DrStrAdjustNo["strAdjustNo"] = strAdjustNo;

                DtStrAdjustNo.Rows.Add(DrStrAdjustNo);

                #endregion

                Ds.Tables.Add(DtStrAdjustNo);

                #region DtErrList  ErrList

                DataTable DtErrList = new DataTable("ErrList");

                DtStrAdjustNo.Columns.Add("ErrList");

                if (ErrList != null)
                {
                    for (int j = 0; j < ErrList.Count; j++)
                    {
                        DataRow DrErrList = DtErrList.NewRow();

                        DrErrList["ErrList"] = ErrList[j].ToString();

                        DtErrList.Rows.Add(DrErrList);
                    }
                }
                else
                {
                    DataRow DrErrList = DtErrList.NewRow();

                    DrErrList["ErrList"] = " ";

                    DtErrList.Rows.Add(DrErrList);
                }
                #endregion

                Ds.Tables.Add(DtErrList);

                Result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return Result;


        }