Example #1
0
    //顯示GridView1
    private void ShowGrid(string chain_no, string store, string boxcorde, out string msg)
    {
        string pick_no = "";//理貨單號

        CGDModel.ProcessPickQualityCheck BCO = new CGDModel.ProcessPickQualityCheck(ConntionDB);

        DataTable Dt = null;
        ParameterList.Clear();

        ParameterList.Add(SLP_StAcceptDate.Text.Trim());//門市進貨日
        ParameterList.Add(txtPickBatch.Text.Trim());//理貨批次
        ParameterList.Add(chain_no);//通路
        ParameterList.Add(store);//門市
        ParameterList.Add(boxcorde);//箱號

        string errMsg = "", checkBatch = "";
        msg = "";
        Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetStoreInfo, ParameterList, out errMsg);

        if (errMsg.Length == 0)
        {
            if (Dt.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "查無該箱條碼相關資料";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該箱條碼相關資料 ');", true);
                msg = "查無該箱條碼相關資料";

                txtItemBarcode.CssClass = "readtxtbox";
                txtItemBarcode.Enabled = false;

                clearTxtBox1();

                if (txtBoxBarcode.Text.Length > 0)
                {
                    SetClinetFocus(txtBoxBarcode.ClientID);
                }
                else
                {
                    SetClinetFocus(txtBoxNumber.ClientID);
                }

                return;
            }
            else //依理貨單號擷取單號的所以品項
            {
                SLP_ChanNo.Text = Dt.Rows[0]["CHAN_NO"].ToString();
                SLP_Store.Text = Dt.Rows[0]["STORE"].ToString();
                txtRoute.Text = Dt.Rows[0]["ROUTE"].ToString();
                txtStep.Text = Dt.Rows[0]["STEP"].ToString();

                pick_no = Dt.Rows[0]["PICK_NO"].ToString();//理貨單號
                txtGoodsWeigth.Text = Dt.Rows[0]["GOODS_WEIGTH"].ToString();
                ViewState["PICK_NO"] = Dt.Rows[0]["PICK_NO"].ToString();
                //txtPickNo.Text = Dt.Rows[0]["PICK_NO"].ToString();

                //先取得檢核批次
                ParameterList.Clear();

                ParameterList.Add(SLP_StAcceptDate.Text.Trim());//門市進貨日
                ParameterList.Add(txtPickBatch.Text.Trim());//理貨批次
                ParameterList.Add(txtBoxNumber.Text.Trim());//箱號
                checkBatch = BCO.StQuerySwitch(CGDModel.CGDCommon.QueryType.GetCheckBatch, ParameterList, out errMsg);

                //取得其餘GRID上所需資料
                Dt = null;
                ParameterList.Clear();

                ParameterList.Add(pick_no);//門市進貨日
                ParameterList.Add(checkBatch);//檢核批次,直接帶給SQL值

                Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetStoreBoxItem, ParameterList, out errMsg);

                if (errMsg.Length != 0)
                {
                    ErrorMsgLabel.Text = "查無該理貨單貨單號的品項資料";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該理貨單貨單號的品項資料 ');", true);
                    msg = "查無該理貨單貨單號的品項資料";

                    DataTable DtNull = null;
                    GridView1.DataSource = DtNull;
                    GridView1.DataBind();

                    if (txtBoxBarcode.Text.Length > 0)
                    {
                        SetClinetFocus(txtBoxBarcode.ClientID);
                    }
                    else
                    {
                        SetClinetFocus(txtBoxNumber.ClientID);
                    }

                    return;
                }
                else
                {
                    string SessionIDName = "CGD231_" + PageTimeStamp.Value;
                    Session[SessionIDName] = Dt;
                    GridView1.Visible = true;
                    GridView1.DataSource = Dt;
                    //設定分頁大小
                    GridView1.PageIndex = 0;
                    GridView1.DataBind();
                    btnEndBox.Enabled = true;
                    btnEndCheck.Enabled = false;

                    //使用XML放置到前端資料
                    //xmlVDS_CGD_PICK_ITEM.InnerHtml = Dt.DataSet.GetXml();
                }

                txtItemBarcode.CssClass = "";
                txtItemBarcode.Enabled = true;

                SetClinetFocus(txtItemBarcode.ClientID);
            }
        }
        else
        {
            ErrorMsgLabel.Text = "查無該箱條碼相關資料";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該箱條碼相關資料 ');", true);
            msg = "查無該箱條碼相關資料";

            txtItemBarcode.CssClass = "readtxtbox";
            txtItemBarcode.Enabled = false;

            clearTxtBox1();

            if (txtBoxBarcode.Text.Length > 0)
            {
                SetClinetFocus(txtBoxBarcode.ClientID);
            }
            else
            {
                SetClinetFocus(txtBoxNumber.ClientID);
            }

            return;
        }
    }
