/// <summary>
        /// INSERT OK 之后,显示对应的数据
        /// </summary>
        /// <param name="buf"></param>
        private void ShowData(string buf)
        {
            try
            {
                StringBuilder sql = new StringBuilder("select fct_code, material_code," +
                                                      " (select b.description from " + SecuGlobal.tb_fpp_itemmaster + " b where a.material_code = b.matnr) description," +
                                                      "  barcode_flag, board_count,  update_date, update_time, update_user" +
                                                      "  from " + SecuGlobal.tbMaster + " a  where 1=1 ");

                if (!string.IsNullOrEmpty(buf))
                {
                    sql.Append(" and material_code = '" + buf + "'");
                }

                sql.Append(" and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' order by update_date desc,update_time desc");

                SecuGlobal.GridViewInitial(grdView1, gridControl1);
                DataTable dt = OracleHelper.ExecuteDataTable(sql.ToString());
                dt = setDtHeader(dt);
                gridControl1.DataSource = dt;
                setGirdView();
            }
            catch (Exception ShowData)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, ShowData.Message);
            }
        }
        /// <summary>
        /// 后台查询数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    btnQuery.Enabled = false;

                    SecuGlobal.GridViewInitial(gridView1, gridControl1);
                    SecuGlobal.GridViewInitial(gridView2, gridControl2);

                    DataTable dt = null;
                    dt           = OracleHelper.ExecuteDataTable(getSql(plantCode, vendorCode4, dFrom, dTo, status)); //vendorCode4 BP3A
                    if (dt == null)
                    {
                        return;
                    }

                    dt = setDtHeader(dt); //更改标题栏和显示顺序

                    gridControl1.DataSource = dt;
                    gridView1.BestFitColumns();

                    gridView1.Columns["申请单号"].SummaryItem.SummaryType   = SummaryItemType.Count;
                    gridView1.Columns["申请单号"].SummaryItem.DisplayFormat = "All:{0:f0} ";

                    btnQuery.Enabled = true;
                });
            }
            catch (Exception err)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, err.Message);
            }
        }
 private void ckClipBorad_CheckedChanged(object sender, EventArgs e)
 {
     btnSave.Enabled = false;
     SecuGlobal.GridViewInitial(grdView1, gridControl1);
     if (ckClipBorad.Checked)
     {
         SecuGlobal.showOK(panelStatus, lblStatus, "剪贴板方式:打开EXCEL-复制要上载的数据<标题栏除外>,然后点击批量上载");
     }
     else
     {
         SecuGlobal.showOK(panelStatus, lblStatus, "Excel方式");
     }
 }
        private void showData(string vendCode, string sec_sn)
        {
            SecuGlobal.GridViewInitial(gridView1, grdControl1);
            string sql = " select serial_NO ,vendor ,sec_sn ,add_datetime from " + SecuGlobal.tbSnSecuHist + "   " +
                         " where vendor = '" + vendCode + "' and sec_sn = '" + sec_sn + "' and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' order by serial_no ";
            DataTable dt = OracleHelper.ExecuteDataTable(sql);

            grdControl1.DataSource = dt;


            gridView1.Columns["SERIAL_NO"].SummaryItem.SummaryType   = SummaryItemType.Count;
            gridView1.Columns["SERIAL_NO"].SummaryItem.DisplayFormat = "All: {0:f0} ";
        }
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            try
            {
                if (ckClipBorad.Checked)  //从剪切板获取数据 - 某些EXCEL 格式异常,采用此方式进行
                {
                    if (!bGetDataClipboradAndAnalysis())
                    {
                        return;
                    }
                    else
                    {
                        btnSave.Enabled = true;   // 遍历上传的数据,如果都可用,则Save Enabled = TRUE
                        SecuGlobal.showOK(panelStatus, lblStatus, "数据读取和分析OK ,请按保存按钮上传数据...");
                        return;
                    }
                }

                SecuGlobal.showOK(panelStatus, lblStatus, "文件打开中,请稍等...");
                SecuGlobal.GridViewInitial(grdView1, gridControl1);

                OpenFileDialog fd = new OpenFileDialog();
                fd.Filter           = "Excel文件(*.xls;*.xlsx)|*.xls;*.xlsx"; //过滤文件类型
                fd.InitialDirectory = Application.StartupPath + "\\Temp\\";
                fd.ShowReadOnly     = true;

                DialogResult r = fd.ShowDialog();
                if (r == DialogResult.OK)
                {
                    excelFileName   = fd.FileName;
                    excelFirstTable = GetExcelFirstTableName(excelFileName);
                    DataTable dt = dtImportExcel(excelFileName, excelFirstTable);

                    gridControl1.DataSource = dt;

                    if (!bAnalysisUploadData(dt))
                    {
                        return;
                    }


                    btnSave.Enabled = true;   // 遍历上传的数据,如果都可用,则Save Enabled = TRUE
                    SecuGlobal.showOK(panelStatus, lblStatus, "数据读取和分析OK ,请按保存按钮上传数据...");
                }
            }
            catch (Exception btnOpenFile_Click)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, btnOpenFile_Click.Message);
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                SecuGlobal.showOK(panelStatus, lblStatus, "数据查询中,请稍等...");
                SecuGlobal.GridViewInitial(grdView1, gridControl1);

                backgroundWorker1.RunWorkerAsync();
                SplashScreenManager.ShowForm(typeof(WaitLoading));
            }
            catch (Exception ex)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, ex.Message);
            }
        }
