Beispiel #1
0
 // Добавляет услугу для списания из списка
 private void SelectServiceDefect()
 {
     tmr.Stop();
     string tmplst = "";
     for (int i = 0; i < tblOrder.Rows.Count; i++)
     {
         if (i == (tblOrder.Rows.Count - 1))
             tmplst += "'" + tblOrder.Rows[i][2] + "'";
         else
             tmplst += "'" + tblOrder.Rows[i][2] + "',";
     }
     frmApplyDefect f = new frmApplyDefect();
     f.db_connection = db_connection;
     f.OrderNo = order.Orderno;
     f.GoodsFilter = tmplst;
     f.status = this.order.Distanation.Trim();
     f.ShowDialog();
     if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         /*
         _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
         _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
         _defect_count = decimal.Parse(f.txtCount.Text);
         _defect_type = int.Parse(f.txtType.SelectedValue.ToString());
         _defect_user = f.txtUser.Text;
         _defect_user_id = int.Parse(f.txtUser.SelectedValue.ToString());
         */
         AddToDefTable(f.txtGood.SelectedValue.ToString(), f.txtGood.Text, int.Parse(f.txtType.SelectedValue.ToString()),
                       decimal.Parse(f.txtCount.Text), f.txtUser.Text, int.Parse(f.txtUser.SelectedValue.ToString()),
                       f.txtMashine.SelectedValue.ToString(), f.txtPaper.SelectedValue.ToString());
     }
     tmr.Start();
 }