Example #2
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        string SessionIDName = "CGD231_" + PageTimeStamp.Value;
        DataTable Dt = (DataTable)Session[SessionIDName];
        DataTable Dt2 = null;

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

        CGDModel.ProcessPickQualityCheck BCO = new CGDModel.ProcessPickQualityCheck(ConntionDB);

        try
        {
            if (Dt != null)
            {
                //存檔
                foreach (DataRow dr in Dt.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dr["PICK_NO"].ToString());
                    ParameterList.Add(dr["ITEM"].ToString());
                    ParameterList.Add(dr["PERIOD"].ToString());
                    ParameterList.Add(dr["VIRTUAL_CODE"].ToString());

                    Dt2 = BCO.Get_VDS_CGD_PICK_BK_ITEM_CK(ParameterList);

                    if (Dt2.Rows.Count == 0)
                    {
                        ParameterList.Clear();

                        ParameterList.Add(Session["UID"].ToString());
                        ParameterList.Add(Session["UID"].ToString());
                        ParameterList.Add(dr["PICK_NO"].ToString());
                        ParameterList.Add(dr["ITEM"].ToString());
                        ParameterList.Add(dr["VIRTUAL_CODE"].ToString());
                        ParameterList.Add(dr["PERIOD"].ToString());
                        ParameterList.Add(dr["CHECK_BATCH"].ToString());
                        ParameterList.Add(dr["CHECK_QTY"].ToString());
                        ParameterList.Add(dr["MODIFY_QTY"].ToString());

                        BCO.Insert_VDS_CGD_PICK_BK_ITEM_CK(ParameterList, DBT);
                    }
                    else
                    {
                        ParameterList.Clear();

                        ParameterList.Add(dr["PICK_NO"].ToString());
                        ParameterList.Add(dr["ITEM"].ToString());
                        ParameterList.Add(dr["PERIOD"].ToString());
                        ParameterList.Add(dr["VIRTUAL_CODE"].ToString());
                        ParameterList.Add(dr["CHECK_QTY"].ToString());
                        ParameterList.Add(dr["MODIFY_QTY"].ToString());
                        ParameterList.Add(Session["UID"].ToString());

                        BCO.UPDATE_VDS_CGD_PICK_BK_ITEM_CK(ParameterList, DBT);
                    }
                }

                DBT.Commit();
            }

            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD023.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }

        txtCheckQty.Enabled = true;
        txtModifyQty.ReadOnly = true;
        txtModifyQty.BackColor = System.Drawing.Color.LightGray;
        btnCancel.Visible = false;
        btnYes.Visible = false;
        btnEndCheck.Visible = true;
        btnEndBox.Visible = true;
        btnEndCheck.Enabled = true;
        btnEndBox.Enabled = false;
        txtRCItemBarcode.Text = "";
        ViewState["RCCheckState"] = "N";
        ViewState["RCBoxEndState"] = "N";

        Response.Redirect("CGD231.aspx?Code=CGD23", false);
    }
