Beispiel #1
0
        /// <summary>
        /// 获取资材编号,添加到ComboBox
        /// </summary>
        private void getAssyList()
        {
            try
            {
                string sql = "select MATERIAL_CODE from " + SecuGlobal.tbMaster + " where barcode_flag = 'Y' and " +
                             "FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' order by MATERIAL_CODE ";
                OracleDataReader odr = OracleHelper.ExecuteReader(sql);

                if (odr.HasRows)
                {
                    cbAssyAdd.Properties.Items.Clear();
                    while (odr.Read())
                    {
                        cbAssyAdd.Properties.Items.Add(odr["MATERIAL_CODE"]);
                    }
                }
                else
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "没有Master信息,请联系仓库担当");
                }
            }
            catch (Exception getAssyList)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, getAssyList.Message);
            }
        }
        /// <summary>
        /// 申请单删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                SecuGlobal.showOK(panelStatus, lblStatus, "正在删除申请单数据,请稍等...");
                if (gridView2.RowCount <= 0)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "没有申请单信息");
                    return;
                }

                DialogResult dr = MessageBox.Show("确认删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.OK)
                {
                    if (bReqDocDelete())
                    {
                        SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                    }
                }
            }
            catch (Exception btnDelete_Click)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, btnDelete_Click.Message);
            }
        }
        private bool bAnalysisData()
        {
            int a = 0;

            if (gridView1.RowCount <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "没有要保存的数据!");
                return(false);
            }

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                object valAssy = gridView1.GetRowCellValue(i, gridView1.Columns["材料"]);
                object valReq  = gridView1.GetRowCellValue(i, gridView1.Columns["申请数量"]);
                if (valReq.ToString().Equals("0"))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, valAssy + ": 发料数不能为零");
                    return(false);
                }

                if (!int.TryParse(valReq.ToString(), out a))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, valAssy + ": 发料数量不是有效数字");
                    return(false);
                }
            }
            return(true);
        }
        /// <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>
        /// 验证扫描的SN范围计算的数量和设定的数量是否一致
        /// </summary>
        /// <returns></returns>
        private bool QtyInputCheck_Roll()
        {
            int li_sec_calc_sum = 0;

            if (inputType.Equals("ROLL"))
            {
                if (secuType.Equals("SAMSUNG"))
                {
                    string sql1 = "select to_number(substr('" + ls_sn_to + "',8,8)) - to_number(substr('" + ls_sn_from + "',8,8)) + 1 from dual";
                    li_sec_calc_sum = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql1));
                }
                else if (secuType.Equals("XEROX"))
                {
                    string sql2 = "select to_number(substr('" + ls_sn_to + "',3,7)) - to_number(substr('" + ls_sn_from + "',3,7)) + 1 from dual";
                    li_sec_calc_sum = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql2));
                }

                if (!li_sec_calc_sum.Equals(li_sec_cnt))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "计算数量与设定数量不一致,不允许保存!");
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 成卷/ONE 选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rdType_SelectedIndexChanged(object sender, EventArgs e)
        {
            secuType   = "";
            tbQty.Text = "";
            if (rdType.SelectedIndex == 0)
            {
                secuType = "SAMSUNG";
                if (rdInput.SelectedIndex == 1)
                {
                    tbQty.Text = "2500";
                }
                else
                {
                    tbQty.Text = "1";
                }
            }
            else if (rdType.SelectedIndex == 1)
            {
                secuType = "XEROX";
                if (rdInput.SelectedIndex == 1)
                {
                    tbQty.Text = "10000";
                }
                else
                {
                    tbQty.Text = "1";
                }
            }
            else
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "获取类型异常错误");
            }

            SecuGlobal.showOK(panelStatus, lblStatus, "Ready ! 当前类型:" + secuType + "投入类型:" + inputType);
        }
