コード例 #1
0
ファイル: InW.cs プロジェクト: uwitec/Warehouse
        private InW GetOneModel(StringBuilder strSql, SqlParameter[] parameters)
        {
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                InW model = new InW();
                //if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                //{
                //    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                //}
                if (ds.Tables[0].Rows[0]["BatchID"] != null)
                {
                    model.Batch = ds.Tables[0].Rows[0]["BatchID"].ToString();
                }
                //if (ds.Tables[0].Rows[0]["NormID"] != null && ds.Tables[0].Rows[0]["NormID"].ToString() != "")
                //{
                //    model.NormID = int.Parse(ds.Tables[0].Rows[0]["NormID"].ToString());
                //}
                if (ds.Tables[0].Rows[0]["Barcode"] != null)
                {
                    model.Barcode = ds.Tables[0].Rows[0]["Barcode"].ToString();
                }
                //if (ds.Tables[0].Rows[0]["BigCnt"] != null && ds.Tables[0].Rows[0]["BigCnt"].ToString() != "")
                //{
                //    model.BigCnt = int.Parse(ds.Tables[0].Rows[0]["BigCnt"].ToString());
                //}
                //if (ds.Tables[0].Rows[0]["Machine"] != null && ds.Tables[0].Rows[0]["Machine"].ToString() != "")
                //{
                //    model.Machine = int.Parse(ds.Tables[0].Rows[0]["Machine"].ToString());
                //}
                if (ds.Tables[0].Rows[0]["Length"] != null && ds.Tables[0].Rows[0]["Length"].ToString() != "")
                {
                    model.Length = int.Parse(ds.Tables[0].Rows[0]["Length"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Cnt"] != null && ds.Tables[0].Rows[0]["Cnt"].ToString() != "")
                {
                    model.Cnt = int.Parse(ds.Tables[0].Rows[0]["Cnt"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateTime"] != null && ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NormName"] != null && ds.Tables[0].Rows[0]["NormName"].ToString() != "")
                {
                    model.NormName = ds.Tables[0].Rows[0]["NormName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Model"] != null && ds.Tables[0].Rows[0]["Model"].ToString() != "")
                {
                    model.Model = ds.Tables[0].Rows[0]["Model"].ToString();
                }
                //if (ds.Tables[0].Rows[0]["InTime"] != null && ds.Tables[0].Rows[0]["InTime"].ToString() != "")
                //{
                //    model.InTime = DateTime.Parse(ds.Tables[0].Rows[0]["InTime"].ToString());
                //}
                return(model);
            }
            return(null);
        }
コード例 #2
0
ファイル: frmGoodsIn.cs プロジェクト: uwitec/Warehouse
        private void BindDGV()
        {
            int     _count = 0;
            DataSet ds     = new InW().GetPageList(pagerControl1.PageSize, pagerControl1.PageIndex, "", out _count);

            dataGridView1.DataSource = ds.Tables[0];
            pagerControl1.DrawControl(_count);
        }
コード例 #3
0
        //private void button3_Click(object sender, EventArgs e)
        //{
        //    btn_GenNo.Visible = false;
        //    frmStartScan f = new frmStartScan();
        //    f.ShowDialog();
        //    btn_GenNo.Visible = true;
        //}

        public void AddDGV(string barcode)
        {
            InW m = new InW().GetModelByBarcode(barcode);

            if (m != null)
            {
                allOut.Add(m);
                BindDGV();
            }
        }
コード例 #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 = "";
            }
        }
コード例 #5
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   = "";
            }
        }
コード例 #6
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Columns["cDel"].Index == e.ColumnIndex)
     {
         string v  = dataGridView1.Rows[e.RowIndex].Cells["cBarcode"].Value.ToString();
         InW    _w = null;
         foreach (InW i in allOut)
         {
             if (i.Barcode == v)
             {
                 _w = i;
                 break;
             }
         }
         if (_w != null)
         {
             allOut.Remove(_w);
             BindDGV();
         }
     }
 }
コード例 #7
0
ファイル: frmGoodsIn.cs プロジェクト: uwitec/Warehouse
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == dataGridView1.Columns["cPrint"].Index)
     {
         object v = dataGridView1.Rows[e.RowIndex].Cells["cBatch"].Value;
         if (v != null)
         {
             frmInDetail f = new frmInDetail(v.ToString());
             f.ShowDialog();
         }
     }
     else if (e.ColumnIndex == dataGridView1.Columns["cDel"].Index)
     {
         if (MessageBox.Show(this, "删除后数据不能恢复,是否继续删除?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             object v = dataGridView1.Rows[e.RowIndex].Cells["cBatch"].Value;
             if (v != null)
             {
                 InW no = new InW();
                 if (no.IsRelation(v.ToString()))
                 {
                     MessageBox.Show("该批条码已被出仓,禁止删除!");
                     return;
                 }
                 int re = no.Delete(v.ToString());
                 if (re > 0)
                 {
                     MessageBox.Show("删除成功!");
                     BindDGV();
                 }
                 else
                 {
                     MessageBox.Show("删除失败!");
                 }
             }
         }
     }
 }
