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 CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using com.steering.mes.zgmil.entity; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.ZGMil.NodeResultQuery; using Core.StlMes.Client.ZGMil.Entity; using System.Net; using Core.StlMes.Client.ZGMil.ResultConrtrol; using System.Text.RegularExpressions; using Core.StlMes.Client.ZGMil.Common; using System.Collections; using Core.StlMes.Client.ZGMil.Popup; using CoreFS.SA06; namespace Core.StlMes.Client.ZGMil.Result { public partial class FrmFURResult : FrmBase { #region 初始化 MilPlan QueryMainPlan = new MilPlan(); MilPlan MainPlan = new MilPlan(); FurResultEntity FurResultEntity = new FurResultEntity(); FurResultEntity tempfurresult = new FurResultEntity();//实绩缓存 int PanelSizeFlag = 1; private int _MouseLocX = 0; //鼠标横坐标 private int _MouseLocY = 0; //鼠标纵坐标 private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号 private string proPlanId = null;//轧管订单编号 private string gxPlanNo = null;//工序排产序号 private string lotNo = null;//生产批号 private string id = null;//炉计划ID private string ActiveStatus = null;//主计划活动行的状态 private string ActiveResultNo = null; //private string ChangeUserID = ""; //接班用户名 //private string ChangePassWord = ""; //接班密码 string FirstSlabOutTemp = ""; //用来保存第一支出炉温度后带入下一炉出炉温度 string LastSlabOutTemp = ""; // string Shift = ""; string Group = ""; private string Departm = "";//部门 private string PlineCode = "";//产线 private string plineCode1 = "";//产线 private string _UserName = ""; //private string _Url = ""; private string _UserID = ""; private int ShowMessageFlag = 0; //private int ParamEdit = 0; private int ChangeFlag = 0; //交班标识 string PlanStatusQuery = "20"; private UltraGridRow ActiveUgr = null; public FrmFURResult() { Shift = UserInfo.GetUserOrder(); Group = UserInfo.GetUserGroup(); InitializeComponent(); this.furResult1.UltraGrid3.ClickCellButton += new CellEventHandler(UltraGrid3_ClickCellButton); GetGridButtonName(); ChangeGridColor(); PanelSizeFlag = 0; //获取鼠标坐标 Point formPoint = this.PointToClient(Control.MousePosition); _MouseLocX = Convert.ToInt32(formPoint.X); _MouseLocY = Convert.ToInt32(formPoint.Y); //splitContainer2.SplitterDistance = 180; } protected override void OnShown(EventArgs e) { base.OnShown(e); string hostname = Dns.GetHostName(); IPAddress ip = Dns.GetHostByName(hostname).AddressList[0]; NativeMethodNew na = new NativeMethodNew(this.ob); Departm = UserInfo.GetDepartment(); PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线 if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") ) { this.rollingCard1.ChangCard(); this.furResult1.UltraGrid3.DisplayLayout.Bands[0].Columns["BurnningRate"].Header.Appearance.ForeColor = Color.Gray; this.furResult1.UltraGrid3.DisplayLayout.Bands[0].Columns["BurnningRate"].CellActivation = Activation.NoEdit; ultraGridMatSeq.DisplayLayout.Bands[0].Columns["SCRAP_REASON"].Hidden = true; ultraGridMatSeq.DisplayLayout.Bands[0].Columns["DELBACK"].Hidden = true; ultraGridMatSeq.DisplayLayout.Bands[0].Columns["SCRAP_SLAB"].Hidden = true; ultraGridMatSeq.DisplayLayout.Bands[0].Columns["SCRAP_TIME"].Hidden = true; } foreach (UltraGridRow ugr in ultraGridPlan.Rows) { ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()); } Sign(); frmTechnological1.InitMilSet(PlineCode, "40030", this.ob); PlanQuery(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); //取消卡片筛选 rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; furResult1.UltraGrid3.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGridMatSeq.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ChangeGridColor(); InitControl(); PanelSizeFlag = 0; timer1.Tick += new EventHandler(timer1_Tick); foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns) { ugc.SortIndicator = SortIndicator.Disabled; } foreach (UltraGridColumn ugc in this.ultraGridINFurInfor.DisplayLayout.Bands[0].Columns) { ugc.SortIndicator = SortIndicator.Disabled; } foreach (UltraGridColumn ugc in this.ultraGridOUTFurInfor.DisplayLayout.Bands[0].Columns) { ugc.SortIndicator = SortIndicator.Disabled; } ShowShift(); //splitContainer2.SplitterDistance = 180; } private void ShowShift() { colShowShiftGroup1.Ob = this.ob; colShowShiftGroup1.Group = this.UserInfo.GetUserGroup(); colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder(); colShowShiftGroup1.ShowShift(); colShowShiftGroup1.Timer1.Enabled = true; } /// /// 定时器事件 /// /// /// void timer1_Tick(object sender, EventArgs e) { int MouseLocX = 0; int MouseLocY = 0; //获取当前鼠标坐标 //获取鼠标坐标 Point formPoint = this.PointToClient(Control.MousePosition); MouseLocX = Convert.ToInt32(formPoint.X); MouseLocY = Convert.ToInt32(formPoint.Y); if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY) { ShowMessageFlag = 1; PlanQuery(); ShowMessageFlag = 0; } else { _MouseLocX = MouseLocX; _MouseLocY = MouseLocY; } } /// /// 签名 /// private void Sign() { ColUserName col = new ColUserName(); col.StationId = "1"; col.PlineCode = PlineCode; col.ColGroup = Group; col.Ob = this.ob; col.ShowDialog(); _UserID = col.getUserId(); _UserName = col.getUserName(); } /// /// 初始化控件 /// public void InitControl() { //if (chkDate.Checked) //{ // dtStartDate.Enabled = true; // dtEndDate.Enabled = true; //} //else //{ // dtStartDate.Enabled = false; // dtEndDate.Enabled = false; //} if (chkLotNo.Checked) { txtLOT_NO.Enabled = true; } else { txtLOT_NO.Enabled = false; } if (chkHeatNo.Checked) { txtJudgeStoveNo.Enabled = true; } else { txtJudgeStoveNo.Enabled = false; } GetGridButtonName(); } #endregion #region 查询 控件赋值 方法 /// /// 刷新 /// public void ReFresh() { GetGridButtonName(); ChangeGridColor(); GetFurRack(); GetRollingCard(); } /// /// 判断是否能开始当前炉次 /// /// private bool IsStart() { bool Start = true; foreach (UltraGridRow ugr in ultraGridPlan.Rows) { UltraGridRow ugr1 = ultraGridPlan.ActiveRow; if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉") { string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getInFurTime", new object[] { JudgeStoveNo }, this.ob); if (string.IsNullOrEmpty(dt.Rows[0]["LAST_IN_TIME"].ToString())) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】入炉未完成,【" + BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】不能入炉"); Start = false; } } } return Start; } /// /// GridButton赋名 /// public void GetGridButtonName() { NativeMethodNew NaMethod = new NativeMethodNew(this.ob); if (ultraGridMatSeq.Rows.Count > 0) { foreach (UltraGridRow ugr in ultraGridMatSeq.Rows) { ugr.Cells["SCRAP_SLAB"].Value = "剔除管坯"; ugr.Cells["DELBACK"].Value = "剔料回退"; } } furResult1.UpdateDate(); if (ultraGridPlan.Rows.Count > 0) { } } /// /// 更改剔除坯料行颜色 /// public void ChangeGridColor() { foreach (UltraGridRow ugr in ultraGridPlan.Rows) { if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉") { ugr.Appearance.BackColor = Color.YellowGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉") { ugr.Appearance.BackColor = Color.LightGray; } if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉") { ugr.Appearance.BackColor = Color.LightGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉") { ugr.Appearance.BackColor = Color.LightGreen; } } foreach (UltraGridRow ugr in ultraGridINFurInfor.Rows) { if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉") { ugr.Appearance.BackColor = Color.YellowGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉") { ugr.Appearance.BackColor = Color.LightGray; } if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉") { ugr.Appearance.BackColor = Color.LightGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉") { ugr.Appearance.BackColor = Color.LightGreen; } } foreach (UltraGridRow ugr in ultraGridOUTFurInfor.Rows) { if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉") { ugr.Appearance.BackColor = Color.YellowGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉") { ugr.Appearance.BackColor = Color.LightGray; } if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉") { ugr.Appearance.BackColor = Color.LightGreen; } if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉") { ugr.Appearance.BackColor = Color.LightGreen; } } foreach (UltraGridRow ugr in ultraGridMatSeq.Rows) { if (ugr != null) { switch (ugr.Cells["STATUS"].Value.ToString()) { case "剔除": ugr.Appearance.BackColor = Color.Yellow; break; } switch (ugr.Cells["OUT_CHANGE_FLAG"].Value.ToString()) { case "出炉交班待确认": ugr.Appearance.BackColor = Color.LightGreen; break; } switch (ugr.Cells["IN_CHANGE_FLAG"].Value.ToString()) { case "入炉交班待确认": ugr.Appearance.BackColor = Color.LightGreen; break; } } } } /// /// 查询加热炉管号队列 /// public void GetFurRack() { dtMatSeq.Clear(); UltraGridRow ugr = ActiveUgr; int TabIndex = ultraTabControl2.ActiveTab.Index; switch (TabIndex) { case 0: if (ultraGridPlan.Rows.Count == 0) { return; } break; case 1: if (ultraGridINFurInfor.Rows.Count == 0) { return; } break; case 2: if (ultraGridOUTFurInfor.Rows.Count == 0) { return; } break; } if (ugr != null) { //string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); if (ugr.Cells["IS_START"].Value.ToString() == "未开始入炉") { return; } DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurRackSeq", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtMatSeq, true); //ultraGridMatSeq.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand); } } /// /// 查询流通卡信息 /// public void GetRollingCard() { UltraGridRow ugr = ultraGridPlan.ActiveRow; if (ugr != null) { string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); DataTable dt = new DataTable(); if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017")) { dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); } else { dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); } RollingCardEditGrid(dt, JudgeStoveNo); } } /// /// 查询结炉实绩 /// public void NodeQuery() { string Group = UserInfo.GetUserGroup(); DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string StartTime = SeverTime.ToString("yyyy-MM-dd"); string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd"); string Date = StartTime; string Time = SeverTime.ToLongTimeString(); //晚班 if (Shift == "3") { Time = Time.Replace(":", ""); if (int.Parse(Time) > 205900) { StartTime += " " + "21:00:00"; EndTime += " " + "10:00:00"; } else { StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00"; EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00"; } } else { StartTime = StartTime + " 00:00:00"; EndTime = EndTime + " 00:00:00"; } DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.GetSingleFurNodeResult", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob); FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 2, Date, Shift, Group, this.ob); frm.ShowDialog(); } #endregion #region 事件 /// /// checkbox点击事件 /// /// /// private void chkDate_CheckedChanged(object sender, EventArgs e) { //if (chkDate.Checked) //{ // dtStartDate.Enabled = true; // dtEndDate.Enabled = true; //} //else //{ // dtStartDate.Enabled = false; // dtEndDate.Enabled = false; //} if (chkLotNo.Checked) { txtLOT_NO.Enabled = true; } else { txtLOT_NO.Enabled = false; } if (chkHeatNo.Checked) { txtJudgeStoveNo.Enabled = true; } else { txtJudgeStoveNo.Enabled = false; } if (chkStatusQuery.Checked) { PlanStatusQuery = "99"; } else { PlanStatusQuery = "20"; } if (chkAutoRefresh.Checked) { timer1.Enabled = true; } else { timer1.Enabled = false; } } /// /// ToolBar按钮 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": PlanQuery(); break; case "DoSave": FurResultSave(); break; case "DoNode": FeedSawResultNode(); break; case "DoSign": Sign(); break; case "DoNodeBack": NodeBack(); break; case "DoNodeQuery": NodeQuery(); break; case "DoStart": DoStart(); break; case "DoStartBack": StartBack(); break; case "DoQueryBefore": QueryBefore(); break; case "DoChangeCancel": ChangeCancel(); break; case "DoPrint": PrintResult(); break; case "Close": this.Dispose(); this.Close(); break; } } /// /// 查询按钮 /// public void PlanQuery() { if (chkHeatNo.Checked) { if (string.IsNullOrEmpty(txtJudgeStoveNo.Text)) { MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (this.chkLotNo.Checked) { if (string.IsNullOrEmpty(this.txtLOT_NO.Text)) { MessageBox.Show("请输入需查询的轧批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } string PrimaKey = ""; string PrimaKey1 = ""; string PrimaKey2 = ""; UltraGridRow ugr = this.ultraGridPlan.ActiveRow; if (ugr != null) { PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); } UltraGridRow ugrIN = this.ultraGridINFurInfor.ActiveRow; if (ugrIN != null) { PrimaKey1 = ugrIN.Cells["JUDGE_STOVE_NO"].Value.ToString(); } UltraGridRow ugrOUT = this.ultraGridOUTFurInfor.ActiveRow; if (ugrOUT != null) { PrimaKey2 = ugrOUT.Cells["JUDGE_STOVE_NO"].Value.ToString(); } //if (dtStartDate.DateTime > dtEndDate.DateTime) //{ // MessageBox.Show("开始时间不能大于结束时间。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //} //if (chkDate.Checked == true) //{ // QueryMainPlan.StartTime = this.dtStartDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss"); // QueryMainPlan.EndTime = this.dtEndDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss"); //} else { QueryMainPlan.StartTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss"); QueryMainPlan.EndTime = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd HH:mm:ss"); } if (chkHeatNo.Checked == true) { QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text; } else { QueryMainPlan.JudgeStoveNo = ""; } if (chkLotNo.Checked == true) { QueryMainPlan.LotNo = this.txtLOT_NO.Text; } else { QueryMainPlan.LotNo = ""; } dtMatSeq.Clear(); dtPlan.Clear(); dtINFurInfor.Clear(); dtOUTFurInfor.Clear(); QueryMainPlan.PlineCode = plineCode1; QueryMainPlan.Status = PlanStatusQuery; if (ultraTabControl2.Tabs[0].Active) { //查询待装炉计划 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getINFurPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob); if (dt.Rows.Count > 0) { GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true); foreach (UltraGridRow ugr1 in ultraGridPlan.Rows) { if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey) { ugr1.Activated = true; } } } } else if (ultraTabControl2.Tabs[1].Active) { //查询待出炉炉次计划 DataTable dtINFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getINFurOUTPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob); { if (dtINFur.Rows.Count > 0) { GridHelper.CopyDataToDatatable(ref dtINFur, ref dtINFurInfor, true); foreach (UltraGridRow ugrINFur in ultraGridINFurInfor.Rows) { if (ugrINFur.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey1) { ugrINFur.Activated = true; } } } } } else if (ultraTabControl2.Tabs[2].Active) { //查询已出炉炉次计划 DataTable dtOUTFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getOUTFurPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob); { if (dtOUTFur.Rows.Count > 0) { GridHelper.CopyDataToDatatable(ref dtOUTFur, ref dtOUTFurInfor, true); foreach (UltraGridRow ugrOUTFur in ultraGridOUTFurInfor.Rows) { if (ugrOUTFur.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey2) { ugrOUTFur.Activated = true; } } } } } ChangeGridColor(); } /// /// 单击计划行 /// /// /// private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e) { dtMatSeq.Clear(); switch (ultraTabControl2.SelectedTab.Index) { case 0: if (this.dtPlan.Rows.Count > 0) { ActiveUgr = ultraGridPlan.ActiveRow; AfterRowActive(ActiveUgr); } else { ActiveUgr = null; } break; case 1: if (this.dtINFurInfor.Rows.Count > 0) { ActiveUgr = ultraGridINFurInfor.ActiveRow; AfterRowActive(ActiveUgr); } else { ActiveUgr = null; } break; case 2: if (this.dtOUTFurInfor.Rows.Count > 0) { ActiveUgr = ultraGridOUTFurInfor.ActiveRow; AfterRowActive(ActiveUgr); } else { ActiveUgr = null; } break; } } /// /// 单击行激活方法 /// /// private void AfterRowActive(UltraGridRow ugr) { if (ugr == null) { return; } //查询主计划信息 dtMatSeq.Clear(); string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string Status = ugr.Cells["IS_START"].Value.ToString(); MainPlan.JudgeStoveNo = JudgeStoveNo; ActiveJUDGE_STOVE_NO = JudgeStoveNo; ActiveStatus = ugr.Cells["IS_START"].Value.ToString(); ActiveResultNo = ugr.Cells["ID"].Value.ToString(); proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString(); gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString(); lotNo = ugr.Cells["LOT_NO"].Value.ToString(); id = ugr.Cells["ID"].Value.ToString(); MainPlan.ProPlanId = proPlanId; MainPlan.GxPlanNo = gxPlanNo; DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob); if (dtMP.Rows.Count > 0) { GridEdit(dtMP); //轧制计划信息 //查询流通卡信息 DataTable dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtRollingCard.Rows.Count > 0) { RollingCardEditGrid(dtRollingCard, JudgeStoveNo); } else { //清空流通卡值 rollingCard1.ClearData(); //GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4); } //查询加热炉实绩信息 DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { FurResultEdit(dtFurResult); } else { FurResultEntity fr = new com.steering.mes.zgmil.entity.FurResultEntity(); furResult1.Value = fr; //清空加热炉实绩 // GridHelper.InitCardGrid(furResult1.FurResultDateSource1, furResult1.UltraGrid3); //加一段温度 txtTemp1.Text = "0.00"; //加二段温度 txtTemp2.Text = "0.00"; //加三段温度 txtTemp3.Text = "0.00"; //加四段温度 txtTemp4.Text = "0.00"; //加五段温度 txtTemp5.Text = "0.00"; //加六段温度 txtTemp6.Text = "0.00"; //加七段温度 txtTemp7.Text = "0.00"; //加八段温度 txtTemp8.Text = "0.00"; //炉压 txtFurTemp1.Text = "0.00"; //风压 txtPress1.Text = "0.00"; //天然气压力 txtGasPress1.Text = "0.00"; } } if (Status != "未开始入炉") { GetFurRack(); } else { dtMatSeq.Rows.Clear(); } GetGridButtonName(); ChangeGridColor(); } /// /// 双击计划开始入炉 /// /// /// // private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e) private void DoStart() { dtMatSeq.Clear(); switch (ultraTabControl2.SelectedTab.Index) { case 0: if (this.dtPlan.Rows.Count > 0) { ActiveUgr = ultraGridPlan.ActiveRow; PlanStart(ActiveUgr); } break; case 1: if (this.dtINFurInfor.Rows.Count > 0) { ActiveUgr = ultraGridINFurInfor.ActiveRow; PlanStart(ActiveUgr); } break; case 2: if (this.dtOUTFurInfor.Rows.Count > 0) { ActiveUgr = ultraGridOUTFurInfor.ActiveRow; PlanStart(ActiveUgr); } break; } } private void PlanStart(UltraGridRow ugr) { NativeMethodNew NaMethod = new NativeMethodNew(this.ob); HOTMethod hm = new HOTMethod(this.ob); if (ugr != null) { string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string Statue = ugr.Cells["IS_START"].Value.ToString(); string ResultNo = ugr.Cells["ID"].Value.ToString(); MainPlan.JudgeStoveNo = HeatNo; MainPlan.ProPlanId = proPlanId; MainPlan.GxPlanNo = gxPlanNo; ActiveStatus = Statue; ActiveJUDGE_STOVE_NO = HeatNo; ActiveResultNo = ResultNo; if (!NaMethod.isBegineNode(HeatNo, 0)) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】未开始锯切,不能进行入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ActiveStatus == "已完成出炉") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成入炉,不允许再次入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ActiveStatus == "已开始入炉") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已开始入炉,不允许再次入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (hm.InFurIsEnd("0", PlineCode).Rows.Count > 0) { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(hm.InFurIsEnd("0", PlineCode).Rows[0][0].ToString()) + "】正在入炉,当前炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】不能开始入炉"); return; } //查询是否有正在装炉未装炉完成的炉次 //DataTable dtNonEndIN = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { "0", proPlanId, gxPlanNo }, this.ob); //{ // if (dtNonEndIN.Rows.Count > 0) // { // MessageBox.Show("炉号【" + dtNonEndIN.Rows[0][0].ToString().Substring(0, 6) + "】未完成入炉,不能继续入炉。"); // return; // } //} DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob); GridEdit(dtMP); //轧制计划信息 string Judge_Stove_No = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); if (!NaMethod.isBegineNode(Judge_Stove_No, 0)) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】未开始锯切,不能入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //查询是否已开始入炉 DataTable dtIsInFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { HeatNo, proPlanId, gxPlanNo }, this.ob); //已开始入炉 if (dtIsInFur.Rows.Count > 0) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已开始入炉,不能再次入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + MainPlan.JudgeStoveNo + "】开始入炉?") == DialogResult.No) //{ // return; //} if (tempfurresult != null) { //炉温设定 FurResultEntity.SetFurTemp = tempfurresult.SetFurTemp; //第一支出炉温度 //FurResultEntity.FirstSlabOutTemp = tempfurresult.FirstSlabOutTemp; //最后一支出炉温度 //FurResultEntity.LastSlabOutTemp = tempfurresult.LastSlabOutTemp; //烧损率 FurResultEntity.BurnningRate = tempfurresult.BurnningRate; //加一段温度 FurResultEntity.LheatCruve1 = tempfurresult.LheatCruve1; //加二段温度 FurResultEntity.LheatCruve2 = tempfurresult.LheatCruve2; //加三段温度 FurResultEntity.LheatCruve3 = tempfurresult.LheatCruve3; //加四段温度 FurResultEntity.LheatCruve4 = tempfurresult.LheatCruve4; //加五段温度 FurResultEntity.LheatCruve5 = tempfurresult.LheatCruve5; //加六段温度 FurResultEntity.LheatCruve6 = tempfurresult.LheatCruve6; //加七段温度 FurResultEntity.LheatCruve7 = tempfurresult.LheatCruve7; //加八段温度 FurResultEntity.LheatCruve8 = tempfurresult.LheatCruve8; //炉压 FurResultEntity.FurPress = tempfurresult.FurPress; //风压 FurResultEntity.WindPress = tempfurresult.WindPress; //天然气压力 FurResultEntity.GasPress = tempfurresult.GasPress; } DataTable dtBR = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getBurnningRate", new object[] { PlineCode, ResultNo }, this.ob); if (dtBR.Rows.Count > 0) { FurResultEntity.BurnningRate = dtBR.Rows[0][0].ToString(); } //string PLineCode = dtMP.Rows[0]["PLINE_CODE"].ToString(); string LotNo = dtMP.Rows[0]["LOT_NO"].ToString(); string StoveNo = dtMP.Rows[0]["STOVE_NO"].ToString(); //修改主计划状态为 15-开始入炉,新增加热炉实绩信息 FurResultEntity.JudgeStoveNo = HeatNo; FurResultEntity.ResultNo = ResultNo; FurResultEntity.LotNo = LotNo; FurResultEntity.StoveNo = StoveNo; FurResultEntity.PlineCode = PlineCode; FurResultEntity.Status = "15"; DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); //string StartTime = SeverTime.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:ss"); string StartTime = SeverTime.ToString("yyyy-MM-dd HH:mm:ss"); FurResultEntity.StartTime = StartTime; FurResultEntity.FirstInTime = StartTime; FurResultEntity.FirstInGroup = Group; FurResultEntity.FirstInShift = Shift; FurResultEntity.ProPlanId = proPlanId; FurResultEntity.GxPlanNo = gxPlanNo; FurResultEntity.ColShift = UserInfo.GetUserOrder(); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.startInFur", new object[] { FurResultEntity }, this.ob); NativeMethodNew na = new NativeMethodNew(this.ob); na.InsertSTAferDoubleClick(HeatNo, 1, "0", proPlanId, gxPlanNo); GetFurRack(); ChangeGridColor(); GetGridButtonName(); PlanQuery(); ShowMessageFlag = 1; FurResultSave(); ShowMessageFlag = 0; // FurResultSaveNoMessage(); } } /// /// 保存 /// public void FurResultSave() { if (ActiveUgr == null) { return; } //if (ultraGridPlan.ActiveRow != null) //{ FurResultEntity FurResultSave = new FurResultEntity(); UltraGridRow ugr = ActiveUgr; string ResultNo = ActiveResultNo; UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0]; furResult1.UltraGrid3.UpdateData(); if (ActiveUgr == null && ActiveJUDGE_STOVE_NO == null) { MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.ultraGridPlan.ActiveRow == null) { FurResultSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO; } else { FurResultSave.JudgeStoveNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString(); } if (ActiveStatus == "未开始入炉") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(FurResultSave.JudgeStoveNo.ToString()) + "】未开始进行入炉或,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (ActiveStatus == "已完成入炉") //{ // MessageBox.Show("炉号:【" + FurResultSave.JudgeStoveNo + "】已完成入炉,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + FurResultSave.JudgeStoveNo + "】保存实绩?") == DialogResult.No) //{ // return; //} FurResultSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO; string Status = ActiveStatus; //查询是否已开始入炉 DataTable dtIsInFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { FurResultSave.JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); //未开始入炉 //剔除支数 if (!string.IsNullOrEmpty(furResult1.FurResultDateSource1.Rows[0]["ScrapNum"].ToString())) { FurResultSave.ScrapNum = furResult1.FurResultDateSource1.Rows[0]["ScrapNum"].ToString(); } else { FurResultSave.ScrapNum = "0"; } //查询上个班合格支数 DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { FurResultSave.JudgeStoveNo, ResultNo, 1, PlineCode, proPlanId, gxPlanNo }, this.ob); //入炉支数 if (dtQANum.Rows.Count > 0) { FurResultSave.InFurNum = dtQANum.Rows[0][0]; } else { FurResultSave.InFurNum = "0"; } //出炉支数 int InNum = int.Parse(FurResultSave.InFurNum.ToString()); int ScrapNum = int.Parse(FurResultSave.ScrapNum.ToString()); FurResultSave.OutFurNum = (InNum - ScrapNum).ToString(); //交接班支数 if (!string.IsNullOrEmpty(furResult1.FurResultDateSource1.Rows[0]["ChangeNum"].ToString())) { FurResultSave.ChangeNum = furResult1.FurResultDateSource1.Rows[0]["ChangeNum"].ToString(); } else { FurResultSave.ChangeNum = "0"; } //节奏 FurResultSave.Rhythm = furResult1.FurResultDateSource1.Rows[0]["Rhythm"].ToString(); //备注 FurResultSave.Remark = furResult1.FurResultDateSource1.Rows[0]["Remark"].ToString(); //炉温设定 FurResultSave.SetFurTemp = furResult1.FurResultDateSource1.Rows[0]["SetFurTemp"].ToString(); //第一支出炉温度 FurResultSave.FirstSlabOutTemp = furResult1.FurResultDateSource1.Rows[0]["FirstSlabOutTemp"].ToString(); if (!string.IsNullOrEmpty(FurResultSave.FirstSlabOutTemp.ToString())) { FirstSlabOutTemp = FurResultSave.FirstSlabOutTemp.ToString(); } //最后一支出炉温度 FurResultSave.LastSlabOutTemp = furResult1.FurResultDateSource1.Rows[0]["LastSlabOutTemp"].ToString(); if (!string.IsNullOrEmpty(FurResultSave.LastSlabOutTemp.ToString())) { LastSlabOutTemp = FurResultSave.LastSlabOutTemp.ToString(); } //烧损率 FurResultSave.BurnningRate = furResult1.FurResultDateSource1.Rows[0]["BurnningRate"].ToString(); //第一支入炉时间 FurResultSave.FirstInTime = furResult1.FurResultDateSource1.Rows[0]["FirstInTime"].ToString(); //最后一支入炉时间 FurResultSave.LastInTime = furResult1.FurResultDateSource1.Rows[0]["LastInTime"].ToString(); //第一支出炉时间 FurResultSave.FirstOutTime = furResult1.FurResultDateSource1.Rows[0]["FirstOutTime"].ToString(); //最后一支出炉时间 FurResultSave.LastOutTime = furResult1.FurResultDateSource1.Rows[0]["LastOutTime"].ToString(); //入炉开始时间 FurResultSave.StartTime = furResult1.FurResultDateSource1.Rows[0]["FirstInTime"].ToString(); //出炉结束时间 FurResultSave.EndTime = furResult1.FurResultDateSource1.Rows[0]["LastOutTime"].ToString(); //加一段温度 FurResultSave.LheatCruve1 = getstring(txtTemp1.Text); //加二段温度 FurResultSave.LheatCruve2 = getstring(txtTemp2.Text.Replace("_", "")); //加三段温度 FurResultSave.LheatCruve3 = getstring(txtTemp3.Text.Replace("_", "")); //加四段温度 FurResultSave.LheatCruve4 = getstring(txtTemp4.Text.Replace("_", "")); //加五段温度 FurResultSave.LheatCruve5 = getstring(txtTemp5.Text.Replace("_", "")); //加六段温度 FurResultSave.LheatCruve6 = getstring(txtTemp6.Text.Replace("_", "")); //加七段温度 FurResultSave.LheatCruve7 = getstring(txtTemp7.Text.Replace("_", "")); //加八段温度 FurResultSave.LheatCruve8 = getstring(txtTemp8.Text.Replace("_", "")); //炉压 FurResultSave.FurPress = getstring(txtFurTemp1.Text.Replace("_", "")); //风压 FurResultSave.WindPress = getstring(txtPress1.Text.Replace("_", "")); //天然气压力 FurResultSave.GasPress = getstring(txtGasPress1.Text.Replace("_", "")); FurResultSave.NodeFurFlag = "0"; FurResultSave.ProPlanId = proPlanId; FurResultSave.GxPlanNo = gxPlanNo; if (string.IsNullOrEmpty(FurResultSave.FirstInTime.ToString())) { MessageBox.Show("第一支入炉时间不能为空,请输入正确的第一支入炉时间"); return; } //查询结炉状态,已结炉的计划 结炉时间不能为空 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob); if (int.Parse(dt.Rows[0][0].ToString()) > 19) { if (string.IsNullOrEmpty(FurResultSave.LastOutTime.ToString())) { MessageBox.Show("最后一支出炉时间不能为空,请输入正确的最后一支出炉时间时间"); return; } } int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.saveFurResult", new object[] { FurResultSave }, this.ob); if (ShowMessageFlag == 0) { MessageBox.Show("炉号【" + FurResultSave.JudgeStoveNo.ToString().Substring(0,6) + "】保存成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } furResult1.IsCellSelect = false; tempfurresult = NativeMethod.GetEntityToEntity(tempfurresult, FurResultSave); PlanQuery(); } /// /// 结炉 /// public void FeedSawResultNode() { if (this.ActiveUgr == null) { MessageBox.Show("未选择任何炉号,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.ultraGridMatSeq.Rows.Count == 0) { MessageBox.Show("没有生成管号队列,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } HOTMethod hm = new HOTMethod(this.ob); FurResultEntity FurResultSave = new FurResultEntity(); UltraGridRow ugr = ActiveUgr; UltraGridRow ugr1 = furResult1.UltraGrid3.Rows[0]; UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0]; furResult1.UltraGrid3.UpdateData(); //判断是否有重复剔除的坯子 foreach (UltraGridRow ugr4 in ultraGridMatSeq.Rows) { if (ugr4.Cells["MAT_NO"].Value.ToString().Equals("") && ugr4.Cells["STATUS"].Value.ToString().Equals("剔除")) { MessageBox.Show("不存在序号第【" + ugr4.Cells["SEQ"].Value.ToString() + "】的坯子,它已被其它工序剔除,不能再次剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string Status = ugr.Cells["IS_START"].Value.ToString(); string ResultNo = ugr.Cells["ID"].Value.ToString(); string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString(); string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString(); if (ActiveStatus == "已完成出炉") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已出炉,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string NodeFlag = ""; //查询是否已开始入炉 DataTable dtIsInFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); //未开始入炉 if (dtIsInFur.Rows.Count == 0) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始入炉,不能结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //查看结炉标识 DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFlag.Rows.Count > 0) { NodeFlag = dtFlag.Rows[0]["NODE_FUR_FLAG"].ToString(); } else { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未锯切完成,不能结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (NodeFlag != "1") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未锯切完成,不能结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //查询该炉是否已经开始出炉 DataTable dtIsStart = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getIsStartStats", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob); { if (dtIsStart.Rows.Count > 0) { switch (dtIsStart.Rows[0][0].ToString()) { case "0": MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】正在装炉,不能结炉。"); return; break; //case "1": // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始出炉,不能结炉。"); // return; // break; } } else { return; } } if (hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 1) > 0) { MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 1) + "】未接班确认,不能结炉"); return; } DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult1.Rows.Count > 0) { if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["FIRST_OUT_TIME"].ToString())) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未出炉,不能结炉。"); return; } if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString())) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】最后一支未入炉,不能结炉。"); return; } } else { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未入炉,不能结炉。"); return; } if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉?") == DialogResult.No) { return; } //剔除支数 FurResultSave.ScrapNum = "0"; //查询本道工序剔除支数 DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, proPlanId, gxPlanNo }, this.ob); if (dtScrapNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString())) { FurResultSave.ScrapNum = dtScrapNum.Rows[0][0].ToString(); } } //查询上个工序合格支数 DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, proPlanId, gxPlanNo }, this.ob); //入炉支数 if (dtQANum.Rows.Count > 0) { FurResultSave.InFurNum = dtQANum.Rows[0][0]; NativeMethodNew na = new NativeMethodNew(this.ob); //if (int.Parse(FurResultSave.InFurNum.ToString()) - na.GetSlabNum(JudgeStoveNo, proPlanId, gxPlanNo, 3, this.ob) < 0) //{ // MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} } else { FurResultSave.InFurNum = "0"; } //出炉支数 int InNum = int.Parse(FurResultSave.InFurNum.ToString()); int ScrapNum = int.Parse(FurResultSave.ScrapNum.ToString()); FurResultSave.OutFurNum = (InNum - ScrapNum).ToString(); //交接班支数 if (!string.IsNullOrEmpty(ugr1.Cells["ChangeNum"].Value.ToString())) { FurResultSave.ChangeNum = ugr1.Cells["ChangeNum"].Value.ToString(); } else { FurResultSave.ChangeNum = "0"; } //节奏 FurResultSave.Rhythm = ugr1.Cells["Rhythm"].Value.ToString(); //备注 FurResultSave.Remark = ugr1.Cells["Remark"].Value.ToString(); //炉温设定 FurResultSave.SetFurTemp = ugr1.Cells["SetFurTemp"].Value.ToString(); //第一支出炉温度 FurResultSave.FirstSlabOutTemp = ugr1.Cells["FirstSlabOutTemp"].Value.ToString(); if (!string.IsNullOrEmpty(FurResultSave.FirstSlabOutTemp.ToString())) { FirstSlabOutTemp = FurResultSave.FirstSlabOutTemp.ToString(); } //最后一支出炉温度 FurResultSave.LastSlabOutTemp = ugr1.Cells["LastSlabOutTemp"].Value.ToString(); if (!string.IsNullOrEmpty(FurResultSave.LastSlabOutTemp.ToString())) { LastSlabOutTemp = FurResultSave.LastSlabOutTemp.ToString(); } //烧损率 if (string.IsNullOrEmpty(ugr1.Cells["BurnningRate"].Value.ToString())) { FurResultSave.BurnningRate = "2.0"; } else { FurResultSave.BurnningRate = ugr1.Cells["BurnningRate"].Value.ToString(); } //第一支入炉时间 FurResultSave.FirstInTime = ugr1.Cells["FirstInTime"].Value.ToString(); //最后一支入炉时间 FurResultSave.LastInTime = ugr1.Cells["LastInTime"].Value.ToString(); //第一支出炉时间 FurResultSave.FirstOutTime = ugr1.Cells["FirstOutTime"].Value.ToString(); //最后一支出炉时间 FurResultSave.LastOutTime = ugr1.Cells["LastOutTime"].Value.ToString(); //入炉开始时间 FurResultSave.StartTime = ugr1.Cells["FirstInTime"].Value.ToString(); //出炉结束时间 FurResultSave.EndTime = ugr1.Cells["LastOutTime"].Value.ToString(); //加一段温度 FurResultSave.LheatCruve1 = getstring(txtTemp1.Text.Replace("_", "")); //加二段温度 FurResultSave.LheatCruve2 = getstring(txtTemp2.Text.Replace("_", "")); //加三段温度 FurResultSave.LheatCruve3 = getstring(txtTemp3.Text.Replace("_", "")); //加四段温度 FurResultSave.LheatCruve4 = getstring(txtTemp4.Text.Replace("_", "")); //加五段温度 FurResultSave.LheatCruve5 = getstring(txtTemp5.Text.Replace("_", "")); //加六段温度 FurResultSave.LheatCruve6 = getstring(txtTemp6.Text.Replace("_", "")); //加七段温度 FurResultSave.LheatCruve7 = getstring(txtTemp7.Text.Replace("_", "")); //加八段温度 FurResultSave.LheatCruve8 = getstring(txtTemp8.Text.Replace("_", "")); //炉压 FurResultSave.FurPress = getstring(txtFurTemp1.Text.Replace("_", "")); //风压 FurResultSave.WindPress = getstring(txtPress1.Text.Replace("_", "")); //天然气压力 FurResultSave.GasPress = getstring(txtGasPress1.Text.Replace("_", "")); //合格吨 double DBHeight = 0; double DBNum = 1; DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob); if (dtDBH.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString())) { DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString()); } if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString())) { DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString()); } } FurResultSave.QaTon = DBHeight * (1.0 - (double.Parse(FurResultSave.BurnningRate.ToString()) / 100)) * double.Parse(FurResultSave.OutFurNum.ToString()); //状态 - 20 出炉 FurResultSave.Status = "20"; FurResultSave.NodeFurFlag = "1"; FurResultSave.JudgeStoveNo = JudgeStoveNo; FurResultSave.LotNo = FurResultSave.ColGroup = UserInfo.GetUserGroup(); FurResultSave.ColShift = UserInfo.GetUserOrder(); FurResultSave.ColUser = _UserName; FurResultSave.UserId = _UserID; FurResultSave.GxPlanNo = gxPlanNo; FurResultSave.ProPlanId = proPlanId; FurResultSave.LotNo = lotNo; FurResultSave.PlineCode = plineCode1; NativeMethod.CheckNodeMatStatus(JudgeStoveNo, proPlanId, gxPlanNo, 2, this.ob); //写进程表 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult"; ccp.MethodName = "updateMilSlab"; ccp.ServerParams = new object[] { JudgeStoveNo, "2", proPlanId, gxPlanNo }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult"; ccp.MethodName = "updateProcess"; ccp.ServerParams = new object[] { JudgeStoveNo, "2", "2", proPlanId, gxPlanNo, lotNo, PlineCode }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.nodeFurResult", new object[] { FurResultSave }, this.ob); if (count > 0) { int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { JudgeStoveNo, 2, 0, PlineCode, proPlanId, gxPlanNo }, this.ob); //NativeMethodNew na = new NativeMethodNew(this.ob); //na.InsertSTAferDoubleClick(JudgeStoveNo, 1, "1", proPlanId, gxPlanNo); NativeMethod.CheckNodeMatStatus(JudgeStoveNo, proPlanId, gxPlanNo, 1, this.ob); furResult1.IsCellSelect = false; //结炉后清空材料号为空的班次班组 count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.ClearShitAfterNode", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob); } } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); PlanQuery(); ChangeGridColor(); this.furResult1.ClearData(); //dtMatSeq.Clear(); ActiveRow(); tempfurresult = NativeMethod.GetEntityToEntity(tempfurresult, FurResultSave); } /// /// 开始回退 /// private void StartBack() { if (this.ActiveUgr == null) { MessageBox.Show("请选择需要回退的炉号!!!"); return; } UltraGridRow ugr = ActiveUgr; string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string ResultNo = ugr.Cells["ID"].Value.ToString(); string StartStatus = ugr.Cells["IS_START"].Value.ToString(); if (StartStatus == "已完成出炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已结炉,不能入炉回退!!!!"); return; } if (StartStatus == "未开始入炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始入炉,不能入炉回退!!!!"); return; } //NativeMethodNew nvw = new NativeMethodNew(this.ob); //if (nvw.isBegineNode(JudgeStoveNo, 2)) //{ // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始穿孔,不能入炉回退!!!!"); // return; //} int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, proPlanId, gxPlanNo }, this.ob); GetFurRack(); ChangeGridColor(); GetGridButtonName(); PlanQuery(); ActiveRow(); } /// /// 结炉回退 /// private void NodeBack() { string Group = UserInfo.GetUserGroup(); string Shift = UserInfo.GetUserOrder(); if (this.ActiveUgr == null) { MessageBox.Show("请选择需要回退的炉号!!!"); return; } UltraGridRow ugr = ActiveUgr; string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string ResultNo = ugr.Cells["ID"].Value.ToString(); string NodeFlag = ugr.Cells["IS_START"].Value.ToString(); if (NodeFlag != "已完成出炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!"); return; } //查询结炉班次班组 DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 1, proPlanId, gxPlanNo }, this.ob); if (dtNodeGroup.Rows.Count > 0) { string NodeShift = dtNodeGroup.Rows[0][0].ToString(); string NodeGroup = dtNodeGroup.Rows[0][1].ToString(); if (Shift == NodeShift && Group == NodeGroup) { } else { switch (NodeShift) { case "0": NodeShift = "白班"; break; case "1": NodeShift = "早班"; break; case "2": NodeShift = "中班"; break; case "3": NodeShift = "夜班"; break; } switch (NodeGroup) { case "1": NodeGroup = "甲班"; break; case "2": NodeGroup = "乙班"; break; case "3": NodeGroup = "丙班"; break; case "4": NodeGroup = "丁班"; break; } switch (this.UserInfo.GetUserOrder()) { case "0": Shift = "白班"; break; case "1": Shift = "早班"; break; case "2": Shift = "中班"; break; case "3": Shift = "夜班"; break; } switch (this.UserInfo.GetUserGroup()) { case "1": Group = "甲班"; break; case "2": Group = "乙班"; break; case "3": Group = "丙班"; break; case "4": Group = "丁班"; break; } MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已由" + NodeGroup + "," + NodeShift + "结炉,当班不能结炉回退"); return; } ActiveRow(); } DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count > 0) { string NodeProcess = ""; //当前炉次结炉工序 string NodeStatus = dt.Rows[0][0].ToString(); switch (NodeStatus) { case "20": NodeProcess = "环形加热炉"; break; case "30": NodeProcess = "穿孔"; break; case "40": NodeProcess = "连轧"; break; case "50": NodeProcess = "再加热炉"; break; case "60": NodeProcess = "定径"; break; case "70": NodeProcess = "分切"; break; case "80": NodeProcess = "矫直"; break; case "90": NodeProcess = "探伤"; break; case "96": NodeProcess = "质检"; break; } if (NodeStatus != "20") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退"); return; } } //判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退 //查询当前炉次是否有交班点 int Seq = 0; //入炉交班序号 int OutSeq = 0; //出炉交班序号 DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 1, proPlanId, gxPlanNo }, this.ob); if (dt1.Rows.Count > 0) { for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[i]["IN_CHANGE_FLAG"].ToString() == "1") { Seq = int.Parse(dt1.Rows[i][0].ToString()); } if (dt1.Rows[i]["OUT_CHANGE_FLAG"].ToString() == "1") { OutSeq = int.Parse(dt1.Rows[i][0].ToString()); } } } //查询当前炉次最后一支是否入炉 DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob); if (dtFurResult1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString())) { Seq = ultraGridMatSeq.Rows.Count; } } int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, Seq, OutSeq, 2, proPlanId, gxPlanNo, lotNo }, this.ob); GetFurRack(); ChangeGridColor(); GetGridButtonName(); PlanQuery(); } /// /// 管坯剔除 /// /// /// private void ultraGridMatSeq_ClickCellButton(object sender, CellEventArgs e) { MilSlabScrapSeqEntity ScrapSlab = new MilSlabScrapSeqEntity(); UltraGridRow ugr = ultraGridMatSeq.ActiveRow; UltraGridRow ugr1 = ActiveUgr; HOTMethod hm = new HOTMethod(this.ob); string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); int Seq = int.Parse(ugr.Cells["SEQ"].Value.ToString()); string PlanStatus = ugr1.Cells["IS_START"].Value.ToString(); string MatStatus = ugr.Cells["STATUS"].Value.ToString(); string Remark = ugr.Cells["REMARK"].Value.ToString(); string ResultNo = ugr1.Cells["ID"].Value.ToString(); string MAT_NO = ugr.Cells["MAT_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult"; ccp.MethodName = "scrapMatCheck"; ccp.ServerParams = new object[] { JudgeStoveNo, 2, proPlanId, gxPlanNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo); string shif = ugr.Cells["COL_SHIFT"].Value.ToString(); string group = ugr.Cells["COL_GROUP"].Value.ToString(); NativeMethodNew nasssss = new NativeMethodNew(this.ob); if (nasssss.IsRackOperate(shif, group)) { MessageBox.Show("序号:【" + Seq + "】管已由" + shif + "," + group + "交班操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (PlanStatus == "已完成出炉") // -- 修改结炉回退操作时放开 { if (e.Cell.Column.Key == "IN_CHANGE_NUM" || e.Cell.Column.Key == "OUT_CHANGE_NUM") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已出炉,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (e.Cell.Column.Key == "BTNOUTCHANGECOM" || e.Cell.Column.Key == "BTNINCHANGECOM") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已出炉,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已出炉,不允许剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } if (e.Cell.Column.Key == "SCRAP_SLAB") { if (MatStatus == "剔除") { MessageBox.Show("坯料已被剔除不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (PlanStatus == "未开始入炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】不是入炉状态,不能剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.selectPortBacthSlample", new object[] { MAT_NO }, ob); if (ds.Rows.Count > 0) { if (MessageUtil.ShowYesNoAndQuestion("此管坯已有被取为样管,是否继续剔除?") == DialogResult.No) { return; } } int i = 0; foreach (UltraGridRow uRow in ultraGridMatSeq.Rows) { if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) >2) { i = i + 1; } } if (Seq < 3 && i > 0) { if (MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,是否确认剔除。") == DialogResult.No) { return; } } if (ultraGridMatSeq.Rows.Count - ScrapNumBefore < Seq) { MessageBox.Show("不存在序号为【" + Seq + "】的管号已在前道工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //管排锯切前判断当前管坯序号是否已剔除 DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { JudgeStoveNo, Seq.ToString(), proPlanId, gxPlanNo }, this.ob); if (dtSeq.Rows.Count > 0) { MessageBox.Show("不存在序号为【" + Seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (MessageUtil.ShowYesNoAndQuestion("是否剔除该坯料") == DialogResult.No) //{ // return; //} ScrapSlab.JudgeStoveNo = JudgeStoveNo; ScrapSlab.ProPlanId = proPlanId; ScrapSlab.GxPlanNo = gxPlanNo; ScrapSlab.Seq = Seq; ScrapSlab.ProcessNo = "2"; ScrapSlab.Flag = "0"; ScrapSlab.ColMode = "1"; ScrapSlab.ColUser = UserInfo.GetUserName(); ScrapSlab.ColGroup = UserInfo.GetUserGroup(); ScrapSlab.ColShift = UserInfo.GetUserOrder(); ScrapSlab.Remark = Remark; int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.scrapFurMat", new object[] { ScrapSlab }, this.ob); //剔除支数+1 int ScrapNum = 0; if (string.IsNullOrEmpty(furResult1.FurResultDateSource1.Rows[0]["ScrapNum"].ToString()) || furResult1.FurResultDateSource1.Rows[0]["ScrapNum"].ToString() == "0") { ScrapNum = 1; } else { ScrapNum = int.Parse(furResult1.FurResultDateSource1.Rows[0]["ScrapNum"].ToString()) + count; } furResult1.Value.ScrapNum = ScrapNum; // furResult1.UpdateDateForRack(); //MessageBox.Show("管序号【" + Seq + "】剔除成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (e.Cell.Column.Key == "DELBACK") { //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No) //{ // return; //} if (!MatStatus.Equals("剔除")) { MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } NativeMethodNew na = new NativeMethodNew(this.ob); int counts = na.DeleteSlabSeq(JudgeStoveNo, Seq.ToString(), 2, 1, 0, proPlanId, gxPlanNo); if (counts > 0) { // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } //入炉交班 if (e.Cell.Column.Key == "IN_CHANGE_NUM") { //if (PlanStatus == "已完成入炉" || PlanStatus == "已开始出炉") //{ // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成入炉,不能入炉交班。"); // return; //} //查询是否有最后一直入炉时间 DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString())) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成入炉,不能入炉交班。"); return; } } string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); int BeforeChangeNum = 0; //查询上个班入炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString()); } } if (Seq <= BeforeChangeNum) { MessageBox.Show("前道班次已交班,该支不能再次交班。"); return; } if (Seq > ultraGridMatSeq.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 2, 1, proPlanId, gxPlanNo }, this.ob); //hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, Seq, 0); } //入炉交班确认 if (e.Cell.Column.Key == "BTNINCHANGECOM") { int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, 0, proPlanId, gxPlanNo); if (WaitChangeSeq == 0) { MessageBox.Show("没有待交班确认的管号。"); return; } if (WaitChangeSeq != Seq) { MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。"); return; } if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + Seq + "】交班?") == DialogResult.No) { return; } // //查询是否有该班接班记录 int BeforeChangeNum = 0; //查询上个班入炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString()); } } if (Seq <= BeforeChangeNum) { MessageBox.Show("前道班次已交班,该支不能再次交班。"); return; } if (Seq > ultraGridMatSeq.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); //DateTime SeverTime = DateTime.Now; string Time = SeverTime.ToLongTimeString(); string StartTime = SeverTime.ToShortDateString() + " 00:00:00"; string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; Time = Time.Replace(":", ""); switch (Shift) { case "1": if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000) { StartTime = SeverTime.ToShortDateString() + " 06:00:00"; EndTime = SeverTime.ToShortDateString() + " 08:00:00"; } if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000) { StartTime = SeverTime.ToShortDateString() + " 13:00:00"; EndTime = SeverTime.ToShortDateString() + " 15:00:00"; } break; case "2": if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000) { StartTime = SeverTime.ToShortDateString() + " 13:00:00"; EndTime = SeverTime.ToShortDateString() + " 15:00:00"; } if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000) { StartTime = SeverTime.ToShortDateString() + " 20:00:00"; EndTime = SeverTime.ToShortDateString() + " 22:00:00"; } break; case "3": if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000) { StartTime = SeverTime.ToShortDateString() + " 20:00:00"; EndTime = SeverTime.ToShortDateString() + " 22:00:00"; } if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000) { StartTime = SeverTime.ToShortDateString() + " 06:00:00"; EndTime = SeverTime.ToShortDateString() + " 08:00:00"; } break; } //未登录 if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "1", PlineCode)) // if (ChangeUserID == "") { //FrmChangeGroup frmCg = new FrmChangeGroup(this.ob); //frmCg.ShowDialog(); //if (frmCg.DialogResult == DialogResult.OK) if (this.DoRelogin(DoCheck)) { string ShiftS = UserInfo.GetUserOrder(); string GroupS = UserInfo.GetUserGroup(); //插入接班确认履历表 hm.InsertChangeRemuse(ShiftS, GroupS, _UserName, "1", PlineCode); string User = UserInfo.GetUserName(); //查询上个班入炉交班支数 DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum1.Rows[0][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum1.Rows[0][0].ToString()); } } int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 2, 1, proPlanId, gxPlanNo }, this.ob); ChangeFlag = 1; //查询是否有出炉交班但未确认接班的炉号 DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1 }, this.ob); { if (dtOutChange.Rows.Count > 0) { string WaitOutFur = dtOutChange.Rows[0][0].ToString(); MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要出炉交班确认。"); } } } } else { //string Shift = UserInfo.GetUserOrder(); //string Group = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); //int BeforeChangeNum = 0; ////查询上个班入炉交班支数 DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum1.Rows[0][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum1.Rows[0][0].ToString()); } } string Date = SeverTime.ToString("yyyyMMdd"); string ShiftB = HOTMethod.GetShiftBefore(Shift, Group, Date).Substring(0, 1); string GroupB = HOTMethod.GetShiftBefore(Shift, Group, Date).Substring(1, 1); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, ShiftB, GroupB, _UserName, 2, 1, proPlanId, gxPlanNo }, this.ob); ChangeFlag = 1; //查询是否有出炉交班但未确认接班的炉号 DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1 }, this.ob); { if (dtOutChange.Rows.Count > 0) { string WaitOutFur = dtOutChange.Rows[0][0].ToString(); MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要出炉交班确认。"); } } } } //出炉交班 if (e.Cell.Column.Key == "OUT_CHANGE_NUM") { string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); int BeforeChangeNum = 0; //查询是否有第一直出炉时间 DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult1.Rows.Count > 0) { if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["FIRST_OUT_TIME"].ToString())) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未出炉,不能出炉交班。"); return; } } else { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未出炉,不能出炉交班。"); return; } //查询上个班出炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum.Rows[1][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum.Rows[1][0].ToString()); } } if (Seq <= BeforeChangeNum) { MessageBox.Show("前道班次已交班,该支不能再次交班。"); return; } if (Seq > ultraGridMatSeq.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, Seq, 1); //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 2, 2, proPlanId, gxPlanNo }, this.ob); ChangeFlag = 1; } //出炉交班确认 if (e.Cell.Column.Key == "BTNOUTCHANGECOM") { int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, 1, proPlanId, gxPlanNo); if (WaitChangeSeq == 0) { MessageBox.Show("没有待交班确认的管号。"); return; } if (WaitChangeSeq != Seq) { MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。"); return; } if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + Seq + "】交班?") == DialogResult.No) { return; } int BeforeChangeNum = 0; //查询上个班出炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum.Rows[1][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum.Rows[1][0].ToString()); } } if (Seq <= BeforeChangeNum) { MessageBox.Show("前道班次已交班,该支不能再次交班。"); return; } if (Seq > ultraGridMatSeq.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } ////查询是否有该班接班记录 //DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); //string Time = SeverTime.ToLongTimeString(); ////DateTime SeverTime = DateTime.Now; ////string Time = SeverTime.ToLongTimeString(); //string StartTime = SeverTime.ToShortDateString() + " 00:00:00"; //string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; //Time = Time.Replace(":", ""); //switch (Shift) //{ // case "1": // if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000) // { // StartTime = SeverTime.ToShortDateString() + " 06:00:00"; // EndTime = SeverTime.ToShortDateString() + " 08:00:00"; // } // if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000) // { // StartTime = SeverTime.ToShortDateString() + " 13:00:00"; // EndTime = SeverTime.ToShortDateString() + " 15:00:00"; // } // break; // case "2": // if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000) // { // StartTime = SeverTime.ToShortDateString() + " 13:00:00"; // EndTime = SeverTime.ToShortDateString() + " 15:00:00"; // } // if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000) // { // StartTime = SeverTime.ToShortDateString() + " 20:00:00"; // EndTime = SeverTime.ToShortDateString() + " 22:00:00"; // } // break; // case "3": // if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000) // { // StartTime = SeverTime.ToShortDateString() + " 20:00:00"; // EndTime = SeverTime.ToShortDateString() + " 22:00:00"; // } // if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000) // { // StartTime = SeverTime.ToShortDateString() + " 06:00:00"; // EndTime = SeverTime.ToShortDateString() + " 08:00:00"; // } // break; //} //if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "1", PlineCode)) //{ //FrmChangeGroup frmCg = new FrmChangeGroup(this.ob); //frmCg.ShowDialog(); //if (frmCg.DialogResult == DialogResult.OK) if (this.DoRelogin(DoCheck)) { string ShiftS = UserInfo.GetUserOrder(); string GroupS = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); hm.InsertChangeRemuse(ShiftS, GroupS, _UserName, "1", PlineCode); //查询上个班入炉交班支数 DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum1.Rows[0][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum1.Rows[0][0].ToString()); } } // hm.InsertChangeRemuse(Shift, Group, _UserName, "0", PlineCode); int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 2, 2, proPlanId, gxPlanNo }, this.ob); ChangeFlag = 1; //hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, Seq, 1); //查询是否有入炉交班但未确认接班的炉号 DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 0 }, this.ob); { if (dtOutChange.Rows.Count > 0) { //string WaitOutFur = dtOutChange.Rows[0][0].ToString(); //MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要入炉交班确认。"); } } } } //else //{ // //string Shift = UserInfo.GetUserOrder(); // //string Group = UserInfo.GetUserGroup(); // string User = UserInfo.GetUserName(); // //int BeforeChangeNum = 0; // //查询上个班出炉交班支数 // DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode, Shift, Group }, this.ob); // if (dtChangeNum1.Rows.Count > 0) // { // if (!string.IsNullOrEmpty(dtChangeNum1.Rows[1][0].ToString())) // { // BeforeChangeNum = int.Parse(dtChangeNum1.Rows[1][0].ToString()); // } // } // //获取上个班班次班组 // string Date = SeverTime.ToString("yyyyMMdd"); // string ShiftB = HOTMethod.GetShiftBefore(Shift, Group, Date).Substring(0, 1); // string GroupB = HOTMethod.GetShiftBefore(Shift, Group, Date).Substring(1, 1); // int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq, 0, BeforeChangeNum, PlineCode, ShiftB, GroupB, _UserName, 2, 2 }, this.ob); // ChangeFlag = 1; // // hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 1, Seq, 1); // //查询是否有入炉交班但未确认接班的炉号 // DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 0 }, this.ob); // { // if (dtOutChange.Rows.Count > 0) // { // string WaitOutFur = dtOutChange.Rows[0][0].ToString(); // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要入炉交班确认。"); // } // } // // } //} //过渡方法,接班后重登陆初始化导致Grid.Row为null if (ultraGridPlan.Rows == null) { return; } DataTable dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtRollingCard.Rows.Count > 0) { RollingCardEditGrid(dtRollingCard, JudgeStoveNo); } else { //清空流通卡值 rollingCard1.ClearData(); //GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4); } //查询加热炉实绩信息 DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { FurResultEdit(dtFurResult); } else { FurResultEntity fr = new com.steering.mes.zgmil.entity.FurResultEntity(); furResult1.Value = fr; //清空加热炉实绩 // GridHelper.InitCardGrid(furResult1.FurResultDateSource1, furResult1.UltraGrid3); //加一段温度 txtTemp1.Text = "0.00"; //加二段温度 txtTemp2.Text = "0.00"; //加三段温度 txtTemp3.Text = "0.00"; //加四段温度 txtTemp4.Text = "0.00"; //加五段温度 txtTemp5.Text = "0.00"; //加六段温度 txtTemp6.Text = "0.00"; //加七段温度 txtTemp7.Text = "0.00"; //加八段温度 txtTemp8.Text = "0.00"; //炉压 txtFurTemp1.Text = "0.00"; //风压 txtPress1.Text = "0.00"; //天然气压力 txtGasPress1.Text = "0.00"; } GetFurRack(); ChangeGridColor(); GetGridButtonName(); } public string DoCheck(CoreUserInfo User) { return ""; } /// /// 点击保存单支出入炉时间 /// /// /// public void UltraGrid3_ClickCellButton(object sender, CellEventArgs e) { string JudgeStoveNo = ""; string Status = ""; string ResultNo = ""; string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); UltraGridRow ugr = this.ActiveUgr; HOTMethod hm = new HOTMethod(this.ob); if (ugr != null) { DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.ToLongTimeString(); JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); Status = ugr.Cells["IS_START"].Value.ToString(); ResultNo = ugr.Cells["ID"].Value.ToString(); if (e.Cell.Column.Key == "CHANGENUMCANCEL") { if (Status == "未开始入炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始入炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Status == "已完成出炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成出炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { if (e.Cell.Column.Key != "btnFirstIn") { if (Status == "未开始入炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始入炉,不能开始第一支入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (Status == "已完成出炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成出炉,不能进行操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } int count = 0; int Flag = 0; switch (e.Cell.Column.Key) { case "btnFirstIn": DoStart(); //this.furResult1.Value.FirstInTime = DateTime.Now.ToString(); //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.updateFurTime", new object[] { JudgeStoveNo, Flag }, this.ob); break; case "btnLastIn": //查看结炉标识 string NodeFlag = ""; DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFlag.Rows.Count > 0) { NodeFlag = dtFlag.Rows[0]["NODE_FUR_FLAG"].ToString(); } else { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未锯切完成,不能入炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (NodeFlag != "1") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未锯切完成,不能入炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Flag = 1; this.furResult1.Value.LastInTime = Time; count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, "", Flag }, this.ob); count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.SetInFur", new object[] { JudgeStoveNo, ResultNo, Shift, Group, _UserName }, this.ob); break; case "btnFirstOut": Flag = 2; DataTable dtIsOut = hm.InFurIsEnd("2", PlineCode); if (dtIsOut.Rows.Count > 0) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(dtIsOut.Rows[0][0].ToString()) + "】正在出炉。"); return; } //判断是否已经入炉完成 //DataTable dtFurStatus = hm.InFurStatus(JudgeStoveNo); //string IsStart = ""; //if (dtFurStatus.Rows.Count > 0) //{ // IsStart = dtFurStatus.Rows[0][0].ToString(); // if (IsStart == "0") // { // MessageBox.Show("炉号【" + dtINFurInfor.Rows[0][0].ToString().Substring(0, 6) + "】正在入炉,未完成入炉不能开始出炉。"); // return; // } // //if (IsStart == "2") // //{ // // MessageBox.Show("炉号【" + dtINFurInfor.Rows[0][0].ToString().Substring(0, 6) + "】正在出炉,不能再次开始出炉。"); // // return; // //} //} //else //{ // return; //} this.furResult1.Value.FirstOutTime = Time; string Temp = FirstSlabOutTemp; //保存第一支出炉温度 时间并更新运输需求起运启时间 //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, Temp, Flag }, this.ob); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult"; ccp.MethodName = "updateFurTimeTms"; ccp.ServerParams = new object[] { JudgeStoveNo, Shift, Group, Temp, Flag,id }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnInfo == "第一支出炉成功!") { } else { MessageUtil.ShowTips(ccp.ReturnInfo); } break; case "btnLastOut": FeedSawResultNode(); //Flag = 3; //this.furResult1.Value.LastOutTime = DateTime.Now.ToString(); //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FurResult.updateFurTime", new object[] { JudgeStoveNo, Flag }, this.ob); break; case "CHANGENUMCANCEL": Flag = 5; NativeMethodNew nass = new NativeMethodNew(this.ob); nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 1); //查询加热炉实绩信息 DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { FurResultEdit(dtFurResult); } break; } //刷新实绩界面 if (Flag < 5) { this.furResult1.UpdateDateTime(Flag); GetFurRack(); } PlanQuery(); ActiveRow(); } } /// /// 交班取消 /// private void ChangeCancel() { int Flag = 0; string JudgeStoveNo = ""; string Status = ""; string ResultNo = ""; UltraGridRow ugr = this.ActiveUgr; if (ugr != null) { JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); Status = ugr.Cells["IS_START"].Value.ToString(); ResultNo = ugr.Cells["ID"].Value.ToString(); if (Status == "未开始入炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始入炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Status == "已完成出炉") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成出炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //查询最后一支是否入炉 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["LAST_IN_TIME"].ToString())) { Flag = 1; } } NativeMethodNew nass = new NativeMethodNew(this.ob); nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 1, Flag); //查询加热炉实绩信息 DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getFurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { FurResultEdit(dtFurResult); } PlanQuery(); } } /// /// 双击管号队列表头更改grid大小 /// /// /// private void ultraGridMatSeq_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e) { if (PanelSizeFlag == 0) { PanelSizeFlag = 1; //splitContainer2.SplitterDistance = 180; } else { PanelSizeFlag = 0; // splitContainer2.SplitterDistance = 90; } } /// /// 计划表ROW点击变换判断 /// private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e) { if (this.furResult1.IsCellSelect == true) { if (ActiveStatus != "已开始入炉") { this.furResult1.IsCellSelect = false; //MessageBox.Show("警告:炉号:" + ActiveJUDGE_STOVE_NO + "未开始入炉,不允许保存入炉实绩", "提示", MessageBoxButtons.OK); return; } //if (MessageBox.Show("提示:加热实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ // this.furResult1.IsCellSelect = false; // //保存探伤实绩 //} else { ActiveRow(); ShowMessageFlag = 1; FurResultSave(); ShowMessageFlag = 0; this.furResult1.IsCellSelect = false; foreach (UltraGridRow ugr in this.ultraGridPlan.Rows) { if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == ActiveJUDGE_STOVE_NO) { this.ultraGridPlan.ActiveRow = ugr; } } return; } } } /// /// 打印报表 /// private void PrintResult() { DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.ToLongTimeString(); string StartTime = ""; string EndTime = ""; string strurl = ""; //晚班 Time = Time.Replace(":", ""); if (Shift == "3") { //查询晚班前一天20点40后到当天07点20前所有记录 if (int.Parse(Time) < 072000) { StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00"; EndTime = SeverTime.ToShortDateString() + " 07:20:00"; //string Date2 = SeverTime.ToString("yyyy-MM-dd"); //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; } //查询当天晚班的所有数据 else if (int.Parse(Time) > 204000) { StartTime = SeverTime.ToShortDateString() + " 20:40:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00"; //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; } } //白班 中班 else { StartTime = SeverTime.ToShortDateString() + " 00:00:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; } switch (PlineCode) { case "C008": //250 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C009": //258 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C010": //168 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C012": //Arssel break; case "C017": //460 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C072": //508 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; } FrmRepExcel fre = new FrmRepExcel(ob, strurl); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } /// /// 查询上个班原始记录 /// private void QueryBefore() { HOTMethod hm = new HOTMethod(this.ob); DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.ToLongTimeString(); string Date = ""; if (Shift == "3") { Time = Time.Replace(":", ""); if (int.Parse(Time) < 122000) { Date = SeverTime.AddDays(-1).ToString("yyyyMMdd"); } else { Date = SeverTime.ToString("yyyyMMdd"); } } if (Shift == "1" || Shift == "0") { Date = SeverTime.AddDays(-1).ToString("yyyyMMdd"); } else { Date = SeverTime.ToString("yyyyMMdd"); } string StartTime = ""; // 开始时间 用于报表查询 string EndTime = ""; // 结束时间 用于报表查询 string StartTimeU = ""; // 开始时间 用于得到上班UserID string EndTimeU = ""; // 结束时间 用于得到上班UserID string strurl = ""; string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode); //if (PlineCode.Equals("C072")) //{ // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date); //} //else //{ // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group); //} string UserIDBefore = ""; //晚班 Time = Time.Replace(":", ""); if (Shift == "3") { //查询晚班前一天中班所有记录 if (int.Parse(Time) < 122000) { StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00"; EndTime = SeverTime.ToShortDateString() + " 00:00:00"; //string Date2 = SeverTime.ToString("yyyy-MM-dd"); StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00"; EndTimeU = SeverTime.ToShortDateString() + " 00:00:00"; UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 1, PlineCode); //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; } //查询当天中班的所有数据 else if (int.Parse(Time) > 204000) { StartTime = SeverTime.ToShortDateString() + " 13:40:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; StartTimeU = SeverTime.ToShortDateString() + " 13:40:00"; EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 1, PlineCode); //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; } } //白班 else if (Shift == "1") { StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00"; EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00"; StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00"; EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00"; UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 1, PlineCode); } //中班 else { StartTime = SeverTime.ToShortDateString() + " 00:00:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; StartTimeU = SeverTime.ToShortDateString() + " 00:00:00"; EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 1, PlineCode); //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; } switch (PlineCode) { case "C008": //250 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; break; case "C009": //258 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult258.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; break; case "C010": //168 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; break; case "C012": //Arssel break; case "C017": //460 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult460.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; break; case "C072": //508 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult508.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore; break; } FrmRepExcel fre = new FrmRepExcel(ob, strurl); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } #endregion #region 卡片赋值 /// /// 轧制信息Grid赋值 /// /// 轧制计划信息datatable public void GridEdit(DataTable dt) { if (dt.Rows.Count > 0) { DataRow row1 = dt.Rows[0]; //熔炼炉号 this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString(); //炉号 this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString()); //生产批号 this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString(); //工序合同号 this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString(); //执行工艺号 this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString(); //执行工艺号路径 this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString(); //产线代码 this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString(); //状态 this.rollingInfomation1.Value.Status = row1["STATUS"].ToString(); //监制 this.rollingInfomation1.Value.Producer = row1["producer"].ToString(); //工艺状态 this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString(); //单倍长 this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString(); //单倍重 this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString(); //轧制长度 this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString(); //分切数 this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString(); //目标长度 this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString(); //最终用户 this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString(); //目标库 this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString(); //品种 this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString(); //成品规格 this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString(); //扣型 this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString(); //长度范围 this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString(); //轧管判定标准 this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString(); //断面 this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString(); //钢种代码 this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString(); //钢种名称 this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString(); //钢级代码 this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString(); //钢级名称 this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString(); //炼钢判定标准 this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString(); //去向 this.rollingInfomation1.Value.Target = row1["target"].ToString(); //支 this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString(); //吨 this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString(); //切损去向 this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString(); //切损长度 this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString(); //切损重量 this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString(); //倍尺数 this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString(); //标准类别代码 this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString(); //标准类别描述 this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString(); //成品备注 this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString(); this.rollingInfomation1.UpdateData(); } } /// /// 流通卡赋值 /// /// public void RollingCardEditGrid(DataTable dt, string heatno) { if (dt.Rows.Count > 0) { //上料切前剔除支数 this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString(); //上料切前合格支数 this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString(); //上料剔除支数 this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString(); //上料合格支数 this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString(); //加热炉剔除支数 this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString(); //加热炉合格支数 this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString(); //穿孔剔除支数 this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString(); //穿孔合格支数 this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString(); //连轧剔除支数 this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString(); //连轧合格支数 this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString(); //再加热炉剔除支数 this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString(); //再加热炉合格支数 this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString(); //定径剔除支数 this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString(); //定径合格支数 this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString(); //分切前剔除支数 this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString(); //分切前合格支数 this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString(); //分切剔除支数 this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString(); //分切合格支数 this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString(); //矫直剔除支数 this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString(); //矫直合格支数 this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString(); //矫直下线支数 this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString(); //探伤剔除支数 this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString(); //探伤合格支数 this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString(); NativeMethodNew na = new NativeMethodNew(this.ob); if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10)) { //探伤下线支数 this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString(); } else { if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0") { this.rollingCard1.Value.OfflineTesting = ""; } else { //探伤下线支数 this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString(); } } //表检合格支数 this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString(); //表检废品支数 this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString(); //表检下线支数 this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString(); //表检返线支数 //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString(); this.rollingCard1.UpdateData(); } else { this.rollingCard1.ClearData(); } } /// /// 加热炉实绩赋值 /// /// public void FurResultEdit(DataTable dt) { UltraGridRow ugr = this.rollingCard1.UltraGrid4.Rows[0]; if (!string.IsNullOrEmpty(ugr.Cells["QualifiedNum2"].Value.ToString())) { furResult1.Value.InFurNum = ugr.Cells["QualifiedNum2"].Value.ToString(); } else { this.furResult1.Value.InFurNum = "0"; } //剔除支数 this.furResult1.Value.ScrapNum = dt.Rows[0]["SCRAP_NUM"].ToString(); //出炉支数 //if (dt.Rows[0]["OUT_FUR_NUM"].ToString() == "0" ) //{ // int InFurNum = int.Parse(furResult1.Value.InFurNum.ToString()); // int ScrapNum = int.Parse(furResult1.Value.ScrapNum.ToString()); // this.furResult1.Value.OutFurNum = (InFurNum - ScrapNum).ToString(); //} //else //{ // this.furResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); //} this.furResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); //交接班支数 this.furResult1.Value.ChangeNum = dt.Rows[0]["CHANGE_NUM"].ToString(); //节奏 this.furResult1.Value.Rhythm = dt.Rows[0]["RHYTHM"].ToString(); //备注 this.furResult1.Value.Remark = dt.Rows[0]["REMARK"].ToString(); //炉温设定 this.furResult1.Value.SetFurTemp = dt.Rows[0]["SET_FUR_TEMP"].ToString(); //第一支出炉温度 this.furResult1.Value.FirstSlabOutTemp = dt.Rows[0]["FIRST_SLAB_OUT_TEMP"].ToString(); //最后一支出炉温度 this.furResult1.Value.LastSlabOutTemp = dt.Rows[0]["LAST_SLAB_OUT_TEMP"].ToString(); //烧损率 this.furResult1.Value.BurnningRate = dt.Rows[0]["BURNNING_RATE"].ToString(); //第一支入炉时间 this.furResult1.Value.FirstInTime = dt.Rows[0]["FIRST_IN_TIME"].ToString(); //最后一支入炉时间 this.furResult1.Value.LastInTime = dt.Rows[0]["LAST_IN_TIME"].ToString(); //第一支出炉时间 this.furResult1.Value.FirstOutTime = dt.Rows[0]["FIRST_OUT_TIME"].ToString(); //最后一支出炉时间 this.furResult1.Value.LastOutTime = dt.Rows[0]["LAST_OUT_TIME"].ToString(); //入炉开始时间 this.furResult1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString(); //出炉结束时间 this.furResult1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString(); //出炉交接班支数 this.furResult1.Value.OutChangeNum = dt.Rows[0]["OUT_CHANGE_NUM"].ToString(); //加一段温度 txtTemp1.Text = getstring(dt.Rows[0]["LHEAT_CRUVE1"].ToString()); //加二段温度 txtTemp2.Text = getstring(dt.Rows[0]["LHEAT_CRUVE2"].ToString()); //加三段温度 txtTemp3.Text = getstring(dt.Rows[0]["LHEAT_CRUVE3"].ToString()); //加四段温度 txtTemp4.Text = getstring(dt.Rows[0]["LHEAT_CRUVE4"].ToString()); //加五段温度 txtTemp5.Text = getstring(dt.Rows[0]["LHEAT_CRUVE5"].ToString()); //加六段温度 txtTemp6.Text = getstring(dt.Rows[0]["LHEAT_CRUVE6"].ToString()); //加七段温度 txtTemp7.Text = getstring(dt.Rows[0]["LHEAT_CRUVE7"].ToString()); //加八段温度 txtTemp8.Text = getstring(dt.Rows[0]["LHEAT_CRUVE8"].ToString()); //炉压 txtFurTemp1.Text = getstring(dt.Rows[0]["FUR_PRESS"].ToString()); //风压 txtPress1.Text = getstring(dt.Rows[0]["WIND_PRESS"].ToString()); //天然气压力 txtGasPress1.Text = getstring(dt.Rows[0]["GAS_PRESS"].ToString()); this.furResult1.UpdateDate(); } /// /// 加热炉实绩赋值 /// /// public void FurResultEditForRack(DataTable dt) { UltraGridRow ugr = this.rollingCard1.UltraGrid4.Rows[0]; if (!string.IsNullOrEmpty(ugr.Cells["QualifiedNum2"].Value.ToString())) { furResult1.Value.InFurNum = ugr.Cells["QualifiedNum2"].Value.ToString(); } else { this.furResult1.Value.InFurNum = "0"; } //剔除支数 this.furResult1.Value.ScrapNum = dt.Rows[0]["SCRAP_NUM"].ToString(); //出炉支数Y //{ // int InFurNum = int.Parse(furResult1.Value.InFurNum.ToString()); // int ScrapNum = int.Parse(furResult1.Value.ScrapNum.ToString()); // this.furResult1.Value.OutFurNum = (InFurNum - ScrapNum).ToString(); //} //else //{ // this.furResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); //} this.furResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); //交接班支数 this.furResult1.Value.ChangeNum = dt.Rows[0]["CHANGE_NUM"].ToString(); //出炉交接班支数 this.furResult1.Value.OutChangeNum = dt.Rows[0]["OUT_CHANGE_NUM"].ToString(); this.furResult1.UpdateDateForRack(); } public string getstring(string str) { string result = "0"; if (!string.IsNullOrEmpty(str)) { if (str.Contains("_")) { str = str.Replace("_", ""); if (str.Equals(".")) { str = "0"; } } if (str.Equals(".")) { str = "0"; } result = str; } return result; } #endregion /// /// 带入工艺参数 /// /// private void frmTechnological1_DoubleClickEvent(DataTable dt) { UltraGridRow ugr = null; switch (ultraTabControl2.SelectedTab.Index) { case 0: if (this.dtPlan.Rows.Count > 0) { ugr = ultraGridPlan.ActiveRow; } else { return; } break; case 1: if (this.dtINFurInfor.Rows.Count > 0) { ugr = ultraGridINFurInfor.ActiveRow; } else { return; } break; case 2: if (this.dtOUTFurInfor.Rows.Count > 0) { ugr = ultraGridOUTFurInfor.ActiveRow; } else { return; } break; } NativeMethodNew NmN = new NativeMethodNew(this.ob); HOTMethod HOTm = new HOTMethod(this.ob); string Jno = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); dtMatSeq.Clear(); this.furResult1.ClearData(); if (!NmN.isBegineNode(Jno, 1)) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始入炉,不能带入参数。"); return; } //if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, PlineCode)) //{ // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成出炉,不能带入参数。"); // return; //} FurResultEntity FurResultEdit = new FurResultEntity(); FurResultEdit = (FurResultEntity)EntityTool.setObjectByDataTable(FurResultEdit, dt); //this.furResult1.Value = NativeMethod.GetEntityToEntity(this.furResult1.Value, FurResultEdit); this.furResult1.UpdateDateForPrama(FurResultEdit); ShowMessageFlag = 1; FurResultSave(); ShowMessageFlag = 0; } /// /// 激活Grid中选中行 /// public void ActiveRow() { UltraGridRow ugr = null; switch (ultraTabControl2.SelectedTab.Index) { case 0: if (this.dtPlan.Rows.Count > 0) { ugr = ultraGridPlan.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; case 1: if (this.dtINFurInfor.Rows.Count > 0) { ugr = ultraGridINFurInfor.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; case 2: if (this.dtOUTFurInfor.Rows.Count > 0) { ugr = ultraGridOUTFurInfor.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; } } /// /// tab页切换事件 /// /// /// private void ultraTabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { PlanQuery(); UltraGridRow ugr = null; dtMatSeq.Clear(); this.furResult1.ClearData(); switch (ultraTabControl2.SelectedTab.Index) { case 0: if (this.dtPlan.Rows.Count > 0) { ugr = ultraGridPlan.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; case 1: if (this.dtINFurInfor.Rows.Count > 0) { ugr = ultraGridINFurInfor.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; case 2: if (this.dtOUTFurInfor.Rows.Count > 0) { ugr = ultraGridOUTFurInfor.ActiveRow; AfterRowActive(ugr); ActiveUgr = ugr; } else { ActiveUgr = null; } break; } } /// /// 到点提示交班 /// 暂停使用到点提示交班 /// /// /// private void timer2_Tick(object sender, EventArgs e) { //if (!plineCode1.Equals("C072")) //{ // DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); // string Time = SeverTime.ToLongTimeString(); // Time = Time.Replace(":", ""); // if (ChangeFlag == 0) // { // if (int.Parse(Time) > 065459 && int.Parse(Time) < 065600 || int.Parse(Time) > 070359 && int.Parse(Time) < 070500) // { // if (Shift == "3") // { // if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes) // { // } // ChangeFlag = 1; // return; // } // } // if (int.Parse(Time) > 135359 && int.Parse(Time) < 135500 || int.Parse(Time) > 140359 && int.Parse(Time) < 140500) // { // if (Shift == "1") // { // if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes) // { // } // ChangeFlag = 1; // return; // } // } // if (int.Parse(Time) > 205359 && int.Parse(Time) < 205500 || int.Parse(Time) > 210359 && int.Parse(Time) < 210500) // { // if (Shift == "2") // { // if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes) // { // } // ChangeFlag = 1; // return; // } // } // } //} } //private void txtFurTemp_TextChanged(object sender, EventArgs e) //{ // if (!string.IsNullOrEmpty(txtTemp1.Text.ToString().Trim())) // { // txtTemp1.Text = CheckStyle(txtTemp1.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp2.Text.ToString().Trim())) // { // txtTemp2.Text=CheckStyle(txtTemp2.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp3.Text.ToString().Trim())) // { // txtTemp3.Text = CheckStyle(txtTemp3.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp4.Text.ToString().Trim())) // { // txtTemp4.Text = CheckStyle(txtTemp4.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp5.Text.ToString().Trim())) // { // txtTemp5.Text = CheckStyle(txtTemp5.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp6.Text.ToString().Trim())) // { // txtTemp6.Text = CheckStyle(txtTemp6.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp7.Text.ToString().Trim())) // { // txtTemp7.Text = CheckStyle(txtTemp7.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtTemp8.Text.ToString().Trim())) // { // txtTemp8.Text = CheckStyle(txtTemp8.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtFurTemp1.Text.ToString().Trim())) // { // txtFurTemp1.Text = CheckStyle(txtFurTemp1.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtPress1.Text.ToString().Trim())) // { // txtPress1.Text = CheckStyle(txtPress1.Text.ToString().Trim()); // } // if (!string.IsNullOrEmpty(txtGasPress1.Text.ToString().Trim())) // { // txtGasPress1.Text = CheckStyle(txtGasPress1.Text.ToString().Trim()); // } // // MessageBox.Show(""); //} /// /// 管号队列修改剔除原因 备注 /// /// /// private void ultraGridMatSeq_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { e.Handled = true; UltraGridRow ugr = null; int Index = ultraGridMatSeq.ActiveRow.Index; if (Index < ultraGridMatSeq.Rows.Count - 1) { ugr = ultraGridMatSeq.Rows[Index - 1]; // ugr = ultraGrid1.ActiveRow; } else { ugr = ultraGridMatSeq.ActiveRow; } ultraGridMatSeq.UpdateData(); ultraGridMatSeq.Update(); string ScrapReason = ugr.Cells["SCRAP_REASON"].Text.ToString().Trim(); string Remark = ugr.Cells["REMARK"].Text.ToString(); string Seq = ugr.Cells["SEQ"].Text.ToString(); string Status = ugr.Cells["STATUS"].Text.ToString(); if (Status == "剔除") { int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateMatNoPro", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, Seq, ScrapReason, Remark }, this.ob); } //ultraGridTC(); GetFurRack(); ChangeGridColor(); GetGridButtonName(); } } private void FrmFURResult_Load(object sender, EventArgs e) { NativeMethodNew na = new NativeMethodNew(this.ob); Departm = UserInfo.GetDepartment(); plineCode1 = na.GetPCode(Departm);//获取 用户 对应的产线 this.ultraTabControl2.SelectedTabChanged += new Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventHandler(this.ultraTabControl2_SelectedTabChanged); } } }