private void frmFlowCardQuery_Load(object sender, EventArgs e) { CommonMethod.RefreshAndAutoSize(ultraGrid1); try { dateTimePicker1.Value = DateTime.Today; dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1); } catch (Exception ex) { Debug.WriteLine(ex.Message); } try { string strKey = this.CustomInfo.ToUpper(); if (!string.IsNullOrEmpty(strKey) && strKey.Length == 2) { if (strKey.Substring(0, 2).Equals("GX")) { this._STOCK = "SH000100"; } else if (strKey.Substring(0, 2).Equals("BC")) { this._STOCK = "SH000098"; } else if (strKey.Substring(0, 2).Equals("XC")) { this._STOCK = "SH000120"; } else if (strKey.Substring(0, 2).Equals("LG")) { this._STOCK = "SH000166"; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Query": { this.GetFlowCardInfo(""); break; } case "Save": { this.Save(); break; } case "Cancel": { this.Cancel(); break; } case "出炉结束": { this.Save1(); break; } case "取消结束": { this.Cancel1(); break; } case "导出": { CommonMethod.ExportDataWithSaveDialog2(ref this.ultraGrid1, this.Text); break; } } }
public ucBilletFlowCard() { InitializeComponent(); try { this.ultraGrid1.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ultraGrid1_ClickCellButton); ultraGrid1.DisplayLayout.Bands[0].Columns["FD_ZC_ENTERDATETIME"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton; ultraGrid1.DisplayLayout.Bands[0].Columns["FD_ZC_ENTERDATETIME"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter; ultraGrid1.DisplayLayout.Bands[0].Columns["FD_ZZ_DATE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton; ultraGrid1.DisplayLayout.Bands[0].Columns["FD_ZZ_DATE"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter; } catch { } try { ultraGrid1.DisplayLayout.Bands[0].Columns["FN_LENGTH"].ValueList = CommonMethod.GetValuelistLength(); CommonMethod.InitUserControl(ref ultraDataSource1, ref ultraGrid1); CommonMethod.SetUltraGridCellReadOnly(ref ultraGrid1, true); } catch { } }
public void SetPost_Rolling(ProduceLine ProLine) { try { ArrayList alistEditable = new ArrayList(); alistEditable.Add("FN_ZZ_SPEC"); if (ProLine != ProduceLine.GX) { alistEditable.Add("FN_LENGTH"); } alistEditable.Add("FD_ZZ_DATE"); alistEditable.Add("FN_ZZ_NUM"); alistEditable.Add("FN_ZZ_WASTNUM"); alistEditable.Add("FS_ZZ_MEMO"); CommonMethod.SetUltraGridCellEditable(ref ultraGrid1, alistEditable); ultraGrid1.ActiveCell = ultraGrid1.Rows[0].Cells["FN_ZZ_SPEC"]; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode); } catch { } }
private bool DataValidation_Batchno() { strBatchNo = ""; strOrderNo = ""; strSpec = ""; strLength = ""; frmSetSpec frm = new frmSetSpec(_PRODUCELINE, _CODETYPE, Success, strBatchNo, strOrderNo, strSpec, strLength); frm.Location = CommonMethod.SetChildWindowLocation(frm.Size); if (frm.ShowDialog() == DialogResult.OK) { strBatchNo = frm.BATCHNO; strOrderNo = frm.ORDERNO; strSpec = frm.SPEC; strLength = frm.LEN; return(true); } return(false); }
/// <summary> /// 数据有效性验证 /// </summary> /// <param name="alistCardNo"></param> /// <param name="alistCount"></param> /// <param name="alistWeight"></param> /// <param name="alistPosition"></param> /// <param name="alistStoveNo"></param> /// <returns></returns> private bool DataValidation_Save(out ArrayList alistCardNo, out ArrayList alistCount, out ArrayList alistWeight, out ArrayList alistPosition, out ArrayList alistStoveNo) { alistStoveNo = new ArrayList(); alistCardNo = new ArrayList(); alistCount = new ArrayList(); alistWeight = new ArrayList(); alistPosition = new ArrayList(); ultraGrid1.UpdateData(); try { UltraGridRow row = null; string strCardNo = "", strCount = "", strWeight = "", strPosition = "", strStoveNo = ""; string str_FS_SPEC; string str_FN_LENGTH; string str_FN_WEIGHT; string str_FN_BILLETCOUNT; string str_FN_ID; string str_FS_MINDIFFERENTRATE; string str_FS_MAXDIFFERENTRATE; string str_FS_BUNDLEWEIGHT; string str_FS_BUNDLEMINWWEIGHT; string str_FS_BUNDLEMAXWWEIGHT; for (int i = 0; i < this.ultraGrid1.Rows.Count; i++) { row = this.ultraGrid1.Rows[i]; if (Convert.ToBoolean(row.Cells["CHECKED"].Value)) { strCardNo = Convert.ToString(row.Cells["FS_CARDNO"].Value).Trim(); strCount = Convert.ToString(row.Cells["FN_GPYS_NUMBER"].Value).Trim(); strWeight = Convert.ToString(row.Cells["FN_GPYS_WEIGHT"].Value).Trim(); strPosition = Convert.ToString(row.Cells["FS_DJH"].Value).Trim(); strStoveNo = Convert.ToString(row.Cells["FS_GP_STOVENO"].Value).Trim(); //BT_BCTHEORYWEIGHTINFO的所有字段 str_FS_SPEC = Convert.ToString(row.Cells["FS_SPEC"].Value).Trim(); str_FN_LENGTH = Convert.ToString(row.Cells["FN_LENGTH"].Value).Trim(); str_FN_WEIGHT = Convert.ToString(row.Cells["FN_WEIGHT"].Value).Trim(); str_FN_BILLETCOUNT = Convert.ToString(row.Cells["FN_BILLETCOUNT"].Value).Trim(); str_FN_ID = Convert.ToString(row.Cells["FN_ID"].Value).Trim(); str_FS_MINDIFFERENTRATE = Convert.ToString(row.Cells["FS_MINDIFFERENTRATE"].Value).Trim(); str_FS_MAXDIFFERENTRATE = Convert.ToString(row.Cells["FS_MAXDIFFERENTRATE"].Value).Trim(); str_FS_BUNDLEWEIGHT = Convert.ToString(row.Cells["FS_BUNDLEWEIGHT"].Value).Trim(); str_FS_BUNDLEMINWWEIGHT = Convert.ToString(row.Cells["FS_BUNDLEMINWWEIGHT"].Value).Trim(); str_FS_BUNDLEMAXWWEIGHT = Convert.ToString(row.Cells["FS_BUNDLEMAXWWEIGHT"].Value).Trim(); if (string.IsNullOrEmpty(strCount)) { MessageBox.Show("请输入验收条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true); return(false); } int iCount = 0; bool bOK = false; bOK = int.TryParse(strCount, out iCount); if (!bOK) { MessageBox.Show("验收条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true); return(false); } if (iCount <= 0) { MessageBox.Show("验收条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true); return(false); } if (string.IsNullOrEmpty(strWeight)) { MessageBox.Show("请输入验收重量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true); return(false); } decimal dWeight = 0.0M; bOK = decimal.TryParse(strWeight, out dWeight); if (!bOK) { MessageBox.Show("验收重量必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true); return(false); } if (dWeight <= 0) { MessageBox.Show("验收重量必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true); return(false); } if (string.IsNullOrEmpty(strPosition)) { MessageBox.Show("请输入货架号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_DJH", true); return(false); } alistCardNo.Add(strCardNo); alistCount.Add(strCount); alistWeight.Add(strWeight); alistPosition.Add(strPosition); alistStoveNo.Add(strStoveNo); } } } catch (Exception ex) { MessageBox.Show("数据验证失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(false); } return(true); }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BilletStock_Load(object sender, EventArgs e) { CommonMethod.RefreshAndAutoSize(ultraGrid1); }
private void cbx_Filter_CheckedChanged(object sender, EventArgs e) { CommonMethod.SetUltraGridRowFilter(ref ultraGrid1, cbx_Filter.Checked); }
private void GetFlowCardInfo() { string strWhere = ""; if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strWhere += Convert.ToString(" and t.fs_batch_optdate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } string ConditionName = ""; if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(tbBatchNoTo.Text.Trim())) { ConditionName = rbtn_BatchNo.Checked ? "t.fs_zc_batchno" : "t.fs_gp_stoveno"; strWhere += Convert.ToString(" and " + ConditionName + " like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } else if (!string.IsNullOrEmpty(tbBatchNoTo.Text.Trim()) && string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { ConditionName = rbtn_BatchNo.Checked ? "t.fs_zc_batchno" : "t.fs_gp_stoveno"; strWhere += Convert.ToString(" and " + ConditionName + " like '%" + tbBatchNoTo.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(tbBatchNoTo.Text.Trim())) { ConditionName = rbtn_BatchNo.Checked ? "x.fs_zc_batchno" : "x.fs_gp_stoveno"; strWhere = " and t.fs_batch_optdate >= (select max(x.fs_batch_optdate) from it_fp_techcard x where " + ConditionName + " = '" + tbQueryBatchNo.Text.Trim() + "') "; strWhere += " and t.fs_batch_optdate <= (select max(x.fs_batch_optdate) from it_fp_techcard x where " + ConditionName + " = '" + tbBatchNoTo.Text.Trim() + "') "; } string strSql = ""; strSql += Convert.ToString("select 'false' checked,").Trim() + " "; strSql += Convert.ToString(" t.fs_cardno,").Trim() + " "; strSql += Convert.ToString(" t.fd_smeltdate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_nb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" round(round(t.fn_gp_len * 0.21, 3) * decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)), 3) fn_ll_weight,").Trim() + " "; strSql += Convert.ToString(" decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)) fn_gp_checkcount,").Trim() + " "; strSql += Convert.ToString(" round(decode(nvl(t.fn_gp_totalcount, 0), 0, '', (decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0))*nvl(t.fn_jj_weight, 0)/nvl(t.fn_gp_totalcount,0))), 3) fn_jj_weight,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number,").Trim() + " "; strSql += Convert.ToString(" t.fs_djh,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gpys_receivedate, 'yyyy-MM-dd hh24:mi:ss') fd_gpys_receivedate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gpys_receiver,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_batchno,").Trim() + " "; strSql += Convert.ToString(" t.fn_zc_enternumber,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_zc_enterdatetime, 'yyyy-MM-dd hh24:mi:ss') fd_zc_enterdatetime,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_operator,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_memo,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_spec,").Trim() + " "; strSql += Convert.ToString(" t.fn_length,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_zz_date, 'yyyy-MM-dd hh24:mi:ss') fd_zz_date,").Trim() + " "; strSql += Convert.ToString(" t.fs_zz_operator,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_num,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_wastnum,").Trim() + " "; strSql += Convert.ToString(" t.fs_zz_memo,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_flow,").Trim() + " "; strSql += Convert.ToString(" nvl(t.fs_discharge_begined, '0') fs_discharge_begined,").Trim() + " "; strSql += Convert.ToString(" nvl(t.fs_discharge_end, '0') fs_discharge_end,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_freezed, '1', '冻结', '自由') fs_freezed,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_checked, '1', '√', '') fs_checked").Trim() + " "; if (_STOCK.Equals("SH000100")) { strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " "; strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + " "; strSql += Convert.ToString(",round((select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(round(decode(nvl(fn_gp_totalcount, 0),0,'',(decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0))*nvl(fn_jj_weight, 0) / nvl(fn_gp_totalcount, 0))),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " "; strSql += Convert.ToString(" ,round((select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " "; } else if (_STOCK.Equals("SH000098")) { strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " "; strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + " "; strSql += Convert.ToString(",round((select sum(d.FN_THEORYWEIGHT) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(fn_jj_weight) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " "; strSql += Convert.ToString(" ,round((select sum(d.FN_THEORYWEIGHT) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " "; } else if (_STOCK.Equals("SH000120")) { strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " "; strSql += Convert.ToString(" ,(select sum(d.fn_weight) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + ", "; strSql += Convert.ToString("round((select sum(d.FN_THEORYWEIGHT) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(fn_jj_weight) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " "; strSql += Convert.ToString(" ,round((select sum(d.FN_THEORYWEIGHT) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " "; strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " "; } strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where t.fs_gp_flow = '" + _STOCK + "' and nvl(t.fs_isvalid, '0') = '0' and t.fs_batched = '1' and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fs_gp_completeflag, '0') when t.fs_transtype = '3' then '1' else '0' end = '1'").Trim() + " "; strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fn_jj_weight, 0) when t.fs_transtype = '3' then 1 else 0 end > 0").Trim() + " "; strSql += " " + strWhere + " "; strSql += Convert.ToString(" order by t.fs_zc_batchno desc, t.fs_gp_stoveno").Trim() + " "; string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } //CommonMethod.RefreshAndAutoSize(ultraGrid1); if (_STOCK.Equals("SH000098") || _STOCK.Equals("SH000120")) { ultraGrid1.DisplayLayout.Bands[0].Columns["FN_ZZ_QUALIFIED_TRATE"].Hidden = true; } MarkupRows(); }
private void GetFlowCardInfo(string strCardNo) { string strSql = ""; strSql += Convert.ToString("select 'false' checked,").Trim() + " "; strSql += Convert.ToString(" t.fs_cardno,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_smeltdate, 'yyyy-mm-dd hh24:mi:ss') fd_smeltdate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" round(round(t.fn_gp_len *0.21, 3) * decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)), 3) fn_ll_weight,").Trim() + " "; strSql += Convert.ToString(" decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)) fn_gp_checkcount,").Trim() + " "; strSql += Convert.ToString(" round(decode(nvl(t.fn_gp_totalcount, 0), 0, '', (decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0))*nvl(t.fn_jj_weight, 0)/nvl(t.fn_gp_totalcount,0))), 3) fn_jj_weight,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gp_judgedate, 'yyyy-mm-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number,").Trim() + " "; strSql += Convert.ToString(" t.fs_djh,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gpys_receivedate, 'yyyy-mm-dd hh24:mi:ss') fd_gpys_receivedate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gpys_receiver,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_batchno,").Trim() + " "; strSql += Convert.ToString(" t.fn_zc_enternumber,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_zc_enterdatetime, 'yyyy-mm-dd hh24:mi:ss') fd_zc_enterdatetime,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_operator,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_memo,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_spec,").Trim() + " "; strSql += Convert.ToString(" t.fn_length,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_zz_date, 'yyyy-mm-dd hh24:mi:ss') fd_zz_date,").Trim() + " "; strSql += Convert.ToString(" t.fs_zz_operator,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_num,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_wastnum,").Trim() + " "; strSql += Convert.ToString(" t.fs_zz_memo,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_flow,").Trim() + " "; strSql += Convert.ToString(" nvl(t.fs_discharge_begined, '0') fs_discharge_begined,").Trim() + " "; strSql += Convert.ToString(" nvl(t.fs_discharge_end, '0') fs_discharge_end,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_freezed, '1', '冻结', '自由') fs_freezed,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_checked, '1', '√', '') fs_checked,").Trim() + " "; strSql += "decode(t.FS_UNQUALIFIED,'0','√','1','×','√') FS_UNQUALIFIED "; strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where nvl(t.fs_isvalid, '0') = '0'").Trim() + " "; if (_POST == Post.Receive) { string str = ""; if (cbx_Other1.Checked) { str += " t.fs_gp_flow = '" + GetOther1() + "' "; } if (cbx_Other2.Checked) { str += (string.IsNullOrEmpty(str) ? "" : " or ") + " t.fs_gp_flow = '" + GetOther2() + "' "; } if (cbx_Other3.Checked) { str += (string.IsNullOrEmpty(str) ? "" : " or ") + " t.fs_gp_flow = '" + GetOther3() + "' "; } if (string.IsNullOrEmpty(str)) { str += " t.fs_gp_flow = '" + _STOCK + "' "; } str = "(" + str + ")"; strSql += " and " + str + " "; //strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fs_gp_completeflag, '0') when t.fs_transtype = '3' then '1' else '0' end = '1'").Trim() + " "; //strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fn_jj_weight, 0) when t.fs_transtype = '3' then 1 else 0 end > 0").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_batched, '0') = '0' and t.fs_zc_batchno is null").Trim() + " "; if (rbtnA.Checked) { strSql += Convert.ToString(" and (nvl(t.Fs_Checked, 0) = '0' or nvl(t.Fn_Gpys_Number, 0) <= 0)").Trim() + " "; } else if (rbtnB.Checked) { strSql += Convert.ToString(" and nvl(t.Fs_Checked, 0) = '1' and nvl(t.Fn_Gpys_Number, 0) > 0").Trim() + " "; } } else if (_POST == Post.Charge) { strSql += Convert.ToString(" and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_batched, '0') = '1'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fn_zz_num, 0) = 0").Trim() + " "; if (rbtnA.Checked) { strSql += Convert.ToString(" and nvl(t.Fn_Zc_Enternumber, 0) <= 0").Trim() + " "; } else if (rbtnB.Checked) { strSql += Convert.ToString(" and nvl(t.Fn_Zc_Enternumber, 0) > 0").Trim() + " "; } } else if (_POST == Post.DisCharge) { strSql += Convert.ToString(" and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_batched, '0') = '1'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fn_zc_enternumber, 0) > 0").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_operator is not null").Trim() + " "; strSql += Convert.ToString(" and not exists (select 1 from dt_productplan t1 where t1.fs_batchno = t.fs_zc_batchno and nvl(t1.fs_completeflag, '0') = '1')").Trim() + " "; if (rbtnA.Checked) { strSql += Convert.ToString(" and nvl(t.fs_discharge_begined, '0') = '0'").Trim() + " "; } else if (rbtnB.Checked) { strSql += Convert.ToString(" and nvl(t.fs_discharge_end, '0') = '1'").Trim() + " "; } } else if (_POST == Post.Roll) { strSql += Convert.ToString(" and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_batched, '0') = '1'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fn_zc_enternumber, 0) > 0").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_operator is not null").Trim() + " "; if (rbtnA.Checked) { strSql += Convert.ToString(" and nvl(t.Fn_Zz_Num, 0) <= 0").Trim() + " "; } else if (rbtnB.Checked) { strSql += Convert.ToString(" and nvl(t.Fn_Zz_Num, 0) > 0").Trim() + " "; } } if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); if (_POST == Post.Receive) { strSql += Convert.ToString(" and t.fd_gp_judgedate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } else { strSql += Convert.ToString(" and t.fs_batch_optdate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { if (_POST == Post.Receive) { strSql += Convert.ToString(" and t.fs_djh like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } else { strSql += Convert.ToString(" and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim().ToUpper() + "%'").Trim() + " "; } if (_POST == Post.Receive) { strSql += Convert.ToString(" order by t.fs_gp_stoveno desc").Trim() + " "; } else { strSql += Convert.ToString(" order by t.fs_zc_batchno desc, t.fs_gp_stoveno").Trim() + " "; } string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } CommonMethod.RefreshAndAutoSize(ultraGrid1); MarkupRows(); if (dataTable1.Rows.Count == 0) { ucBilletFlowCard1.ResetData(); } else { ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } //if (string.IsNullOrEmpty(strCardNo)) //return; for (int i = 0; i < ultraGrid1.Rows.Count; i++) { try { if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals(strCardNo)) { CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_CARDNO", false); } if (ultraGrid1.Rows[i].Cells["FS_UNQUALIFIED"].Value.ToString() == "×") { ultraGrid1.Rows[i].Appearance.ForeColor = Color.Red; } } catch { } } }
public void ResetData() { CommonMethod.InitUserControl(ref ultraDataSource1, ref ultraGrid1); }
private void BilletFlowCard_Load(object sender, EventArgs e) { CommonMethod.RefreshAndAutoSize(ultraGrid1); try { dateTimePicker1.Value = DateTime.Today; dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1); } catch (Exception ex) { Debug.WriteLine(ex.Message); } try { string strKey = this.CustomInfo.ToUpper(); if (!string.IsNullOrEmpty(strKey) && strKey.Length == 3) { if (strKey.Substring(0, 2).Equals("GX")) { this._STOCK = "SH000100"; this._PRODUCELINE = ProduceLine.GX; } else if (strKey.Substring(0, 2).Equals("BC")) { this._STOCK = "SH000098"; this._PRODUCELINE = ProduceLine.BC; } else if (strKey.Substring(0, 2).Equals("XC")) { this._STOCK = "SH000120"; //型材未知 this._PRODUCELINE = ProduceLine.XC; } if (strKey.Substring(2, 1).Equals("1")) { this._POST = Post.Receive; ucBilletFlowCard1.SetPost_BilletReceive(); SetToolButtonCaption("Save", "验收登记"); SetToolButtonCaption("Cancel", "撤销验收"); SetToolButtonCaption("开始", "分析时间"); SetToolButtonCaption("轧制编号", " 货架编号"); SetToolButtonVisible("其他库1", false); SetToolButtonVisible("其他库2", false); SetToolButtonVisible("其他库3", false); SetToolButtonVisible("出炉结束", false); SetToolButtonVisible("取消结束", false); rbtnA.Text = "未验收"; rbtnB.Text = "已验收"; cbxDateTime.Checked = false; lbl_Mark.Text = "此颜色表示已验收登记"; } else if (strKey.Substring(2, 1).Equals("2")) { this._POST = Post.Charge; ucBilletFlowCard1.SetPost_Charge(); SetToolButtonCaption("Save", "入炉登记"); SetToolButtonCaption("Cancel", "撤销入炉"); SetToolButtonCaption("开始", "组批时间"); SetToolButtonCaption("轧制编号", " 轧制编号"); SetToolButtonVisible("其他库1", false); SetToolButtonVisible("其他库2", false); SetToolButtonVisible("其他库3", false); SetToolButtonVisible("出炉结束", false); SetToolButtonVisible("取消结束", false); rbtnA.Text = "未入炉"; rbtnB.Text = "已入炉"; cbxDateTime.Checked = true; lbl_Mark.Text = "此颜色表示已入炉登记"; } else if (strKey.Substring(2, 1).Equals("3")) { this._POST = Post.DisCharge; ultraExpandableGroupBox1.Visible = false; SetToolButtonCaption("Save", "出炉开始"); SetToolButtonCaption("Cancel", "撤销开始"); SetToolButtonCaption("开始", "组批时间"); SetToolButtonCaption("轧制编号", " 轧制编号"); SetToolButtonVisible("其他库1", false); SetToolButtonVisible("其他库2", false); SetToolButtonVisible("其他库3", false); SetToolButtonVisible("出炉结束", true); SetToolButtonVisible("取消结束", true); rbtnA.Text = "未出炉"; rbtnB.Text = "已出炉"; rbtnC.Checked = true; cbxDateTime.Checked = true; lbl_Mark.Text = "此颜色表示已出炉登记"; lbl_InFurnance.Text = "此颜色表示正在出炉"; lbl_InFurnance.Visible = true; } else if (strKey.Substring(2, 1).Equals("4")) { this._POST = Post.Roll; ucBilletFlowCard1.SetPost_Rolling(_PRODUCELINE); SetToolButtonCaption("Save", "保存"); SetToolButtonCaption("Cancel", "撤销"); SetToolButtonCaption("开始", "组批时间"); SetToolButtonCaption("轧制编号", " 轧制编号"); SetToolButtonVisible("其他库1", false); SetToolButtonVisible("其他库2", false); SetToolButtonVisible("其他库3", false); SetToolButtonVisible("出炉结束", false); SetToolButtonVisible("取消结束", false); rbtnA.Text = "未挑废"; rbtnB.Text = "已挑废"; cbxDateTime.Checked = true; lbl_Mark.Text = "此颜色表示已挑废登记"; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void frmWeightQueryBC_Load(object sender, EventArgs e) { CommonMethod.RefreshAndAutoSize(ultraGrid1); try { dateTimePicker1.Value = DateTime.Today; dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1); } catch (Exception ex) { Debug.WriteLine(ex.Message); } try { this.ultraGrid1.DisplayLayout.Bands[1].Columns["FS_SHIFT"].ValueList = CommonMethod.GetValuelistBanci(); this.ultraGrid1.DisplayLayout.Bands[1].Columns["FS_TERM"].ValueList = CommonMethod.GetValuelistBanzu(); } catch { } try { string strKey = this.CustomInfo.ToUpper(); if (!string.IsNullOrEmpty(strKey) && strKey.Length == 1) { if (strKey.Substring(0, 1).Equals("0")) //查询 { this.ultraToolbarsManager1.Toolbars[1].Visible = false; this.SetToolButtonVisible("判定不合格", false); this.SetToolButtonVisible("撤销不合格", false); } else if (strKey.Substring(0, 1).Equals("1")) //补打 { this.ultraToolbarsManager1.Toolbars[1].Visible = true; this.SetToolButtonVisible("判定不合格", false); this.SetToolButtonVisible("撤销不合格", false); } else if (strKey.Substring(0, 1).Equals("2")) //判废 { this.ultraToolbarsManager1.Toolbars[1].Visible = false; this.SetToolButtonVisible("判定不合格", true); this.SetToolButtonVisible("撤销不合格", true); } } } catch { } try { pictureBox3.Hide(); pictureBox3.SendToBack(); } catch { } }
private bool DataValidation_Save(out ArrayList alistCardNo, out ArrayList alistCount, out ArrayList alistWeight) { alistCardNo = new ArrayList(); alistCount = new ArrayList(); alistWeight = new ArrayList(); ultraGrid2.UpdateData(); try { UltraGridRow row = null; string strCardNo = "", strCount = "", strWeight = ""; for (int i = 0; i < this.ultraGrid2.Rows.Count; i++) { row = this.ultraGrid2.Rows[i]; if (Convert.ToBoolean(row.Cells["CHECKED"].Value)) { strCardNo = Convert.ToString(row.Cells["FS_CARDNO"].Value).Trim(); strCount = Convert.ToString(row.Cells["FN_BILLET_COUNT"].Value).Trim(); strWeight = Convert.ToString(row.Cells["FN_BILLET_WEIGHT"].Value).Trim(); if (string.IsNullOrEmpty(strCount)) { MessageBox.Show("请输入组批条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true); return(false); } int iCount = 0; bool bOK = false; bOK = int.TryParse(strCount, out iCount); if (!bOK) { MessageBox.Show("组批条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true); return(false); } if (iCount <= 0) { MessageBox.Show("组批条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true); return(false); } if (string.IsNullOrEmpty(strWeight)) { MessageBox.Show("请输入组批重量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true); return(false); } decimal dWeight = 0.0M; bOK = decimal.TryParse(strWeight, out dWeight); if (!bOK) { MessageBox.Show("组批重量必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true); return(false); } if (dWeight <= 0) { MessageBox.Show("组批重量必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true); return(false); } alistCardNo.Add(strCardNo); alistCount.Add(strCount); alistWeight.Add(strWeight); } } } catch (Exception ex) { MessageBox.Show("数据验证失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(false); } return(true); }
private void GetFlowCardInfo() { string strWhere = ""; if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strWhere += Convert.ToString(" and t.fd_plantime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strWhere += Convert.ToString(" and t.fs_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%'").Trim() + " "; } string strSql = ""; strSql += Convert.ToString("select t.fs_techcardno fs_cardno,").Trim() + " "; strSql += Convert.ToString(" to_char(t1.fd_smeltdate, 'yyyy-MM-dd hh24:mi') fd_smeltdate,").Trim() + " "; strSql += Convert.ToString(" t.fs_stoveno fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t1.FS_GP_STEELTYPE fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t1.FS_GP_SPE fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_length, 3) fn_length,").Trim() + " "; strSql += Convert.ToString(" decode(nvl(t1.fs_gp_flow, t.fs_receiver),'SH000098','棒材厂','SH000100','高线厂','SH000120','型材厂','SH000166','炼钢落地',t1.fs_gp_flow) fs_gp_flow,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t1.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" nvl(t2.fn_gp_totalcount, t1.FN_GP_TOTALCOUNT) fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" case when t2.fn_gp_totalcount is not null then round(round(t.fn_length *").Trim() + " "; strSql += Convert.ToString(" 0.21,3) * t2.fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" 3) else round(round(0.21*t.fn_length,3)*t.fn_count,3) end fn_ll_weight,").Trim() + " "; strSql += Convert.ToString(" t2.fn_gp_totalcount fn_gp_checkcount,").Trim() + " "; strSql += Convert.ToString(" nvl(round(t2.fn_jj_weight, 3), round(round(0.21*t.fn_length,3)*t.fn_count,3)) fn_jj_weight,").Trim() + " "; strSql += Convert.ToString(" t1.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t1.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t1.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate").Trim() + " "; strSql += Convert.ToString(" from dt_fp_plan t,").Trim() + " "; strSql += Convert.ToString(" it_fp_techcard t1,").Trim() + " "; strSql += Convert.ToString(" (select x.fs_stoveno,").Trim() + " "; strSql += Convert.ToString(" count(1) fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" sum(nvl(x.fn_netweight, 0)) fn_jj_weight").Trim() + " "; strSql += Convert.ToString(" from dt_steelweightdetailroll x").Trim() + " "; strSql += Convert.ToString(" where exists").Trim() + " "; strSql += Convert.ToString(" (select 1").Trim() + " "; strSql += Convert.ToString(" from dt_fp_plan t").Trim() + " "; strSql += Convert.ToString(" where t.fs_stoveno = x.fs_stoveno " + strWhere + ")").Trim() + " "; strSql += Convert.ToString(" group by x.fs_stoveno) t2").Trim() + " "; if (string.IsNullOrEmpty(_STOCK)) { strSql += Convert.ToString(" where 1 = 1").Trim() + " "; } else { strSql += Convert.ToString(" where nvl(t1.fs_gp_flow, t.fs_receiver) = '" + _STOCK + "'").Trim() + " "; } strSql += Convert.ToString(" and t.fs_stoveno = t1.fs_gp_stoveno(+)").Trim() + " "; //strSql += Convert.ToString(" and t.fs_techcardno = t1.fs_cardno(+)").Trim() + " "; strSql += Convert.ToString(" and t.fs_stoveno = t2.fs_stoveno(+) " + strWhere).Trim() + " "; strSql += Convert.ToString(" order by substr(t.fs_stoveno, 4, 1), t.fs_stoveno desc").Trim(); string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } CommonMethod.RefreshAndAutoSize(ultraGrid1); }
private void GetStockInfo(QueryOpportunity Opp) { //PL/SQL Special Copy string strSql = ""; strSql += Convert.ToString("select 'false' checked,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " "; strSql += Convert.ToString(" t.fn_billet_count,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_billet_weight, 3) fn_billet_weight,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_billet_count * round(0.21 * t.fn_gp_len, 3), 3) fn_billet_weight_ll,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " "; strSql += Convert.ToString(" t.fs_cardno,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number,").Trim() + " "; strSql += Convert.ToString(" nvl(t.fs_unqualified, '0') fs_unqualified,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gpys_weight, 3) fn_gpys_weight,").Trim() + " "; strSql += Convert.ToString(" round(nvl(t.fn_gpys_number, 0) * round(0.21 * t.fn_gp_len, 3), 3) fn_gpys_weight_ll,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_checked, '1', '√', '') fs_checked").Trim() + " "; strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where nvl(t.fs_batched, '0') = '0'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is null").Trim() + " "; strSql += Convert.ToString(" and t.fs_gp_flow = '" + this._STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_isvalid, '0') = '0'").Trim() + " "; strSql += Convert.ToString(" and t.fs_checked = '1'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fn_gpys_number, 0) > 0").Trim() + " "; if (Opp == QueryOpportunity.UI) { if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strSql += Convert.ToString(" and t.fd_gp_judgedate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryButtressNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_djh like '%" + tbQueryButtressNo.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%'").Trim() + " "; } } strSql += Convert.ToString(" order by t.fs_gp_stoveno").Trim(); string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } this.MarkupRows(); CommonMethod.RefreshAndAutoSize(ultraGrid2); this.BatchCalc(); }
private void GetBatchInfo(QueryOpportunity Opp) { //PL/SQL SPECIAL COPY string strSql = ""; strSql += Convert.ToString("select distinct t.fs_zc_batchno,").Trim() + " "; strSql += Convert.ToString(" max(t.fn_zz_spec) over(partition by t.fs_zc_batchno) fn_zz_spec,").Trim() + " "; strSql += Convert.ToString(" max(t.fn_length) over(partition by t.fs_zc_batchno) fn_length,").Trim() + " "; strSql += Convert.ToString(" max(t.fs_gp_steeltype) over(partition by t.fs_zc_batchno) fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" max(t.fs_zc_orderno) over(partition by t.fs_zc_batchno) fs_zc_orderno,").Trim() + " "; strSql += Convert.ToString(" max(t.fs_gp_spe) over(partition by t.fs_zc_batchno) fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" max(t.fn_gp_len) over(partition by t.fs_zc_batchno) fn_gp_len,").Trim() + " "; strSql += Convert.ToString(" sum(nvl(t.fn_billet_count, 0)) over(partition by t.fs_zc_batchno) fn_billet_count,").Trim() + " "; strSql += Convert.ToString(" sum(nvl(t.fn_billet_weight, 0)) over(partition by t.fs_zc_batchno) fn_billet_weight,").Trim() + " "; strSql += Convert.ToString(" sum(nvl(t.fn_billet_weight_ll, 0)) over(partition by t.fs_zc_batchno) fn_billet_weight_ll,").Trim() + " "; strSql += Convert.ToString(" max(t.fs_batch_optor) over(partition by t.fs_zc_batchno) fs_batch_optor,").Trim() + " "; strSql += Convert.ToString(" max(t.fs_batch_optdate) over(partition by t.fs_zc_batchno) fs_batch_optdate").Trim() + " "; strSql += Convert.ToString(" from (select t.fs_zc_batchno,").Trim() + " "; strSql += Convert.ToString(" t.fn_zz_spec,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_length, 3) fn_length,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number fn_billet_count,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_orderno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " "; strSql += Convert.ToString(" t.fs_batch_optor,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fs_batch_optdate, 'yyyy-MM-dd HH24:mi:ss') fs_batch_optdate,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gpys_weight, 3) fn_billet_weight,").Trim() + " "; strSql += Convert.ToString(" round(nvl(fn_gpys_number, 0) * round(0.21 * nvl(t.fn_gp_len, 0), 3), 3) fn_billet_weight_ll").Trim() + " "; strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where t.fs_batched = '1'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and t.fs_gp_flow = '" + this._STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_isvalid, '0') = '0'").Trim() + " "; if (Opp == QueryOpportunity.UI) { if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strSql += Convert.ToString(" and t.fs_batch_optdate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strSql += Convert.ToString(" and exists (select 1 from (select x.fs_zc_batchno from it_fp_techcard x where x.fs_batched = '1' and x.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%') x where x.fs_zc_batchno = t.fs_zc_batchno)").Trim() + " "; } } else { strSql += Convert.ToString(" and t.fs_batch_optdate > (sysdate - 1)").Trim() + " "; } strSql += Convert.ToString(" ) t order by FS_ZC_BATCHNO desc").Trim(); string err = ""; DataTable tbMain = null, tbDetail = null; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { tbMain = ds.Tables[0]; } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable3.Rows.Clear(); dataTable2.Rows.Clear(); return; } strSql = ""; strSql += Convert.ToString("select t.fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number fn_billet_count,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gpys_weight, 3) fn_billet_weight,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gp_judgedate, 'yyyy-mm-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " "; strSql += Convert.ToString(" t.fs_zc_batchno,").Trim() + " "; strSql += Convert.ToString(" t.fs_cardno").Trim() + " "; strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where t.fs_batched = '1'").Trim() + " "; strSql += Convert.ToString(" and t.fs_zc_batchno is not null").Trim() + " "; strSql += Convert.ToString(" and t.fs_gp_flow = '" + this._STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_isvalid, '0') = '0'").Trim() + " "; if (Opp == QueryOpportunity.UI) { if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strSql += Convert.ToString(" and t.fs_batch_optdate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strSql += Convert.ToString(" and exists (select 1 from (select x.fs_zc_batchno from it_fp_techcard x where x.fs_batched = '1' and x.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%') x where x.fs_zc_batchno = t.fs_zc_batchno)").Trim() + " "; } } else { strSql += Convert.ToString(" and t.fs_batch_optdate > (sysdate - 1)").Trim() + " "; } err = ""; ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { tbDetail = ds.Tables[0]; ArrayList alistCnst1 = new ArrayList(); if (dataTable3.Constraints.Count > 0) { foreach (Constraint cnst in dataTable3.Constraints) { alistCnst1.Add(cnst); } dataTable3.Constraints.Clear(); } CommonMethod.CopyDataToDatatable(ref tbDetail, ref dataTable3, true); CommonMethod.CopyDataToDatatable(ref tbMain, ref dataTable2, true); for (int i = 0; i < alistCnst1.Count; i++) { dataTable3.Constraints.Add((Constraint)alistCnst1[i]); } } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } CommonMethod.RefreshAndAutoSize(ultraGrid1); if (ultraGrid1.Rows.Count > 0) { ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } }
private void GetWeightInfo(string strBatchNo) { string strWhere = ""; if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strWhere += Convert.ToString(" and t.fd_starttime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { strWhere += Convert.ToString(" and t.fs_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { strWhere += Convert.ToString(" and t.fs_batchno like '%" + txtQueryBatchNo2.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { strWhere += " and t1.fs_batchno>='" + tbQueryBatchNo.Text.Trim() + "'"; } else { strWhere += " and t1.fs_batchno||trim(to_char(fn_bandno,'00'))>='" + tbQueryBatchNo.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo.Text + "','00'))"; } if (string.IsNullOrEmpty(this.tbQueryBandNo2.Text.Trim())) { strWhere += " and t1.fs_batchno<='" + txtQueryBatchNo2.Text.Trim() + "'"; } else { strWhere += " and t1.fs_batchno||trim(to_char(fn_bandno,'00'))<='" + txtQueryBatchNo2.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo2.Text + "','00'))"; } } //PL/SQL SPECIAL COPY string strSql = ""; strSql += Convert.ToString("select a.*,Round(a.fn_theoryweight/a.RealWeight,4)*100 RealRate").Trim() + " "; strSql += Convert.ToString(" from (select case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" 0").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" 1").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 1 then").Trim() + " "; strSql += Convert.ToString(" 2").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 1 then").Trim() + " "; strSql += Convert.ToString(" 3").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" 4").Trim() + " "; strSql += Convert.ToString(" end XH,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" '规格【' || fs_spec || '】小计:'").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 1 then").Trim() + " "; strSql += Convert.ToString(" '牌号【' || fs_steeltype || '】小计:'").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 1 then").Trim() + " "; strSql += Convert.ToString(" '总计:'").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_steeltype) = 0 and grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" max(fs_batchno)").Trim() + " "; strSql += Convert.ToString(" end fs_batchno,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" fs_steeltype").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fs_steeltype,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" fs_spec").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fs_spec,").Trim() + " "; strSql += Convert.ToString(" sum(nvl(fn_bandcount, 0)) fn_bandcount,").Trim() + " "; strSql += Convert.ToString(" round(sum(nvl(fn_totalweight, 0)), 3) fn_totalweight,").Trim() + " "; strSql += Convert.ToString(" round(sum(nvl(fn_theoryweight, 0)), 3) fn_theoryweight,sum(Realweight) Realweight,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" max(fs_productno)").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fs_productno,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" max(fd_starttime)").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fd_starttime,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" max(fd_endtime)").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fd_endtime,").Trim() + " "; strSql += Convert.ToString(" case").Trim() + " "; strSql += Convert.ToString(" when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " "; strSql += Convert.ToString(" grouping(fs_spec) = 0 then").Trim() + " "; strSql += Convert.ToString(" max(fs_completeflag)").Trim() + " "; strSql += Convert.ToString(" else").Trim() + " "; strSql += Convert.ToString(" null").Trim() + " "; strSql += Convert.ToString(" end fs_completeflag ").Trim() + " "; strSql += Convert.ToString(" from (select t.fs_batchno,").Trim() + " "; strSql += Convert.ToString(" t.fs_productno,").Trim() + " "; strSql += Convert.ToString(" t.fs_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_spec,").Trim() + " "; strSql += Convert.ToString(" t1.fn_bandcount,").Trim() + " "; strSql += Convert.ToString(" t1.fn_totalweight,").Trim() + " "; strSql += Convert.ToString(" t1.fn_theoryweight,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_starttime, 'yyyy-MM-dd hh24:mi:ss') fd_starttime,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_endtime, 'yyyy-MM-dd hh24:mi:ss') fd_endtime,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_completeflag, '1', '√', '') fs_completeflag").Trim() + " "; strSql += ",(select sum(it.fn_jj_weight) from it_fp_techcard it where it.fs_zc_batchno=t.fs_batchno) RealWeight "; strSql += Convert.ToString(" from dt_productweightmain t,").Trim() + " "; strSql += Convert.ToString(" (select t1.fs_batchno,").Trim() + " "; strSql += Convert.ToString(" count(1) fn_bandcount,").Trim() + " "; strSql += Convert.ToString(" round(sum(nvl(t1.fn_weight, 0)),3) fn_totalweight,").Trim() + " "; strSql += Convert.ToString(" round(sum(nvl(t1.fn_theoryweight, 0)),3) fn_theoryweight").Trim() + " "; strSql += Convert.ToString(" from dt_productweightdetail t1").Trim() + " "; strSql += Convert.ToString(" where exists").Trim() + " "; strSql += Convert.ToString(" (select 1").Trim() + " "; strSql += Convert.ToString(" from dt_productweightmain t").Trim() + " "; strSql += Convert.ToString(" where t.fs_batchno = t1.fs_batchno " + strWhere + ")").Trim() + " "; strSql += Convert.ToString(" group by t1.fs_batchno) t1").Trim() + " "; strSql += Convert.ToString(" where t.fs_batchno = t1.fs_batchno)").Trim() + " "; strSql += Convert.ToString(" group by cube(fs_batchno, fs_steeltype, fs_spec)) a").Trim() + " "; strSql += Convert.ToString(" where xh <> 4").Trim() + " "; strSql += Convert.ToString(" order by xh, fs_batchno").Trim(); string err = ""; DataTable tbMain = null, tbDetail = null; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { tbMain = ds.Tables[0]; } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable2.Rows.Clear(); dataTable1.Rows.Clear(); return; } strWhere = ""; string strWhere1 = string.Empty; if (cbxDateTime.Checked) { string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"); string strDateTimeTo = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm"); strWhere1 += Convert.ToString(" and x.fd_starttime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { strWhere1 += Convert.ToString(" and x.fs_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " "; } if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { strWhere1 += Convert.ToString(" and x.fs_batchno like '%" + txtQueryBatchNo2.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim())) { if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim())) { strWhere += " and t.fs_batchno>='" + tbQueryBatchNo.Text.Trim() + "'"; } else { strWhere += " and t.fs_batchno||trim(to_char(fn_bandno,'00'))>='" + tbQueryBatchNo.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo.Text + "','00'))"; } if (string.IsNullOrEmpty(this.tbQueryBandNo2.Text.Trim())) { strWhere += " and t.fs_batchno<='" + txtQueryBatchNo2.Text.Trim() + "'"; } else { strWhere += " and t.fs_batchno||trim(to_char(fn_bandno,'00'))<='" + txtQueryBatchNo2.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo2.Text + "','00'))"; } } strSql = ""; strSql += Convert.ToString("select t.fn_bandno,").Trim() + " "; strSql += Convert.ToString(" t.fn_weight,").Trim() + " "; strSql += Convert.ToString(" t.fn_theoryweight,").Trim() + " "; strSql += Convert.ToString(" t.fs_type,").Trim() + " "; strSql += Convert.ToString(" t.fn_length,").Trim() + " "; strSql += Convert.ToString(" t.fn_bandbilletcount,").Trim() + " "; strSql += Convert.ToString(" t.fs_person,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_point, 'K17', '棒材1#秤', 'K18', '棒材1#秤', t.fs_point) fs_point,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_datetime, 'yyyy-MM-dd HH24:mi:ss') fd_datetime,").Trim() + " "; strSql += Convert.ToString(" t.fs_shift,").Trim() + " "; strSql += Convert.ToString(" t.fs_term,").Trim() + " "; strSql += Convert.ToString(" decode(t.fs_upflag, '1', '√', '') fs_upflag,").Trim() + " "; strSql += Convert.ToString(" t1.fs_standno,").Trim() + " "; strSql += Convert.ToString(" t1.fs_printweighttype,").Trim() + " "; strSql += Convert.ToString(" t1.fs_printtype,").Trim() + " "; strSql += Convert.ToString(" t1.fs_twinstype,").Trim() + " "; strSql += Convert.ToString(" t1.fs_addresscheck,").Trim() + " "; strSql += Convert.ToString(" t1.fs_standardcheck,").Trim() + " "; strSql += Convert.ToString(" t1.fs_steeltypecheck,").Trim() + " "; strSql += Convert.ToString(" t.fs_weightno,t.FS_JUDGER,to_char(t.FS_JUDGETIME, 'yyyy-MM-dd HH24:mi:ss') FS_JUDGETIME,").Trim() + " "; strSql += Convert.ToString(" decode(nvl(t.fs_unqualified, '0'), '1', '不合格', '合格') fs_unqualified,").Trim() + " "; strSql += Convert.ToString(" t.fs_batchno,round((t.fn_weight-t.fn_theoryweight)/t.fn_theoryweight*100,3) FN_DISWEIGHT").Trim() + " "; strSql += Convert.ToString(" from dt_productweightdetail t, dt_productplan t1").Trim() + " "; strSql += Convert.ToString(" where exists (select 1").Trim() + " "; strSql += Convert.ToString(" from dt_productweightmain x").Trim() + " "; strSql += Convert.ToString(" where x.fs_batchno = t.fs_batchno " + strWhere1 + ")").Trim() + " "; strSql += strWhere; strSql += Convert.ToString(" and t.fs_batchno = t1.fs_batchno(+)").Trim() + " "; strSql += Convert.ToString(" and t.fs_point = t1.fs_pointid(+)").Trim() + " "; strSql += Convert.ToString(" order by t.fs_batchno, t.fn_bandno").Trim(); err = ""; ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { tbDetail = ds.Tables[0]; ArrayList alistCnst1 = new ArrayList(); if (dataTable2.Constraints.Count > 0) { foreach (Constraint cnst in dataTable2.Constraints) { alistCnst1.Add(cnst); } dataTable2.Constraints.Clear(); } CommonMethod.CopyDataToDatatable(ref tbDetail, ref dataTable2, true); CommonMethod.CopyDataToDatatable(ref tbMain, ref dataTable1, true); for (int i = 0; i < alistCnst1.Count; i++) { dataTable2.Constraints.Add((Constraint)alistCnst1[i]); } } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } CommonMethod.RefreshAndAutoSize(ultraGrid1); if (ultraGrid1.Rows.Count > 0) { ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } if (string.IsNullOrEmpty(strBatchNo)) { return; } for (int i = 0; i < ultraGrid1.Rows.Count; i++) { try { if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_BATCHNO"].Value).Equals(strBatchNo)) { ultraGrid1.Rows[i].ExpandAll(); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_BATCHNO", false); break; } } catch { } } }
/// <summary> /// 查询记录 /// </summary> private void GetBCtheoryWeightInfo() { string strSql = @"select 'false' checked, FS_SPEC, FN_LENGTH, FN_WEIGHT, FN_BILLETCOUNT, FN_ID, FS_MINDIFFERENTRATE, FS_MAXDIFFERENTRATE, FS_BUNDLEWEIGHT, FS_BUNDLEMINWWEIGHT, FS_BUNDLEMAXWWEIGHT from BT_BCTHEORYWEIGHTINFO t where 1 = 1 "; if (!string.IsNullOrEmpty(tbqueryFS_SPEC.Text.Trim()))//规格 { strSql += Convert.ToString(" and t.FS_SPEC like '%" + tbqueryFS_SPEC.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbqueryFN_LENGTH.Text.Trim()))//长度 { strSql += Convert.ToString(" and t.FN_LENGTH like '%" + tbqueryFN_LENGTH.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbqueryFN_WEIGHT.Text.Trim()))//单支理论重量 { strSql += Convert.ToString(" and t.FN_WEIGHT like '%" + tbqueryFN_WEIGHT.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbqueryFN_BILLETCOUNT.Text.Trim())) //单捆包装支数 { strSql += Convert.ToString(" and t.FN_BILLETCOUNT like '%" + tbqueryFN_BILLETCOUNT.Text.Trim() + "%'").Trim() + " "; } strSql += Convert.ToString(" order by t.FN_ID asc").Trim(); string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } CommonMethod.RefreshAndAutoSize(ultraGrid1); if (ultraGrid1.Rows.Count > 0) { ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } for (int i = 0; i < ultraGrid1.Rows.Count; i++) { ultraGrid1.Rows[i].Cells["FN_ID"].Appearance.BackColor = Color.FromArgb(192, 255, 192); } //for (int i = 0; i < ultraGrid1.Rows.Count; i++) //{ // try // { // if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals("")) // { // CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_CARDNO", false); // } // if (ultraGrid1.Rows[i].Cells["FS_UNQUALIFIED"].Value.ToString() == "×") // { // ultraGrid1.Rows[i].Appearance.ForeColor = Color.Red; // } // } // catch { } //} }
public bool DataValidation_Rolling(ProduceLine ProLine, out Hashtable htblValue) { htblValue = new Hashtable(); try { if (ultraGrid1.Rows.Count == 0) { return(false); } ultraGrid1.UpdateData(); string strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_SPEC"].Value).Trim(); if (string.IsNullOrEmpty(strValue)) { MessageBox.Show("请输入轧制规格!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_SPEC", true); return(false); } int iCount = 0; decimal dCount = 0.0M; bool bOK = false; if (ProLine != ProduceLine.GX) { strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_LENGTH"].Value).Trim(); if (string.IsNullOrEmpty(strValue)) { MessageBox.Show("请输入定尺长度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true); return(false); } bOK = int.TryParse(strValue, out iCount); if (!bOK) { MessageBox.Show("定尺长度必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true); return(false); } if (iCount < 0) { MessageBox.Show("定尺长度必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true); return(false); } } strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_NUM"].Value).Trim(); if (string.IsNullOrEmpty(strValue)) { MessageBox.Show("请输入成材条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true); return(false); } bOK = decimal.TryParse(strValue, out dCount); if (!bOK) { MessageBox.Show("成材条数必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true); return(false); } if (dCount < 0) { MessageBox.Show("成材条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true); return(false); } strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_WASTNUM"].Value).Trim(); if (!string.IsNullOrEmpty(strValue)) { bOK = decimal.TryParse(strValue, out dCount); if (!bOK) { MessageBox.Show("轧废条数必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_WASTNUM", true); return(false); } if (dCount < 0) { MessageBox.Show("轧废条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_WASTNUM", true); return(false); } } strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_SPEC"].Text).Trim(); htblValue.Add("V2", strValue); //轧制规格 strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_LENGTH"].Text).Trim(); htblValue.Add("V3", strValue); //定尺长度 strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FD_ZZ_DATE"].Text).Trim(); htblValue.Add("V4", strValue); //轧制时间 strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_NUM"].Text).Trim(); htblValue.Add("V5", strValue); //成材支数 strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_WASTNUM"].Text).Trim(); htblValue.Add("V6", strValue); //轧废支数 strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FS_ZZ_MEMO"].Text).Trim(); htblValue.Add("V8", strValue); //轧废支数 return(true); } catch { } return(false); }
private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e) { try { if (e.Cell.Column.Key.Equals("CHECKED")) { if (Convert.ToBoolean(e.Cell.Value)) { this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value; this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value; this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value; string strWeight = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim(); if (string.IsNullOrEmpty(strWeight) || strWeight == "0") { this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value; } CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, e.Cell.Row.Index, "FN_GPYS_NUMBER", true); } else { this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value = ""; this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = "";; this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = ""; } } else if (e.Cell.Column.Key.Equals("FS_DJH") || e.Cell.Column.Key.Equals("FN_GPYS_WEIGHT")) { string strValue = Convert.ToString(e.Cell.Value).Trim(); if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strValue)) { e.Cell.Value = ""; return; } } else if (e.Cell.Column.Key.Equals("FN_GPYS_NUMBER")) { string strCount = Convert.ToString(e.Cell.Value).Trim(); if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strCount)) { e.Cell.Value = ""; return; } string strCountLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value).Trim(); if (string.IsNullOrEmpty(strCount)) { this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = ""; this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = ""; return; } int iCount = 0; int iCountLG = Convert.ToInt16(strCountLG); if (!int.TryParse(strCount, out iCount)) { MessageBox.Show("验收数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cell.Value = iCountLG.ToString(); return; } if (iCount <= 0) { MessageBox.Show("验收数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cell.Value = iCountLG.ToString(); return; } if (iCount > iCountLG) { MessageBox.Show("验收数不能大于总条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cell.Value = iCountLG.ToString(); return; } try { string strWeightLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value).Trim(); if (!string.IsNullOrEmpty(strWeightLG)) { decimal dWeightYS = Convert.ToDecimal(strWeightLG); decimal dWeight = Math.Round(iCount * dWeightYS / iCountLG, 3); this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeight.ToString(); } } catch { } try { string strWeightLGLL = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value).Trim(); if (!string.IsNullOrEmpty(strWeightLGLL)) { decimal dWeightYS = Convert.ToDecimal(strWeightLGLL); decimal dWeightLL = Math.Round(iCount * dWeightYS / iCountLG, 3); this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = dWeightLL.ToString(); string strWeightSZ = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim(); if (string.IsNullOrEmpty(strWeightSZ) || strWeightSZ == "0") { this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeightLL.ToString(); } } } catch { } } } catch { } }
private void GetStockInfo(string strCardNo) { //PL/SQL Special Copy string strSql = ""; strSql += Convert.ToString("select 'false' checked,").Trim() + " "; strSql += Convert.ToString(" t.fs_cardno,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_smeltdate, 'yyyy-MM-dd hh24:mi:ss') fd_smeltdate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_stoveno,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_steeltype,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_spe,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_c,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_si,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mn,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_s,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_p,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ni,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cr,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_cu,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_v,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_mo,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ceq,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_as,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_ti,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_sb,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_als,").Trim() + " "; strSql += Convert.ToString(" t.fn_gp_totalcount,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_jj_weight, 3) fn_jj_weight,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gp_totalcount * round(decode(substr(t.fs_gp_stoveno, 4, 1), '1', 0.174, '2', 0.174, '3', 0.176, 0.174) * t.fn_gp_len, 3), 3) fn_jj_weight_ll,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_memo,").Trim() + " "; strSql += Convert.ToString(" t.fs_gp_judger,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " "; strSql += Convert.ToString(" t.fn_gpys_number,").Trim() + " "; strSql += Convert.ToString(" t.fs_djh,").Trim() + " "; strSql += Convert.ToString(" to_char(t.fd_gpys_receivedate, 'yyyy-MM-dd hh24:mi:ss') fd_gpys_receivedate,").Trim() + " "; strSql += Convert.ToString(" t.fs_gpys_receiver,").Trim() + " "; strSql += Convert.ToString(" decode(nvl(t.fs_checked, '0'), '0', '', '√') fs_checked,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gpys_weight, 3) fn_gpys_weight,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gpys_number * round(decode(substr(t.fs_gp_stoveno, 4, 1), '1', 0.174, '2', 0.174, '3', 0.176, 0.174) * t.fn_gp_len, 3), 3) fn_gpys_weight_ll,").Trim() + " "; strSql += Convert.ToString(" round(t.fn_gp_len, 2) fn_gp_len,").Trim() + " "; strSql += Convert.ToString(" t.fs_advisespec,").Trim() + " "; strSql += "decode(t.FS_UNQUALIFIED,'0','√','1','×','√') FS_UNQUALIFIED "; strSql += Convert.ToString(" from it_fp_techcard t").Trim() + " "; strSql += Convert.ToString(" where 1 = 1").Trim() + " "; strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fs_gp_completeflag, '0') when t.fs_transtype = '3' then '1' else '0' end = '1'").Trim() + " "; strSql += Convert.ToString(" and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fn_jj_weight, 0) when t.fs_transtype = '3' then 1 else 0 end > 0").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_batched, '0') = '0' and t.fs_zc_batchno is null").Trim() + " "; strSql += Convert.ToString(" and t.fs_gp_flow = '" + this._STOCK + "'").Trim() + " "; strSql += Convert.ToString(" and nvl(t.fs_isvalid, '0') = '0'").Trim() + " "; if (!string.IsNullOrEmpty(tbQueryButtressNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_djh like '%" + tbQueryButtressNo.Text.Trim() + "%'").Trim() + " "; } if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim())) { strSql += Convert.ToString(" and t.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%'").Trim() + " "; } strSql += Convert.ToString(" order by t.fs_gp_stoveno desc").Trim(); string err = ""; DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable table = ds.Tables[0]; CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true); } else { if (!string.IsNullOrEmpty(err)) { MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dataTable1.Rows.Clear(); } CommonMethod.RefreshAndAutoSize(ultraGrid1); if (ultraGrid1.Rows.Count > 0) { ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } //if (string.IsNullOrEmpty(strCardNo)) // return; for (int i = 0; i < ultraGrid1.Rows.Count; i++) { try { if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals(strCardNo)) { CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_CARDNO", false); } if (ultraGrid1.Rows[i].Cells["FS_UNQUALIFIED"].Value.ToString() == "×") { ultraGrid1.Rows[i].Appearance.ForeColor = Color.Red; } } catch { } } }