Beispiel #2
0
        private void SelectServ()
        {
            if (!Defect)
            {
                if (gridServices.GetData(gridServices.Row, 1) != null)
                {
                    if (this.add_to_order)
                    {
                        switch (gridServices.GetData(gridServices.Row, 6).ToString())
                        {
                            case "00001":
                                {
                                    frmApplyService fApply;
                                    if(Date!="")
                                        fApply = new frmApplyService(this.orderno, Date);
                                    else
                                        fApply = new frmApplyService(this.orderno);
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        this._content = fApply.Content;
                                        this._content_count = (decimal)this._content.Count;
                                    }
                                    else
                                    {
                                        frmQueryCount fCount = new frmQueryCount();
                                        fCount.ShowDialog();
                                        if (fCount.DialogResult == DialogResult.OK)
                                        {
                                            this._content_count = fCount.Count;
                                        }
                                        else
                                        {
                                            this._content_count = 0;
                                        }
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00002":
                                {
                                    frmSelectFrame fApply = new frmSelectFrame();
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content = fApply.Content;
                                        _content_count = fApply.Content_count;
                                    }
                                    else
                                    {
                                        frmQueryCount fCount = new frmQueryCount();
                                        fCount.ShowDialog();
                                        if (fCount.DialogResult == DialogResult.OK)
                                        {
                                            _content_count = fCount.Count;
                                        }
                                        else
                                        {
                                            _content_count = 0;
                                        }
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00003":
                                {
                                    frmQueryFrameParam fApply = new frmQueryFrameParam();
                                    string dir = "";
                                    try
                                    {
                                        orderno = orderno.Trim();
                                        Order.OrderInfo ord = new Photoland.Order.OrderInfo(db_connection, orderno);
                                        string date = "";
                                        if (ord.Datein != null)
                                            date = ord.Datein;
                                        else
                                            date = DateTime.Now.ToShortDateString();
                                        if (!Directory.Exists(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno))
                                            Directory.CreateDirectory(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno);
                                        if (!Directory.Exists(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan"))
                                            Directory.CreateDirectory(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan");
                                        dir = prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan";

                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    fApply.lblPath.Text = dir;
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПлощадь: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                        if (prop.Round3)
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                        else
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00004":
                                {
                                    frmQueryFrameParam2 fApply = new frmQueryFrameParam2();
                                    string dir = "";
                                    fApply.lblPath.Text = dir;
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПериметр: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                        if (prop.Round3)
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                        else
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                    fApply.Close();
                                    break;
                                }
                            default:
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        this._content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        this._content_count = 0;
                                    }
                                    break;
                                }
                        }
                    }
                }
                _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
                _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
                _stext_serv = gridServices.GetData(gridServices.Row, 7).ToString();
                if (this.add_to_order)
                {
                    if ((this._id_serv != "0") && (this._content_count > 0))
                        this.DialogResult = DialogResult.OK;
                    else
                        this.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    if (this._id_serv != "0")
                        this.DialogResult = DialogResult.OK;
                    else
                        this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                frmApplyDefect f = new frmApplyDefect();
                f.db_connection = db_connection;
                f.OrderNo = orderno;
                f.ShowDialog();
                if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
                    _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
                    _stext_serv = gridServices.GetData(gridServices.Row, 7).ToString();
                    _defect_count = decimal.Parse(f.txtCount.Text);
                    _defect_type = int.Parse(f.txtType.SelectedValue.ToString());
                    _defect_user = f.txtUser.Text;
                    _defect_user_id = int.Parse(f.txtUser.SelectedValue.ToString());

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
        }
Beispiel #3
0
        // Добавляет услугу для списания из списка
        private void SelectServiceDefect()
        {
            tmr.Stop();
            string tmplst = "";
            List<string> tlst = new List<string>();
            for (int i = 0; i < tblOrder.Rows.Count; i++)
            {
                if (i == (tblOrder.Rows.Count - 1))
                    tmplst += "'" + tblOrder.Rows[i][2] + "'";
                else
                    tmplst += "'" + tblOrder.Rows[i][2] + "',";
                tlst.Add(tblOrder.Rows[i]["id"].ToString().Trim() + ";" + tblOrder.Rows[i]["ActCount"].ToString());
            }

            frmApplyDefect f = new frmApplyDefect();
            f.goodsfromorder = tlst;
            f.db_connection = db_connection;
            f.OrderNo = order.Orderno;
            f.GoodsFilter = tmplst;
            f.status = this.order.Distanation.Trim();
            f.ShowDialog();
            if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                /*
                _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
                _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
                _defect_count = decimal.Parse(f.txtCount.Text);
                _defect_type = int.Parse(f.txtType.SelectedValue.ToString());
                _defect_user = f.txtUser.Text;
                _defect_user_id = int.Parse(f.txtUser.SelectedValue.ToString());
                */
                if ((order.Orderno.Substring(0, 1) == prop.Order_terminal_prefics.Substring(0, 1)) || (order.Orderno.Substring(0,1)==prop.OrderPixlPark.Substring(0,1)))
                {
                    decimal defPrice = 0;
                    for (int i = 0; i < tblOrder.Rows.Count; i++)
                    {
                        if (tblOrder.Rows[i]["id"].ToString().Trim() == f.txtGood.SelectedValue.ToString().Trim())
                        {
                            defPrice = Decimal.Parse(tblOrder.Rows[i]["Price"].ToString());
                        }
                    }
                    AddToDefTable(f.txtGood.SelectedValue.ToString(), f.txtGood.Text, int.Parse(f.txtType.SelectedValue.ToString()),
                        decimal.Parse(f.txtCount.Text), f.txtUser.Text, int.Parse(f.txtUser.SelectedValue.ToString()),
                        f.txtMashine.SelectedValue.ToString(), f.txtPaper.SelectedValue.ToString(), f.txtComment.Text, defPrice);
                }
                else
                {
                    AddToDefTable(f.txtGood.SelectedValue.ToString(), f.txtGood.Text, int.Parse(f.txtType.SelectedValue.ToString()),
                        decimal.Parse(f.txtCount.Text), f.txtUser.Text, int.Parse(f.txtUser.SelectedValue.ToString()),
                        f.txtMashine.SelectedValue.ToString(), f.txtPaper.SelectedValue.ToString(), f.txtComment.Text);
                }

                if (((f.txtType.SelectedValue.ToString().Trim() == "10") && (order.Orderno.Substring(0, 1) != prop.Order_terminal_prefics.Substring(0, 1))) ||
                    ((f.txtType.SelectedValue.ToString().Trim() == "10") && (order.Orderno.Substring(0, 1) != prop.OrderPixlPark.Substring(0, 1))))
                {
                    bool _tmp = false;
                    while (!_tmp)
                    {
                        if (
                            MessageBox.Show("Возврат <" + f.txtGood.Text.Trim() + "> отправляется на переделку?\n\nВНИМАНИЕ! ЗАКАЗ БУДЕТ АВТОМАТИЧЕСКИ СОХРАНЕН С НОВЫМИ СТРОЧКАМИ И ПЕРЕНЕСЕН В СТАТУС \"ПРЕДВАРИТЕЛЬНЫЙ ПРОСМОТР\"\n\n",
                                            "Возврат", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                            DialogResult.Yes)
                        {
                            frmQueryCount fcount = new frmQueryCount();
                            fcount.Count = decimal.Parse(f.txtCount.Text);
                            fcount.ShowDialog();
                            if (fcount.DialogResult == System.Windows.Forms.DialogResult.OK)
                            {
                                AddEvent("Блокирование строчек");
                                _tmp = true;
                                List<string> _tmp_comment = new List<string>();
                                _tmp_comment.Add("Переделка возврата");
                                AddToServTable(f.txtGood.SelectedValue.ToString(), f.txtGood.Text, "", fcount.Count, _tmp_comment);
                                order.AdvancedPayment += order.FinalPayment;
                                order.FinalPayment = 0;
                                ReBild();
                                if(order.UpdateOrder(usr, false, false, false))
                                {
                                    AddEvent("Сделан возврат и переделка");
                                    initOrder(order.Id);
                                    frmOrderClose_Load(this, new EventArgs());
                                    order.Distanation = "000010";
                                    if (!order.UpdateOrder(usr, false, false, false))
                                    {
                                        MessageBox.Show("При назначении нового статуса произошла ошибка!\n" + order.Err, "Ошибка",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    }
                                    else
                                    {
                                        AddEvent("Заказу присвоен новый статус");
                                        initOrder(order.Id);
                                        frmOrderClose_Load(this, new EventArgs());
                                    }

                                }
                                else
                                {
                                    MessageBox.Show("Произошла ошибка во время сохранения заказа!", "Ошибка",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                _tmp = false;
                            }
                        }
                        else
                        {
                            _tmp = true;
                        }
                    }
                }

            }
            tmr.Start();
        }