Ejemplo n.º 1
0
        protected void Btn_Execution_Click(object sender, EventArgs e)
        {
            try
            {
                Button      btn = sender as Button;
                CheckFormat CF  = new CheckFormat();
                foreach (GridViewRow row in gv_List.Rows)
                {
                    Button btnTest = row.Cells[0].FindControl("Btn_Execution") as Button;

                    //判斷是否是按下按鈕的那一行
                    if (btnTest == btn)
                    {
                        var txtTemp = row.Cells[4].FindControl("LackNum") as TextBox;

                        if (CF.CheckID(txtTemp.Text, CheckFormat.FormatName.Number))
                        {
                            string lackQuantity     = txtTemp.Text.Trim();
                            string originalQuantity = row.Cells[3].Text.Trim();

                            //缺少數量 <= 應有數量
                            if (int.Parse(lackQuantity) == 0)
                            {
                                lbl_Message.Text = "數量不可為0!";
                            }
                            else if (int.Parse(lackQuantity) <= int.Parse(originalQuantity))
                            {
                                var productStatus = RB_Flaw.SelectedValue;
                                //儲位名稱,商品編號,應有數量,短缺數量
                                string noProductData = string.Format("{0},{1},{2},{3}", row.Cells[1].Text.Trim(), row.Cells[2].Text.Trim(), row.Cells[3].Text.Trim(), lackQuantity);
                                string account       = row.Cells[9].Text.Trim();
                                string reason        = DDL_Reason.SelectedValue;
                                var    url           = "NoProductCheck.aspx?pickNum=" + lblPickNo.Text + "&productStatus=" + productStatus + "&noProductData=" + noProductData + "&account=" + account + "&reason=" + reason + "&PageKey=" + PageKey;
                                Page.RegisterClientScriptBlock("checkinput", @"<script>window.open('" + url + "','_self');</script>");
                            }
                            else
                            {
                                lbl_Message.Text = "缺少數量 超過 應有數量!";
                            }
                        }
                        else
                        {
                            lbl_Message.Text = "請輸入正確數字!";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("系統發生錯誤 " + ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 原js改寫
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txt_VerifyCheck_NO_TextChanged(object sender, EventArgs e)
        {
            try
            {
                lbl_Message.Text = "";
                CheckFormat CF = new CheckFormat();
                LB_Product_Id1.ClearSelection();
                LB_Product_Id2.ClearSelection();
                //全過
                if (txt_VerifyCheck_NO.Text == "2")
                {
                    int total = LB_Product_Id1.Items.Count;
                    for (int i = 0; i < total; i++)
                    {
                        LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[0]);
                        LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[0]);
                    }
                }
                //還原一筆
                else if (txt_VerifyCheck_NO.Text == "0")
                {
                    if (LB_Product_Id2.Items.Count > 0)
                    {
                        LB_Product_Id1.Items.Insert(0, LB_Product_Id2.Items[0]);
                        LB_Product_Id2.Items.Remove(LB_Product_Id2.Items[0]);
                    }
                }
                else if (Regex.IsMatch(txt_VerifyCheck_NO.Text, "^\\d{8}$"))
                {
                    bool find = false;
                    for (int i = 0; i < LB_Product_Id1.Items.Count; i++)
                    {
                        if (LB_Product_Id1.Items[i].Value.Split(',')[0] == txt_VerifyCheck_NO.Text)
                        {
                            LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[i]);
                            LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[i]);

                            find = true;
                            break;
                        }
                    }

                    //如果不在清單中 顯示(多出)
                    if (!find)
                    {
                        lbl_Message.Text = "這個商品不是這張傳票的!";
                    }
                }
                //如果輸入的是儲位barcode 跳至差異清單
                else if (CF.CheckID(txt_VerifyCheck_NO.Text.Trim(), CheckFormat.FormatName.Storage))
                {
                    string       storage     = txt_VerifyCheck_NO.Text.Trim();
                    var          listLeft    = new List <string>();
                    var          listRight   = new List <string>();
                    int          areaId      = int.Parse(ViewState["areaId"].ToString());
                    var          flowType    = ViewState["flowType"].ToString();
                    var          importType  = ViewState["importType"].ToString();
                    var          ticketType  = ViewState["ticketType"].ToString();
                    ShelfProcess sp          = new ShelfProcess();
                    var          shelf       = sp.GetSearchStorage(storage, areaId);
                    var          storageType = EnumData.StorageType.標準暫存儲位;
                    //if (_flowType == (int)EnumData.FlowType.門市調回)
                    //{
                    //    storageType = EnumData.StorageType.調回暫存儲位;
                    //}
                    //else if (_flowType == (int)EnumData.FlowType.換貨)
                    //{
                    //    storageType = EnumData.StorageType.換貨暫存儲位;
                    //}
                    //else if (_flowType == (int)EnumData.FlowType.台組進貨)
                    //{
                    //    storageType = EnumData.StorageType.海運暫存儲位;
                    //}

                    if (shelf.Type != (int)storageType)
                    {
                        lbl_Message.Text = "這個儲位不屬於" + storageType.ToString() + "!";
                        return;
                    }

                    //串多少& 缺少的字串
                    for (int i = 0; i < LB_Product_Id1.Items.Count; i++)
                    {
                        listLeft.Add(LB_Product_Id1.Items[i].Text.Split('_')[0]);
                    }
                    var productDatas = new List <ImportClass.ProductData>();
                    for (int i = 0; i < LB_Product_Id2.Items.Count; i++)
                    {
                        var productData = new ImportClass.ProductData();
                        productData.Id       = LB_Product_Id2.Items[i].Value.Split(',')[4];
                        productData.Name     = LB_Product_Id2.Items[i].Text.Split('_')[0];
                        productData.Quantity = int.Parse(LB_Product_Id2.Items[i].Value.Split(',')[3]);
                        productData.Ticket   = LB_Product_Id2.Items[i].Value.Split(',')[1];
                        productDatas.Add(productData);

                        listRight.Add(LB_Product_Id2.Items[i].Text.Split('_')[0]);
                    }

                    if (listLeft.Any())
                    {
                        lbl_Message.Text        = "以下產品尚未驗完:" + string.Join(",", listLeft.Count);
                        txt_VerifyCheck_NO.Text = "";
                        return;
                    }

                    if (!listRight.Any())
                    {
                        lbl_Message.Text = "還沒驗到貨!請再次確認!";
                        return;
                    }

                    Session["ProductDatas"] = productDatas;
                    Session["storage"]      = storage;
                    Session["flowType"]     = flowType;
                    Session["pagekey"]      = lblbox.Text;
                    //------------------------------------------------------
                    //箱號驗貨
                    var url = "DiffList.aspx?storage=" + storage + "&ticketType=" + ticketType + "&flowType=" + flowType + "&pagekey=" + lblbox.Text + "&areaId=" + areaId + "&importType=" + importType;

                    //Response.Redirect(url);
                    Page.RegisterClientScriptBlock("checkinput", @"<script>window.open('" + url + "','_self');</script>");

                    txt_VerifyCheck_NO.Enabled = false;
                }
                else
                {
                    lbl_Message.Text = "這個商品不是這張傳票的!";
                }

                txt_VerifyCheck_NO.Text = "";

                //更新數量
                CheckNumToLabel();

                txt_VerifyCheck_NO.Focus();
            }
            catch (Exception ex)
            {
                Response.Write("系統發生錯誤 " + ex.Message);
            }
        }
Ejemplo n.º 3
0
        protected void txt_productId_TextChanged(object sender, EventArgs e)
        {
            try
            {
                var         sp             = new ShelfProcess();
                var         str_input      = txt_productId.Text.Trim().ToUpper();
                var         quantity       = int.Parse(DDL_Quantity.SelectedValue);
                var         productId      = string.Empty;
                var         productBarcode = string.Empty;
                CheckFormat CF             = new CheckFormat();
                //檢查輸入是否為條碼
                if (CF.CheckID(str_input, CheckFormat.FormatName.Product))
                {
                    //檢查是否為有效條碼
                    string chProduct = sp.GetProductNum(txt_productId.Text);
                    if (string.IsNullOrEmpty(chProduct))
                    {
                        lbl_Message.Text = "掃入條碼有誤!";
                        return;
                    }
                    else
                    {
                        productId = chProduct;
                        string chBarcode = sp.GetProductPriceBarcode(chProduct);
                        productBarcode = chBarcode;
                    }
                }
                else
                {
                    //檢查是否為有效產品
                    string chBarcode = sp.GetProductPriceBarcode(str_input);
                    if (string.IsNullOrEmpty(chBarcode))
                    {
                        lbl_Message.Text = "掃入條碼有誤!";
                        return;
                    }
                    else
                    {
                        productId      = str_input;
                        productBarcode = chBarcode;
                    }
                }
                for (int i = 0; i < quantity; i++)
                {
                    ListItem product = new ListItem();
                    product.Text  = productId;
                    product.Value = productBarcode;
                    lsbList.Items.Add(product);
                }

                txt_productId.Text      = "";
                lbl_Message.Text        = "";
                btnPrintProduct.Visible = true;

                txt_productId.Focus();
            }
            catch (Exception ex)
            {
                Response.Write("系統發生錯誤 " + ex.Message);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 差異
        /// </summary>
        /// <param name="isLack"></param>
        /// <param name="flowType"></param>
        protected void DiffBox(bool isLack, int flowType)
        {
            try
            {
                var productId = txt_More_ProdoctID.Text.Trim();
                num = txt_More_ProdoctNum.Text.Trim();

                if (productId != "" && num != "")
                {
                    //條碼轉產編(2013-0319新增)---------------------------------
                    if (CF.CheckID(productId, CheckFormat.FormatName.Product))
                    {
                        productId = sp.GetProductNum(productId);
                    }
                    //----------------------------------------------------------

                    //productId = WMS_Library.ProductStorage.NoProduct.GetProduct(productId);
                    //if (String.IsNullOrEmpty(productId))
                    //{
                    //    lbl_Message.Text = "請輸入正確產品!";
                    //    return;
                    //}
                    if (int.Parse(num) > 0)
                    {
                        if (!string.IsNullOrEmpty(txt_ticket_id.Text))
                        {
                            var shipDa = new POS_Library.ShopPos.ShipInDA();
                            int store  = POS_Library.Public.Utility.GetStore(_areaId);
                            var isTrue = shipDa.IsIssueReport(int.Parse(txt_ticket_id.Text.Trim()), productId, store, flowType);
                            if (isTrue.Result == "1")
                            {
                                lbl_Message.Text = "此產品已回報過!";
                                return;
                            }
                        }
                        ListItem LItem    = new ListItem();
                        string   quantity = string.Empty;
                        if (isLack)
                        {
                            quantity = "-" + txt_More_ProdoctNum.Text.Trim();
                        }
                        else
                        {
                            quantity = txt_More_ProdoctNum.Text.Trim();
                        }
                        LItem.Value = productId + "," + txt_More_ProdoctNum.Text.Trim() + "," + isLack;
                        LItem.Text  = productId + " x " + quantity;
                        LB_Product_Id1.Items.Add(LItem);
                        txt_More_ProdoctNum.Text = "";
                        txt_More_ProdoctID.Text  = "";
                    }
                    else
                    {
                        lbl_Message.Text = "請輸入正確數量!";
                    }
                }
                else
                {
                    lbl_Message.Text = "請輸入產品名稱及數量!";
                }
            }
            catch (Exception ex)
            {
                Response.Write("系統發生錯誤 " + ex.Message);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 輸入txtbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txt_VerifyCheck_NO_TextChanged(object sender, EventArgs e)
        {
            lbl_Message.Text = "";

            var          store  = int.Parse(ViewState["store"].ToString());
            var          areaId = int.Parse(ViewState["areaId"].ToString());
            ShelfProcess sp     = new ShelfProcess();
            CheckFormat  CF     = new CheckFormat();

            LB_Product_Id1.ClearSelection();
            LB_Product_Id2.ClearSelection();
            var 傳票ID = lbl_ticket_id.Text.Trim();

            //全過
            if (txt_VerifyCheck_NO.Text == "2")
            {
                int total = LB_Product_Id1.Items.Count;
                for (int i = 0; i < total; i++)
                {
                    LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[0]);
                    LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[0]);
                }
            }

            //還原一筆
            else if (txt_VerifyCheck_NO.Text == "0")
            {
                if (LB_Product_Id2.Items.Count > 0)
                {
                    LB_Product_Id1.Items.Insert(0, LB_Product_Id2.Items[0]);
                    LB_Product_Id2.Items.Remove(LB_Product_Id2.Items[0]);
                }
            }

            //確認
            else if (txt_VerifyCheck_NO.Text == "1")
            {
                if (LB_Product_Id1.Items.Count != 0)
                {
                    lbl_Message.Text = "部分商品未驗!";
                    return;
                }
                else if (string.IsNullOrEmpty(傳票ID))
                {
                    lbl_Message.Text = "傳票不可為空!";
                    return;
                }
                else
                {
                    var shipDa = new POS_Library.ShopPos.ShipOutDA();
                    var msg    = shipDa.LeaveWithVerify(int.Parse(傳票ID), account, store, DateTime.Now, areaId);
                    if (msg.Result == "1")
                    {
                        lbl_Message.Text           = "驗貨完成!";
                        txt_VerifyCheck_NO.Enabled = false;
                    }
                    else
                    {
                        lbl_Message.Text = msg.Reason;
                    }
                }
            }

            //產品編號
            else if (Regex.IsMatch(txt_VerifyCheck_NO.Text, "^\\d{8}$"))
            {
                bool find = false;

                for (int i = 0; i < LB_Product_Id1.Items.Count; i++)
                {
                    //if (LB_Product_Id1.Items[i].Value == txt_VerifyCheck_NO.Text)
                    //{
                    //lbl_Message.Text = LB_Product_Id1.Items[i].Value.Split(',')[4];
                    if (LB_Product_Id1.Items[i].Value.Split(',')[0] == txt_VerifyCheck_NO.Text)
                    {
                        LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[i]);
                        LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[i]);
                        find = true;
                        break;
                    }
                }

                if (!find)
                {
                    lbl_Message.Text = "這個商品不是這張傳票的!";

                    //LB_Product_Id2.Items.Insert(0, new ListItem(sp.GetProductNum(txt_VerifyCheck_NO.Text) + "(多出)", txt_VerifyCheck_NO.Text));
                }
            }
            else if (CF.CheckID(txt_VerifyCheck_NO.Text, CheckFormat.FormatName.Storage))
            {
                if (LB_Product_Id1.Items.Count == 0)
                {
                    int?type = sp.CheckStorage(txt_VerifyCheck_NO.Text, areaId);

                    if (type == 6 || type == 7)
                    {
                        string product = "";

                        for (int i = 0; i < LB_Product_Id2.Items.Count; i++)
                        {
                            product  = string.IsNullOrEmpty(product) ? product : product + ",";
                            product += LB_Product_Id2.Items[i].Text;
                        }

                        //Response.Redirect("~/DiffList.aspx?product=" + product + "&ticketId=" + lbl_ticket_id.Text + "&storage=" + txt_VerifyCheck_NO.Text.Trim());
                    }
                    else
                    {
                        lbl_Message.Text = "僅可為暫存儲位或不良暫存儲位!";
                    }
                }
                else
                {
                    lbl_Message.Text = "尚有產品未驗!";
                }
            }
            else
            {
                lbl_Message.Text = "這個商品不是這張傳票的!";
            }

            txt_VerifyCheck_NO.Text = "";
            txt_VerifyCheck_NO.Focus();
        }