/// <summary>
        /// 获取 dataGridView 的数据
        /// </summary>
        private void LoadService()
        {
            InWDetail m  = new InWDetail(); // 本项目的 Service 文件夹内的 InWDetail 类(属于 Model 层)
            DataSet   ds = m.GetList(" BatchID = '" + _batchID + "'");

            dataGridView1.DataSource = ds.Tables[0];
        }
Beispiel #2
0
        private void LoadService()
        {
            InWDetail m  = new InWDetail();
            DataSet   ds = m.GetList(" BatchID = '" + _batchID + "'");

            dataGridView1.DataSource = ds.Tables[0];
        }
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            List <string> list      = new List <string>();
            bool          _isTooBig = false;

            foreach (DataGridViewRow dvgr in dataGridView1.Rows)
            {
                if (dvgr.Cells["cSel"].Value != null && (bool)dvgr.Cells["cSel"].Value)
                {
                    list.Add(dvgr.Cells["cBarcode"].Value.ToString());
                    int _cnt = int.Parse(dvgr.Cells["cPrintCnt"].Value.ToString());
                    if (_cnt > 0)
                    {
                        _isTooBig = true;
                    }
                }
            }

            if (list.Count <= 0)
            {
                MessageBox.Show("请勾选要打印的条码!");
                return;
            }

            //如果超过1次,不是管理员就报错
            if (_isTooBig && !Global.IsAdmin)
            {
                MessageBox.Show("勾选的条码已超过打印次数,请联系管理员!");
                return;
            }

            InWDetail iw = new InWDetail();

            try
            {
                foreach (string s in list)
                {
                    // 因 TSC 打印机设置无效(会多次弹出有关警告),所以暂时注释掉下行代码
                    //BarcodeService.TSC(s);  // 项目 Common 的 BarcodeService 类
                    iw.UpdatePrintCnt(s);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("打印失败!原因:" + ex.Message);
                MyLog.WriteLog(ex.Message);
            }
            MessageBox.Show("打印结束!");

            LoadService();
            cbx_All_CheckedChanged(null, null);
        }
Beispiel #4
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 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            List<string> list = new List<string>();
            bool _isTooBig = false;
            foreach (DataGridViewRow dvgr in dataGridView1.Rows)
            {
                if (dvgr.Cells["cSel"].Value!=null && (bool)dvgr.Cells["cSel"].Value)
                {
                    list.Add(dvgr.Cells["cBarcode"].Value.ToString());
                    int _cnt = int.Parse(dvgr.Cells["cPrintCnt"].Value.ToString());
                    if (_cnt > 0)
                    {
                        _isTooBig = true;
                    }
                }
            }

            if (list.Count <= 0)
            {
                MessageBox.Show("请勾选要打印的条码!");
                return;
            }

            //如果超过1次,不是管理员就报错
            if (_isTooBig && !Global.IsAdmin)
            {

                MessageBox.Show("勾选的条码已超过打印次数,请联系管理员!");
                return;

            }

            InWDetail iw = new InWDetail();
            try
            {
                foreach (string s in list)
                {
                    BarcodeService.TSC(s);
                    iw.UpdatePrintCnt(s);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("打印失败!原因:" + ex.Message);
                MyLog.WriteLog(ex.Message);
            }
            MessageBox.Show("打印结束!");
            LoadService();
            cbx_All_CheckedChanged(null, null);
        }
Beispiel #6
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   = "";
            }
        }
Beispiel #7
0
 private void LoadService()
 {
     InWDetail m = new InWDetail();
     DataSet ds = m.GetList(" BatchID = '" + _batchID + "'");
     dataGridView1.DataSource = ds.Tables[0];
 }