Пример #1
0
        /// <summary>
        /// 將取得的產品List放入ListBox
        /// </summary>
        protected void setListBox(int ticketId, int store, int areaId)
        {
            try
            {
                //lbl_Message.Text += " 提醒:請檢查是否有撿貨單未刷確認!";
                var shipDa = new POS_Library.ShopPos.ShipOutDA();

                var list = shipDa.GetTicketDetail(int.Parse(lbl_ticket_id.Text.Trim()), areaId, false, false);

                if (list.Count > 0)
                {
                    var pickNum = string.Format("{0}{1}{2}{3}", ticketId, store.ToString().PadLeft(2, '0'), areaId.ToString().PadLeft(2, '0'), ((int)Utility.ShipPDF.寄倉調出).ToString().PadLeft(2, '0'));
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].Quantity > 0)
                        {
                            ListItem LItem = new ListItem();
                            LItem.Text  = list[i].ProductId + "__X " + list[i].Quantity;
                            LItem.Value = list[i].Barcode + "," + list[i].ProductId + "," + list[i].Quantity + "," + pickNum;
                            LItem.Attributes.Add("value2", list[i].TicketId.ToString());
                            LB_Product_Id1.Items.Add(LItem);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("系統發生錯誤 " + ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// 撿貨確認
        /// </summary>
        protected void DoPickCheck()
        {
            try
            {
                var shipDa = new POS_Library.ShopPos.ShipOutDA();
                //測試 000065457818
                id = txt_PickCheck_NO.Text.Trim();
                if (checkString != "")
                {
                    id = checkString;
                }

                if (string.IsNullOrEmpty(id))
                {
                    lbl_Message.Text = "未輸入條碼!";
                    return;
                }
                var inputPickNum = txt_PickCheck_NO.Text.Trim();
                var pick         = Utility.GetPickNumRegex(inputPickNum);
                var num          = pick.Number;
                var store        = pick.Store;
                var pickType     = pick.PickType;

                POS_Library.ShopPos.JobPerformance JB = new POS_Library.ShopPos.JobPerformance();
                //判斷績效
                var isPerformanceUp = JB.IsPerformancePOS(int.Parse(num), pickType);

                switch (isPerformanceUp)
                {
                case true:      //錯誤的傳票號碼
                    lbl_Message.Text = "此撿貨單已結案!";
                    break;

                case false:       //成功
                    lbl_Message.ForeColor = System.Drawing.Color.Green;
                    lbl_Message.Text      = "此撿貨單未結案!";
                    if (int.Parse(num) < 300)
                    {
                        lbl_Message.Text = num + ":資料錯誤,請洽系統管理員";
                    }
                    //調出+瑕疵(2015-0716新增)
                    if (pickType == 2 || pickType == 4)
                    {
                        ticket_id        = lbl_Ticket_Id.Text = num;
                        lbl_Ship_Id.Text = "0";

                        MSListNewFinal = shipDa.GetPerformance(account, (int)POS_Library.Public.Utility.LogisticsType.調出撿貨確認, int.Parse(num), _areaId);

                        if (MSListNewFinal != null)
                        {
                            if (MSListNewFinal.Result == "1")
                            {
                                lbl_Message.ForeColor = System.Drawing.Color.Green;
                            }
                            lbl_Message.Text = MSListNewFinal.Reason;
                        }
                    }
                    else    // if (pickType == 0)
                    {
                        lbl_Ticket_Id.Text = "0";
                        lbl_Ship_Id.Text   = num;

                        MSListNewFinal = shipDa.GetPerformanceSale(account, (int)POS_Library.Public.Utility.LogisticsType.撿貨, int.Parse(num), _areaId);

                        if (MSListNewFinal != null)
                        {
                            if (MSListNewFinal.Result == "1")
                            {
                                lbl_Message.ForeColor = System.Drawing.Color.Green;
                                lbl_Message.Text      = "成功!";
                            }
                            else
                            {
                                lbl_Message.Text = id + ", " + MSListNewFinal.Reason;
                            }
                        }
                    }

                    break;
                }

                txt_PickCheck_NO.Text = "";
            }
            catch (Exception ex)
            {
                Response.Write(id + ", " + "系統發生錯誤 " + ex.Message);
            }
        }
Пример #3
0
        /// <summary>
        /// Grid_RowCommand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                string Id = e.CommandArgument.ToString();

                if (!string.IsNullOrEmpty(Id))
                {
                    switch (e.CommandName)
                    {
                    case "Detail":
                        //日期參數
                        SDay        = DateTime.Parse(HandleStartDate);
                        EDay        = DateTime.Parse(HandleEndDate);
                        WithoutDate = true;
                        foreach (GridViewRow row in gv_List.Rows)
                        {
                            var tempID = GetCellByName(row, "出貨序號").Text;

                            //判斷是否是按下按鈕的那一行
                            if (tempID == Id)
                            {
                                GridView gv_Detail = GetCellByName(row, "功能").FindControl("gv_Detail") as GridView;
                                Panel    P_Detail  = GetCellByName(row, "功能").FindControl("P_Detail") as Panel;

                                if (gv_Detail.Rows.Count == 0)
                                {
                                    var temp1 = SO.GetOrderDetails(Id, SDay, EDay, WithoutDate).ToList();

                                    int x     = 1;
                                    var temp2 = (from i in temp1
                                                 select new
                                    {
                                        序號 = x++,
                                        型號 = i.ProductId,
                                        條碼 = i.Barcode,
                                        數量 = i.Quantity.ToString(),
                                    }).ToList();

                                    gv_Detail.DataSource = temp2;
                                    gv_Detail.DataBind();
                                }

                                P_Detail.Visible = !P_Detail.Visible;
                            }
                        }

                        break;

                    case "Print":
                        foreach (GridViewRow row in gv_List.Rows)
                        {
                            var tempID = GetCellByName(row, "出貨序號").Text;

                            //判斷是否是按下按鈕的那一行
                            if (tempID == Id)
                            {
                                var 發票號碼  = GetCellByName(row, "發票號碼").Text;
                                var store = POS_Library.Public.Utility.GetStore(_areaId);
                                var order = SO.ShipOut(int.Parse(Id), store);
                                //印單不扣數
                                //var PrintPickListsShelf = SO.PickDetailCk(int.Parse(Id), (int)Utility.ShipPDF.出貨, store);
                                //印單扣數 //order[0].TicketType存是否扣展售資訊
                                var PrintPickListsShelf = SO.PrintPickListsShelf(order, int.Parse(Id), order[0].TicketType, store, _areaId);

                                //是否印撿貨單(2015-0813修改)
                                if (SystemSettings.GetNeedPrintPickSheet() == true)
                                {
                                    Print p = new Print();
                                    p.PrintPickList(PrintPickListsShelf, 發票號碼, "交易明細(補印)");
                                }
                                else
                                {
                                    var SO2            = new POS_Library.ShopPos.ShipOutDA();
                                    var MSListNewFinal = SO2.GetPerformanceSale(account, (int)POS_Library.Public.Utility.LogisticsType.撿貨, int.Parse(Id), _areaId);
                                }
                            }
                        }
                        break;
                    }
                }
                else
                {
                    lbl_Message.Text = "無資料!!";
                }
            }
            catch (Exception ex)
            {
                lbl_Message.Text = "查詢錯誤!!" + ex.Message;
            }
        }
Пример #4
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();
        }