Beispiel #7
0
        private void MeterialGi_Load(object sender, EventArgs e)
        {
            SecuGlobal.setDate(dateEditFrom, dateEditTo);


            if (PaCSGlobal.LoginUserInfo.Fct_code.Equals("C660A"))
            {
                cbPlant.Text = "SSDP";
            }
            else
            {
                cbPlant.Text = "SESC";
            }

            plantInsert = cbPlant.Text;

            string bufVend = SecuGlobal.getPopVendorInfo(PaCSGlobal.LoginUserInfo.Venderid, PaCSGlobal.LoginUserInfo.Fct_code);

            if (!bufVend.Equals(""))
            {
                cbVendor.Text = bufVend;
            }
            else
            {
                cbVendor.Text = PaCSGlobal.LoginUserInfo.Venderid + ":" + PaCSGlobal.LoginUserInfo.Vendername;  //苏州法人
            }

            if (!bGetInfo(bufVend.Substring(0, 4)))
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "材料信息/line 信息获取失败");
                return;
            }

            SecuGlobal.showOK(panelStatus, lblStatus, "Ready");
        }
Beispiel #8
0
        /// <summary>
        /// 出库取消操作判定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private bool bCheckCancleQty(string ls_company, string ls_doc_no, string li_doc_seq)
        {
            try
            {
                int    ll_doc_qty = 0, ll_have_bk_doc_qty = 0;
                string sql = "select nvl(doc_qty,0) from " + SecuGlobal.tbSecurityDoc + " where " +
                             "company = '" + ls_company + "' and doc_no = '" + ls_doc_no + "' and doc_seq = '" + li_doc_seq + "' " +
                             "and fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";

                ll_doc_qty = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql).ToString());

                string sql1 = "select nvl(sum(doc_qty),0) ll_have_bk_doc_qty  from " + SecuGlobal.tbSecurityDoc + " where " +
                              "bk_company = '" + ls_company + "' and bk_doc_no = '" + ls_doc_no + "' and bk_doc_seq = '" + li_doc_seq + "' " +
                              "and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
                ll_have_bk_doc_qty = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql1).ToString());

                if (ll_have_bk_doc_qty == ll_doc_qty)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "本条记录已全部返退,不能再进行返退!");
                    return(false);;
                }

                tbDocQty.Text = (ll_doc_qty - ll_have_bk_doc_qty).ToString(); //可以返退的数量

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        /// <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);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 获取Meterial Code
        /// LOAD 事件中加载
        /// </summary>
        private void getMeterialCode()
        {
            try
            {
                string sql = " select material_code from " + SecuGlobal.tbMaster + " where " +
                             " FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' order by material_code ";
                OracleDataReader odr = OracleHelper.ExecuteReader(sql);

                if (odr.HasRows)
                {
                    while (odr.Read())
                    {
                        cbMeterial.Properties.Items.Add(odr["material_code"]);
                    }
                }
                else
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "没有找到MASTER 信息");
                }
            }
            catch (Exception getVendorCode)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, getVendorCode.Message);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 查询库存信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbMeterial_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cbMeterial.SelectedIndex != -1)
                {
                    meterialCode = cbMeterial.Properties.Items[cbMeterial.SelectedIndex].ToString();
                }
                else
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "请选择材料信息");
                    return;
                }


                DataTable dt = OracleHelper.ExecuteDataTable(getSql(ls_company, ls_plant, meterialCode));    //ls_company ('BP3A')  ls_plant('SSDP')
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        barcode        = dr["barcode_flag"].ToString();
                        assyDesc       = dr["description"].ToString();
                        txtRemain.Text = dr["stock_qty"].ToString();
                        remain         = txtRemain.Text.Trim();
                    }
                }
                SecuGlobal.showOK(panelStatus, lblStatus, "材料选择改变,请确认信息" + meterialCode);
            }
            catch (Exception error)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, error.Message);
            }
        }
 private void btnDoorPrint_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(doc_no))
     {
         SecuGlobal.showNG(panelStatus, lblStatus, "请首先选择申请单信息");
         return;
     }
     printReqDoc(doc_no);
 }
        /// <summary>
        /// 申请单入库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGr_Click(object sender, EventArgs e)
        {
            try
            {
                SecuGlobal.showOK(panelStatus, lblStatus, "正在进行入库,请稍等...");
                bRun          = true;
                btnGr.Enabled = false;

                if (gridView2.RowCount == 0 || grCount.Equals(0))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "请选择申请单信息");
                    return;
                }

                DialogResult dlg = MessageBox.Show("您确认要进行入库:" + doc_no + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dlg == DialogResult.OK)
                {
                    int iCount = 0;
                    for (int i = 0; i < gridView2.RowCount; i++)
                    {
                        for (int j = 0; j < gridView2.Columns.Count; j++)
                        {
                            if ((bool)gridView2.GetRowCellValue(i, gridView2.Columns[0]))
                            {
                                iCount += 1;
                                break;
                            }
                        }
                    }
                    if (iCount == 0)
                    {
                        SecuGlobal.showNG(panelStatus, lblStatus, "请选中要入库的信息");
                        return;
                    }


                    if (!bgrDataUpload()) //失败
                    {
                        return;
                    }
                    doc_no = "";
                    btnQuery_Click(sender, e);
                }

                SecuGlobal.showOK(panelStatus, lblStatus, "OK");
            }
            catch (Exception btnGr_Click)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, btnGr_Click.Message);
            }
            finally
            {
                bRun          = false;
                btnGr.Enabled = true;
            }
        }
        private void btnExport_Click(object sender, EventArgs e)
        {
            //showData("C660", "75619"); //显示数据

            if (gridView1.RowCount <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "没有数据");
                return;
            }
            PaCSGlobal.ExportGridToFile(gridView1, "Input Sn");
        }
        /// <summary>
        /// 分析基本条件
        /// </summary>
        /// <param name="scandata"></param>
        /// <returns></returns>
        private bool bAnalysisData_Comm(string scandata)
        {
            if (cbLine.SelectedIndex == -1 || cbMaterialCode.SelectedIndex == -1)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "请选择基本信息- line / 材料");
                return(false);
            }

            ls_item    = cbMaterialCode.Text.Trim();                // 投入材料
            li_sec_cnt = System.Convert.ToInt32(tbQty.Text.Trim()); // 投入数量
            if (li_sec_cnt == 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "投入数量不能为零");
                return(false);
            }

            ls_line = cbLine.Text.Trim().Substring(0, 4);
            if (string.IsNullOrEmpty(ls_line) || (string.IsNullOrEmpty(ls_item)) || ls_item.Equals("ALL"))
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "请选择LINE 信息 或者 材料CODE 信息");
                return(false);
            }

            string sql    = "select count(*) from " + SecuGlobal.tbSnSecuHist + " where serial_no = '" + scandata + "' and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
            int    li_cnt = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql));

            if (li_cnt > 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "序列号重复扫描!");
                return(false);
            }

            string sql1    = "select count(*) from " + SecuGlobal.tbSecurityInSnTest + " where serial_no = '" + scandata + "' and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
            int    li_cnt1 = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql1));

            if (li_cnt1 <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "没有发料的序列号!");
                return(false);
            }

            if (secuType.Equals("SAMSUNG") && !scandata.Length.Equals(15))
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "错误的序列号:" + scandata);
                return(false);
            }

            if (secuType.Equals("XEROX") && !scandata.Length.Equals(9))
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "错误的序列号:" + scandata);
                return(false);
            }
            return(true);
        }
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (grdView1.RowCount <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "没有数据,请先查询!");
            }

            SecuGlobal.showOK(panelStatus, lblStatus, "数据导出中,请稍等...");
            PaCSGlobal.ExportGridToFile(grdView1, "Security Invoice Info");
            SecuGlobal.showOK(panelStatus, lblStatus, "OK");
        }
