| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System.Threading;
- using System.Diagnostics;
- using System.IO;
- using Core.StlMes.Client.LgCommon;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.Misc;
- namespace Core.StlMes.Client.LgResMgt
- {
- public partial class frmScrapSteel2 : frmStyleBase
- {
- private System.Threading.Thread myThread_FG;
- private Hashtable hashLD = new Hashtable();
- private string _strSendSucceededForBof1 = "";
- private string _strSendSucceededForBof2 = "";
- private string _strSendSucceededForBof3 = "";
- private string _strSendSucceededForBof4 = "";
- private string _strSendSucceededForBof5 = "";
- public string workshopNo = "";
- public frmScrapSteel2()
- {
- InitializeComponent();
- CheckForIllegalCrossThreadCalls = false;
- }
- private void frmScrapSteel_Load(object sender, EventArgs e)
- {
- workshopNo = this.CustomInfo;
- intForm();
- checkJZ.Checked = true;
- ultraSBZ.SelectedIndex = 0;
- this.udte_StartTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
- this.udte_EndTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
- ute_RLSJ.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- GetZL_Thread();
- pro_QueryLD();
- ultraSBZ.SelectedIndex = 0;
- if (ultraSLD.Items.Count > 0)
- {
- ultraLD.SelectedIndex = 0;
- }
- GetRLMX_Data();
- pro_QueryNullWgt();
- }
- private void intForm()
- {
- try
- {
- if (workshopNo == "1")
- {
- label15.Text = "1#转炉";
- label16.Text = "2#转炉";
- label17.Visible = false;
- ute_ZL3.Visible = false;
- button3.Visible = false;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数59");
- }
- }
- // 获取料斗信息
- /// <summary>
- /// 获取料斗信息
- /// </summary>
- private void pro_QueryLD()
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add(workshopNo);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_RESULT0001", 5, arry, out strErr);
- if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- hashLD.Clear();
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- if (!hashLD.Contains(ds.Tables[0].Rows[i]["CHARGENO"].ToString()))
- {
- hashLD.Add(ds.Tables[0].Rows[i]["CHARGENO"].ToString(), ds.Tables[0].Rows[i]["TAREWEIGHT"].ToString());
- }
- ultraLD.Items.Add(ds.Tables[0].Rows[i]["CHARGENO"].ToString());
- ultraSLD.Items.Add(ds.Tables[0].Rows[i]["CHARGENO"].ToString());
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数82");
- }
- }
- // 取入炉明细数据主表
- /// <summary>
- /// 取入炉明细数据主表
- /// </summary>
- private void GetRLMX_Data()
- {
- try
- {
- try
- {
- string bz = "";
- string heatno = "";
- string ld = "";
- string strStartTime = this.udte_StartTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- string strEndTime = this.udte_EndTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- if(chkBZ.Checked)
- {
- bz = ultraSBZ.Value.ToString();
- }
- if (chkHeatno.Checked)
- {
- heatno = textHeatno.Text.Trim();
- }
- if (chkLD.Checked)
- {
- ld = ultraSLD.Text.Trim();
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add(strStartTime);
- arry.Add(strEndTime);
- arry.Add(bz);
- arry.Add(bz);
- arry.Add(ld);
- arry.Add(ld);
- arry.Add(heatno);
- arry.Add(heatno);
- arry.Add(workshopNo);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_RESULT0005", 5, arry, out strErr);
- ultraDataSource1.Rows.Clear();
- if (strErr == "" && ds != null)
- {
- if (ds.Tables.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- ultraDataSource1.Rows.Add(new object[] {
- dr["JOBID"].ToString(),
- dr["HEATNO"].ToString(),
- dr["BLOCKFUR"].ToString(),
- dr["STATIONCODE"].ToString(),
- dr["SHIFTCODE"].ToString(),
- dr["CHARGENO"].ToString(),
- dr["TOTALWGT"].ToString(),
- dr["CHUTEWGT"].ToString(),
- dr["JOINSTOVEWGT"].ToString(),
- dr["JOBDATE"].ToString(),
- dr["MEMO"].ToString(),
- dr["OPTPERSONNEL"].ToString()
- });
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数122");
- }
- SetSteelSum();
- PublicMethod.RefreshAndAutoSize(ultraGrid1);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数120");
- }
- }
- // 获取未发送废钢的炉号信息
- /// <summary>
- /// 获取未发送废钢的炉号信息
- /// </summary>
- private void pro_QueryNullWgt()
- {
- try
- {
- string beginNum = "";
- string endNum = "";
- string strNum = "";
- if (radioButton1.Checked)
- {
- strNum = "0";
- }
- else
- {
- strNum = "1";
- }
- if (workshopNo == "1")
- {
- beginNum = "1";
- endNum = "2";
- }
- else
- {
- beginNum = "3";
- endNum = "5";
- }
- string strErr = "";
- string strStartTime = this.udte_StartTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- string strEndTime = this.udte_EndTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
- ArrayList arry = new ArrayList();
- arry.Add(strStartTime);
- arry.Add(strEndTime);
- arry.Add(strNum);
- arry.Add(beginNum);
- arry.Add(endNum);
- arry.Add(strStartTime);
- arry.Add(strEndTime);
- arry.Add(strNum);
- arry.Add(beginNum);
- arry.Add(endNum);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_RESULT0006", 5, arry, out strErr);
- ultraDataSource2.Rows.Clear();
- if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- ultraDataSource2.Rows.Add(new object[] {
- dr["HEATNO"].ToString(),
- dr["STATIONCODE"].ToString(),
- dr["IRONPOTWGT"].ToString(),
- dr["WSTEELWGT"].ToString(),
- dr["OPTDATE"].ToString(),
- dr["FLAG"].ToString()
- });
- }
- }
- PublicMethod.RefreshAndAutoSize(ultraGrid5);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数201");
- }
- }
- // 统计废钢重量
- /// <summary>
- /// 统计废钢重量
- /// </summary>
- private void SetSteelSum()
- {
- UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
- band.Summaries.Clear();
- SummarySettings summary = band.Summaries.Add(SummaryType.Count, band.Columns[5]);
- summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
- summary.DisplayFormat = "合计:";
- for (int i = 6; i < 10; i++)
- {
- summary = band.Summaries.Add(SummaryType.Sum, band.Columns[i]);
- summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
- summary.DisplayFormat = " {0:#####.00}";
- summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Center;
- summary.Appearance.ForeColor = Color.DarkBlue;
- summary.Appearance.BackColor = Color.White;
- }
- band.Override.SummaryFooterCaptionVisible = Infragistics.Win.DefaultableBoolean.False;
- }
- // 取消发送
- /// <summary>
- /// 取消发送
- /// </summary>
- private void CancelSend()
- {
- try
- {
- ultraGrid1.UpdateData();
- string strXH = ultraGrid1.ActiveRow.Cells["JOBID"].Value.ToString();
- string strLH = ultraGrid1.ActiveRow.Cells["HEATNO"].Value.ToString();
- if (strXH.Length == 0)
- {
- MessageBox.Show("无效的炉号!\n无法取消发送!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (strLH.Length == 0)
- {
- MessageBox.Show("无效的序号!\n无法取消发送!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- DialogResult dr = MessageBox.Show("确定取消已经发送的废钢信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
- if (dr == DialogResult.No) return;
- String strErr = "";
- string strSqlID = "frmScrapMater.Cancelsendtwo";
- object[] sArgs = new object[2];
- sArgs[0] = strLH; //炉号
- sArgs[1] = strXH; //序号
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
- "ExecProcWithCollParam", strSqlID, sArgs, out strErr);
- if (strErr != "")
- {
- // MessageBox.Show("废钢信息取消发送失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- else
- {
- MessageBox.Show("废钢信息取消发送成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- GetRLMX_Data();
- pro_QueryNullWgt();
- }
-
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数298");
- }
- }
- //实时刷新当前转炉正在冶炼的熔炼号
- ///<summary>
- ///实时刷新当前转炉正在冶炼的熔炼号
- ///</summary>
- private void GetZL_Thread()
- {
- try
- {
- myThread_FG = new Thread(new ThreadStart(getZLCurrentLH));
- myThread_FG.Priority = ThreadPriority.Normal;
- myThread_FG.Start();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数348");
- }
- }
- // 取当前转炉正在冶炼熔炼号 C##01_DEVICE
- /// <summary>
- /// 取当前转炉正在冶炼熔炼号 CVT01_DEVICE
- /// </summary>
- private void getZLCurrentLH()
- {
- try
- {
- System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
- while (true)
- {
- if (!this.On_Off_Thread)
- {
- System.Threading.Thread.Sleep(500);
- continue;
- }
- this.ute_ZL1.Text = "";
- this.ute_ZL2.Text = "";
- this.ute_ZL3.Text = "";
- //初始化颜色
- ute_ZL1.Appearance.BackColor = Color.White;//.Gainsboro;
- ute_ZL2.Appearance.BackColor = Color.White;
- ute_ZL3.Appearance.BackColor = Color.White;
- ute_RLSJ.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- string strError = "";
- ArrayList arry = new ArrayList();
- arry.Clear();
- arry.Add("getZLCurrentLH.query");
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strError);
- if (strError == "")
- {
- if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- //初始化颜色
- ute_ZL1.Appearance.BackColor = Color.White;
- ute_ZL2.Appearance.BackColor = Color.White;
- ute_ZL3.Appearance.BackColor = Color.White;
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- string v_ZLH = ds.Tables[0].Rows[i]["objectpos"].ToString().Substring(3, 2);
- string v_LH = (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(5, ds.Tables[0].Rows[i]["objectid"].ToString().Length - 5));
- // if (ds.Tables[0].Rows[i]["objectid"].ToString().Substring(0, 1) == "V") v_LH = "V" + v_LH;
- if (workshopNo == "1")
- {
- if (v_ZLH == "01")
- {
- this.ute_ZL1.Text = v_LH;
- HeatNo_HudwId_Exist(v_LH, "01");
- }
- if (v_ZLH == "02")
- {
- this.ute_ZL2.Text = v_LH;
- HeatNo_HudwId_Exist(v_LH, "02");
- }
- }
- else
- {
- if (v_ZLH == "03")
- {
- this.ute_ZL1.Text = v_LH;
- HeatNo_HudwId_Exist(v_LH, "03");
- }
- if (v_ZLH == "04")
- {
- this.ute_ZL2.Text = v_LH;
- HeatNo_HudwId_Exist(v_LH, "04");
-
- }
- if (v_ZLH == "05")
- {
- this.ute_ZL3.Text = v_LH;
- HeatNo_HudwId_Exist(v_LH, "05");
- }
- }
- }
- }
- }
- Thread.Sleep(10000);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数367");
- }
- }
- // 判断是否已经发送废钢
- /// <summary>
- /// 判断是否已经发送废钢
- /// </summary>
- /// <熔炼号="strID"></param>
- /// <炉座号="strGw"></param>
- private void HeatNo_HudwId_Exist(string strID, string strGw)
- {
- string strErr = "";
- try
- {
- ArrayList arry = new ArrayList();
- arry.Add("HeatNo_HudwId_Exist.query");
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- arry.Add(strID);
- arry.Add(strID);
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr == "")
- {
- switch (strGw)
- {
- case "01":
- _strSendSucceededForBof1 = ds.Tables[0].Rows[0]["intCount"].ToString()=="0"?"N":"Y";
- if (_strSendSucceededForBof1 == "N") ute_ZL1.Appearance.BackColor = Color.White;
- if (_strSendSucceededForBof1 == "Y") ute_ZL1.Appearance.BackColor = Color.LightBlue;
- break;
- case "02":
- _strSendSucceededForBof2 = ds.Tables[0].Rows[0]["intCount"].ToString() == "0" ? "N" : "Y";
- if (_strSendSucceededForBof2 == "N") ute_ZL2.Appearance.BackColor = Color.White;
- if (_strSendSucceededForBof2 == "Y") ute_ZL2.Appearance.BackColor = Color.LightBlue;
- break;
- case "03":
- _strSendSucceededForBof3 = ds.Tables[0].Rows[0]["intCount"].ToString() == "0" ? "N" : "Y";
- if (_strSendSucceededForBof3 == "N") ute_ZL1.Appearance.BackColor = Color.White;
- if (_strSendSucceededForBof3 == "Y") ute_ZL1.Appearance.BackColor = Color.LightBlue;
- break;
- case "04":
- _strSendSucceededForBof4 = ds.Tables[0].Rows[0]["intCount"].ToString() == "0" ? "N" : "Y";
- if (_strSendSucceededForBof4 == "N") ute_ZL2.Appearance.BackColor = Color.White;
- if (_strSendSucceededForBof4 == "Y") ute_ZL2.Appearance.BackColor = Color.LightBlue;
- break;
- case "05":
- _strSendSucceededForBof5 = ds.Tables[0].Rows[0]["intCount"].ToString() == "0" ? "N" : "Y";
- if (_strSendSucceededForBof5 == "N") ute_ZL3.Appearance.BackColor = Color.White;
- if (_strSendSucceededForBof5 == "Y") ute_ZL3.Appearance.BackColor = Color.LightBlue;
- break;
- default:
- break;
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数459");
- }
- }
- // 系统菜单栏
- /// <summary>
- /// 系统菜单栏
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Add"://新增
- try
- {
- ute_RLSJ.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- }
- catch
- {
- return;
- }
- GetRLMX_Data();
- break;
- case "Update"://修改
- //if (!string.IsNullOrEmpty(ute_DH2.Text.Trim()) && !string.IsNullOrEmpty(ultNo.Text.Trim()))
- //{
- DialogResult result;
- string mk = "确实要修改吗?";
- result = MessageBox.Show(this, mk, "提示", MessageBoxButtons.YesNo,
- MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- if (ultraGrid1.ActiveRow != null)
- {
- try
- {
- DateTime aa = Convert.ToDateTime(ute_RLSJ.Text.ToString());
- string strXH = this.ultraGrid1.ActiveRow.Cells["ZYXH"].Value.ToString().Trim();
- // UpdateDataRow(strXH);
- GetRLMX_Data();
- }
- catch
- {
- MessageBox.Show("入炉时间 不是合法的日期时间!\n\n请重新选择入炉时间!", "提示");
- }
- }
- else
- {
- MessageBox.Show("请选择需要修改的记录!", "提示");
- }
- }
- // }
- else
- MessageBox.Show("请选择需要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- break;
- case "Query":// 查询
- GetRLMX_Data();
- pro_QueryNullWgt();
- break;
- case "Config":
- frmChargeConfig config = new frmChargeConfig(ob);
- config.Tag = this;
- config.WorkShopNo = workshopNo;
- config.ShowDialog();
- break;
- case "Export"://导出Excel
- Core.Mes.Client.Comm.Globals.ulGridToExcel(ultraGrid1, Text);
- break;
- case "Cancel"://取消发送
- CancelSend();
- break;
- case "Exit":
- this.Close();
- break;
- default:
- break;
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- if (this.ultraGrid1.Rows.Count == 0 || this.ultraGrid1.ActiveRow == null)
- {
- return;
- }
- UltraGridRow row = null;
- if (ultraGrid1.ActiveRow.HasParent())
- {
- row = ultraGrid1.ActiveRow.ParentRow;
- }
- else
- {
- row = ultraGrid1.ActiveRow;
- }
- ultNo.Text = row.Cells["JOBID"].Value.ToString();
- ute_LH.Text = row.Cells["HEATNO"].Value.ToString();
- utlcbdevNo.Text = row.Cells["STATIONCODE"].Value.ToString();
- //ute_DH2.Text = row.Cells["CHARGENO"].Value.ToString();
- ute_RLSJ.Text = row.Cells["JOBDATE"].Value.ToString();
- ute_RLZL.Text = row.Cells["JOINSTOVEWGT"].Value.ToString();
- ute_DZ.Text = row.Cells["CHUTEWGT"].Value.ToString();
- ute_ZZ.Text = row.Cells["TOTALWGT"].Value.ToString();
- ute_BZ.Text = row.Cells["MEMO"].Value.ToString();
- //cbb_BC.Text = row.Cells["SHIFTCODE"].Value.ToString();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数590");
- }
-
- }
- private void ute_RLSJ_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- try
- {
- frmSetTime frm = new frmSetTime(e.Context);
- //frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
- frm.Location = new Point(556,376);//ClsControlPack.GetChildWindowLocation(frm.Size);
- frm.AutoSize = true;
- if (frm.ShowDialog() == DialogResult.OK)
- {
- ute_RLSJ.Text = (Convert.ToDateTime(frm.SelectDate.ToString())).ToString("yyyy-MM-dd HH:mm:ss");
- ute_RLSJ.Update();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数625");
- }
- }
- // 发送废钢到转炉
- /// <summary>
- /// 发送废钢到转炉
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button_Click(object sender, EventArgs e)
- {
- try
- {
- Button button = (Button)sender;
- string stationcode = button.Tag == null ? "" : button.Tag.ToString();
- if (stationcode == "") return;
- string heatno="";
- if (stationcode == "03")
- {
- heatno = this.ute_ZL1.Text.Trim().ToString();
- }
- else if (stationcode == "04")
- {
- heatno = this.ute_ZL2.Text.Trim().ToString();
- }
- else if (stationcode == "05")
- {
- heatno = this.ute_ZL3.Text.Trim().ToString();
- }
- else if (stationcode == "all")
- {
- heatno = this.ute_ZLInput.Text.Trim().ToString();
- }
- if (heatno.Length == 0)
- {
- MessageBox.Show("无效的炉号!\n无法发送废钢!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- //if (ultraGrid1.ActiveRow.Appearance.BackColor == Color.LightGreen)
- //{
- // MessageBox.Show("选取的废钢信息已发送,不能重复发送\n如需重新发送,请先取消发送!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- // return;
- //}
- //if (ute_ZL1.Appearance.BackColor == Color.LightBlue)
- //{
- // DialogResult dr = MessageBox.Show("当前炉号已发送过废钢信息,是否替换原来已经发送的废钢信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
- // if (dr == DialogResult.No) return;
- //}
- this.ultraGrid1.DisplayLayout.Bands[0].Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;
- string v_DATE = (ute_RLSJ.Text.ToString() == "" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") :
- (Convert.ToDateTime(ute_RLSJ.Text.Trim())).ToString("yyyy-MM-dd HH:mm:ss")); //入炉时间
- string v_RLZL = ute_RLZL.Text.Trim() == "" ? "0" : ute_RLZL.Text.Trim(); //入炉重量
- string v_LDZL = ute_DZ.Text.Trim() == "" ? "0" : ute_DZ.Text.Trim(); // 料斗重
- string v_ZZL = ute_ZZ.Text.Trim() == "" ? "0" : ute_ZZ.Text.Trim(); //总重
- try
- {
- Convert.ToDouble(v_RLZL);
- Convert.ToDouble(v_ZZL);
- }
- catch
- {
- MessageBox.Show("重量不是有效数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (v_RLZL == "0" || v_RLZL == "")
- {
- MessageBox.Show("废钢总重为零,发送无意义!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- string strErr = "";
- string strSqlID = "frmScrapMater.sendtwo";
- object[] sArgs = new object[10];
- sArgs[0] = heatno; //炉号
- sArgs[1] = stationcode; //岗位
- sArgs[2] = ultraLD.Text.Trim(); //料斗号
- sArgs[3] = v_DATE; //入炉时间
- sArgs[4] = v_RLZL; //入炉重量
- sArgs[5] = v_LDZL; // 料斗重
- sArgs[6] = v_ZZL; //总重
- sArgs[7] = this.UserInfo.GetUserName(); //操作人
- sArgs[8] = ute_BZ.Text.Trim(); //备注
- sArgs[9] = workshopNo;
- try
- {
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
- "ExecProcWithCollParam", strSqlID, sArgs, out strErr);
- if (strErr != "")
- {
- // MessageBox.Show("发送失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- else
- {
- GetRLMX_Data();
- pro_QueryNullWgt();
- if (stationcode == "03")
- {
- _strSendSucceededForBof3 = "Y";
- }
- else if (stationcode == "04")
- {
- _strSendSucceededForBof4 = "Y";
- }
- else if (stationcode == "05")
- {
- _strSendSucceededForBof5 = "Y";
- }
- HeatNo_HudwId_Exist(heatno, stationcode);
- if (stationcode == "all")
- {
- if (chkHeatnoAdd.Checked)
- {
- try
- {
- ute_ZLInput.Text = (Convert.ToInt32(heatno) + 1).ToString();
- }
- catch { }
- }
- }
- MessageBox.Show("发送成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数651");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数651");
- }
- }
- private void ute_ZZ_ValueChanged(object sender, EventArgs e)
- {
- Double dZz = 0, dDz = 0, dRlzl = 0; //入炉重量,斗重
- try
- {
- //废钢重量
- if (!string.IsNullOrEmpty(ute_DZ.Text.Trim()))
- {
- dDz = Convert.ToDouble(ute_DZ.Text.Trim());
- }
- if (!string.IsNullOrEmpty(ute_ZZ.Text.Trim()))
- {
- dZz = Convert.ToDouble(ute_ZZ.Text.Trim());
- }
- if (dZz - dDz > 0)
- {
- dRlzl = dZz - dDz;
- }
- ute_RLZL.Text = Convert.ToString(dRlzl); //入炉重量
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数779");
- }
- }
- private void ute_RLZL_ValueChanged(object sender, EventArgs e)
- {
- Double dRlzl = 0, dDz = 0; //入炉重量,斗重
- try
- {
- //废钢重量
- if (!string.IsNullOrEmpty(ute_DZ.Text.Trim()))
- {
- dDz = Convert.ToDouble(ute_DZ.Text.Trim());
- }
- if (!string.IsNullOrEmpty(ute_RLZL.Text.Trim()))
- {
- dRlzl = Convert.ToDouble(ute_RLZL.Text.Trim());
- }
- ute_ZZ.Text = Convert.ToString(dRlzl + dDz);//总重量
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数807");
- }
- }
- //private void NumberInput_KeyPress(object sender, KeyPressEventArgs e)
- //{
- // if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
- // {
- // e.Handled = true;
- // }
- // char[] arrary = ((UltraTextEditor)sender).Text.ToCharArray();
- // if (e.KeyChar == '.')
- // {
- // if (arrary.Length == 0)
- // {
- // ((UltraTextEditor)sender).Text = "0.";
- // ((UltraTextEditor)sender).SelectionStart = ((UltraTextEditor)sender).Text.Trim().Length;
- // e.Handled = true;
- // }
- // else
- // {
- // for (int i = 0; i < arrary.Length; i++)
- // {
- // if (arrary[i] == '.')
- // e.Handled = true;
- // }
- // }
- // }
- // if (arrary.Length == 1)
- // {
- // if (e.KeyChar == '0')
- // {
- // if (arrary[0] == '0')
- // e.Handled = true;
-
- // }
- // if (arrary[0] == '0' && e.KeyChar != '.' && e.KeyChar != '\b' && e.KeyChar != '0'&&!(Char.IsNumber(e.KeyChar)))
- // {
- // ((UltraTextEditor)sender).Text = e.KeyChar.ToString();
- // ((UltraTextEditor)sender).SelectionStart = ((UltraTextEditor)sender).Text.Trim().Length;
- // e.Handled = true;
- // }
- // }
- //}
- private void HeatNoInput_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
- {
- e.Handled = true;
- }
- }
- private void chkSend_CheckedChanged(object sender, EventArgs e)
- {
- GetRLMX_Data();
- }
- private void ultraLD_ValueChanged(object sender, EventArgs e)
- {
- try
- {
- ute_DZ.Text = hashLD[ultraLD.Text.Trim()].ToString();
- }
- catch { }
- }
- private void checkJZ_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- if (checkJZ.Checked)
- {
- ute_RLZL.ReadOnly = false;
- ute_ZZ.ReadOnly = true;
- }
- else
- {
- ute_RLZL.ReadOnly = true;
- ute_ZZ.ReadOnly = false;
- }
- }
- catch { }
- }
- private void chkLD_CheckedChanged(object sender, EventArgs e)
- {
- ultraSLD.Enabled = chkLD.Checked;
- }
- private void chkBZ_CheckedChanged(object sender, EventArgs e)
- {
- ultraSBZ.Enabled = chkBZ.Checked;
- }
- private void chkHeatno_CheckedChanged(object sender, EventArgs e)
- {
- textHeatno.Enabled = chkHeatno.Checked;
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- pro_QueryNullWgt();
- }
- private void ultraGrid5_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
- {
- try
- {
- if (ultraGrid5.ActiveRow.Cells["HEATNO"].Value.ToString() != "")
- {
- ute_ZLInput.Text = ultraGrid5.ActiveRow.Cells["HEATNO"].Value.ToString().Trim();
- }
- }
- catch { }
- }
- private void ultraGrid5_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- try
- {
- if (e.Row.Cells["FLAG"].Value.ToString() == "未发送")
- {
- e.Row.Cells["FLAG"].Appearance.BackColor = Color.Salmon;
- }
- if (e.Row.Cells["FLAG"].Value.ToString() == "已发送")
- {
- e.Row.Cells["FLAG"].Appearance.BackColor = Color.PaleGreen;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message + "错误行数946");
- }
- }
- }
- }
|