/// <summary> /// 记载基本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SecuStockCheck_Load(object sender, EventArgs e) { SecuGlobal.setAllVendorInfo(PaCSGlobal.LoginUserInfo.Fct_code, cbVendor); dateEditFrom.Text = PaCSTools.PaCSGlobal.GetServerDateTime(3); dateEditTo.Text = PaCSTools.PaCSGlobal.GetServerDateTime(3); SecuGlobal.showOK(panelStatus, lblStatus, "Ready"); }
/// <summary> /// 加载材料编号,日期,厂家CODE /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SecuReport_Load(object sender, EventArgs e) { SecuGlobal.setAllVendorInfo(PaCSGlobal.LoginUserInfo.Fct_code, cbVendor); SecuGlobal.getMeterialCode(cbMeterial); xtraTabControl1_Click(sender, e); SecuGlobal.showOK(panelStatus, lblStatus, "Ready"); }
/// <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); } }
private void cbAssyAdd_SelectedIndexChanged(object sender, EventArgs e) { if (cbAssyAdd.SelectedIndex != -1) { SecuGlobal.showOK(panelStatus, lblStatus, "材料选择发生变化,请确认后扫描数据"); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { this.Invoke((MethodInvoker) delegate { btnSave.Enabled = false; string doc_seq = OracleHelper.ExecuteScalar("select 'SECU'||to_char(sysdate,'yyyymmdd')||" + "fn_gene_seq('SECU','REQ',to_char(sysdate,'yyyymmdd'),'N','N','N',4) doc_seq from dual").ToString(); //申请单号 //需要保存HEADER 信息 OracleHelper.ExecuteNonQuery(getSql2(doc_seq)); for (int i = 0; i < gridView1.RowCount; i++) { object valAssy = gridView1.GetRowCellValue(i, gridView1.Columns["材料"]); object valReq = gridView1.GetRowCellValue(i, gridView1.Columns["申请数量"]); OracleHelper.ExecuteNonQuery(getSql1(doc_seq, (i + 1).ToString(), valAssy.ToString(), valReq.ToString(), "0", "Y")); } SecuGlobal.showOK(panelStatus, lblStatus, "材料申请OK,申请单号:" + doc_seq); btnSave.Enabled = true; bFirstAdd = true; }); } catch (Exception err) { SecuGlobal.showOK(panelStatus, lblStatus, err.Message); } }
/// <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 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"); }
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> /// 验证扫描的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); }
/// <summary> /// 选中行删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { if (gridView1.RowCount == 0 || lstDeleteInfo.Count == 0) { return; } DialogResult result = MessageBox.Show("确定删除吗吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (object obj in lstDeleteInfo) { for (int i = 0; i < gridView1.RowCount; i++) { object val = gridView1.GetRowCellValue(i, gridView1.Columns["创建时间"]); if (val.ToString().Equals(obj.ToString())) { gridView1.DeleteRow(i); break; } } } } gridView1.Columns["材料"].SummaryItem.SummaryType = SummaryItemType.Count; gridView1.Columns["材料"].SummaryItem.DisplayFormat = "选中: 0"; SecuGlobal.showOK(panelStatus, lblStatus, "OK"); }
/// <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); } }
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) { if (grdView1.RowCount <= 0) { SecuGlobal.showNG(panelStatus, lblStatus, "没有数据,请先查询!"); } SecuGlobal.showOK(panelStatus, lblStatus, "数据导出中,请稍等..."); PaCSGlobal.ExportGridToFile(grdView1, "Security Invoice Info"); SecuGlobal.showOK(panelStatus, lblStatus, "OK"); }
/// <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) { //showData("C660", "75619"); //显示数据 if (gridView1.RowCount <= 0) { SecuGlobal.showNG(panelStatus, lblStatus, "没有数据"); return; } PaCSGlobal.ExportGridToFile(gridView1, "Input Sn"); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string dtFrom = dateEditFrom.Text.Trim().Replace("-", ""); string dtTo = dateEditTo.Text.Trim().Replace("-", ""); StringBuilder sql = new StringBuilder(" select FCT_CODE as \"Fct Code\" , " + " sec_boxno as \"Sec Boxno\" , sec_itemcd as \"Sec Itemcd\", sec_rollfrom as \"Sec Rollfrom\", " + " sec_rollto as \"Sec Rollto\", sec_start as \"Sec Start\", sec_end as \"Sec end\", " + " sec_cnt as \"Sec cnt\", delivery_date as \"Delivery Date\", invoice_no as \"Invoice No\", " + " add_date as \"Add Date\", add_time as \"Add Time\", add_user as \"Add User\", " + " add_ip as \"Add Ip\", " + " case when " + " (select count(*) from " + SecuGlobal.tbSecurityInTest + " b where b.fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' and b.roll_no between a.sec_rollfrom and a.sec_rollto) >= 1 then " + " 'Y' " + " else " + " 'N' " + " end 是否入库 " + " from " + SecuGlobal.tbSecurityInvoice + " a " + " where 1 = 1 and a.fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "'"); if (!string.IsNullOrEmpty(dtFrom) && !string.IsNullOrEmpty(dtTo)) { sql.Append(" and add_date between '" + dtFrom + "' and '" + dtTo + "' "); } if (!string.IsNullOrEmpty(tbBoxNo.Text)) { sql.Append(" and sec_boxno = '" + tbBoxNo.Text.Trim() + "'"); } if (!string.IsNullOrEmpty(tbRollNo.Text)) { sql.Append(" and '" + tbRollNo.Text.Trim() + "' between sec_rollfrom and sec_rollto"); } if (!string.IsNullOrEmpty(tbSecuLabel.Text)) { sql.Append(" and sec_start = '" + tbSecuLabel.Text.Trim() + "'"); } sql.Append(" order by sec_boxno "); DataTable dt = OracleHelper.ExecuteDataTable(sql.ToString()); this.Invoke((MethodInvoker) delegate { gridControl1.DataSource = dt; grdView1.BestFitColumns(); grdView1.Columns["Sec Itemcd"].SummaryItem.SummaryType = SummaryItemType.Count; grdView1.Columns["Sec Itemcd"].SummaryItem.DisplayFormat = "共 {0:f0} 条记录"; SecuGlobal.showOK(panelStatus, lblStatus, "OK"); }); }
/// <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"); }
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} "; }
/// <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); } }
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方式"); } }
/// <summary> /// 查询类型获取《汇总:SUMMARY / 详细:DETAIL》 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void radioGroup2_SelectedIndexChanged(object sender, EventArgs e) { if (radioGroup2.SelectedIndex == 0) { queryType = "SUMMARY"; SecuGlobal.showOK(panelStatus, lblStatus, "汇总查询"); } else { queryType = "DETAIL"; SecuGlobal.showOK(panelStatus, lblStatus, "明细查询"); } }
/// <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); } }
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); } }