Пример #1
0
        private void txt_Barcode_TextChanged(object sender, EventArgs e)
        {
            //if (cbx_Agent.SelectedValue == null)
            //{
            //    MessageBox.Show("请先选择客户!");
            //    cbx_Agent.Focus();
            //    return;
            //}

            if (txt_Barcode.Text.Trim().Length >= 14)
            {
                string _barcode = txt_Barcode.Text.Trim();

                bool _isContain = false;
                foreach (InW i in allOut)
                {
                    if (i.Barcode == _barcode)
                    {
                        _isContain = true;
                        break;
                    }
                }
                if (_isContain)
                {
                    lab_Error.Text = "不能重复录入!";
                    return;
                }

                if (!InWDetail.Exists(_barcode))
                {
                    //MessageBox.Show("该条码不存在!");
                    lab_Error.Text = "该条码不存在!";
                    return;
                }
                if (SupplyDetail.Exists(_barcode))
                {
                    //MessageBox.Show("该条码已出仓,不能重复出仓!");
                    lab_Error.Text = "该条码已出仓,不能重复出仓!";
                    return;
                }
                InW w = new InW().GetModelByBarcode(_barcode);
                allOut.Add(w);
                BindDGV();
                txt_Barcode.Text = "";
                lab_Error.Text   = "";
            }
            else
            {
                lab_Error.Text = "";
            }
        }
Пример #2
0
        /// <summary>
        /// 批量上传输入条码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void link_Upload_Click(object sender, EventArgs e)
        {
            frmBatchUpload f = new frmBatchUpload();    // 本项目的 frmBatchUpload 窗体

            f.ShowDialog();
            if (f.batchList.Count > 0)  // batchList 为 frmBatchUpload 的数据成员
            {
                string _error = "";
                foreach (string _barcode in f.batchList)
                {
                    bool _isContain = false;
                    foreach (InW i in allOut)   // 本项目 Service 文件夹内的 InW 类(属于 Model 层)
                    {
                        if (i.Barcode == _barcode)
                        {
                            _isContain = true;
                            break;
                        }
                    }
                    if (_isContain)
                    {
                        _error += _barcode + "不能重复录入!\n";
                        continue;
                    }

                    if (!InWDetail.Exists(_barcode))
                    {
                        _error += _barcode + "该条码不存在!\n";
                        continue;
                    }
                    if (SupplyDetail.Exists(_barcode))
                    {
                        _error += _barcode + "该条码已出仓,不能重复出仓!\n";
                        continue;
                    }
                    InW w = new InW().GetModelByBarcode(_barcode);
                    allOut.Add(w);  // 如果该条码既不重复又还没出仓则添加到 allOut 中
                }
                if (!string.IsNullOrEmpty(_error))
                {
                    MessageBox.Show(_error);
                }
                BindDGV();  // 自定义函数

                // 重置相关内容
                txt_Barcode.Text = "";
                lab_Error.Text   = "";
            }
        }
Пример #3
0
        private void frmSupplyDetail_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;

            Supply s = new Supply(_supplyID);
            lab_Name.Text = "客户名称:" + s.AgentName;
            lab_Price.Text = "每平米价格:" + s.Price.ToString("0.00") + "元";
            lab_CreatTime.Text = "供货日期:" + s.CreateTime.ToString("yyyy-MM-dd");
            lab_Operator.Text = "操作人员:" + s.Operator;
            lab_Sum.Text = "总计金额:" + s.SumPrice.ToString("0.00") + "元";
            lab_SupplyID.Text = "(单号:" + _supplyID + ")";

            DataSet sd = new SupplyDetail().GetList(" SupplyID = '" + _supplyID + "'");

            dataGridView1.DataSource = sd.Tables[0];
        }
Пример #4
0
        private void frmSupplyDetail_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;

            Supply s = new Supply(_supplyID);   // 本项目 Service 中的 Supply 类(属于 Model 类)

            lab_Name.Text      = "客户名称:" + s.AgentName;
            lab_Price.Text     = "每平米价格:" + s.Price.ToString("0.00") + "元";
            lab_CreatTime.Text = "供货日期:" + s.CreateTime.ToString("yyyy-MM-dd");
            lab_Operator.Text  = "操作人员:" + s.Operator;
            lab_Sum.Text       = "总计金额:" + s.SumPrice.ToString("0.00") + "元";
            lab_SupplyID.Text  = "(单号:" + _supplyID + ")";

            DataSet sd = new SupplyDetail().GetList(" SupplyID = '" + _supplyID + "'");

            dataGridView1.DataSource = sd.Tables[0];
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbx_Agent.SelectedValue == null)
            {
                MessageBox.Show("请先选择客户!");
                cbx_Agent.Focus();
                return;
            }

            if (cbx_Level.SelectedValue == null)
            {
                MessageBox.Show("请先选择级别!");
                cbx_Level.Focus();
                return;
            }

            if (allOut.Count <= 0)
            {
                MessageBox.Show("没有要出货的成品!");
                return;
            }

            if (MessageBox.Show("确定要生成供货单吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            List <SupplyDetail> list = new List <SupplyDetail>();

            foreach (InW i in allOut)
            {
                SupplyDetail s = new SupplyDetail();
                s.Barcode  = i.Barcode;
                s.NormName = i.NormName;
                s.SumMoney = i.SumPrice;
                s.Length   = i.Length;
                s.Model    = i.Model;
                list.Add(s);
            }

            Supply m = new Supply();

            m.SupplyID  = GenSupplyID();
            m.AgentName = cbx_Agent.SelectedValue.ToString();
            m.Price     = _price;
            m.Operator  = Global.userName;
            m.SumPrice  = decimal.Parse(lab_Sum.Text.Replace("元", "").Trim());


            int re = m.Add(list);

            if (re > 0)
            {
                //MessageBox.Show("生成供应单成功!");
                _price = 0;
                cbx_Agent.SelectedIndex = -1;
                cbx_Level.SelectedIndex = -1;
                txt_Price.Text          = "";
                txt_Barcode.Text        = "";
                allOut = new List <InW>();
                BindDGV();

                frmSupplyReport ff = new frmSupplyReport(m.SupplyID);
                ff.Text = "生成供应单成功";
                ff.ShowDialog();
            }
            else
            {
                MessageBox.Show("生成供应单失败!");
            }
        }