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.Control; using Core.Mes.Client.Comm.Server; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Entity; using com.steering.mes.zgmil.entity; using Core.StlMes.Client.ZGMil.NodeResultQuery; using System.Net; using Core.StlMes.Client.ZGMil.ResultConrtrol; using Core.StlMes.Client.ZGMil.Common; using CoreFS.SA06; namespace Core.StlMes.Client.ZGMil.Result { public partial class FrmReFurResult : FrmBase { #region 初始化 private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null; int PanelSizeFlag = 0; RollingInfomation rf = new RollingInfomation(); FeedRowPlan QuertFeedplan = new FeedRowPlan(); MilPlan QueryMainPlan = new MilPlan(); FeedRowPlan Feedplan = new FeedRowPlan(); MilPlan MainPlan = new MilPlan(); MilRollingResultEntity RollingRs = new MilRollingResultEntity(); FeedSawResultEntity FeedSawResult = new FeedSawResultEntity(); MilRefurResultEntity RefurRs = new MilRefurResultEntity(); MilRefurRackEntity RefurRack = new MilRefurRackEntity(); MilSlabScrapSeqEntity ScrapSeq = new MilSlabScrapSeqEntity(); private UltraGridRow ActiveUgr = null; private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号 private string ActiveStatus = null;////主计划活动行的状态 private string ActiveResultNo = ""; //主计划活动行ResultNo private string proPlanId = null;//轧管订单编号 private string gxPlanNo = null;//工序排产序号 private string lotNo = null;//生产批号 int ShowMessageFlag = 0; MilRefurResultEntity temprefur = new MilRefurResultEntity();//保存当前实绩类 string PlanStatusQuery = "50"; string Shift = ""; string Group = ""; private string Departm = "";//部门 private string PlineCode = "";//产线 private string _UserName = ""; private string _UserID = ""; // private string _Url = ""; private int _MouseLocX = 0; //鼠标横坐标 private int _MouseLocY = 0; //鼠标纵坐标 public Infragistics.Win.UltraWinGrid.UltraGrid Grid { get { return _grid; } } public FrmReFurResult() { Shift = UserInfo.GetUserOrder(); Group = UserInfo.GetUserGroup(); InitializeComponent(); PanelSizeFlag = 0; this.reFurResult1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton); //获取鼠标坐标 Point formPoint = this.PointToClient(Control.MousePosition); _MouseLocX = Convert.ToInt32(formPoint.X); _MouseLocY = Convert.ToInt32(formPoint.Y); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); //屏蔽Grid筛选条件 foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns) { ugc.SortIndicator = SortIndicator.Disabled; } rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; reFurResult1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; InitControl(); 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; } timer1.Tick += new EventHandler(timer1_Tick); ShowShift(); } private void ShowShift() { colShowShiftGroup1.Ob = this.ob; colShowShiftGroup1.Group = this.UserInfo.GetUserGroup(); colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder(); colShowShiftGroup1.ShowShift(); colShowShiftGroup1.Timer1.Enabled = true; } /// /// 页面开启事件 /// /// 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);//获取 用户 对应的产线 PlanQuery(); 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(); } /// /// 签名 /// private void Sign() { ColUserName col = new ColUserName(); col.StationId = "4"; 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; } Shift = UserInfo.GetUserOrder(); Group = UserInfo.GetUserGroup(); } #endregion #region 按钮操作 /// /// ToolBar按钮 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": PlanQuery(); break; case "Save": FeedRowSave(); break; case "Node": FeedSawResultNode(); break; case "DoNodeBack": NodeBack(); break; case "DoSign": Sign(); break; case "NodeQuery": NodeQuery(); break; case "DoChangeCancel": ChangeCancel(); break; case "DoQueryBefore": QueryBefore(); break; case "DoPrint": PrintResult(); break; case "DoStart": DoStart(); break; case "DoStartBack": StartBack(); break; case "Close": this.Dispose(); this.Close(); break; } } /// /// 查询主计划 /// private void PlanQuery() { 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 (chkHeatNo.Checked) { if (this.txtJudgeStoveNo.Text == "") { MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text; } } else { QueryMainPlan.JudgeStoveNo = ""; } if (chkLotNo.Checked) { if (this.txtLOT_NO.Text == "") { MessageBox.Show("请输入生产批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { QueryMainPlan.LotNo = this.txtLOT_NO.Text; } } else { QueryMainPlan.LotNo = ""; } dtPlan.Clear(); tbRollDate.Clear(); dtINFurInfor.Clear(); dtOUTFurInfor.Clear(); QueryMainPlan.PlineCode = PlineCode; QueryMainPlan.Status = PlanStatusQuery; if (ultraTabControl3.Tabs[0].Active) { //查询待装炉计划 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.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 (ultraTabControl3.Tabs[1].Active) { //查询待出炉炉次计划 DataTable dtINFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.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 (ultraTabControl3.Tabs[2].Active) { //查询已出炉炉次计划 DataTable dtOUTFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.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) { tbRollDate.Clear(); switch (ultraTabControl3.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; } //查询主计划信息 tbRollDate.Clear(); string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); string Status = ugr.Cells["IS_START"].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(); MainPlan.JudgeStoveNo = JudgeStoveNo; MainPlan.ProPlanId = proPlanId; MainPlan.GxPlanNo = gxPlanNo; ActiveJUDGE_STOVE_NO = JudgeStoveNo; ActiveStatus = ugr.Cells["IS_START"].Value.ToString(); ActiveResultNo = ugr.Cells["ID"].Value.ToString(); 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.FrmReFurResult.getRefurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { GridEditResult(dtFurResult); } else { MilRefurResultEntity fr = new com.steering.mes.zgmil.entity.MilRefurResultEntity(); reFurResult1.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 != "未开始入炉") { RackQuery(JudgeStoveNo); } else { tbRollDate.Rows.Clear(); } GetRollingCard();//流通卡赋值 refurResultQuery(); //ChangeGridColor(); } /// /// 双击入炉 /// /// /// private void DoStart() // private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e) { HOTMethod hm = new HOTMethod(this.ob); DataTable dt = new DataTable(); if (ActiveUgr == null) { return; } else { //if (!IsStart()) //{ // return; //} UltraGridRow ugr = ActiveUgr; string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();//判定炉号 string ResultNo = ugr.Cells["ID"].Value.ToString();//实绩编号 ActiveStatus = ugr.Cells["IS_START"].Value.ToString(); NativeMethodNew Nvw = new NativeMethodNew(this.ob); //if (!Nvw.isBegineNode(HeatNo, 3)) //{ // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】未连轧,不能入再加热炉。"); // 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, 1).Rows.Count > 0) { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(hm.InFurIsEnd("0", PlineCode, 1).Rows[0][0].ToString()) + "】正在入炉,当前炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】不能开始入炉"); return; } RefurRs.Clear(); if (ugr.Cells["IS_START"].Text.ToString().Trim() == "已开始再加热") { MessageBox.Show("已入再加热炉,无法进行再次入炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { MainPlan.JudgeStoveNo = HeatNo; DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob); GridEdit(dtMP); //轧制计划信息 if (temprefur != null) { RefurRs.FirstInTemp = temprefur.FirstInTemp; RefurRs.FirstOutTemp = temprefur.FirstOutTemp; RefurRs.LastInTemp = temprefur.LastInTemp; RefurRs.LastOutTemp = temprefur.LastOutTemp; RefurRs.ProcessRoute = temprefur.ProcessRoute; RefurRs.SetFurTemp = temprefur.SetFurTemp; RefurRs.TransferRhythm = temprefur.TransferRhythm; RefurRs.SteppingRhythm = temprefur.SteppingRhythm; RefurRs.BeginRollingTemp = temprefur.BeginRollingTemp; //加一段温度 RefurRs.LheatCruve1 = temprefur.LheatCruve1; //加二段温度 RefurRs.LheatCruve2 = temprefur.LheatCruve2; //加三段温度 RefurRs.LheatCruve3 = temprefur.LheatCruve3; //加四段温度 RefurRs.LheatCruve4 = temprefur.LheatCruve4; //加五段温度 RefurRs.LheatCruve5 = temprefur.LheatCruve5; //加六段温度 RefurRs.LheatCruve6 = temprefur.LheatCruve6; //加七段温度 RefurRs.LheatCruve7 = temprefur.LheatCruve7; //加八段温度 RefurRs.LheatCruve8 = temprefur.LheatCruve8; //炉温 RefurRs.FurPress = temprefur.FurPress; //风压 RefurRs.WindPress = temprefur.WindPress; //天然气压力 RefurRs.GasPress = temprefur.GasPress; } //DataTable dtBR = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getBurnningRate", new object[] { PlineCode }, this.ob); //if (dtBR.Rows.Count > 0) //{ // RefurRs.Burningrate = dtBR.Rows[0][0].ToString(); //} string stoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();//熔炼炉号 string lotNo = dtMP.Rows[0]["LOT_NO"].ToString();//生产批号 string factoryId = dtMP.Rows[0]["PLINE_CODE"].ToString();//产线 RefurRs.JudgeStoveNo = HeatNo; RefurRs.StoveNo = stoveNo; RefurRs.LotNo = lotNo; RefurRs.PlineCode = factoryId; RefurRs.ColUser = this.UserInfo.GetUserName(); RefurRs.ColShift = this.UserInfo.GetUserOrder(); RefurRs.ColGroup = this.UserInfo.GetUserGroup(); DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:ss"); RefurRs.StartTime = Time; RefurRs.FirstInTime = Time; RefurRs.ResultNo = ResultNo; RefurRs.NodeFurFlag = "0"; RefurRs.ProPlanId = proPlanId; RefurRs.GxPlanNo = gxPlanNo; //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + HeatNo + "】开始入炉?") == DialogResult.No) //{ // return; //} //修改主计划状态、新增再加热实绩 int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertResultForMainPlan", new object[] { RefurRs }, this.ob); //往跟踪记录表插入开始时间 NativeMethodNew na = new NativeMethodNew(this.ob); na.InsertSTAferDoubleClick(RefurRs.JudgeStoveNo.ToString(), 4, "0", proPlanId, gxPlanNo); //查询主表记录 DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 5 }, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true); ChangeCellName(); // ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand); foreach (UltraGridRow ugr1 in this.ultraGridPlan.Rows) { ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString()); //if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo) //{ // ultraGridPlan.ActiveRow = ugr1; //} } } ChangeGridColor(); PlanQuery(); RackQuery(HeatNo); } } /// /// 开始回退 /// private void StartBack() { if (ActiveUgr == null) { return; } else { 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, 5)) //{ // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始定径,不能开始回退!!!!"); // return; //} int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob); ChangeGridColor(); PlanQuery(); } } /// /// 保存 /// private void FeedRowSave() { if (ActiveUgr == null) { return; } int count = 0; try { reFurResult1.UltraGrid2.UpdateData(); } catch (Exception e) { MessageBox.Show("请输入正确的时间。"); return; } UltraGridRow ugrg = this.reFurResult1.UltraGrid2.Rows[0]; string heatNo = null; this.reFurResult1.UltraGrid2.UpdateData(); RefurRs.Clear();//清空公共类 if (this.ActiveUgr == null && ActiveJUDGE_STOVE_NO == null) { MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.ActiveUgr == null) { RefurRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO; } else { heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim(); RefurRs.JudgeStoveNo = heatNo; } if (ActiveStatus == "未开始入炉") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(RefurRs.JudgeStoveNo.ToString()) + "】未开始进行入炉或,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (ActiveStatus == "已完成再加热") //{ // MessageBox.Show("炉号:【" + RefurRs.JudgeStoveNo + "】已完成再加热,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + RefurRs.JudgeStoveNo + "】保存实绩?") == DialogResult.No) //{ // return; //} DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count > 0)//如果上一工序结炉则计算出来料支数等数据 { if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() == "1") { if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.Rows[0].Cells["QualifiedNum5"].Text.ToString().Trim()))//来料支数 { //来料支数 this.RefurRs.InFurNum = this.rollingCard1.UltraGrid4.Rows[0].Cells["QualifiedNum5"].Text.ToString().Trim(); if (!string.IsNullOrEmpty(this.reFurResult1.UltraGrid2.ActiveRow.Cells["ScrapNum"].Text.ToString())) { //剔废支数 RefurRs.ScrapNum = this.reFurResult1.UltraGrid2.ActiveRow.Cells["ScrapNum"].Text.ToString(); //出炉支数 this.RefurRs.OutFurNum = int.Parse(RefurRs.InFurNum.ToString()) - int.Parse(RefurRs.ScrapNum.ToString()); } else { RefurRs.ScrapNum = "0"; RefurRs.OutFurNum = RefurRs.InFurNum.ToString(); } } } } //RefurRs.InFurNum = ugrg.Cells["InRefurNum"].Value.ToString().Trim(); //RefurRs.ScrapNum = ugrg.Cells["ScrapNum"].Value.ToString().Trim(); //RefurRs.OutFurNum =( int.Parse(RefurRs.InFurNum.ToString()) - int.Parse(RefurRs.ScrapNum.ToString())).ToString(); RefurRs.Changeclassnum = ugrg.Cells["ChangeClassNum"].Value.ToString().Trim().Trim('_');//交接班支数限制问题? RefurRs.Remark = ugrg.Cells["Remark"].Text.ToString().Trim().Trim('_'); RefurRs.ProcessRoute = ugrg.Cells["ProcessRoute"].Value.ToString().Trim().Trim('_'); RefurRs.SetFurTemp = ugrg.Cells["SetFURTemp"].Value.ToString().Trim().Trim('_'); RefurRs.SteppingRhythm = ugrg.Cells["SteppingRhythm"].Text.ToString().Trim().Trim('_'); if (RefurRs.SteppingRhythm.ToString() == ".") { RefurRs.SteppingRhythm = ""; } RefurRs.TransferRhythm = ugrg.Cells["TransferRhythm"].Value.ToString().Trim().Trim('_'); if (RefurRs.TransferRhythm.ToString() == ".") { RefurRs.TransferRhythm = ""; } RefurRs.ActualLengthOfWastePipe = ugrg.Cells["PipeSize"].Value.ToString().Trim().Trim('_'); RefurRs.FirstInTemp = ugrg.Cells["FirstInTemp"].Value.ToString().Trim().Trim('_'); RefurRs.FirstOutTemp = ugrg.Cells["FirstOutTemp"].Value.ToString().Trim().Trim('_'); RefurRs.FirstInTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_'); RefurRs.LastInTime = ugrg.Cells["LastInTime"].Value.ToString().Trim().Trim('_'); RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString().Trim().Trim('_'); RefurRs.LastInTemp = ugrg.Cells["LastInTemp"].Value.ToString().Trim().Trim('_'); RefurRs.LastOutTemp = ugrg.Cells["LastOutTemp"].Value.ToString().Trim().Trim('_'); RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_'); RefurRs.OutChangeNum = ugrg.Cells["OUT_CHANGE_NUM"].Value.ToString().Trim().Trim('_'); RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_'); RefurRs.FirstOutTime = ugrg.Cells["FirstOutTime"].Value.ToString().Trim().Trim('_'); RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_'); RefurRs.EndTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_'); //RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim(); //RefurRs.ColUser = this.UserInfo.GetUserName(); //RefurRs.ColShift = this.UserInfo.GetUserOrder(); //RefurRs.ColGroup = this.UserInfo.GetUserGroup(); // RefurRs.JudgeStoveNo = heatNo; //加一段温度 RefurRs.LheatCruve1 = getstring(ultraTextEditor16.Text.Trim('_')); //加二段温度 RefurRs.LheatCruve2 = getstring(ultraTextEditor1.Text.Trim('_')); //加三段温度 RefurRs.LheatCruve3 = getstring(ultraTextEditor10.Text.Trim('_')); //加四段温度 RefurRs.LheatCruve4 = getstring(ultraTextEditor11.Text.Trim('_')); //加五段温度 RefurRs.LheatCruve5 = getstring(ultraTextEditor12.Text.Trim('_')); //加六段温度 RefurRs.LheatCruve6 = getstring(ultraTextEditor13.Text.Trim('_')); //加七段温度 RefurRs.LheatCruve7 = getstring(ultraTextEditor14.Text.Trim('_')); //加八段温度 RefurRs.LheatCruve8 = getstring(ultraTextEditor15.Text.Trim('_')); //炉温 RefurRs.FurPress = getstring(ultraTextEditor19.Text.Trim('_')); //风压 RefurRs.WindPress = getstring(ultraTextEditor18.Text.Trim('_')); //天然气压力 RefurRs.GasPress = getstring(ultraTextEditor17.Text.Trim('_')); //残氧量 RefurRs.ResidualOxygen = "0"; RefurRs.ProPlanId = proPlanId; RefurRs.GxPlanNo = gxPlanNo; //if (RefurRs.Changeclassnum.ToString() == "") //{ // RefurRs.Changeclassnum = "0"; //} //if (int.Parse(RefurRs.Changeclassnum.ToString()) - int.Parse(RefurRs.InFurNum.ToString()) > 0) //{ // MessageBox.Show("交接班支数不允许大于入炉支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (string.IsNullOrEmpty(RefurRs.FirstInTime.ToString())) { MessageBox.Show("第一支入炉时间不能为空,请输入正确的第一支入炉时间"); return; } //查询结炉状态,已结炉的计划 结炉时间不能为空 DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob); if (int.Parse(dt1.Rows[0][0].ToString()) > 49) { if (string.IsNullOrEmpty(RefurRs.LastOutTime.ToString())) { MessageBox.Show("最后一支出炉时间不能为空,请输入正确的最后一支出炉时间时间"); return; } } count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.resultSave", new object[] { RefurRs }, this.ob); if (count > 0) { MessageBox.Show("再入炉实绩保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } this.reFurResult1.IsCellSelect = false; temprefur = NativeMethod.GetEntityToEntity(temprefur, RefurRs);//当前实绩备份 ChangeGridColor(); PlanQuery(); RackQuery(ActiveJUDGE_STOVE_NO); } /// /// 结炉 /// private void FeedSawResultNode() { FeedRowSave(); try { reFurResult1.UltraGrid2.UpdateData(); } catch (Exception e) { MessageBox.Show("请输入正确的时间。"); return; } HOTMethod hm = new HOTMethod(this.ob); if (ActiveUgr == null) { return; } int count = 0; RefurRs.Clear(); UltraGridRow ugrg = this.reFurResult1.UltraGrid2.Rows[0]; this.reFurResult1.UltraGrid2.UpdateData(); string heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim(); this.RefurRs.JudgeStoveNo = heatNo; this.RollingRs.JudgeStoveNo = heatNo; string Status = ActiveUgr.Cells["IS_START"].Value.ToString2(); string ResultNo = ActiveUgr.Cells["ID"].Value.ToString2(); string proPlanId = ActiveUgr.Cells["PRO_PLAN_ID"].Value.ToString(); string gxPlanNo = ActiveUgr.Cells["GX_PLAN_NO"].Value.ToString(); //判断是否有重复剔除的坯子 foreach (UltraGridRow ugr4 in ultraGrid1.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; } } 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 (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉?") == DialogResult.No) { return; } DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, 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; } string BackPlanFlag = ""; //返线计划标识(5--荒管组炉的炉号) DataTable dtBackPlanFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getMilPlanFalg", new object[] { heatNo, PlineCode, proPlanId, gxPlanNo }, this.ob); if (dtBackPlanFlag.Rows.Count > 0) { BackPlanFlag = dtBackPlanFlag.Rows[0]["BACK_PLAN_FLAG"].ToString(); } if (BackPlanFlag != "5") { //查询上一炉的实绩 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count == 0) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未开始,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() != "1") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (hm.NodeGetWaitChangeMat(heatNo, ResultNo, 4) > 0) { MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(heatNo, ResultNo, 4) + "】未接班确认,不能结炉"); return; } RefurRs.ScrapNum = "0"; //查询本道工序剔除支数 DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob); if (dtScrapNum.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString())) { RefurRs.ScrapNum = dtScrapNum.Rows[0][0].ToString(); } } //查询上个工序合格支数 DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob); //入炉支数 if (dtQANum.Rows.Count > 0) { RefurRs.InFurNum = dtQANum.Rows[0][0]; NativeMethodNew na = new NativeMethodNew(this.ob); if (int.Parse(RefurRs.InFurNum.ToString()) - na.GetSlabNum(heatNo, proPlanId, gxPlanNo, 4, this.ob) < 0) { //MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; } } else { RefurRs.InFurNum = "0"; } //出炉支数 int InNum = int.Parse(RefurRs.InFurNum.ToString()); int ScrapNum = int.Parse(RefurRs.ScrapNum.ToString()); RefurRs.OutFurNum = (InNum - ScrapNum).ToString(); RefurRs.Changeclassnum = ugrg.Cells["ChangeClassNum"].Value.ToString().Trim().Trim('_');//交接班支数限制问题? RefurRs.Remark = ugrg.Cells["Remark"].Text.ToString().Trim().Trim('_'); RefurRs.ProcessRoute = ugrg.Cells["ProcessRoute"].Value.ToString().Trim().Trim('_'); RefurRs.SetFurTemp = ugrg.Cells["SetFURTemp"].Value.ToString().Trim().Trim('_'); RefurRs.SteppingRhythm = ugrg.Cells["SteppingRhythm"].Text.ToString().Trim().Trim('_'); if (RefurRs.SteppingRhythm.ToString() == ".") { RefurRs.SteppingRhythm = ""; } RefurRs.TransferRhythm = ugrg.Cells["TransferRhythm"].Value.ToString().Trim().Trim('_'); if (RefurRs.TransferRhythm.ToString() == ".") { RefurRs.TransferRhythm = ""; } RefurRs.ActualLengthOfWastePipe = ugrg.Cells["PipeSize"].Value.ToString().Trim().Trim('_'); RefurRs.FirstInTemp = ugrg.Cells["FirstInTemp"].Value.ToString().Trim().Trim('_'); RefurRs.FirstOutTemp = ugrg.Cells["FirstOutTemp"].Value.ToString().Trim().Trim('_'); RefurRs.FirstInTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_'); RefurRs.LastInTime = ugrg.Cells["LastInTime"].Value.ToString().Trim().Trim('_'); RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString().Trim().Trim('_'); RefurRs.LastInTemp = ugrg.Cells["LastInTemp"].Value.ToString().Trim().Trim('_'); RefurRs.LastOutTemp = ugrg.Cells["LastOutTemp"].Value.ToString().Trim().Trim('_'); RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_'); RefurRs.EndTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_'); RefurRs.OutChangeNum = ugrg.Cells["OUT_CHANGE_NUM"].Value.ToString().Trim().Trim('_'); RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_'); RefurRs.FirstOutTime = ugrg.Cells["FirstOutTime"].Value.ToString().Trim().Trim('_'); //RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_'); RefurRs.ColUser = _UserName; RefurRs.UserId = _UserID; RefurRs.ColShift = this.UserInfo.GetUserOrder(); RefurRs.ColGroup = this.UserInfo.GetUserGroup(); RefurRs.JudgeStoveNo = heatNo; RefurRs.UserId = _UserID; //加一段温度 RefurRs.LheatCruve1 = getstring(ultraTextEditor16.Text.Trim('_')); //加二段温度 RefurRs.LheatCruve2 = getstring(ultraTextEditor1.Text.Trim('_')); //加三段温度 RefurRs.LheatCruve3 = getstring(ultraTextEditor10.Text.Trim('_')); //加四段温度 RefurRs.LheatCruve4 = getstring(ultraTextEditor11.Text.Trim('_')); //加五段温度 RefurRs.LheatCruve5 = getstring(ultraTextEditor12.Text.Trim('_')); //加六段温度 RefurRs.LheatCruve6 = getstring(ultraTextEditor13.Text.Trim('_')); //加七段温度 RefurRs.LheatCruve7 = getstring(ultraTextEditor14.Text.Trim('_')); //加八段温度 RefurRs.LheatCruve8 = getstring(ultraTextEditor15.Text.Trim('_')); //炉温 RefurRs.FurPress = getstring(ultraTextEditor19.Text.Trim('_')); //风压 RefurRs.WindPress = getstring(ultraTextEditor18.Text.Trim('_')); //天然气压力 RefurRs.GasPress = getstring(ultraTextEditor17.Text.Trim('_')); //合格吨 double DBHeight = 0; double BurnningRate = 0; double DBNum = 1; //烧损率 if (string.IsNullOrEmpty(ugrg.Cells["BurningRate"].Value.ToString())) { RefurRs.Burningrate = "2.0"; } else { RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString(); } DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { heatNo, 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]["BURNNING_RATE"].ToString())) { BurnningRate = double.Parse(dtDBH.Rows[0]["BURNNING_RATE"].ToString()); } if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString())) { DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString()); } } RefurRs.QaTon = DBHeight * (1 - (BurnningRate / 100)) * (1 - (double.Parse(BurnningRate.ToString()) / 100)) * double.Parse(RefurRs.OutFurNum.ToString()); //残氧量 RefurRs.ResidualOxygen = ""; RefurRs.NodeFurFlag = "1";//结炉标识 RefurRs.ProPlanId = proPlanId; RefurRs.GxPlanNo = gxPlanNo; RefurRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO; RefurRs.LotNo = lotNo; RefurRs.PlineCode = PlineCode; //写进程表 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult"; ccp.MethodName = "updateMilSlab"; ccp.ServerParams = new object[] { heatNo, "5", 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[] { heatNo, "5", "5", proPlanId, gxPlanNo, lotNo, PlineCode }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { if (count == 0) { count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.endStoveForMainPlan", new object[] { RefurRs, heatNo, PlineCode, _UserName, Shift, Group }, this.ob); if (count > 0) { count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 5, 0, PlineCode, proPlanId, gxPlanNo }, this.ob); if (count > 0) { //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertFurnacesReslut", new object[] { heatNo, PlineCode, _UserName, Shift, Group }, this.ob); //if (count == 0) //{ MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); NativeMethodNew na = new NativeMethodNew(this.ob); //na.InsertSTAferDoubleClick(heatNo, 4, "1", proPlanId, gxPlanNo); NativeMethod.CheckNodeMatStatus(heatNo, proPlanId, gxPlanNo, 4, this.ob); PlanQuery(); GetRollingCard(heatNo); this.reFurResult1.IsCellSelect = false; //} } } } } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } ChangeGridColor(); PlanQuery(); RackQuery(heatNo); } /// /// 结炉回退 /// private void NodeBack() { if (ActiveUgr == null) { 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, 4, 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 + "结炉,当班不能结炉回退"); } } 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 "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 != "50") { 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, 4, 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.FrmReFurResult.getRefurResult", 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 = ultraGrid1.Rows.Count; } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmReFurResult"; ccp.MethodName = "deleteFurnacesReslut"; ccp.ServerParams = new object[] { JudgeStoveNo, PlineCode, proPlanId, gxPlanNo }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.deleteFurnacesReslut", new object[] { JudgeStoveNo, PlineCode }, this.ob); if (ccp.ReturnInfo.Equals("荒管剔除成功!")) { int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 4, PlineCode, Seq, OutSeq, 5, proPlanId, gxPlanNo, lotNo }, this.ob); } else { //MessageUtil.ShowTips(ccp.ReturnInfo); MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已经荒管组炉,不可以结炉回退!"); } ChangeGridColor(); PlanQuery(); RackQuery(JudgeStoveNo); } /// /// 毛管剔除 /// /// /// private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e) { if (ActiveUgr == null) { return; } HOTMethod hm = new HOTMethod(this.ob); DataTable dt = new DataTable(); int scrapNum = 0; int count = 0; string heatNo = ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim(); string seq = ultraGrid1.ActiveRow.Cells["SEQ"].Text.ToString().Trim(); string MAT_NO = ultraGrid1.ActiveRow.Cells["MAT_NO"].Text.ToString().Trim(); int Seq = int.Parse(seq); string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); string User = UserInfo.GetUserName(); string PlanStatus = ActiveUgr.Cells["IS_START"].Value.ToString(); if (PlanStatus == "已完成出炉") // -- 修改结炉回退操作时放开 { if (e.Cell.Column.Key == "IN_CHANGE_NUM" || e.Cell.Column.Key == "OUT_CHANGE_NUM") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (e.Cell.Column.Key == "BTNOUTCHANGECOM" || e.Cell.Column.Key == "BTNINCHANGECOM") { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult"; ccp.MethodName = "scrapMatCheck"; ccp.ServerParams = new object[] { heatNo, 5, proPlanId, gxPlanNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo); if (e.Cell.Column.Key == "DELETE") { if (this.ultraGrid1.ActiveRow.Cells["STATUS"].Text.ToString().Trim() == "剔除") { MessageBox.Show("此毛管已被剔除,不可重复剔除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ultraGrid1.Rows.Count - ScrapNumBefore < int.Parse(seq)) { MessageBox.Show("不存在序号为【" + seq + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", 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 ultraGrid1.Rows) { if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) > 2) { i = i + 1; } } if (int.Parse(seq) < 3 && i > 0) { if (MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,是否确认剔除。") == DialogResult.No) { return; } } //管排锯切前判断当前管坯序号是否已剔除 //DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { heatNo, seq }, this.ob); //if (dtSeq.Rows.Count > 0) //{ // MessageBox.Show("不存在序号为【" + seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} RefurRs.JudgeStoveNo = heatNo; RefurRs.ProPlanId = proPlanId; RefurRs.GxPlanNo = gxPlanNo; dt.Clear(); ScrapSeq.Seq = seq; ScrapSeq.JudgeStoveNo = heatNo; ScrapSeq.ColUser = this.UserInfo.GetUserName(); ScrapSeq.ColShift = this.UserInfo.GetUserOrder(); ScrapSeq.ColGroup = this.UserInfo.GetUserGroup(); ScrapSeq.ProPlanId = proPlanId; ScrapSeq.GxPlanNo = gxPlanNo; //新增管列序号表 count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertScrapSlabSeq", new object[] { ScrapSeq }, this.ob); if (count > 0) { dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.scrapNumQuery", new object[] { RefurRs }, this.ob); if (dt.Rows.Count > 0) { scrapNum = int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString()); } RefurRack.ScrapNum = scrapNum.ToString(); RefurRack.ColUser = UserInfo.GetUserName(); RefurRack.ColGroup = UserInfo.GetUserGroup(); RefurRack.ColShift = UserInfo.GetUserOrder(); RefurRack.Status = "1"; RefurRack.JudgeStoveNo = heatNo; RefurRack.Seq = seq; RefurRack.ProPlanId = proPlanId; RefurRack.GxPlanNo = gxPlanNo; count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.rackDelete", new object[] { RefurRack }, this.ob); if (count > 0) { RackQuery(ActiveJUDGE_STOVE_NO); refurResultQuery(); GetRollingCard(); } } } if (e.Cell.Column.Key == "DELBACK") { //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No) //{ // return; //} if (!this.ultraGrid1.ActiveRow.Cells["STATUS"].Text.ToString().Trim().Equals("剔除")) { MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } NativeMethodNew na = new NativeMethodNew(this.ob); int counts = na.DeleteSlabSeq(heatNo, seq.ToString(), 5, 1, 0, proPlanId, gxPlanNo); if (counts > 0) { // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); RackQuery(ActiveJUDGE_STOVE_NO); refurResultQuery(); GetRollingCard(); } else { MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } //入炉交班 if (e.Cell.Column.Key == "IN_CHANGE_NUM") { //查询是否有最后一只入炉时间 DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { ActiveJUDGE_STOVE_NO, 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; } } int BeforeChangeNum = 0; //查询上个班入炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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 > ultraGrid1.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob); //hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, Seq, 0); } //入炉交班确认 if (e.Cell.Column.Key == "BTNINCHANGECOM") { int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, 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; } // //查询是否有该班接班记录 DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.ToLongTimeString(); string StartTime = SeverTime.ToShortDateString() + " 00:00:00"; string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; int BeforeChangeNum = 0; //查询上个班入炉交班支数 DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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 > ultraGrid1.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } //未登录 if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "4", PlineCode)) { if (this.DoRelogin(DoCheck)) { //查询上个班入炉交班支数 DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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, "4", PlineCode); // string User = UserInfo.GetUserName(); int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob); //查询是否有出炉交班但未确认接班的炉号 DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQueryReFur", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, proPlanId, gxPlanNo }, this.ob); { if (dtOutChange.Rows.Count > 0) { string WaitOutFur = dtOutChange.Rows[0][0].ToString(); MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要出炉交班确认。"); } } } } else { //string User = UserInfo.GetUserName(); DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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 count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob); //查询是否有出炉交班但未确认接班的炉号 DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQueryReFur", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, proPlanId, gxPlanNo }, 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 dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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()); } } DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, 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 (Seq <= BeforeChangeNum) { MessageBox.Show("前道班次已交班,该支不能再次交班。"); return; } if (Seq > ultraGrid1.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 2, 2 }, this.ob); //ChangeFlag = 1; hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, Seq, 1); } //出炉交班确认 if (e.Cell.Column.Key == "BTNOUTCHANGECOM") { int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, 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[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, 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 > ultraGrid1.Rows.Count - ScrapNumBefore) { MessageBox.Show("该支已被前道工序剔除,不能在该支交班"); return; } if (this.DoRelogin(DoCheck)) { //string User = UserInfo.GetUserName(); //hm.InsertChangeRemuse(Shift, Group, _UserName, "4", PlineCode); //查询上个班出炉交班支数 DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob); if (dtChangeNum1.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtChangeNum1.Rows[1][0].ToString())) { BeforeChangeNum = int.Parse(dtChangeNum1.Rows[1][0].ToString()); } } int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 5, 2, proPlanId, gxPlanNo }, this.ob); } } //过渡方法,接班后重登陆初始化导致Grid.Row为null if (ultraGridPlan.Rows == null) { return; } DataTable dtFurResult2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob); GridEditResult(dtFurResult2); ChangeGridColor(); GetRollingCard();//流通卡赋值 RackQuery(heatNo); } public string DoCheck(CoreUserInfo User) { return ""; } /// /// 交班取消 /// private void ChangeCancel() { int Flag = 0; string JudgeStoveNo = ""; string Status = ""; string ResultNo = ""; UltraGridRow ugr = this.ActiveUgr; string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); 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.FrmReFurResult.getRefurResult", 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, 4, Flag); //查询加热炉实绩信息 DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); if (dtFurResult.Rows.Count > 0) { GridEditResult(dtFurResult); } PlanQuery(); } } /// /// 点击保存单支出入炉时间 /// /// /// public void UltraGrid2_ClickCellButton(object sender, CellEventArgs e) { DateTime SeverTime = NativeMethod.GetSeverTime(this.ob); string Time = SeverTime.ToLongTimeString(); HOTMethod hm = new HOTMethod(this.ob); string temp = ""; string Shift = UserInfo.GetUserOrder(); string Group = UserInfo.GetUserGroup(); if (ActiveUgr == null) { return; } string JudgeStoveNo = ""; string ResultNo = ""; UltraGridRow ugr = ActiveUgr; if (ugr != null) { JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); ResultNo = ugr.Cells["ID"].Value.ToString(); } int count = 0; int Flag = 0; string Status = ugr.Cells["IS_START"].Value.ToString(); 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; } switch (e.Cell.Column.Key) { case "btnFirstIn": this.reFurResult1.UltraGrid2.Rows[0].Cells["FirstInTime"].Value = Time; DoStart(); Flag = 0; temp = temprefur.FirstInTemp.ToString(); count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob); break; case "btnLastIn": string BackPlanFlag = ""; //返线计划标识(5--荒管组炉的炉号) DataTable dtBackPlanFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getMilPlanFalg", new object[] { JudgeStoveNo, PlineCode, proPlanId, gxPlanNo }, this.ob); if (dtBackPlanFlag.Rows.Count > 0) { BackPlanFlag = dtBackPlanFlag.Rows[0]["BACK_PLAN_FLAG"].ToString(); } if (BackPlanFlag != "5") { string NodeFlag = ""; DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", 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; temp = temprefur.LastInTemp.ToString(); this.reFurResult1.UltraGrid2.Rows[0].Cells["LastInTime"].Value = Time; count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob); count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.SetInFur", new object[] { JudgeStoveNo, ResultNo, Shift, Group, _UserName }, this.ob); break; case "btnFirstOut": Flag = 2; temp = temprefur.FirstOutTemp.ToString(); DataTable dtIsOut = hm.InFurIsEnd("2", PlineCode, 1); if (dtIsOut.Rows.Count > 0) { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(dtIsOut.Rows[0][0].ToString()) + "】正在出炉。"); return; } this.reFurResult1.UltraGrid2.Rows[0].Cells["FirstOutTime"].Value = Time; count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob); break; case "btnLastOut": Flag = 3; FeedSawResultNode(); temp = temprefur.LastOutTemp.ToString(); this.reFurResult1.UltraGrid2.Rows[0].Cells["LastOutTime"].Value = Time; //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob); break; } PlanQuery(); //刷新实绩界面 //this.reFurResult1.UpdateData(); } 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; } /// /// 修改IS_START名称 /// public void ChangeCellName() { //if (ultraGridPlan.Rows.Count > 0) //{ // NativeMethodNew na = new NativeMethodNew(this.ob); // foreach (UltraGridRow ugr in ultraGridPlan.Rows) // { // //String Judge_Stove_No = ugr.Cells["JUDGE_DTOVE_NO"].Value.ToString(); // //if (na.isBegineNode(Judge_Stove_No, 0)) // //{ // // ugr.Appearance.BackColor = Color.YellowGreen; // //} // if (ugr.Cells["IS_START"].Value.ToString() != "未开始再加热" && ugr.Cells["IS_START"].Value.ToString() != "已开始再加热" && ugr.Cells["IS_START"].Value.ToString() != "已完成再加热") // { // switch (Convert.ToInt32(ugr.Cells["IS_START"].Value)) // { // case 3: // ugr.Cells["IS_START"].Value = "未开始再加热"; // break; // case 0: // ugr.Cells["IS_START"].Value = "已开始再加热"; // break; // case 1: // ugr.Cells["IS_START"].Value = "已完成再加热"; // break; // } // } // } //} } /// /// 变色 /// private 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 ultraGrid1.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; } } } } /// /// 判断是否能开始当前炉次 /// /// 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.FrmReFurResult.getInFurTime", new object[] { JudgeStoveNo }, this.ob); if (string.IsNullOrEmpty(dt.Rows[0]["LAST_IN_TIME"].ToString())) // if(!(dt.Rows.Count>0)) { MessageBox.Show("炉号【" + JudgeStoveNo + "】入炉未完成,【" + ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() + "】不能入炉"); Start = false; } } } return Start; } /// /// 查询流通卡信息 /// private void GetRollingCard() { if (!string.IsNullOrEmpty(ActiveJUDGE_STOVE_NO)) { 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[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob); } else { dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob); } RollingCardEditGrid(dt, ActiveJUDGE_STOVE_NO); } } /// /// 流通卡赋值 /// /// 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.BacklineStraight = dt.Rows[0]["BACKLINE_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(); this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString(); } else { if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0") { this.rollingCard1.Value.OfflineTesting = ""; this.rollingCard1.Value.BacklineTesting = ""; } else { //探伤下线支数 this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString(); this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_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(); } } /// /// 查询流通卡信息 /// private void GetRollingCard(string heatNo) { string JudgeStoveNo = heatNo; DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob); RollingCardEditGrid(dt, JudgeStoveNo); } #endregion #region 事件处理 private void chkHeatNo_CheckedChanged(object sender, EventArgs e) { if (this.chkHeatNo.Checked) { this.txtJudgeStoveNo.Enabled = true; } else { this.txtJudgeStoveNo.Enabled = false; } if (this.chkLotNo.Checked) { this.txtLOT_NO.Enabled = true; } else { this.txtLOT_NO.Enabled = false; } if (chkStatusQuery.Checked) { PlanStatusQuery = "99"; } else { PlanStatusQuery = "50"; } } /// /// 再加热炉跟踪信息查询 /// private void RackQuery(string heatNo) { tbRollDate.Clear(); int TabIndex = ultraTabControl3.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; } RefurRack.JudgeStoveNo = heatNo; RefurRack.ProPlanId = proPlanId; RefurRack.GxPlanNo = gxPlanNo; DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.rackQueryForHeatNo", new object[] { RefurRack }, this.ob);//再加热炉跟踪信息 GridHelper.CopyDataToDatatable(ref dt, ref tbRollDate, true); ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand); foreach (UltraGridRow ugr in ultraGrid1.Rows) { ugr.Cells["DELETE"].Value = "剔除"; ugr.Cells["DELBACK"].Value = "剔料回退"; } ChangeGridColor(); } /// /// tab页切换事件 /// /// /// private void ultraTabControl3_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { PlanQuery(); UltraGridRow ugr = null; tbRollDate.Clear(); this.reFurResult1.ClearData(); switch (ultraTabControl3.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 refurResultQuery() { DataTable dt = new DataTable(); dt.Clear(); if (ActiveUgr == null) { return; } string heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim(); RefurRs.JudgeStoveNo = heatNo; dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob); GridEditResult(dt); } /// /// 再入炉实绩赋值给Grid /// /// private void GridEditResult(DataTable dt) { if (dt.Rows.Count > 0) { //入炉支数 this.reFurResult1.Value.InFurNum = dt.Rows[0]["IN_FUR_NUM"].ToString(); //剔除支数 this.reFurResult1.Value.ScrapNum = dt.Rows[0]["SCRAP_NUM"].ToString(); //入炉交接班支数 this.reFurResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString(); //出炉交接班支数 this.reFurResult1.Value.OutChangeNum = dt.Rows[0]["OUT_CHANGE_NUM"].ToString(); //出炉支数 if (dt.Rows[0]["IN_FUR_NUM"].ToString() == "") { this.reFurResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); } else { if (dt.Rows[0]["OUT_FUR_NUM"].ToString() == "") { if (dt.Rows[0]["SCRAP_NUM"].ToString() == "") { this.reFurResult1.Value.OutFurNum = (int.Parse(this.reFurResult1.Value.InFurNum.ToString()) - 0).ToString(); } else { this.reFurResult1.Value.OutFurNum = (int.Parse(this.reFurResult1.Value.InFurNum.ToString()) - int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString())).ToString(); } } else { this.reFurResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString(); } } //备注 this.reFurResult1.Value.Remark = dt.Rows[0]["REMARK"].ToString(); //工艺路线 this.reFurResult1.Value.ProcessRoute = dt.Rows[0]["PROCESS_ROUTE"].ToString(); //炉温设定 this.reFurResult1.Value.SetFurTemp = dt.Rows[0]["SET_FUR_TEMP"].ToString(); //步进梁节奏 this.reFurResult1.Value.SteppingRhythm = dt.Rows[0]["STEPPING_RHYTHM"].ToString(); //移送链节奏 this.reFurResult1.Value.TransferRhythm = dt.Rows[0]["TRANSFER_RHYTHM"].ToString(); //荒管实际尺寸 //开始时间 this.reFurResult1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString(); //结束时间 this.reFurResult1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString(); //结束时间 this.reFurResult1.Value.ActualLengthOfWastePipe = dt.Rows[0]["ACTUAL_LENGTH_OF_WASTE_PIPE"].ToString(); //第一支入炉温度 this.reFurResult1.Value.FirstInTemp = dt.Rows[0]["FIRST_IN_TEMP"].ToString(); //第一支出炉温度 this.reFurResult1.Value.FirstOutTemp = dt.Rows[0]["FIRST_OUT_TEMP"].ToString(); //第一支入炉时间 this.reFurResult1.Value.FirstInTime = dt.Rows[0]["FIRST_IN_TIME"].ToString(); //最后一支入炉时间 this.reFurResult1.Value.LastInTime = dt.Rows[0]["LAST_IN_TIME"].ToString(); // 烧损率 this.reFurResult1.Value.Burningrate = "2.0";//dt.Rows[0]["BURNINGRATE"].ToString(); //最后一支入炉温度 this.reFurResult1.Value.LastInTemp = dt.Rows[0]["LAST_IN_TEMP"].ToString(); //最后一支出炉温度 this.reFurResult1.Value.LastOutTemp = dt.Rows[0]["LAST_OUT_TEMP"].ToString(); //第一支出炉时间 this.reFurResult1.Value.FirstOutTime = dt.Rows[0]["FIRST_OUT_TIME"].ToString(); //最后一支出炉时间 this.reFurResult1.Value.LastOutTime = dt.Rows[0]["LAST_OUT_TIME"].ToString(); this.reFurResult1.Value.BeginRollingTemp = dt.Rows[0]["BEGIN_ROLLING_TEMP"].ToString(); this.reFurResult1.UpdateData(); //加一段温度 this.ultraTextEditor16.Text = getstring(dt.Rows[0]["LHEAT_CRUVE1"].ToString()); //加二段温度 this.ultraTextEditor1.Text = getstring(dt.Rows[0]["LHEAT_CRUVE2"].ToString()); //加三段温度 ultraTextEditor10.Text = getstring(dt.Rows[0]["LHEAT_CRUVE3"].ToString()); //加四段温度 ultraTextEditor11.Text = getstring(dt.Rows[0]["LHEAT_CRUVE4"].ToString()); //加五段温度 ultraTextEditor12.Text = getstring(dt.Rows[0]["LHEAT_CRUVE5"].ToString()); //加六段温度 ultraTextEditor13.Text = getstring(dt.Rows[0]["LHEAT_CRUVE6"].ToString()); //加七段温度 ultraTextEditor14.Text = getstring(dt.Rows[0]["LHEAT_CRUVE7"].ToString()); //加八段温度 ultraTextEditor15.Text = getstring(dt.Rows[0]["LHEAT_CRUVE8"].ToString()); //炉温 ultraTextEditor19.Text = getstring(dt.Rows[0]["FUR_PRESS"].ToString()); //风压 ultraTextEditor18.Text = getstring(dt.Rows[0]["WIND_PRESS"].ToString()); //天然气压力 ultraTextEditor17.Text = getstring(dt.Rows[0]["GAS_PRESS"].ToString()); } else//再加热实绩为null 时清楚实绩卡里的记录 { MilRefurResultEntity re = new MilRefurResultEntity(); this.reFurResult1.Value = re; this.reFurResult1.UpdateData(); //加一段温度 this.ultraTextEditor16.Text = "0.00"; //加二段温度 this.ultraTextEditor1.Text = "0.00"; //加三段温度 ultraTextEditor10.Text = "0.00"; //加四段温度 ultraTextEditor11.Text = "0.00"; //加五段温度 ultraTextEditor12.Text = "0.00"; //加六段温度 ultraTextEditor13.Text = "0.00"; //加七段温度 ultraTextEditor14.Text = "0.00"; //加八段温度 ultraTextEditor15.Text = "0.00"; //炉温 ultraTextEditor19.Text = "0.00"; //风压 ultraTextEditor18.Text = "0.00"; //天然气压力 ultraTextEditor17.Text = "0.00"; } this.reFurResult1.UpdateData(); } /// /// Grid表头事件 /// /// /// private void ultraGrid1_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e) { if (PanelSizeFlag == 0) { PanelSizeFlag = 1; splitContainer2.SplitterDistance = 180; } else { PanelSizeFlag = 0; splitContainer2.SplitterDistance = 90; } } #endregion /// /// 轧制信息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(); } } /// /// 计划表ROW点击变换判断 /// /// /// private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e) { if (this.reFurResult1.IsCellSelect == true) { NativeMethodNew na = new NativeMethodNew(this.ob); if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 4)) { this.reFurResult1.IsCellSelect = false; return; } //if (MessageBox.Show("提示:再加热炉实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ // this.reFurResult1.IsCellSelect = false; // //保存探伤实绩 //} else { FeedRowSave(); this.reFurResult1.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; } } } /// /// 查询结炉实绩 /// public void NodeQuery() { string Group = UserInfo.GetUserGroup(); string Shift = UserInfo.GetUserOrder(); 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.FrmReFurResult.GetReFurResultNodeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmReFurResult"; ccp.MethodName = "GetReFurResultNodeQuery"; ccp.ServerParams = new object[] { PlineCode, Shift, Group, StartTime, EndTime }; ccp = this.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp.ReturnObject == null) { return; } DataTable dt = ccp.SourceDataTable; FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 5, Date, Shift, Group, this.ob); frm.ShowDialog(); } /// /// 打印报表 /// private void PrintResult() { Group = UserInfo.GetUserGroup(); Shift = UserInfo.GetUserOrder(); 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"); } //查询当天晚班的所有数据 else if (int.Parse(Time) > 204000) { StartTime = SeverTime.ToShortDateString() + " 20:40:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00"; } } //白班 中班 else { StartTime = SeverTime.ToShortDateString() + " 00:00:00"; EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00"; } switch (PlineCode) { case "C008": //250 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult250.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=RepMilAgainiFurResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C009": //258 break; case "C010": //168 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID; break; case "C012": //Arssel break; case "C017": //460 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), 4, 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), 4, 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), 4, 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), 4, 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=RepMilAgainiFurResult250.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=RepMilAgainiFurResult250.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 //晚班 break; case "C010": //168 strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult168.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 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 frmTechnological1_DoubleClickEvent(DataTable dt) { GridEditResult(dt); } /// /// 自动刷新 /// /// /// private 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 ultraGridMatSeq_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { e.Handled = true; UltraGridRow ugr = null; int Index = ultraGrid1.ActiveRow.Index; if (Index < ultraGrid1.Rows.Count - 1) { ugr = ultraGrid1.Rows[Index - 1]; // ugr = ultraGrid1.ActiveRow; } else { ugr = ultraGrid1.ActiveRow; } ultraGrid1.UpdateData(); ultraGrid1.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); } ChangeGridColor(); RackQuery(ActiveJUDGE_STOVE_NO); } } } }