Beispiel #17
0
 /// <summary>
 /// 数据查询
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnApply_Click(object sender, EventArgs e)
 {
     try
     {
         SecuGlobal.showOK(panelStatus, lblStatus, "正在查询数据,请稍等...");
         backgroundWorker1.RunWorkerAsync();
         SplashScreenManager.ShowForm(typeof(WaitLoading));
     }
     catch (Exception ex)
     {
         SecuGlobal.showNG(panelStatus, lblStatus, ex.Message);
     }
 }
        /// <summary>
        /// 加载Vendor信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StockQuery_Load(object sender, EventArgs e)
        {
            setDicVendor(PaCSGlobal.LoginUserInfo.Fct_code);
            if (dicVendor.Count <= 0)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, "没有找到VENDOR 信息,请联系管理员");
                return;
            }


            SecuGlobal.setAllVendorInfo(PaCSGlobal.LoginUserInfo.Fct_code, cbVendor);
            SecuGlobal.showOK(panelStatus, lblStatus, "Ready");
        }
        /// <summary>
        /// 后台查询数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                getVariable();
                DataTable dt = OracleHelper.ExecuteDataTable(getSql(company, ls_material_code, ls_plant));

                if (dt != null)
                {
                    dt.Columns["plant"].ColumnName         = "厂家";
                    dt.Columns["material_code"].ColumnName = "材料";
                    dt.Columns["description"].ColumnName   = "材料描述";
                    dt.Columns["stock_qty"].ColumnName     = "厂家库存";
                    dt.Columns["trans_qty"].ColumnName     = "厂家转移库存";
                }

                string vendorDesc = "";
                foreach (DataRow dr in dt.Rows)
                {
                    dicVendor.TryGetValue(dr["COMPANY"].ToString(), out vendorDesc);
                    dr["COMPANY"] = vendorDesc;
                }

                this.Invoke((MethodInvoker) delegate
                {
                    gridControl1.DataSource = dt;

                    grdView1.BestFitColumns();
                    grdView1.Columns["材料"].SummaryItem.SummaryType   = SummaryItemType.Count;
                    grdView1.Columns["材料"].SummaryItem.DisplayFormat = "All:{0:f0}";

                    grdView1.Columns["厂家库存"].SummaryItem.SummaryType   = SummaryItemType.Sum;
                    grdView1.Columns["厂家库存"].SummaryItem.DisplayFormat = "{0:f0}";


                    grdView1.Columns["厂家转移库存"].SummaryItem.SummaryType   = SummaryItemType.Sum;
                    grdView1.Columns["厂家转移库存"].SummaryItem.DisplayFormat = "{0:f0}";

                    //指定列对齐方式
                    grdView1.Columns["材料描述"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Near;
                    grdView1.Columns["厂家库存"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Far;
                    grdView1.Columns["厂家转移库存"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                });
            }
            catch (Exception err)
            {
                //XtraMessageBox.Show(this, "System error[ShowData]: " + err.Message);
                SecuGlobal.showNG(panelStatus, lblStatus, err.Message);
            }
        }
Beispiel #20
0
 /// <summary>
 /// 获取截取字符串的必要条件
 /// </summary>
 /// <param name="type"></param>
 private void getScanSplitValue(string type)
 {
     try
     {
         string    sql = "select code 描述,etc1 开始长度,etc2 截取长度 from " + SecuGlobal.tb_code + "  where FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' and lang_key = 'EN'  and prefix = '" + type + "' order by seq_no";
         DataTable dt  = OracleHelper.ExecuteDataTable(sql);
         grdControl2.DataSource             = dt;
         grdScanSetting.Columns["描述"].Width = 120;
     }
     catch (Exception getScanSplitValue)
     {
         SecuGlobal.showNG(panelStatus, lblStatus, getScanSplitValue.Message);
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                backgroundWorker2.RunWorkerAsync();
                SplashScreenManager.ShowForm(typeof(WaitLoading));

                btnSave.Enabled = false;
            }
            catch (Exception btnSave_Click)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, btnSave_Click.Message);  //是否要做Rollback?
            }
        }
        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);
            }
        }