Пример #5
0
        public bool PrintPickList(string OrderID, int pickType, string InvoiceNumberNow)
        {
            Log.Add(0, OrderID, OrderStep.ToString(), "OrderStep:2,發票列印完成", ClerkID, PosNo);

            bool result = false;

            string[] ItemNo   = JsonConvert.DeserializeObject <string[]>(Request["ItemNoList"]);
            string[] color    = JsonConvert.DeserializeObject <string[]>(Request["ColorList"]);
            string[] quantity = JsonConvert.DeserializeObject <string[]>(Request["QuantityList"]);
            string[] price    = JsonConvert.DeserializeObject <string[]>(Request["PriceList"]);
            var      ShipId   = int.Parse(OrderID);
            var      store    = POS_Library.Public.Utility.GetStoreForShop(_areaId);
            List <TicketShelfTemp> ticketTemp = new List <TicketShelfTemp>();

            try
            {
                #region 建立撿貨明細

                var       Ticket = 0;
                var       Date   = DateTime.Today.ToString("yyyy-MM-dd");
                ShipOutDA SO     = new ShipOutDA();
                for (int i = 0; i < quantity.Length; i++)
                {
                    TicketShelfTemp detail = new TicketShelfTemp();
                    detail.Account      = ClerkName;
                    detail.GuestId      = 1;
                    detail.ShipId       = ShipId.ToString();
                    detail.ShipoutDate  = Date;
                    detail.ProductId    = ItemNo[i];
                    detail.Quantity     = int.Parse(quantity[i]);
                    detail.ProductColor = color[i];
                    detail.Ticket       = Ticket;
                    detail.Store        = store;

                    ticketTemp.Add(detail);
                }

                List <TicketShelfTemp> PrintPickListsShelf = new List <TicketShelfTemp>();
                string MachineName = HttpContext.Current.Server.MachineName;

                #endregion

                #region 扣數

                if (pickType != 1)
                {
                    if (pickType == 0)
                    {
                        PrintPickListsShelf = SO.PrintPickListsShelf(ticketTemp, ShipId, (int)Utility.ShipPDF.出貨, store, _areaId);
                    }

                    if (pickType == 5)
                    {
                        PrintPickListsShelf = SO.PrintPickListsShelf(ticketTemp, ShipId, (int)Utility.ShipPDF.出貨含展售, store, _areaId);
                    }

                    Log.Add(0, OrderID, "3", "OrderStep:3,撿貨完成", ClerkID, PosNo);

                    //判斷設定檔再決定要不要印撿貨單
                    if (SystemSettings.GetNeedPrintPickSheet() == true)
                    {
                        Print  p           = new Print();
                        string PrintResult = p.PrintPickList(PrintPickListsShelf, InvoiceNumberNow, "交易明細");

                        if (PrintResult == "Success")
                        {
                            Log.Add(0, OrderID, "4", "OrderStep:4,列印撿貨單完成", ClerkID, PosNo);
                        }
                        else
                        {
                            string Event1 = string.Format("發票號碼:{0},產生揀貨單失敗!", InvoiceNumberNow);
                            string Event2 = string.Format("產生失敗原因:{0}", PrintResult);
                            Log.Add(5, OrderID, InvoiceNumberNow, Event1 + Event2, ClerkID, PosNo);
                        }
                    }
                    else
                    {
                        var SO2            = new POS_Library.ShopPos.ShipOutDA();
                        var MSListNewFinal = SO2.GetPerformanceSale(ClerkName, (int)POS_Library.Public.Utility.LogisticsType.撿貨, ShipId, _areaId);
                        Log.Add(0, OrderID, "4", "OrderStep:4,交易完成,無需印撿貨單", ClerkID, PosNo);
                    }
                }

                if (pickType == 1)
                {
                    PrintPickListsShelf = SO.PrintPickListsShelf(ticketTemp, ShipId, (int)Utility.ShipPDF.出貨重出, store, _areaId);
                    var SO2            = new POS_Library.ShopPos.ShipOutDA();
                    var MSListNewFinal = SO2.GetPerformanceSale(ClerkName, (int)POS_Library.Public.Utility.LogisticsType.撿貨, ShipId, _areaId);
                    Log.Add(0, OrderID, "3", "OrderStep:3 商品從不可銷庫存扣數完成,不需印檢貨單", ClerkID, PosNo);
                    UpdateReturnsOrderIDRelated();
                }
                result = true;

                #endregion
            }
            catch (Exception ex)
            {
                result   = false;
                ErrorMsg = ex.Message;
                string Event1 = string.Format("訂單編號:{0},發票號碼:{1},揀貨時發生失敗", OrderID, InvoiceNumberNow);
                string Event2 = string.Format("揀貨失敗原因:{0}", ErrorMsg);
                Log.Add(5, OrderID, InvoiceNumberNow, Event1 + Event2, ClerkID, PosNo);

                #region 記錄傳給WMS扣數之前的所有變數資料
                var    PickListData       = new { ticketTemp = ticketTemp, ShipId = ShipId, pickType = pickType, store = store, int_treasurytype = _areaId };
                string PickListDataString = JsonConvert.SerializeObject(PickListData);
                string FilePath           = HttpContext.Current.Server.MapPath(".") + string.Format("\\{0:yyyyMMdd}_{1}.txt", DateTime.Today, ShipId);
                using (System.IO.StreamWriter streamWriter = System.IO.File.AppendText(FilePath))
                {
                    streamWriter.WriteLine("{0:yyyy/MM/dd HH:mm:ss ffff}, {1}", DateTime.Now, PickListDataString);
                }
                #endregion
            }
            return(result);
        }