Beispiel #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 = "";
            }
        }
Beispiel #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   = "";
            }
        }