Beispiel #23
0
        /// <summary>
        /// 选中对应申请单之后,数据显示到控件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selection_SelectionChanged(object sender, EventArgs e)
        {
            iCount = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if ((bool)gridView1.GetRowCellValue(i, gridView1.Columns[0]))
                {
                    type = gridView1.GetRowCellValue(i, gridView1.Columns["移库类型"]).ToString();
                    string assy = gridView1.GetRowCellValue(i, gridView1.Columns["材料"]).ToString();
                    cbMaterial.Text = assy;
                    tbDesc.Text     = gridView1.GetRowCellValue(i, gridView1.Columns["材料描述"]).ToString();

                    barCode = gridView1.GetRowCellValue(i, gridView1.Columns["条形码"]).ToString();
                    string sql = "select nvl(sum(STOCK_QTY),0) stock_qty from " + SecuGlobal.tbSecurityStock + " where " +
                                 "material_code = '" + assy + "' AND company = '" + vend4 + "' AND PLANT = '" + plantInsert + "' and " +
                                 "FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'"; //plantInsert -SSDP OR SESC
                    tbStockQty.Text = OracleHelper.ExecuteScalar(sql).ToString();
                    SecuGlobal.showOK(panelStatus, lblStatus, "选中材料是:" + assy);

                    if (ckCancle.Checked)  // 出库取消模式下,不是NOR 的不允许取消
                    {
                        string mov = gridView1.GetRowCellValue(i, gridView1.Columns["移库方向"]).ToString();
                        if (!mov.Equals("NOR") || type.Equals("GR"))
                        {
                            SecuGlobal.showNG(panelStatus, lblStatus, "此记录不能做出库取消,请再次确认");
                            gridView1.SetRowCellValue(i, gridView1.Columns[0], false);
                            return;
                        }
                        else
                        {
                            btnSave.Enabled = true;
                            bk_docno        = gridView1.GetRowCellValue(i, gridView1.Columns["申请单号"]).ToString(); //RTN 记录单号
                            ls_bk_company   = gridView1.GetRowCellValue(i, gridView1.Columns["厂家"]).ToString();   //RTN 厂家信息

                            if (!bCheckCancleQty(ls_bk_company, bk_docno, "1"))
                            {
                                SecuGlobal.showNG(panelStatus, lblStatus, "数据取消分析NG,请在确认");
                                btnSave.Enabled = false;
                                return;
                            }
                            SecuGlobal.showOK(panelStatus, lblStatus, "数据可以取消,请继续...");
                        }
                    }

                    iCount += 1;

                    break;
                }
            }
        }
        /// <summary>
        /// 遍历EXCEL(DataTable)
        /// 如果数据已经存在那么ERROR 提示
        /// </summary>
        /// <param name="dt"></param>
        /// <returns>True(数据可用) 否则False</returns>
        private bool bAnalysisUploadData(DataTable dt)
        {
            bool   b            = false;
            string ls_sec_boxno = "";
            string ls_sec_start = "";
            string ls_sec_end   = "";
            string strSql       = "";
            int    iCounts;

            foreach (DataRow dr in dt.Rows)
            {
                ls_sec_boxno = Convert.ToString(dr[5]);
                ls_sec_start = Convert.ToString(dr[3]);
                ls_sec_end   = Convert.ToString(dr[4]);

                strSql = "select count(*) from " + SecuGlobal.tbSecurityInvoice + " where sec_boxno = '" + ls_sec_boxno + "' " +
                         "and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
                iCounts = System.Convert.ToInt32(OracleHelper.ExecuteScalar(strSql));

                if (iCounts >= 1)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "已经上载的箱号:" + ls_sec_boxno);
                    break;
                }

                strSql = "select * from " + SecuGlobal.tbSecurityInvoice + "  where '" + ls_sec_start + "' between sec_start and sec_end " +
                         "and fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
                iCounts = System.Convert.ToInt32(OracleHelper.ExecuteScalar(strSql));
                if (iCounts >= 1)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "已上载的防伪标签号:" + ls_sec_start);
                    break;
                }


                strSql = "select * from " + SecuGlobal.tbSecurityInvoice + " where '" + ls_sec_end + "' between sec_start and sec_end " +
                         "and fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";
                iCounts = System.Convert.ToInt32(OracleHelper.ExecuteScalar(strSql));
                if (iCounts >= 1)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "已上载的防伪标签号:" + ls_sec_end);
                    break;
                }

                b = true;
            }

            return(b);
        }
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            this.Invoke((MethodInvoker) delegate
            {
                SecuGlobal.showOK(panelStatus, lblStatus, "数据上传中,请耐心等待...");
                try
                {
                    //MessageBox.Show(grdView1.RowCount.ToString());
                    for (int i = 0; i < grdView1.RowCount; i++)
                    {
                        StringBuilder sql = new StringBuilder("insert into  " + SecuGlobal.tbSecurityInvoice +
                                                              "(sec_boxno,sec_itemcd,sec_rollfrom,sec_rollto,sec_start,sec_end,sec_cnt,delivery_date,invoice_no,add_date,add_time,add_user,add_ip,FCT_CODE) " +
                                                              "values (:sec_boxno,:sec_itemcd,:sec_rollfrom,:sec_rollto,:sec_start,:sec_end,:sec_cnt,:delivery_date,:invoice_no," +
                                                              "to_char(sysdate,'yyyymmdd'),to_char(sysdate,'hh24miss'),:add_user,:add_ip,:FCT_CODE)");

                        OracleParameter[] parameters = new OracleParameter[] {
                            new OracleParameter(":sec_boxno", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[5]))),
                            new OracleParameter(":sec_itemcd", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[0]))),
                            new OracleParameter(":sec_rollfrom", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[1]))),
                            new OracleParameter(":sec_rollto", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[2]))),
                            new OracleParameter(":sec_start", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[3]))),
                            new OracleParameter(":sec_end", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[4]))),
                            new OracleParameter(":sec_cnt", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[6]))),
                            new OracleParameter(":delivery_date", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[7]))),
                            new OracleParameter(":invoice_no", Convert.ToString(grdView1.GetRowCellValue(i, grdView1.Columns[8]))),
                            //new OracleParameter(":add_date", to_char(sysdate,'yyyymmdd')),
                            //new OracleParameter(":add_time", "to_char(sysdate,'hh24miss')"),
                            new OracleParameter(":add_user", PaCSTools.PaCSGlobal.LoginUserInfo.Name),
                            new OracleParameter(":add_ip", PaCSTools.PaCSGlobal.GetClientIp()),
                            new OracleParameter(":FCT_CODE", PaCSTools.PaCSGlobal.LoginUserInfo.Fct_code)
                        };
                        OracleHelper.ExecuteNonQuery(sql.ToString(), parameters);
                    }
                    SecuGlobal.showOK(panelStatus, lblStatus, "数据保存 OK");
                }
                catch (Exception DoWork)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, DoWork.Message); // rollback ?
                }
                finally
                {
                    if (ckClipBorad.Checked)  //剪贴板模式恢复到EXCEL模式,
                    {
                        //System.Windows.Forms.Clipboard.Clear(); //剪贴板不能清空,否则会导致数据显示异常
                        ckClipBorad.Checked = false;
                    }
                }
            });
        }