Example #3
0
    // 商品條碼處的ENTER事件
    protected void btnHideEnter_Click(object sender, EventArgs e)
    {
        if (txtItemBarcode.Text.Trim().Length != 0)
        {
            string barcode_type = "";
            if (txtItemBarcode.Text.Trim().Length <= 13)
                barcode_type = "1";
            else barcode_type = "2";


            //查巡該商品條碼,條碼類別的品號,期別資料
            ParameterList.Clear();

            CGDModel.ProcessPickQualityCheck BCO = new CGDModel.ProcessPickQualityCheck(ConntionDB);
            DataTable Dt = null;
            DataTable DtQty = null;
            string errMsg = "";

            ParameterList.Add(barcode_type);//條碼類別
            ParameterList.Add(txtItemBarcode.Text);//商品條碼
            ParameterList.Add(SLP_StAcceptDate.Text);//門市進貨日
            ParameterList.Add(txtPickBatch.Text);//理貨批次
            ParameterList.Add(txtBoxNumber.Text);//箱號

            Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetCheckItem, ParameterList, out errMsg);

            if (errMsg.Length != 0)
            {
                ErrorMsgLabel.Text = "查無該商品條碼,條碼類別的品號,期別資料";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該商品條碼,條碼類別的品號,期別資料 ');", true);

                clearTxtBox2();

                if (txtItemBarcode.ReadOnly == true)
                    SetClinetFocus(txtItemBarcode.ClientID);

                return;
            }
            else
            {
                if (Dt.Rows.Count > 1)
                {
                    ErrorMsgLabel.Text = "輸入的「商品條碼」資料無效(傳回多筆品號資料";

                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 輸入的「商品條碼」資料無效(傳回多筆品號資料) ');", true);

                    clearTxtBox2();

                    if (txtItemBarcode.ReadOnly == true)
                        SetClinetFocus(txtItemBarcode.ClientID);

                    return;
                }
                else if (Dt.Rows.Count == 0)
                {
                    ErrorMsgLabel.Text = "查無該品號期別理貨單號的理貨數量";

                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該品號期別理貨單號的理貨數量 ');", true);

                    clearTxtBox2();

                    if (txtItemBarcode.ReadOnly == true)
                        SetClinetFocus(txtItemBarcode.ClientID);

                    return;
                }

                ParameterList.Clear();
                ParameterList.Add(Dt.Rows[0]["ITEM"].ToString());//品號
                ParameterList.Add(Dt.Rows[0]["PERIOD"].ToString());//期別
                ParameterList.Add(ViewState["PICK_NO"].ToString());//理貨單號(隱藏欄位)

                DtQty = BCO.GetCheckItemPickQty(ParameterList, out errMsg);

                if (errMsg.Length != 0)
                {
                    ErrorMsgLabel.Text = "查無該品號期別理貨單號的理貨數量";

                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該品號期別理貨單號的理貨數量 ');", true);

                    clearTxtBox2();

                    if (txtItemBarcode.ReadOnly == true)
                        SetClinetFocus(txtItemBarcode.ClientID);

                    return;
                }
                else
                {
                    txtPickQty.Text = DtQty.Rows[0]["PICK_QTY"].ToString();
                    txtItem.Text = DtQty.Rows[0]["ITEM"].ToString();
                    txtVirtualCode.Text = DtQty.Rows[0]["VIRTUAL_CODE"].ToString();
                    txtPeriod.Text = DtQty.Rows[0]["PERIOD"].ToString();
                }
            }


            //檢查商品條碼是否重覆
            if (ViewState["RCCheckState"].ToString() == "N")
            {
                if (haChkQty.Count == 0)
                {
                    haChkQty.Add(txtItemBarcode.Text.Trim(), 1);
                    txtCheckQty.Text = "1";
                }
                else
                {
                    haChkQty[txtItemBarcode.Text.Trim()] = Convert.ToInt32(haChkQty[txtItemBarcode.Text.Trim()]) + 1;
                    txtCheckQty.Text = haChkQty[txtItemBarcode.Text.Trim()].ToString();
                }

                ViewState["CheckQty_Hide"] = txtCheckQty.Text;

                ViewState["RCCheckState"] = "N";
                ViewState["RCBoxEndState"] = "N";
                btnEndBox.Enabled = false;
                btnEndCheck.Enabled = true;
            }
            else
            {
                if (haModQty.Count == 0)
                {
                    haModQty.Add(txtItemBarcode.Text.Trim(), 1);
                    txtModifyQty.Text = "1";
                }
                else
                {
                    haModQty[txtItemBarcode.Text.Trim()] = Convert.ToInt32(haModQty[txtItemBarcode.Text.Trim()]) + 1;
                    txtModifyQty.Text = haModQty[txtItemBarcode.Text.Trim()].ToString();
                }

                ViewState["ModifyQty"] = txtModifyQty.Text;

            }


            //算品檢數
            string SessionIDName = "CGD231_" + PageTimeStamp.Value;
            DataTable _Dt = (DataTable)Session[SessionIDName];

            if (ViewState["RCCheckState"].ToString() == "N")
            {
                foreach (DataRow dr in _Dt.Rows)
                {
                    if ((dr["ITEM"].ToString() == txtItem.Text.Trim()) && (dr["VIRTUAL_CODE"].ToString() == txtVirtualCode.Text.Trim()) && (dr["PERIOD"].ToString() == txtPeriod.Text.Trim()))
                    {
                        dr["CHECK_QTY"] = Int32.Parse(dr["CHECK_QTY"].ToString()) + 1;
                        dr["DIFF_QTY"] = Int32.Parse(dr["CHECK_QTY"].ToString()) - Int32.Parse(dr["PICK_QTY"].ToString());
                    }
                }
            }
            else
            {
                foreach (DataRow dr in _Dt.Rows)
                {
                    if ((dr["ITEM"].ToString() == txtItem.Text.Trim()) && (dr["VIRTUAL_CODE"].ToString() == txtVirtualCode.Text.Trim()) && (dr["PERIOD"].ToString() == txtPeriod.Text.Trim()))
                    {
                        dr["MODIFY_QTY"] = Int32.Parse(dr["MODIFY_QTY"].ToString()) + 1;
                        dr["DIFF_QTY"] = Int32.Parse(dr["MODIFY_QTY"].ToString()) + Int32.Parse(dr["CHECK_QTY"].ToString()) - Int32.Parse(dr["PICK_QTY"].ToString());
                    }
                }
            }

            Session[SessionIDName] = _Dt;
            GridView1.DataSource = _Dt;
            GridView1.DataBind();

            //if (txtItemBarcode.ReadOnly == true)
                SetClinetFocus(txtItemBarcode.ClientID);
        }

    }