Example #7
0
        /// <summary>
        /// 后台查询数据并且显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                getVariable();
                DataTable dt = null;

                this.Invoke((MethodInvoker) delegate
                {
                    switch (queryType)
                    {
                    case "SUMMARY":
                        dt = OracleHelper.ExecuteDataTable(getSqlSummary(ls_req_vendor, ls_sdate, ls_edate, ls_material_code, ls_plant));
                        if (dt != null)
                        {
                            dt = setDtHeader(dt);
                        }

                        SecuGlobal.GridViewInitial(grdView1, gridControl1);
                        gridControl1.DataSource = dt;
                        grdView1.BestFitColumns();

                        grdView1.Columns["描述"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
                        grdView1.Columns["描述"].SummaryItem.SummaryType   = SummaryItemType.Count;
                        grdView1.Columns["描述"].SummaryItem.DisplayFormat = "All: {0:f0}";

                        break;

                    case "DETAIL":
                        dt = OracleHelper.ExecuteDataTable(getSqlDetail(ls_req_vendor, ls_sdate, ls_edate));

                        SecuGlobal.GridViewInitial(grdView1, gridControl1);
                        gridControl1.DataSource = dt;
                        grdView1.BestFitColumns();

                        grdView1.Columns["REQ_VENDOR"].SummaryItem.SummaryType   = SummaryItemType.Count;
                        grdView1.Columns["REQ_VENDOR"].SummaryItem.DisplayFormat = "All: {0:f0}";
                        break;
                    }
                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                });
            }
            catch (Exception err)
            {
                XtraMessageBox.Show(this, "System error[ShowData]: " + err.Message);
            }
        }
Example #8
0
        /// <summary>
        /// 根据选择内容,获取截取字符串
        /// 设置基本信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void radioGroup2_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            tbQty.Text = "";
            switch (is_security_type)
            {
            case "SAMSUNG":
                if (radioGroup2.SelectedIndex == 0)     //整箱
                {
                    strUnitType = "BOX";
                    tbQty.Text  = "20000";
                    getScanSplitValue("353");
                }
                else if (radioGroup2.SelectedIndex == 1)     //整卷
                {
                    strUnitType = "ROLL";
                    tbQty.Text  = "2500";
                    getScanSplitValue("354");
                }
                else     //单个
                {
                    strUnitType = "ONE";
                    tbQty.Text  = "1";
                    SecuGlobal.GridViewInitial(grdScanSetting, grdControl2);
                }
                break;

            case "XEROX":
                if (radioGroup2.SelectedIndex == 1)     //整卷
                {
                    strUnitType = "ROLL";
                    tbQty.Text  = "10000";
                    getScanSplitValue("355");
                }
                else if (radioGroup2.SelectedIndex == 2)     //单个
                {
                    strUnitType = "ONE";
                    tbQty.Text  = "1";
                }
                break;
            }
            clear();

            SecuGlobal.showOK(panelStatus, lblStatus, "投入类型为:" + is_security_type + " < " + strUnitType + " >");
        }
        /// <summary>
        /// 后台加载数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    doc_no = this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns["申请单号"]).ToString();
                    SecuGlobal.GridViewInitial(gridView2, gridControl2); //清除

                    DataTable dt = OracleHelper.ExecuteDataTable(getSql2(doc_no, plantCode));
                    dt           = setDtHeader1(dt);
                    girdView2DataLoading(dt); //加载数据到GridView2 中
                });
            }
            catch (Exception err)
            {
                XtraMessageBox.Show(this, "System error[ShowData]: " + err.Message);
            }
        }