Beispiel #26
0
        /// <summary>
        /// 拆分的ASSY CODE 进行判定,然后判断
        /// 申请单号获取
        /// </summary>
        /// <returns></returns>
        private bool AnalysisCondition(string data)
        {
            try
            {
                string sql = "select count(*) from " + SecuGlobal.tbSecurityInTest + " where scan_data = '" + data + "' " +
                             "and FCT_CODE = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'";

                int a = System.Convert.ToInt32(OracleHelper.ExecuteScalar(sql));
                if (a > 0)
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "数据已经上传,请在确认!");
                    return(false);
                }

                if (string.IsNullOrEmpty(cbAssyAdd.Text))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "请选择材料信息");
                    return(false);
                }


                workDate = PaCSGlobal.GetServerDateTime(2);
                if (string.IsNullOrEmpty(workDate) || !workDate.Length.Equals(8))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "当前日期获取失败,请联系管理担当");
                    return(false);
                }

                //doc_no = GetDocNo(workDate);
                if (string.IsNullOrEmpty(doc_no))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "申请单号获取失败,请联系管理担当");
                    return(false);
                }


                if (string.IsNullOrEmpty(strUnitType))
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "类型获取失败,BOX/ROLL/ONE?");
                    return(false);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #27
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!bGetValues())
                {
                    return;
                }

                if (!bAnalysis())
                {
                    return;
                }


                DialogResult dr = MessageBox.Show("是否保存修改的内容", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr != DialogResult.OK)
                {
                    SecuGlobal.showOK(panelStatus, lblStatus, "用户取消作业");
                    return;
                }

                if (!bInsertData()) //数据写入到TB_SECURITY_DOC
                {
                    return;
                }

                int li_check = iUpdateStockQty(); // 更新库存数量tb_security_stock
                if (li_check == 0)
                {
                    if (ckCancle.Checked)
                    {
                        ckCancle.Checked = false;
                    }

                    btnApply_Click(sender, e);
                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                    Reset(); //数据初始化
                }
                else
                {
                    SecuGlobal.showNG(panelStatus, lblStatus, "库存数量更新失败,请联系管理员");
                }
            }
            catch (Exception er)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, er.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);
            }
        }
 private void btnQuery_Click(object sender, EventArgs e)
 {
     try
     {
         SecuGlobal.showOK(panelStatus, lblStatus, "正在查询数据,请稍等...");
         getVariable();
         backgroundWorker1.RunWorkerAsync();
         SplashScreenManager.ShowForm(typeof(WaitLoading));
         SecuGlobal.showOK(panelStatus, lblStatus, "Ready");
     }
     catch (Exception btnQuery_Click)
     {
         SecuGlobal.showNG(panelStatus, lblStatus, btnQuery_Click.Message);
     }
 }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                getVariable();

                if (xtraTabControl1.SelectedTabPage == xtraTabPage1)
                {
                    DialogResult dr = MessageBox.Show("当前页面 - < 部门库存查询 >,继续请按OK", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        backgroundWorker1.RunWorkerAsync();
                        SplashScreenManager.ShowForm(typeof(WaitLoading));
                    }
                }
                else if (xtraTabControl1.SelectedTabPage == xtraTabPage2)
                {
                    DialogResult dr = MessageBox.Show("当前页面 - < 每卷使用明细查询 >,继续请按OK", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        backgroundWorker2.RunWorkerAsync();
                        SplashScreenManager.ShowForm(typeof(WaitLoading));
                    }
                }
                else if (xtraTabControl1.SelectedTabPage == xtraTabPage3)
                {
                    DialogResult dr = MessageBox.Show("当前页面 - < 范围段明细查询 >,继续请按OK", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        backgroundWorker3.RunWorkerAsync();
                        SplashScreenManager.ShowForm(typeof(WaitLoading));
                    }
                }
                else
                {
                    DialogResult dr = MessageBox.Show("当前页面 - < 报废未返回序列号 >,继续请按OK", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        backgroundWorker4.RunWorkerAsync();
                        SplashScreenManager.ShowForm(typeof(WaitLoading));
                    }
                }
            }
            catch (Exception ex)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, ex.Message);
            }
        }