コード例 #8
0
ファイル: frmGoodsIn.cs プロジェクト: uwitec/Warehouse
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string modelStr = txt_Model.Text.Trim();
            string macStr   = cbx_Machine.Text;
            string bigStr   = cbx_Big.Text;
            string cntStr   = cbx_Cnt.Text;
            string lenStr   = txt_Length.Text.Trim();

            if (string.IsNullOrEmpty(cntStr) || string.IsNullOrEmpty(bigStr) || string.IsNullOrEmpty(macStr))
            {
                MessageBox.Show("卷数或件数格式不正确!");
                cbx_Cnt.Focus();
                return;
            }
            if (string.IsNullOrEmpty(modelStr))
            {
                MessageBox.Show("请输入成品型号!");
                txt_Model.Focus();
                return;
            }
            if (!ValidateService.IsNumber(lenStr))
            {
                MessageBox.Show("米数不正确!");
                txt_Length.Focus();
                return;
            }

            try
            {
                InW m = new InW();
                m.Model    = modelStr;
                m.NormName = cbx_Norm.SelectedValue.ToString();
                m.Machine  = int.Parse(macStr);
                m.BigCnt   = int.Parse(bigStr);
                m.Cnt      = int.Parse(cntStr);
                m.Length   = int.Parse(lenStr);
                m.Batch    = GenBatchNO();
                List <string> barList = GenBarcode(m.Machine, m.BigCnt, m.Cnt);
                m.Barcode  = barList[0] + "~" + barList[barList.Count - 1];
                m.Operator = Global.userName;
                m.InTime   = dtp_InTime.Value;


                int re = m.Add(barList);
                if (re > 0)
                {
                    MessageBox.Show("入库成功!");
                    BindDGV();
                }
                else
                {
                    MessageBox.Show("入库失败!");
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("99"))
                {
                    MessageBox.Show("每天同一规格成品入仓数量不能大于99件!");
                    //txt_Cnt.Focus();
                }
                else
                {
                    MessageBox.Show("系统异常! 详细:" + ex.Message);
                }
            }
        }
コード例 #9
0
ファイル: InW.cs プロジェクト: TGHGH/Warehouse-1
 private InW GetOneModel(StringBuilder strSql, SqlParameter[] parameters)
 {
     DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         InW model = new InW();
         //if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
         //{
         //    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
         //}
         if (ds.Tables[0].Rows[0]["BatchID"] != null)
         {
             model.Batch = ds.Tables[0].Rows[0]["BatchID"].ToString();
         }
         //if (ds.Tables[0].Rows[0]["NormID"] != null && ds.Tables[0].Rows[0]["NormID"].ToString() != "")
         //{
         //    model.NormID = int.Parse(ds.Tables[0].Rows[0]["NormID"].ToString());
         //}
         if (ds.Tables[0].Rows[0]["Barcode"] != null)
         {
             model.Barcode = ds.Tables[0].Rows[0]["Barcode"].ToString();
         }
         //if (ds.Tables[0].Rows[0]["BigCnt"] != null && ds.Tables[0].Rows[0]["BigCnt"].ToString() != "")
         //{
         //    model.BigCnt = int.Parse(ds.Tables[0].Rows[0]["BigCnt"].ToString());
         //}
         //if (ds.Tables[0].Rows[0]["Machine"] != null && ds.Tables[0].Rows[0]["Machine"].ToString() != "")
         //{
         //    model.Machine = int.Parse(ds.Tables[0].Rows[0]["Machine"].ToString());
         //}
         if (ds.Tables[0].Rows[0]["Length"] != null && ds.Tables[0].Rows[0]["Length"].ToString() != "")
         {
             model.Length = int.Parse(ds.Tables[0].Rows[0]["Length"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Cnt"] != null && ds.Tables[0].Rows[0]["Cnt"].ToString() != "")
         {
             model.Cnt = int.Parse(ds.Tables[0].Rows[0]["Cnt"].ToString());
         }
         if (ds.Tables[0].Rows[0]["CreateTime"] != null && ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["NormName"] != null && ds.Tables[0].Rows[0]["NormName"].ToString() != "")
         {
             model.NormName = ds.Tables[0].Rows[0]["NormName"].ToString();
         }
         if (ds.Tables[0].Rows[0]["Model"] != null && ds.Tables[0].Rows[0]["Model"].ToString() != "")
         {
             model.Model = ds.Tables[0].Rows[0]["Model"].ToString();
         }
         //if (ds.Tables[0].Rows[0]["InTime"] != null && ds.Tables[0].Rows[0]["InTime"].ToString() != "")
         //{
         //    model.InTime = DateTime.Parse(ds.Tables[0].Rows[0]["InTime"].ToString());
         //}
         return model;
     }
     return null;
 }