Example #10
0
        /// <summary>
        /// 后台查询数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    getVariable(); //获取变量信息
                    if (vend4.Equals(""))
                    {
                        SecuGlobal.showNG(panelStatus, lblStatus, "vendor code 4 为空");
                        return;
                    }

                    SecuGlobal.GridViewInitial(gridView1, gridControl1);

                    DataTable dt = OracleHelper.ExecuteDataTable(getSql(ls_plant, vend4, ls_sdate, ls_edate));  //ls_plant - %

                    if (dt == null)
                    {
                        SecuGlobal.showOK(panelStatus, lblStatus, "没有查询到符合条件的数据");
                        return;
                    }

                    dt = setDtHeader(dt); //更改标题栏和显示顺序
                    gridControl1.DataSource = dt;
                    gridView1.BestFitColumns();

                    gridView1.Columns["申请单号"].SummaryItem.SummaryType   = SummaryItemType.Count;
                    gridView1.Columns["申请单号"].SummaryItem.DisplayFormat = "All:{0:f0} ";

                    GridCheckMarksSelection selection      = new GridCheckMarksSelection(gridView1); // 增加CHECKBOX
                    selection.CheckMarkColumn.VisibleIndex = 0;
                    selection.SelectionChanged            += selection_SelectionChanged;

                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                });
            }
            catch (Exception err)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, err.Message);
            }
        }
Example #11
0
        /// <summary>
        /// 显示数据到GRID,申请单号为查询条件
        /// </summary>
        /// <param name="doc_no"></param>
        private void showData(string doc_no)
        {
            try
            {
                SecuGlobal.showOK(panelStatus, lblStatus, "正在查询数据,请稍等...");
                SecuGlobal.GridViewInitial(gridView2, gridControl1);

                string sql = " select fct_code, doc_no, doc_seq, item, qty,  " +
                             "        box_no, roll_no, lot_no,  " +
                             "        security_start, security_end, security_type,  " +
                             "        unit, gr_date, gr_time,  " +
                             "        gr_user, gr_ip " +
                             " from " + SecuGlobal.tbSecurityInTest + " " +
                             " where doc_no = '" + doc_no + "' and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'" +
                             " order by doc_seq desc ";

                DataTable dt = OracleHelper.ExecuteDataTable(sql);
                if (dt == null)
                {
                    return;
                }

                dt = setDtHeader(dt);
                gridControl1.DataSource = dt;
                gridView2.BestFitColumns();

                gridView2.Columns["Doc No"].SummaryItem.SummaryType   = SummaryItemType.Count;
                gridView2.Columns["Doc No"].SummaryItem.DisplayFormat = "All: {0:f0} ";

                gridView2.Columns["Qty"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
                gridView2.Columns["Qty"].Width = 100;
                gridView2.Columns["Qty"].SummaryItem.SummaryType   = SummaryItemType.Sum;
                gridView2.Columns["Qty"].SummaryItem.DisplayFormat = "{0:f0} ";

                SecuGlobal.showOK(panelStatus, lblStatus, "OK");
            }
            catch (Exception showData)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, showData.Message);
            }
        }
        /// <summary>
        /// 添加信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbRemark.Text) || string.IsNullOrEmpty(cbDept.Text) || string.IsNullOrEmpty(cbMeterial.Text) || string.IsNullOrEmpty(tbUser.Text))
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "请填写基本信息");
                return;
            }

            if (bFirstAdd)  // 判断是否是第一次写入数据
            {
                SecuGlobal.GridViewInitial(gridView1, gridControl1);
            }


            if (gridView1.RowCount > 0)    // 一个申请单号中不允许添加不同类型的CODE
            {
                string bufAssyCode = cbMeterial.Text;
                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    object val = gridView1.GetRowCellValue(i, gridView1.Columns["材料"]);
                    if (val.ToString().Equals(bufAssyCode))
                    {
                        SecuGlobal.showNG(panelStatus, lblStatus, "已经添加的材料信息" + bufAssyCode);
                        return;
                    }
                }
            }

            getVariable();

            if (reqQty <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "请确认申请数量");
                return;
            }

            add();//添加数据到GridView
            SecuGlobal.showOK(panelStatus, lblStatus, "OK");
            bFirstAdd = false;
        }