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 com.steering.mes.zgmil.entity;
using Infragistics.Win.UltraWinGrid;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.ZGMil.Entity;
using Core.StlMes.Client.ZGMil.NodeResultQuery;
using System.Net;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using Core.StlMes.Client.ZGMil.Popup;
using Core.StlMes.Client.ZGMil.Common;
using CoreFS.SA06;
namespace Core.StlMes.Client.ZGMil.Result
{
public partial class FrmRollingRPipeResult : 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();
FeedSawResultEntity FeedSawResult = new FeedSawResultEntity();
MilRollingRackEntity RackRs = new MilRollingRackEntity();
MilRollingResultEntity ResultRs = new MilRollingResultEntity();
MilRollingHistoryEntity HistoryRs = new MilRollingHistoryEntity();
MilSlabScrapSeqEntity ScrapSeq = new MilSlabScrapSeqEntity();
string PlanStatusQuery = "39";
string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
MilRollingResultEntity temprollingresult = new MilRollingResultEntity();
private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号
private string ActiveStatus = null;//主计划活动行的状态
private string ActiveResultNo = null;//主计划实绩编号
private string ActiveLotNo = null;//主计划批号
private string _UpdateFlag = "0"; //调度日志确认标识
//private string PlineCode = null;//产线代码
string Shift = "";
string Group = "";
private string Departm = "";//部门
private string PlineCode = "";//产线
private string lotNo = null;//生产批号
private int _MouseLocX = 0; //鼠标横坐标
private int _MouseLocY = 0; //鼠标纵坐标
private string ChangeUserID = ""; //接班用户名
private string ChangePassWord = ""; //接班密码
private int ShowMessageFlag = 0; //保存弹窗标识 0 弹出 1 不弹出
private string _UserName = "";
private string _UserID = "";
private string _Url = "";
private int ChangeFlag = 0;
string proPlanId = "";
string gxPlanNo = "";
public Infragistics.Win.UltraWinGrid.UltraGrid Grid
{
get { return _grid; }
}
public FrmRollingRPipeResult()
{
InitializeComponent();
PanelSizeFlag = 0;
this.rollResult1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton);
this.rollResult_Arssel1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton);
//获取鼠标坐标
Point formPoint = this.PointToClient(Control.MousePosition);
_MouseLocX = Convert.ToInt32(formPoint.X);
_MouseLocY = Convert.ToInt32(formPoint.Y);
}
///
/// 定时器事件
///
///
///
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;
}
}
///
/// 交班取消
///
///
///
void UltraGrid2_ClickCellButton(object sender, CellEventArgs e)
{
string JudgeStoveNo = "";
string Status = "";
string ResultNo = "";
UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
if (ugr != null)
{
if (e.Cell.Column.Key == "CHANGENUMCANCEL")
{
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;
}
NativeMethodNew nass = new NativeMethodNew(this.ob);
nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 3);
//ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, Shift, Group);
RackQuery(JudgeStoveNo);
this.rollResult_Arssel1.UpdateData();
this.rollResult1.UpdateData();
PlanQuery();
}
}
}
///
/// 连轧回退
///
///
///
///
///
///
/// 加热炉/再加热炉最后一支入炉标识 0-未入炉 1-入炉 最后一支入炉时,交班取消不能取消入炉交班
/// 0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检
///
public int ChangeShiftBackRolling(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group)
{
int count = 0;
int process = 3;
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.findRollingRack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group}, this.ob);
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0 )
{
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group}, this.ob);
}
if (dt1.Rows.Count > 0)
{
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group }, this.ob);
}
return count;
}
///
/// 交班取消
///
private void ChangeCancel()
{
string JudgeStoveNo = "";
string Status = "";
string ResultNo = "";
UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
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;
}
foreach (UltraGridRow ug in ultraGrid1.Rows)
{
if (ug.Cells["CHANGE_FLAG"].Text == "待接班确认")
{
//NativeMethodNew nass = new NativeMethodNew(this.ob);
//nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 3);
ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, "", "");
}
}
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.doQueryRackGroup", new object[] { JudgeStoveNo, ResultNo }, ob);
if (ds.Rows.Count > 0)
{
if (ds.Rows[0]["COL_SHIFT"].ToString() == UserInfo.GetUserOrder() && ds.Rows[0]["COL_GROUP"].ToString() == UserInfo.GetUserGroup())
{
//NativeMethodNew nass = new NativeMethodNew(this.ob);
//nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 3);
ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, Shift, Group);
//更新连轧调度日志
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";
string Date = "";
if (Shift == "3")
{
Time = Time.Replace(":", "");
Date = SeverTime.AddDays(+1).ToString("yyyyMMdd");
}
else
{
Date = SeverTime.ToString("yyyyMMdd");
}
string ShiftA = this.UserInfo.GetUserOrder();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(0, 1);
string GroupA = this.UserInfo.GetUserGroup();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(1, 1);
if (_UpdateFlag == "0")
{
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeGroupCancelUpdateContralLog", new object[] { Shift, Group, ShiftA, GroupA, ActiveJUDGE_STOVE_NO, ActiveLotNo }, this.ob);
}
}
}
RackQuery(JudgeStoveNo);
this.rollResult_Arssel1.UpdateData();
this.rollResult1.UpdateData();
PlanQuery();
}
}
protected override void OnLoad(EventArgs e)
{
Shift = UserInfo.GetUserOrder();
Group = UserInfo.GetUserGroup();
base.OnLoad(e);
//屏蔽Grid筛选条件
chk.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollResult1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollResult_Arssel1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
{
ugc.SortIndicator = SortIndicator.Disabled;
}
timer1.Tick += new EventHandler(timer1_Tick);
//ChangeGridColor();
InitControl();
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);//获取 用户 对应的产线
if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
{
this.rollingCard1.ChangCard();
}
ultraTabControl1.Tabs[1].Visible = false;
//if (PlineCode == "C009")
switch (PlineCode)
{
case "C008":
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].Header.Appearance.ForeColor = Color.Gray;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].Header.Appearance.ForeColor = Color.Gray;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].CellActivation = Activation.NoEdit;
break;
case "C009":
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].Header.Appearance.ForeColor = Color.Gray;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["Roller7"].Header.Appearance.ForeColor = Color.Gray;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].Header.Appearance.ForeColor = Color.Gray;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["RollingForce"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLINGFORCE7"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLSPEED7"].CellActivation = Activation.NoEdit;
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLSPACE7"].CellActivation = Activation.NoEdit;
break;
case "C012":
ultraTabControl1.Tabs[0].Visible = false;
ultraTabControl1.Tabs[0].Visible = true;
break;
case "C072":
rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["startRollTemp"].Header.Caption = "入口温度(℃)";
break;
}
Sign();
frmTechnological1.InitMilSet(PlineCode, "40070", this.ob);
PlanQuery();
}
///
/// 签名
///
private void Sign()
{
ColUserName col = new ColUserName();
col.StationId = "3";
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;
}
}
#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 "NodeQuery":
NodeQuery();
break;
case "DoNodeBack":
NodeBack();
break;
case "DoStart":
DoStart();
break;
case "DoQueryBefore":
QueryBefore();
break;
case "DoStartBack":
StartBack();
break;
case "DoToolChange":
DoToolChange();
break;
case "DoSign":
Sign();
break;
case "DoPrint":
PrintResult();
break;
case "DoChangeCancel":
ChangeCancel();
break;
case "Close":
this.Dispose();
this.Close();
break;
}
}
///
/// 修改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 bool IsStart()
{
bool Start = true;
foreach (UltraGridRow ugr in ultraGridPlan.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() == "已开始连轧")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】正在连轧,不能两炉同时开始连轧", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Start = false;
}
}
return Start;
}
///
/// 查询主计划
///
private void PlanQuery()
{
string PrimaKey = "";
string SencodKey = "";
UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
if (ugr != null)
{
PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
if (ugr.HasParent())
{
SencodKey = ugr.Cells["FEED_ROW_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)
{
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();
QueryMainPlan.PlineCode = PlineCode;
QueryMainPlan.Status = PlanStatusQuery;
QueryMainPlan.StartStatus = PlanStartStatusQuery;
QueryMainPlan.ProPlanId = proPlanId;
QueryMainPlan.GxPlanNo = gxPlanNo;
//查询主表记录
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
if (dt.Rows.Count == 0)
{
if (ShowMessageFlag == 0)
{
MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
else
{
GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
//ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
ChangeCellName();
ChangeGridColor();
if (ugr != null)
{
foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
{
if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
{
ugr1.Activated = true;
}
}
}
}
}
///
/// 单击主计划
///
///
///
private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
{
tbRollDate.Clear();
if (dtPlan.Rows.Count > 0)
{
UltraGridRow ugr = ultraGridPlan.ActiveRow;
if (ugr != null)
{
string HeatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
ActiveJUDGE_STOVE_NO = HeatNo;
string Status = ugr.Cells["IS_START"].Value.ToString();
ActiveStatus = Status;
ActiveResultNo = ugr.Cells["ID"].Value.ToString();
ActiveLotNo = ugr.Cells["LOT_NO"].Value.ToString();
MainPlan.JudgeStoveNo = HeatNo;
PlineCode = ugr.Cells["Pline_Code"].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();
//查询该炉 该班次调度日志是否确认
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getControlStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveLotNo, Shift, Group, proPlanId, gxPlanNo }, this.ob);
if (dt1.Rows.Count > 0)
{
_UpdateFlag = dt1.Rows[0][0].ToString();
}
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
if (dtMP.Rows.Count > 0)
{
if (dtMP.Rows[0]["PLINE_CODE"].ToString() == "C012")
{
ultraTabControl1.Tabs[0].Visible = false;
ultraTabControl1.Tabs[1].Visible = true;
}
else
{
ultraTabControl1.Tabs[0].Visible = true;
ultraTabControl1.Tabs[1].Visible = false;
}
GridEdit(dtMP); //轧制计划信息
PlineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
resultQuery(HeatNo, PlineCode);//实绩查询
}
if (Status != "未开始连轧")
{
RackQuery(HeatNo);//查询跟踪记录信息
}
else
{
//tbRollDate.Rows.Clear();
}
GetRollingCard();
}
}
}
///
/// 双击开始连轧
///
///
///
private void DoStart()
{
ResultRs.Clear();
DataTable dt = new DataTable();
//if (this.UserInfo.GetUserOrder() == "0")
//{
// MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
if (ultraGridPlan.Rows.Count > 0)
{
//if (!IsStart())
//{
// return;
//}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();//判定炉号
ActiveJUDGE_STOVE_NO = HeatNo;
string Status = ugr.Cells["IS_START"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
NativeMethodNew Nvw = new NativeMethodNew(this.ob);
//if (!Nvw.isBegineNode(HeatNo, 2))
//{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】未穿孔,不能连轧。");
// return;
//}
ActiveStatus = Status;
if (Status == "已完成连轧")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许重新开始!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
PlineCode = ugr.Cells["Pline_Code"].Value.ToString();
if (ugr != null)
{
if (Status == "已开始连轧")
{
MessageBox.Show("连轧脱管正在进行,无法再次开始连轧!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
MainPlan.JudgeStoveNo = HeatNo;
MainPlan.ProPlanId = proPlanId;
MainPlan.GxPlanNo = gxPlanNo;
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
GridEdit(dtMP); //轧制计划信息
if (temprollingresult != null)
{
//1
ResultRs.VrsSpeed = temprollingresult.VrsSpeed;
ResultRs.InsertLength = temprollingresult.InsertLength;
ResultRs.Tubesize = temprollingresult.Tubesize;
ResultRs.Emspeed = temprollingresult.Emspeed;
ResultRs.LimitSpeed = temprollingresult.LimitSpeed;
ResultRs.Ext1RackSpeed = temprollingresult.Ext1RackSpeed;
ResultRs.RackSpace1 = temprollingresult.RackSpace1;
ResultRs.RackSpace2 = temprollingresult.RackSpace2;
ResultRs.RackSpace3 = temprollingresult.RackSpace3;
ResultRs.RackSpace4 = temprollingresult.RackSpace4;
ResultRs.RackSpace5 = temprollingresult.RackSpace5;
ResultRs.RackSpace6 = temprollingresult.RackSpace6;
ResultRs.RackSpace7 = temprollingresult.RackSpace7;
ResultRs.RackSpeed1 = temprollingresult.RackSpeed1;
ResultRs.RackSpeed2 = temprollingresult.RackSpeed2;
ResultRs.RackSpeed3 = temprollingresult.RackSpeed3;
ResultRs.RackSpeed4 = temprollingresult.RackSpeed4;
ResultRs.RackSpeed5 = temprollingresult.RackSpeed5;
ResultRs.RackSpeed6 = temprollingresult.RackSpeed6;
ResultRs.RackSpeed7 = temprollingresult.RackSpeed7;
ResultRs.RollingForce1 = temprollingresult.RollingForce1;
ResultRs.RollingForce2 = temprollingresult.RollingForce2;
ResultRs.RollingForce3 = temprollingresult.RollingForce3;
ResultRs.RollingForce4 = temprollingresult.RollingForce4;
ResultRs.RollingForce5 = temprollingresult.RollingForce5;
ResultRs.RollingForce6 = temprollingresult.RollingForce6;
ResultRs.RollingForce7 = temprollingresult.RollingForce7;
ResultRs.StartRollTemp = temprollingresult.StartRollTemp;
//阿塞尔线
ResultRs.Tubesize = temprollingresult.Tubesize;
ResultRs.QoRollerThroatDiameter = temprollingresult.QoRollerThroatDiameter;
ResultRs.QcRollerThroatDiameter = temprollingresult.QcRollerThroatDiameter;
ResultRs.RollingThroatDiameter = temprollingresult.RollingThroatDiameter;
ResultRs.RollerBiteSpeed = temprollingresult.RollerBiteSpeed;//咬入
ResultRs.Rollangle = temprollingresult.Rollangle;//轧辊角
ResultRs.FeedAngle = temprollingresult.FeedAngle;//喂入角
ResultRs.RollingSpeed = temprollingresult.RollingSpeed;//轧制速度
}
string stoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();//熔炼炉号
string lotNo = dtMP.Rows[0]["LOT_NO"].ToString();//生产批号
string factoryId = dtMP.Rows[0]["PLINE_CODE"].ToString();//产线
ResultRs.JudgeStoveNo = HeatNo;
ResultRs.ResultNo = ResultNo;
ResultRs.StoveNo = stoveNo;
ResultRs.LotNo = lotNo;
ResultRs.PlineCode = factoryId;
ResultRs.ColUser = this.UserInfo.GetUserName();
ResultRs.ColShift = this.UserInfo.GetUserOrder();
ResultRs.ColGroup = this.UserInfo.GetUserGroup();
ResultRs.ProPlanId = proPlanId;
ResultRs.GxPlanNo = gxPlanNo;
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + HeatNo + "】开始连轧?") == DialogResult.No)
//{
// return;
//}
//修改主计划状态、新增连轧实绩
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FrmRollingRPipeResult";
ccp.MethodName = "insertResultForMainPlan";
ccp.ServerParams = new object[] { ResultRs };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnInfo == "开始成功!")
{
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
//int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertResultForMainPlan", new object[] { ResultRs }, this.ob);
//新增连轧调度日志
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertContralLog", new object[] { HeatNo, lotNo, Shift, Group, _UserID, _UserName, "0", proPlanId, gxPlanNo }, this.ob);
//往跟踪记录表插入连轧开始时间
NativeMethodNew na = new NativeMethodNew(this.ob);
na.InsertSTAferDoubleClick(HeatNo, 3, "0", proPlanId, gxPlanNo);
//resultQuery();
//刷新主表
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true);
//ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
ChangeCellName();
ChangeGridColor();
foreach (UltraGridRow ugr1 in this.ultraGridPlan.Rows)
{
if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
{
ultraGridPlan.ActiveRow = ugr1;
}
}
}
}
}
///
/// 保存
///
private void FeedRowSave()
{
ResultRs.Clear();
int count = 0;
string flag = "";
try
{
rollResult1.UltraGrid2.UpdateData();
rollResult_Arssel1.UltraGrid2.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
UltraGridRow ugrg = this.rollResult1.UltraGrid2.Rows[0];
UltraGridRow uRow = this.rollResult_Arssel1.UltraGrid2.Rows[0];
string factoryId = null;
//string heatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
if (this.ultraGridPlan.ActiveRow == null && ActiveJUDGE_STOVE_NO == null)
{
MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (this.ultraGridPlan.ActiveRow == null)
{
factoryId = PlineCode;
ResultRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
}
else
{
ResultRs.JudgeStoveNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
factoryId = this.ultraGridPlan.ActiveRow.Cells["Pline_Code"].Value.ToString();
}
if (ActiveStatus == "未开始连轧")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(ResultRs.JudgeStoveNo.ToString()) + "】未开始进行连轧,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//if (ActiveStatus == "已完成连轧")
//{
// MessageBox.Show("炉号:【" + ResultRs.JudgeStoveNo + "】已完成连轧,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + ResultRs.JudgeStoveNo.ToString().Substring(0, 6) + "】保存实绩?") == DialogResult.No)
//{
// return;
//}
if (factoryId != "C012")//其他线
{
//this.rollResult1.UltraGrid2.Update();
this.rollResult1.UltraGrid2.UpdateData();
MilRollingResultEntity rr = new MilRollingResultEntity();
this.rollResult_Arssel1.Value = rr;
flag = "0";
if (string.IsNullOrEmpty(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim()))
{
ResultRs.ScrapNum = 0;
if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
{
ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
}
else
{
ResultRs.QualifiedNum = 0;
}
}
else
{
ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
{
ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
}
}
ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
//ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
ResultRs.Changeclassnum = ugrg.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
ResultRs.Remark = ugrg.Cells["Remark1"].Value.ToString().Trim();
ResultRs.VrsSpeed = ugrg.Cells["VXSSPEED"].Value.ToString().Trim();
ResultRs.Tubesize = ugrg.Cells["SIZE"].Text.ToString().Trim();
ResultRs.InsertLength = ugrg.Cells["INSERTLENGTH"].Value.ToString().Trim();
ResultRs.Emspeed = ugrg.Cells["EMSPEED"].Value.ToString().Trim();
ResultRs.LimitSpeed = ugrg.Cells["SPEEDLIMIT"].Value.ToString().Trim();
ResultRs.Ext1RackSpeed = ugrg.Cells["EXT1SPEED"].Value.ToString().Trim();
ResultRs.RackSpeed1 = ugrg.Cells["ROLLSPEED1"].Value.ToString().Trim();
ResultRs.RackSpeed2 = ugrg.Cells["ROLLSPEED2"].Value.ToString().Trim();
ResultRs.RackSpeed3 = ugrg.Cells["ROLLSPEED3"].Value.ToString().Trim();
ResultRs.RackSpeed4 = ugrg.Cells["ROLLSPEED4"].Value.ToString().Trim();
ResultRs.RackSpeed5 = ugrg.Cells["ROLLSPEED5"].Value.ToString().Trim();
ResultRs.RackSpeed6 = ugrg.Cells["ROLLSPEED6"].Value.ToString().Trim();
ResultRs.RackSpeed7 = ugrg.Cells["ROLLSPEED7"].Value.ToString().Trim();
ResultRs.RackSpace1 = ugrg.Cells["ROLLSPACE1"].Value.ToString().Trim();
ResultRs.RackSpace2 = ugrg.Cells["ROLLSPACE2"].Value.ToString().Trim();
ResultRs.RackSpace3 = ugrg.Cells["ROLLSPACE3"].Value.ToString().Trim();
ResultRs.RackSpace4 = ugrg.Cells["ROLLSPACE4"].Value.ToString().Trim();
ResultRs.RackSpace5 = ugrg.Cells["ROLLSPACE5"].Value.ToString().Trim();
ResultRs.RackSpace6 = ugrg.Cells["ROLLSPACE6"].Value.ToString().Trim();
ResultRs.RackSpace7 = ugrg.Cells["ROLLSPACE7"].Value.ToString().Trim();
ResultRs.RollingForce1 = ugrg.Cells["ROLLINGFORCE1"].Value.ToString().Trim();
ResultRs.RollingForce2 = ugrg.Cells["ROLLINGFORCE2"].Value.ToString().Trim();
ResultRs.RollingForce3 = ugrg.Cells["ROLLINGFORCE3"].Value.ToString().Trim();
ResultRs.RollingForce4 = ugrg.Cells["ROLLINGFORCE4"].Value.ToString().Trim();
ResultRs.RollingForce5 = ugrg.Cells["ROLLINGFORCE5"].Value.ToString().Trim();
ResultRs.RollingForce6 = ugrg.Cells["ROLLINGFORCE6"].Value.ToString().Trim();
ResultRs.RollingForce7 = ugrg.Cells["ROLLINGFORCE7"].Value.ToString().Trim();
ResultRs.StartTime = ugrg.Cells["StartTime"].Value.ToString().Trim();
ResultRs.EndTime = ugrg.Cells["EndTime"].Value.ToString().Trim();//--
ResultRs.StartRollTemp = ugrg.Cells["startRollTemp"].Value.ToString().Trim();
ResultRs.ColUser = this.UserInfo.GetUserName();
ResultRs.ColShift = this.UserInfo.GetUserOrder();
ResultRs.ColGroup = this.UserInfo.GetUserGroup();
ResultRs.ProPlanId = proPlanId;
ResultRs.GxPlanNo = gxPlanNo;
//ResultRs.JudgeStoveNo = heatNo;
ResultRs.PlineCode = flag;
if (ResultRs.Changeclassnum.ToString() == "")
{
ResultRs.Changeclassnum = "0";
}
//if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
//{
// MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
if (string.IsNullOrEmpty(ResultRs.StartTime.ToString()))
{
MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
return;
}
//查询结炉状态,已结炉的计划 结炉时间不能为空
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob);
if (int.Parse(dt.Rows[0][0].ToString()) > 39)
{
if (string.IsNullOrEmpty(ResultRs.EndTime.ToString()))
{
MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
return;
}
//开始时间必须小于结束时间
if (DateTime.Parse(ResultRs.StartTime.ToString()) > DateTime.Parse(ResultRs.EndTime.ToString()))
{
MessageBox.Show("结束时间不能小于开始时间。");
return;
}
}
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultSave", new object[] { ResultRs, _UpdateFlag }, this.ob);
this.rollResult_Arssel1.IsCellSelect = false;
this.rollResult1.IsCellSelect = false;
if (count > 0)
{
if (ShowMessageFlag == 0)
{
MessageBox.Show("连轧实绩保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}
else//阿塞尔线
{
ResultRs.Clear();
this.rollResult_Arssel1.UltraGrid2.Update();
MilRollingResultEntity rr = new MilRollingResultEntity();
this.rollResult1.Value = rr;
flag = "1";
if (string.IsNullOrEmpty(uRow.Cells["SCRAPNUM"].Text.ToString().Trim()))
{
ResultRs.ScrapNum = 0;
if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
{
ResultRs.QualifiedNum = "0";
}
else
{
ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
}
}
else
{
ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Text.ToString().Trim();
if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
{
//MessageBox.Show("轧制支数为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
}
}
ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
//ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Value.ToString().Trim();
ResultRs.Changeclassnum = uRow.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
ResultRs.Remark = uRow.Cells["REMARK"].Value.ToString().Trim();
ResultRs.Tubesize = uRow.Cells["TUBESIZE"].Text.ToString().Trim();
ResultRs.QoRollerThroatDiameter = uRow.Cells["QUICKOPEN"].Value.ToString().Trim();
ResultRs.QcRollerThroatDiameter = uRow.Cells["QUICKCLOSE"].Value.ToString().Trim();
ResultRs.RollingThroatDiameter = uRow.Cells["ROLLING"].Value.ToString().Trim();
ResultRs.RollerBiteSpeed = uRow.Cells["BITE"].Value.ToString().Trim();
ResultRs.RollingAngle = uRow.Cells["ROLLTAPER"].Text.ToString().Trim();
ResultRs.FeedAngle = uRow.Cells["FEEDANGLE"].Value.ToString().Trim();
ResultRs.RollingSpeed = uRow.Cells["ROLLINGSPEED"].Value.ToString().Trim();
ResultRs.StartTime = uRow.Cells["START_TIME"].Value.ToString().Trim();
ResultRs.EndTime = uRow.Cells["END_TIME"].Value.ToString().Trim();
ResultRs.StartRollTemp = uRow.Cells["startRollTemp"].Value.ToString().Trim();
ResultRs.ColUser = this.UserInfo.GetUserName();
ResultRs.ColShift = this.UserInfo.GetUserOrder();
ResultRs.ColGroup = this.UserInfo.GetUserGroup();
ResultRs.ProPlanId = proPlanId;
ResultRs.GxPlanNo = gxPlanNo;
//ResultRs.JudgeStoveNo = heatNo;
ResultRs.PlineCode = flag;
if (ResultRs.Changeclassnum.ToString() == "")
{
ResultRs.Changeclassnum = "0";
}
//if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
//{
// MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
if (string.IsNullOrEmpty(ResultRs.StartTime.ToString()))
{
MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
return;
}
//查询结炉状态,已结炉的计划 结炉时间不能为空
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob);
if (int.Parse(dt.Rows[0][0].ToString()) > 39)
{
if (string.IsNullOrEmpty(ResultRs.EndTime.ToString()))
{
MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
return;
}
//开始时间必须小于结束时间
if (DateTime.Parse(ResultRs.StartTime.ToString()) > DateTime.Parse(ResultRs.EndTime.ToString()))
{
MessageBox.Show("结束时间不能小于开始时间。");
return;
}
}
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultSave", new object[] { ResultRs, _UpdateFlag }, this.ob);
this.rollResult_Arssel1.IsCellSelect = false;
this.rollResult1.IsCellSelect = false;
if (count > 0)
{
if (ShowMessageFlag == 0)
{
MessageBox.Show("连轧实绩保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}
// resultQuery();
temprollingresult = NativeMethod.GetEntityToEntity(temprollingresult, ResultRs);
// RackQuery(ActiveJUDGE_STOVE_NO);
ChangeGridColor();
PlanQuery();
}
///
/// 结炉
///
private void FeedSawResultNode()
{
FeedRowSave();
//if (this.UserInfo.GetUserOrder() == "0")
//{
// MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
try
{
rollResult1.UltraGrid2.UpdateData();
rollResult_Arssel1.UltraGrid2.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
HOTMethod hm = new HOTMethod(this.ob);
int count = 0;
string seq = "";
UltraGridRow ugrg = this.rollResult1.UltraGrid2.Rows[0];
UltraGridRow uRow = this.rollResult_Arssel1.UltraGrid2.Rows[0];
//判断是否有重复剔除的坯子
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;
}
}
string factoryId = null;
string flag = "0";
if (this.ultraGridPlan.ActiveRow == null)
{
MessageBox.Show("未选择任何炉号,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string heatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
string ResultNo = this.ultraGridPlan.ActiveRow.Cells["ID"].Text.ToString().Trim();
string LotNo = this.ultraGridPlan.ActiveRow.Cells["LOT_NO"].Text.ToString().Trim();
string proPlanId = this.ultraGridPlan.ActiveRow.Cells["PRO_PLAN_ID"].Value.ToString();
string gxPlanNo = this.ultraGridPlan.ActiveRow.Cells["GX_PLAN_NO"].Value.ToString();
//if (ultraGridPlan.ActiveRow != ultraGridPlan.Rows[0])
//{ MessageUtil.ShowTips("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】之前有未结的炉号,请按顺序结炉!"); return; }
ResultRs.Clear();
ResultRs.JudgeStoveNo = heatNo;
string Status = ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString();
if (Status == "已完成连轧")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已完成连轧,不允许结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
factoryId = this.ultraGridPlan.ActiveRow.Cells["Pline_Code"].Value.ToString();
if (Status != "已开始连轧")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】未开始连轧,不允许结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (hm.NodeGetWaitChangeMat(heatNo, ResultNo, 3) > 0)
{
MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(heatNo, ResultNo, 3) + "】未接班确认,不能结炉");
return;
}
if (factoryId != "C012")//其他线
{
//this.rollResult1.UltraGrid2.Update();
this.rollResult1.UltraGrid2.UpdateData();
MilRollingResultEntity rr = new MilRollingResultEntity();
this.rollResult_Arssel1.Value = rr;
flag = "0";
//剔除支数
ResultRs.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
ResultRs.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
//if (ugrg.Cells["SCRAPNUM"].Text.ToString().Trim() == "")
//{
// ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
//}
//else
//{
// if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString()))
// {
// if (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) > int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim()))
// {
// ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
// }
// else
// {
// // MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// // return;
// }
// }
// else
// {
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
//}
//合格支数
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(ResultRs.ScrapNum.ToString()))
{
//合格支数
ResultRs.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
ResultRs.QualifiedNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
}
else
{
ResultRs.Rollingnum = 0;
ResultRs.QualifiedNum = 0;
}
}
else
{
ResultRs.Rollingnum = 0;
ResultRs.QualifiedNum = 0;
}
}
//ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
//ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
ResultRs.Changeclassnum = ugrg.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
ResultRs.Remark = ugrg.Cells["Remark1"].Value.ToString().Trim();
ResultRs.VrsSpeed = ugrg.Cells["VXSSPEED"].Value.ToString().Trim();
ResultRs.Tubesize = ugrg.Cells["SIZE"].Text.ToString().Trim();
ResultRs.InsertLength = ugrg.Cells["INSERTLENGTH"].Value.ToString().Trim();
ResultRs.Emspeed = ugrg.Cells["EMSPEED"].Value.ToString().Trim();
ResultRs.LimitSpeed = ugrg.Cells["SPEEDLIMIT"].Value.ToString().Trim();
ResultRs.Ext1RackSpeed = ugrg.Cells["EXT1SPEED"].Value.ToString().Trim();
ResultRs.RackSpeed1 = ugrg.Cells["ROLLSPEED1"].Value.ToString().Trim();
ResultRs.RackSpeed2 = ugrg.Cells["ROLLSPEED2"].Value.ToString().Trim();
ResultRs.RackSpeed3 = ugrg.Cells["ROLLSPEED3"].Value.ToString().Trim();
ResultRs.RackSpeed4 = ugrg.Cells["ROLLSPEED4"].Value.ToString().Trim();
ResultRs.RackSpeed5 = ugrg.Cells["ROLLSPEED5"].Value.ToString().Trim();
ResultRs.RackSpeed6 = ugrg.Cells["ROLLSPEED6"].Value.ToString().Trim();
ResultRs.RackSpeed7 = ugrg.Cells["ROLLSPEED7"].Value.ToString().Trim();
ResultRs.RackSpace1 = ugrg.Cells["ROLLSPACE1"].Value.ToString().Trim();
ResultRs.RackSpace2 = ugrg.Cells["ROLLSPACE2"].Value.ToString().Trim();
ResultRs.RackSpace3 = ugrg.Cells["ROLLSPACE3"].Value.ToString().Trim();
ResultRs.RackSpace4 = ugrg.Cells["ROLLSPACE4"].Value.ToString().Trim();
ResultRs.RackSpace5 = ugrg.Cells["ROLLSPACE5"].Value.ToString().Trim();
ResultRs.RackSpace6 = ugrg.Cells["ROLLSPACE6"].Value.ToString().Trim();
ResultRs.RackSpace7 = ugrg.Cells["ROLLSPACE7"].Value.ToString().Trim();
ResultRs.RollingForce1 = ugrg.Cells["ROLLINGFORCE1"].Value.ToString().Trim();
ResultRs.RollingForce2 = ugrg.Cells["ROLLINGFORCE2"].Value.ToString().Trim();
ResultRs.RollingForce3 = ugrg.Cells["ROLLINGFORCE3"].Value.ToString().Trim();
ResultRs.RollingForce4 = ugrg.Cells["ROLLINGFORCE4"].Value.ToString().Trim();
ResultRs.RollingForce5 = ugrg.Cells["ROLLINGFORCE5"].Value.ToString().Trim();
ResultRs.RollingForce6 = ugrg.Cells["ROLLINGFORCE6"].Value.ToString().Trim();
ResultRs.RollingForce7 = ugrg.Cells["ROLLINGFORCE7"].Value.ToString().Trim();
ResultRs.StartTime = ugrg.Cells["StartTime"].Value.ToString().Trim();
ResultRs.StartRollTemp = ugrg.Cells["startRollTemp"].Value.ToString().Trim();
ResultRs.ColUser = _UserName;
ResultRs.UserId = _UserID;
ResultRs.ProPlanId = proPlanId;
ResultRs.GxPlanNo = gxPlanNo;
ResultRs.ColShift = this.UserInfo.GetUserOrder();
ResultRs.ColGroup = this.UserInfo.GetUserGroup();
//ResultRs.JudgeStoveNo = heatNo;
ResultRs.PlineCode = flag;
if (ResultRs.Changeclassnum.ToString() == "")
{
ResultRs.Changeclassnum = "0";
}
}
else//阿塞尔线
{
ResultRs.Clear();
this.rollResult_Arssel1.UltraGrid2.Update();
MilRollingResultEntity rr = new MilRollingResultEntity();
this.rollResult1.Value = rr;
flag = "1";
//剔除支数
ResultRs.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
ResultRs.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
//else
//{
// if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
// {
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
// else
// {
// if (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) > int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim()))
// {
// ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
// }
// else
// {
// MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
// }
//}
//ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
//合格支数
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(ResultRs.ScrapNum.ToString()))
{
//合格支数
ResultRs.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
ResultRs.QualifiedNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
}
else
{
ResultRs.Rollingnum = 0;
ResultRs.QualifiedNum = 0;
}
}
else
{
ResultRs.Rollingnum = 0;
ResultRs.QualifiedNum = 0;
}
}
// ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Value.ToString().Trim();
ResultRs.Changeclassnum = uRow.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
ResultRs.Remark = uRow.Cells["REMARK"].Value.ToString().Trim();
ResultRs.Tubesize = uRow.Cells["TUBESIZE"].Text.ToString().Trim();
ResultRs.QoRollerThroatDiameter = uRow.Cells["QUICKOPEN"].Value.ToString().Trim();
ResultRs.QcRollerThroatDiameter = uRow.Cells["QUICKCLOSE"].Value.ToString().Trim();
ResultRs.RollingThroatDiameter = uRow.Cells["ROLLING"].Value.ToString().Trim();
ResultRs.RollerBiteSpeed = uRow.Cells["BITE"].Value.ToString().Trim();
ResultRs.RollingAngle = uRow.Cells["ROLLTAPER"].Text.ToString().Trim();
ResultRs.FeedAngle = uRow.Cells["FEEDANGLE"].Value.ToString().Trim();
ResultRs.RollingSpeed = uRow.Cells["ROLLINGSPEED"].Value.ToString().Trim();
ResultRs.StartTime = uRow.Cells["START_TIME"].Value.ToString().Trim();
ResultRs.StartRollTemp = uRow.Cells["startRollTemp"].Value.ToString().Trim();
ResultRs.ColUser = _UserName;
ResultRs.UserId = _UserID;
ResultRs.ProPlanId = proPlanId;
ResultRs.GxPlanNo = gxPlanNo;
ResultRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
ResultRs.LotNo = lotNo;
ResultRs.PlineCode = PlineCode;
ResultRs.ColShift = this.UserInfo.GetUserOrder();
ResultRs.ColGroup = this.UserInfo.GetUserGroup();
//ResultRs.JudgeStoveNo = heatNo;
ResultRs.PlineCode = flag;
if (ResultRs.Changeclassnum.ToString() == "")
{
ResultRs.Changeclassnum = "0";
}
//if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
//{
// MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
}
double DBHeight = 0;
double BurnningRate = 0;
double DBNum = 1;
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());
}
}
string QANum = "0";
if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
{
QANum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
}
ResultRs.QaTon = DBHeight * (1 - (BurnningRate / 100)) * double.Parse(QANum.ToString());
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.perForationResultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() == "1")
{
if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉?") == DialogResult.No)
{
return;
}
if (count == 0)
{
//写进程表
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
ccp.MethodName = "updateMilSlab";
ccp.ServerParams = new object[] { heatNo, "4", 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, "4", "4", proPlanId, gxPlanNo, lotNo, PlineCode };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
#region 修改连轧调度日志
//查询有效最大管序号
int MaxSeq = 0;
DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getMaxSeq", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (dtSeq.Rows.Count > 0)
{
MaxSeq = int.Parse(dtSeq.Rows[0][0].ToString());
}
//查询上个班交班支数
int BeforeChangeNum = 0;
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, 3, 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());
}
}
MilControlLogEntity ControlLogEntity = new MilControlLogEntity();
//查询本班合格支数
string[] Temp = GetDbHeightBruningRate(heatNo, ResultNo, BeforeChangeNum+1, MaxSeq).Split('-');
string QaTon = Temp[0];
string ScrapTon = Temp[1];
string ScrapNum1 = Temp[2];
ControlLogEntity.QualifiedNum = (MaxSeq - BeforeChangeNum - int.Parse(ScrapNum1.ToString3())).ToString3();
ControlLogEntity.ScrapNum = ScrapNum1.ToString3();
ControlLogEntity.QualifiedWt = QaTon.ToString3();
ControlLogEntity.ScrapWt = ScrapTon.ToString3();
ControlLogEntity.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
ControlLogEntity.LotNo = ActiveLotNo;
ControlLogEntity.UserId = _UserID;
ControlLogEntity.UserName = _UserName;
ControlLogEntity.ProPlanId = proPlanId;
ControlLogEntity.GxPlanNo = gxPlanNo;
ControlLogEntity.ProBc = Shift;
ControlLogEntity.ProBz = Group;
ControlLogEntity.NodeFlag = "1";
if (int.Parse(ControlLogEntity.QualifiedNum) < 1)
{
if (MessageUtil.ShowYesNoAndQuestion("合格支数为" +ControlLogEntity.QualifiedNum+"支,是否确认继续结炉?") == DialogResult.No)
{
return;
}
}
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
ControlLogEntity.ProcDate = SeverTime.ToString("yyyyMMdd");
ControlLogEntity.BalYearMonth = SeverTime.ToString("yyyyMM");
string a = SeverTime.ToShortTimeString();
string Time = SeverTime.ToLongTimeString();
Time = Time.Replace(":", "");
if (int.Parse(Time) > 120000 && int.Parse(Time) < 240000 && Shift == "3")
{
ControlLogEntity.ProcDate = SeverTime.AddDays(1).ToString("yyyyMMdd");
ControlLogEntity.BalYearMonth = SeverTime.AddDays(5).ToString("yyyyMM");
}
//if (_UpdateFlag == "0")
//{
if (BeforeChangeNum == 0)
{
ControlLogEntity.ChangeShiftFlag = "0";
//int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeShiftGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
}
else
{
ControlLogEntity.ChangeShiftFlag = "2";
//int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeShiftGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
}
//}
#endregion
ResultRs.LotNo = lotNo;
ResultRs.PlineCode = PlineCode;
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.endStoveForMainPlan", new object[] { ResultRs, ControlLogEntity }, this.ob);
//
NativeMethodNew na = new NativeMethodNew(this.ob);
// na.InsertSTAferDoubleClick(heatNo, 3, "1", proPlanId, gxPlanNo);
NativeMethod.CheckNodeMatStatus(heatNo, proPlanId, gxPlanNo, 3, this.ob);
if (count > 0)
{
if (PlineCode.Equals("C008") || PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
{
//插入MIL_SLAB_SCRAP表
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 4, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 5, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
}
else
{
//插入MIL_SLAB_SCRAP表
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 4, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
}
if (count > 0)
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
this.rollResult_Arssel1.IsCellSelect = false;
this.rollResult1.IsCellSelect = false;
temprollingresult = NativeMethod.GetEntityToEntity(temprollingresult, ResultRs);
//刷新主表
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true);
//ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
ChangeCellName();
ChangeGridColor();
RackQuery(heatNo);
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;
}
}
}
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
///
/// 开始回退
///
private void StartBack()
{
if (ultraGridPlan.Rows.Count > 0)
{
if (this.ultraGridPlan.ActiveRow == null)
{
MessageBox.Show("请选择需要回退的炉号!!!");
return;
}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
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 (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
//{
// if (nvw.isBegineNode(JudgeStoveNo, 5))
// {
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始定径,不能开始回退!!!!");
// return;
// }
//}
//else
//{
// if (nvw.isBegineNode(JudgeStoveNo, 4))
// {
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已入再加热炉,不能开始回退!!!!");
// return;
// }
//}
if (_UpdateFlag == "0")
{
// 0- 开始回退 1-结炉回退
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.DeleteControlLog", new object[] { JudgeStoveNo, ActiveLotNo, 0, proPlanId, gxPlanNo }, this.ob);
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
RackQuery(JudgeStoveNo);
ChangeGridColor();
PlanQuery();
}
}
///
/// 结炉回退
///
private void NodeBack()
{
if (this.ultraGridPlan.ActiveRow == null)
{
MessageBox.Show("请选择需要回退的炉号!!!");
return;
}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string NodeFlag = ugr.Cells["IS_START"].Value.ToString();
string LotNo = ugr.Cells["LOT_NO"].Value.ToString();
if (NodeFlag != "已完成连轧")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!");
return;
}
string SHIFTf = this.UserInfo.GetUserOrder();
string GROUPf = this.UserInfo.GetUserGroup();
DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getControlStatus", new object[] { JudgeStoveNo, LotNo, SHIFTf, GROUPf, proPlanId, gxPlanNo }, this.ob);
_UpdateFlag = "0";
if (dtFlag.Rows.Count > 0)
{
_UpdateFlag = dtFlag.Rows[0][0].ToString();
}
if (_UpdateFlag == "1")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】在调度室已确认,不能结炉回退!!!!");
return;
}
//查询结炉班次班组
DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 3, 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;
}
}
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 != "40")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退");
return;
}
}
//判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退
//查询当前炉次是否有交班点
int Seq = 0;
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 3, proPlanId, gxPlanNo }, this.ob);
if (dt1.Rows.Count > 0)
{
Seq = int.Parse(dt1.Rows[dt1.Rows.Count - 1][0].ToString());
}
if (_UpdateFlag == "0")
{
// 0- 开始回退 1-结炉回退
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.DeleteControlLog", new object[] { JudgeStoveNo, ActiveLotNo, 1, proPlanId, gxPlanNo }, this.ob);
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, Seq, 0, 4, proPlanId, gxPlanNo, lotNo }, this.ob);
RackQuery(JudgeStoveNo);
ChangeGridColor();
PlanQuery();
}
///
/// 毛管剔除
///
///
///
private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
{
//if (this.UserInfo.GetUserOrder() == "0")
//{
// MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
RackRs.Clear();
UltraGridRow ugr_pian = ultraGridPlan.ActiveRow;
string HeatNo = ugr_pian.Cells["JUDGE_STOVE_NO"].Value.ToString();
UltraGridRow ugr_testingrack = ultraGrid1.ActiveRow;
HOTMethod hm = new HOTMethod(this.ob);
DataTable dt = new DataTable();
int scrapNum = 0;
int count = 0;
string ResultNo = ugr_pian.Cells["ID"].Value.ToString();
string heatNo = this.ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
string seq = this.ultraGrid1.ActiveRow.Cells["SEQ"].Text.ToString().Trim();
string PlanStatuss = ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString();
string MAT_NO = ugr_testingrack.Cells["MAT_NO"].Value.ToString();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
ccp.MethodName = "scrapMatCheck";
ccp.ServerParams = new Object[] { ugr_pian.Cells["JUDGE_STOVE_NO"].Value.ToString(), 4, proPlanId, gxPlanNo };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
string shif = ugr_testingrack.Cells["COL_SHIFT"].Value.ToString();
string group = ugr_testingrack.Cells["COL_GROUP"].Value.ToString();
//string shifSeq = ""; //待交班的班次
//string groupSeq = ""; //待交班的班组
//NativeMethodNew nasssss = new NativeMethodNew(this.ob);
//if (nasssss.IsRackOperateRolling(shif, group))
//{
// MessageBox.Show("序号:【" + seq + "】子管已由" + shif + "," + group + "操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
if (PlanStatuss == "已完成连轧")
{
if (e.Cell.Column.Key == "CHANGE_NUM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else if (e.Cell.Column.Key == "BTNCHANGECOM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不能剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
if (e.Cell.Column.Key == "DELETE")
{
if (ultraGrid1.ActiveRow.Cells["STATUS"].Value.ToString() == "剔除")
{
MessageBox.Show("该毛管已被剔除不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
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)
//{
// MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,请先从正常管开始剔除。");
// 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;
//}
if (ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString() != "已开始连轧")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】的毛管未开始连轧,请检查确认后再剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//查询前几道工序累计剔除多少半成品管(管坯等进行换算)
if (ultraGrid1.Rows.Count - ScrapNumBefore < int.Parse(ugr_testingrack.Cells["SEQ"].Value.ToString()))
{
MessageBox.Show("不存在序号为【" + ugr_testingrack.Cells["SEQ"].Value.ToString() + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//if (ugr_testingrack.Cells["MAT_NO"].Text == "")
//{
// MessageBox.Show("不存在序号为【" + ugr_testingrack.Cells["SEQ"].Value.ToString() + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", 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;
}
}
// 有班次交班了,其它班次不能操作。
foreach (UltraGridRow ugd in ultraGrid1.Rows)
{
if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
{
string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
NativeMethodNew nasssss = new NativeMethodNew(this.ob);
if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
{
MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
ResultRs.JudgeStoveNo = heatNo;
dt.Clear();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.scrapNumQuery", new object[] { ResultRs }, this.ob);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["SCRAP_NUM"].ToString() == "")
{
scrapNum = 0;
}
else
{
scrapNum = int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString());
}
}
//if (MessageUtil.ShowYesNoAndQuestion("是否剔除该毛管") == DialogResult.No)
//{
// return;
//}
RackRs.ScrapNum = (scrapNum + 1).ToString();
RackRs.ColUser = UserInfo.GetUserName();
RackRs.ColGroup = UserInfo.GetUserGroup();
RackRs.ColShift = UserInfo.GetUserOrder();
RackRs.Status = "1";
RackRs.JudgeStoveNo = heatNo;
RackRs.Seq = seq;
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.rackDelete", new object[] { RackRs }, this.ob);
if (count > 0)
{
//新增管列序号表
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.FrmRollingRPipeResult.insertScrapSlabSeq", new object[] { ScrapSeq }, this.ob);
}
}
if (e.Cell.Column.Key == "DELBACK")
{
//if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
//{
// return;
//}
if (!ultraGrid1.ActiveRow.Cells["STATUS"].Value.ToString().Equals("剔除"))
{
MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
// 有班次交班了,其它班次不能操作。
foreach (UltraGridRow ugd in ultraGrid1.Rows)
{
if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
{
string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
NativeMethodNew nasssss = new NativeMethodNew(this.ob);
if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
{
MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
NativeMethodNew na = new NativeMethodNew(this.ob);
int counts = na.DeleteSlabSeq(HeatNo, seq.ToString(), 4, 1, 0, proPlanId, gxPlanNo);
if (counts > 0)
{
// MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
RackQuery(HeatNo);
foreach (UltraGridRow ugr_1 in ultraGrid1.Rows)
{
if (ugr_1.Cells["SEQ"].Value.ToString() == seq)
{
ultraGrid1.ActiveRow = ugr_1;
}
}
}
else
{
MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
//交班
if (e.Cell.Column.Key == "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[] { HeatNo, ResultNo, 3, 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());
}
}
int Seq2 = int.Parse(seq);
if (Seq2 <= BeforeChangeNum)
{
MessageBox.Show("前道班次已交班,该支不能再次交班。");
return;
}
if (Seq2 > ultraGrid1.Rows.Count - ScrapNumBefore)
{
MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
return;
}
if (ultraGrid1.Rows.Count == Seq2)
{
MessageBox.Show("该支是本炉最后一支,请结炉!");
return;
}
// 有班次交班了,其它班次不能操作。
foreach (UltraGridRow ugd in ultraGrid1.Rows)
{
if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
{
string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
NativeMethodNew nasssss = new NativeMethodNew(this.ob);
if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
{
MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
//int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 4, 0 }, this.ob);
// ChangeFlag = 1;
hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 3, int.Parse(seq), 0);
ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.doSetShiftGroup", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq2, BeforeChangeNum, PlineCode, Shift, Group, User }, this.ob);
}
//接班确认
if (e.Cell.Column.Key == "BTNCHANGECOM")
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
int BeforeChangeNum = 0;
string shiftSeq = "";
string groupSeq = "";
foreach (UltraGridRow ugd in ultraGrid1.Rows)
{
if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
{
shiftSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
}
}
//查询上个班交班支数
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { HeatNo, ResultNo, 3, 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());
}
}
int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 3, 0, proPlanId, gxPlanNo);
if (WaitChangeSeq == 0)
{
MessageBox.Show("没有待交班确认的管号。");
return;
}
if (WaitChangeSeq != int.Parse(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";
string Date = "";
if (this.DoRelogin(DoCheck))
{
//插入接班确认履历表
hm.InsertChangeRemuse(Shift, Group, _UserName, "3", PlineCode);
int Seq2 = int.Parse(seq);
//int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 4, 0 }, this.ob);
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, PlineCode, Shift, Group, _UserName }, this.ob);
ChangeFlag = 1;
#region 修改连轧日志表
string gridShift = Shift;
string gridGroup = Group;
if(!shiftSeq.Equals("") && !groupSeq.Equals(""))
{
switch (shiftSeq)
{
case "常白班":
shiftSeq = "0";
break;
case "白班":
shiftSeq = "0";
break;
case "早班":
shiftSeq = "1";
break;
case "中班":
shiftSeq = "2";
break;
case "夜班":
shiftSeq = "3";
break;
}
switch (groupSeq)
{
case "甲":
groupSeq = "1";
break;
case "乙":
groupSeq = "2";
break;
case "丙":
groupSeq = "3";
break;
case "丁":
groupSeq = "4";
break;
}
gridShift = shiftSeq;
gridGroup = groupSeq;
}
//foreach (UltraGridRow ugd in ultraGrid1.Rows)
//{
// if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
// {
// gridShift = ugd.Cells["COL_SHIFT"].Value.ToString();
// gridGroup = ugd.Cells["COL_GROUP"].Value.ToString();
// }
//}
string[] Temp = GetDbHeightBruningRate(heatNo, ResultNo, BeforeChangeNum, Seq2).Split('-');
string QaTon = Temp[0];
string ScrapTon = Temp[1];
string ScrapNum1 = Temp[2];
MilControlLogEntity ControlLogEntity = new MilControlLogEntity();
ControlLogEntity.QualifiedNum = (Seq2 - BeforeChangeNum - int.Parse(ScrapNum1)).ToString();
ControlLogEntity.ScrapNum = ScrapNum1.ToString();
ControlLogEntity.QualifiedWt = QaTon.ToString();
ControlLogEntity.ScrapWt = ScrapTon.ToString();
ControlLogEntity.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
ControlLogEntity.ProBc = gridShift;
ControlLogEntity.ProBz = gridGroup;
ControlLogEntity.LotNo = ActiveLotNo;
ControlLogEntity.UserId = _UserID;
ControlLogEntity.UserName = _UserName;
ControlLogEntity.ChangeShiftFlag = "1";
ControlLogEntity.ProPlanId = proPlanId;
ControlLogEntity.GxPlanNo = gxPlanNo;
//CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FrmRollingRPipeResult";
ccp.MethodName = "changeGroupUpdateContralLog";
ccp.ServerParams = new object[] { ControlLogEntity };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
//int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
//if (count2 > 0)
//{
if (Shift == "3")
{
Time = Time.Replace(":", "");
Date = SeverTime.AddDays(+1).ToString("yyyyMMdd");
}
else
{
Date = SeverTime.ToString("yyyyMMdd");
}
string ShiftA = this.UserInfo.GetUserOrder();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(0, 1);
string GroupA = this.UserInfo.GetUserGroup();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(1, 1);
//if (_UpdateFlag == "0")
//{
//接班标识
string ChangeShiftFlag = "2";
int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertContralLog", new object[] { HeatNo, ActiveLotNo, ShiftA, GroupA, _UserID, _UserName, ChangeShiftFlag, proPlanId, gxPlanNo }, this.ob);
//}
//}
#endregion
}
}
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { HeatNo, proPlanId, gxPlanNo }, this.ob);
//过渡方法,接班后重登陆初始化导致Grid.Row为null
if (ultraGridPlan.Rows == null)
{
return;
}
if (dt1.Rows.Count > 0)
{
if (PlineCode != "C012")
{
GridEditHistoryForRack(dt1);
}
else
{
GridEditHistoryAressForRack(dt1);
}
}
GetRollingCard();
RackQuery(HeatNo);
}
///
/// 连轧跟踪信息查询
///
private void RackQuery(string heatNo)
{
tbRollDate.Clear();
if (ultraGridPlan.Rows.Count > 0)
{
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.rackQueryForHeatNo", new object[] { heatNo,proPlanId,gxPlanNo }, this.ob);//连轧跟踪信息
GridHelper.CopyDataToDatatable(ref dt, ref tbRollDate, true);
ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
foreach (UltraGridRow dr in ultraGrid1.Rows)
{
dr.Cells["DELETE"].Value = "剔除";
dr.Cells["DELBACK"].Value = "剔料回退";
if (dr.Cells["STATUS"].Text == "剔除")
{
dr.Cells["SCRAP_REASON"].Activation = Activation.AllowEdit;
}
}
}
ChangeGridColor();
}
///
/// 变色
///
private void ChangeGridColor()
{
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["CHANGE_FLAG"].Value.ToString())
{
case "待接班确认":
ugr.Appearance.BackColor = Color.LightGreen;
break;
}
}
}
foreach (UltraGridRow uRow in ultraGridPlan.Rows)
{
if (uRow != null)
{
switch (uRow.Cells["IS_START"].Value.ToString())
{
case "已完成连轧":
uRow.Appearance.BackColor = Color.YellowGreen;
break;
}
}
}
}
///
/// 查询连轧实绩
///
private void resultQuery(string heatNo, string PliceCode)
{
string strheatno = heatNo;
string factoryId = PliceCode;
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { strheatno, proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
if (factoryId != "C012")
{
GridEditHistory(dt);
}
else
{
GridEditHistoryAress(dt);
}
}
if (dt.Rows.Count == 0)
{
MilRollingResultEntity rr = new MilRollingResultEntity();
rollResult_Arssel1.Value = rr;
rollResult1.Value = rr;
}
}
#endregion
#region 卡片赋值
///
/// 连轧实绩Grid赋值Aress_1
///
///
private void GridEditHistoryAress(DataTable dt)
{
ultraTabControl1.Tabs[0].Visible = false;
ultraTabControl1.Tabs[1].Visible = true;
if (dt.Rows.Count > 0)
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
rollResult_Arssel1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
rollResult_Arssel1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult_Arssel1.Value.ScrapNum.ToString()))
{
//合格支数
rollResult_Arssel1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
}
else
{
rollResult_Arssel1.Value.Rollingnum = 0;
}
}
else
{ rollResult_Arssel1.Value.Rollingnum = 0; }
}
//交接班支数
this.rollResult_Arssel1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
//备注
this.rollResult_Arssel1.Value.Remark = dt.Rows[0]["REMARK"].ToString();
//毛管名义尺寸
this.rollResult_Arssel1.Value.Tubesize = dt.Rows[0]["TUBESIZE"].ToString();
//连轧开始时间
this.rollResult_Arssel1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString();
//连轧结束时间
this.rollResult_Arssel1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString();
//快开
this.rollResult_Arssel1.Value.QoRollerThroatDiameter = dt.Rows[0]["QO_ROLLER_THROAT_DIAMETER"].ToString();
//轧制
this.rollResult_Arssel1.Value.RollingThroatDiameter = dt.Rows[0]["ROLLING_THROAT_DIAMETER"].ToString();
//快关
this.rollResult_Arssel1.Value.QcRollerThroatDiameter = dt.Rows[0]["QC_ROLLER_THROAT_DIAMETER"].ToString();
//咬入
this.rollResult_Arssel1.Value.RollerBiteSpeed = dt.Rows[0]["ROLLER_BITE_SPEED"].ToString();
//轧辊角
this.rollResult_Arssel1.Value.RollingAngle = dt.Rows[0]["ROLLING_ANGLE"].ToString();
//喂角转速
this.rollResult_Arssel1.Value.FeedAngle = dt.Rows[0]["FEED_ANGLE"].ToString();
//轧制转速
this.rollResult_Arssel1.Value.RollingSpeed = dt.Rows[0]["ROLLING_SPEED"].ToString();
this.rollResult_Arssel1.Value.StartRollTemp = dt.Rows[0]["START_ROLL_TEMP"].ToString();
this.rollResult_Arssel1.UpdateData();
}
}
///
/// 查询流通卡信息
///
private 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("C008") || 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);
}
}
///
/// 查询流通卡信息
///
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);
}
#region 事件处理
private void chkLotNo_CheckedChanged(object sender, EventArgs e)
{
this.txtLOT_NO.Enabled = this.chkLotNo.Checked;
}
private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
{
if (this.chkHeatNo.Checked)
{
this.txtJudgeStoveNo.Enabled = true;
}
else
{
this.txtJudgeStoveNo.Enabled = false;
}
if (chkStatusQuery.Checked)
{
PlanStatusQuery = "99";
PlanStartStatusQuery = "40";
}
else
{
PlanStatusQuery = "39";
PlanStartStatusQuery = "00";
}
if (chkAutoRefresh.Checked)
{
timer1.Enabled = true;
}
else
{
timer1.Enabled = false;
}
}
public string DoCheck(CoreUserInfo User)
{
return "";
}
///
/// 查询合格支 合格吨
///
///
///
///
///
/// 0-交班合废支吨
///
private string GetDbHeightBruningRate(string JudgeStoveNo, string ResultNo, int StartSeq, int EndSeq)
{
string DbHeightBrate = "";
double DbHeight = 0;
double BRate = 0;
int ScrapNum = 0;
double QaTon = 0;
double ScrapTon = 0;
DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getDBHeightBRate", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (dtDBH.Rows.Count > 0)
{
DbHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
BRate = double.Parse(dtDBH.Rows[0]["burnning_rate"].ToString());
}
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, StartSeq, EndSeq, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
ScrapNum = int.Parse(dtScrapNum.Rows[0][0].ToString());
}
QaTon = (EndSeq - StartSeq+1 - ScrapNum) * DbHeight * (1 - (BRate / 100));
ScrapTon = ScrapNum * DbHeight * (1 - (BRate / 100));
DbHeightBrate = QaTon + "-" + ScrapTon + "-" + ScrapNum;
return DbHeightBrate;
}
///
/// Grid表头事件
///
///
///
private void ultraGrid1_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.rollResult1.IsCellSelect == true)
{
NativeMethodNew na = new NativeMethodNew(this.ob);
if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
{
this.rollResult1.IsCellSelect = false;
return;
}
//if (MessageBox.Show("提示:连轧实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
//{
// this.rollResult1.IsCellSelect = false;
// //保存探伤实绩
//}
else
{
ShowMessageFlag = 1;
FeedRowSave();
ShowMessageFlag = 0;
this.rollResult1.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;
}
}
if (this.rollResult_Arssel1.IsCellSelect == true)
{
NativeMethodNew na = new NativeMethodNew(this.ob);
if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
{
this.rollResult_Arssel1.IsCellSelect = false;
return;
}
//if (MessageBox.Show("提示:探伤实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
//{
// this.rollResult1.IsCellSelect = false;
// //保存探伤实绩
// FeedRowSave();
//}
else
{
this.rollResult_Arssel1.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 Shift = UserInfo.GetUserOrder();
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";
}
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.GetRollResultNodeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 4, Date, Shift, Group, this.ob);
frm.ShowDialog();
}
#endregion
///
/// 当班工具更换
///
private void DoToolChange()
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
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 += " " + "07:00:00";
}
else
{
StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "07:00:00";
}
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.toolChangeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
txtQuery frm = new txtQuery(2, Date, Shift, Group, User, PlineCode, this.ob);
frm.ShowDialog();
}
///
///
///
///
private void frmTechnological1_DoubleClickEvent(DataTable dt)
{
NativeMethodNew NmN = new NativeMethodNew(this.ob);
HOTMethod HOTm = new HOTMethod(this.ob);
if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始连轧,不能带入参数。");
return;
}
//if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 3, PlineCode))
//{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成连轧,不能带入参数。");
// return;
//}
MilRollingResultEntity RollingResult = new MilRollingResultEntity();
RollingResult = (MilRollingResultEntity)EntityTool.setObjectByDataTable(RollingResult, dt);
this.rollResult1.UpdateDateForPrama(RollingResult);
ShowMessageFlag = 1;
FeedRowSave();
ShowMessageFlag = 0;
}
///
/// Arsel
///
///
private void frmTechnological2_DoubleClickEvent(DataTable dt)
{
NativeMethodNew NmN = new NativeMethodNew(this.ob);
HOTMethod HOTm = new HOTMethod(this.ob);
if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始连轧,不能带入参数。");
return;
}
//if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 3, PlineCode))
//{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成连轧,不能带入参数。");
// return;
//}
MilRollingResultEntity RollingResult = new MilRollingResultEntity();
RollingResult = (MilRollingResultEntity)EntityTool.setObjectByDataTable(RollingResult, dt);
this.rollResult_Arssel1.UpdateDateForPrama(RollingResult);
ShowMessageFlag = 1;
FeedRowSave();
ShowMessageFlag = 0;
}
///
/// 到点提示交班
///
///
///
private void timer2_Tick(object sender, EventArgs e)
{
if (!PlineCode.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 ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != (char)13)
{
}
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];
}
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, 3, Seq, ScrapReason, Remark }, this.ob);
}
RackQuery(ActiveJUDGE_STOVE_NO);
}
}
#endregion
#region 卡片赋值
///
/// 连轧实绩Grid赋值Aress_1
///
///
private void GridEditHistoryAressForRack(DataTable dt)
{
ultraTabControl1.Tabs[0].Visible = false;
ultraTabControl1.Tabs[1].Visible = true;
if (dt.Rows.Count > 0)
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
rollResult_Arssel1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
rollResult_Arssel1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult_Arssel1.Value.ScrapNum.ToString()))
{
//合格支数
rollResult_Arssel1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
}
else
{
rollResult_Arssel1.Value.Rollingnum = 0;
}
}
else
{ rollResult_Arssel1.Value.Rollingnum = 0; }
}
//交接班支数
this.rollResult_Arssel1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
this.rollResult_Arssel1.UpdateDataForRack();
}
}
///
/// 连轧实绩Grid赋值
///
///
private void GridEditHistory(DataTable dt)
{
ultraTabControl1.Tabs[0].Visible = true;
ultraTabControl1.Tabs[1].Visible = false;
if (dt.Rows.Count > 0)
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
rollResult1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
rollResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult1.Value.ScrapNum.ToString()))
{
//合格支数
rollResult1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
}
else
{
rollResult1.Value.Rollingnum = 0;
}
}
else
{ rollResult1.Value.Rollingnum = 0; }
}
//交接班支数
this.rollResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
//备注
this.rollResult1.Value.Remark = dt.Rows[0]["REMARK"].ToString();
//VRS转速
this.rollResult1.Value.VrsSpeed = dt.Rows[0]["VRS_SPEED"].ToString();
//预插入长度
this.rollResult1.Value.InsertLength = dt.Rows[0]["INSERT_LENGTH"].ToString();
//毛管名义尺寸
this.rollResult1.Value.Tubesize = dt.Rows[0]["TUBESIZE"].ToString();
//EM转速
this.rollResult1.Value.Emspeed = dt.Rows[0]["EMSPEED"].ToString();
//限动速度
this.rollResult1.Value.LimitSpeed = dt.Rows[0]["LIMIT_SPEED"].ToString();
//EX1脱管机架转速
this.rollResult1.Value.Ext1RackSpeed = dt.Rows[0]["EXT1_RACK_SPEED"].ToString();
//连轧开始时间
this.rollResult1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString();
//连轧结束时间
this.rollResult1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString();
//机架转速1
this.rollResult1.Value.RackSpeed1 = dt.Rows[0]["RACK_SPEED1"].ToString();
//机架转速2
this.rollResult1.Value.RackSpeed2 = dt.Rows[0]["RACK_SPEED2"].ToString();
//机架转速3
this.rollResult1.Value.RackSpeed3 = dt.Rows[0]["RACK_SPEED3"].ToString();
//机架转速4
this.rollResult1.Value.RackSpeed4 = dt.Rows[0]["RACK_SPEED4"].ToString();
//机架转速5
this.rollResult1.Value.RackSpeed5 = dt.Rows[0]["RACK_SPEED5"].ToString();
//机架转速6
this.rollResult1.Value.RackSpeed6 = dt.Rows[0]["RACK_SPEED6"].ToString();
//机架转速7
this.rollResult1.Value.RackSpeed7 = dt.Rows[0]["RACK_SPEED7"].ToString();
//辊缝转速1
this.rollResult1.Value.RackSpace1 = dt.Rows[0]["RACK_SPACE1"].ToString();
//辊缝转速2
this.rollResult1.Value.RackSpace2 = dt.Rows[0]["RACK_SPACE2"].ToString();
//辊缝转速3
this.rollResult1.Value.RackSpace3 = dt.Rows[0]["RACK_SPACE3"].ToString();
//辊缝转速4
this.rollResult1.Value.RackSpace4 = dt.Rows[0]["RACK_SPACE4"].ToString();
//辊缝转速5
this.rollResult1.Value.RackSpace5 = dt.Rows[0]["RACK_SPACE5"].ToString();
//辊缝转速6
this.rollResult1.Value.RackSpace6 = dt.Rows[0]["RACK_SPACE6"].ToString();
//辊缝转速7
this.rollResult1.Value.RackSpace7 = dt.Rows[0]["RACK_SPACE7"].ToString();
//机架轧制力1
this.rollResult1.Value.RollingForce1 = dt.Rows[0]["ROLLING_FORCE1"].ToString();
//机架轧制力2
this.rollResult1.Value.RollingForce2 = dt.Rows[0]["ROLLING_FORCE2"].ToString();
//机架轧制力3
this.rollResult1.Value.RollingForce3 = dt.Rows[0]["ROLLING_FORCE3"].ToString();
//机架轧制力4
this.rollResult1.Value.RollingForce4 = dt.Rows[0]["ROLLING_FORCE4"].ToString();
//机架轧制力5
this.rollResult1.Value.RollingForce5 = dt.Rows[0]["ROLLING_FORCE5"].ToString();
//机架轧制力6
this.rollResult1.Value.RollingForce6 = dt.Rows[0]["ROLLING_FORCE6"].ToString();
//机架轧制力7
this.rollResult1.Value.RollingForce7 = dt.Rows[0]["ROLLING_FORCE7"].ToString();
this.rollResult1.Value.StartRollTemp = dt.Rows[0]["START_ROLL_TEMP"].ToString();
this.rollResult1.UpdateData();
}
}
///
/// 连轧实绩Grid赋值
///
///
private void GridEditHistoryForRack(DataTable dt)
{
ultraTabControl1.Tabs[0].Visible = true;
ultraTabControl1.Tabs[1].Visible = false;
if (dt.Rows.Count > 0)
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
rollResult1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
rollResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtQANum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
{
if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult1.Value.ScrapNum.ToString()))
{
//合格支数
rollResult1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
}
else
{
rollResult1.Value.Rollingnum = 0;
}
}
else
{ rollResult1.Value.Rollingnum = 0; }
}
//交接班支数
this.rollResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
this.rollResult1.UpdateDataForRack();
}
}
///
/// 流通卡赋值
///
///
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();
}
}
///
/// 轧制信息Grid赋值
///
/// 轧制计划信息datatable
public void GridEdit(DataTable dt)
{
if (dt.Rows.Count > 0)
{
DataRow row1 = dt.Rows[0];
//熔炼炉号
this.chk.Value.StoveNo = row1["stove_no"].ToString();
//炉号
this.chk.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
//生产批号
this.chk.Value.LotNo = row1["lot_no"].ToString();
//工序合同号
this.chk.Value.ContractNo = row1["contract_no"].ToString();
//执行工艺号
this.chk.Value.ImpProcess = row1["imp_process"].ToString();
//执行工艺号路径
this.chk.Value.ImpProcessPath = row1["imp_process_path"].ToString();
//产线代码
this.chk.Value.PlineCode = row1["pline_code"].ToString();
//状态
this.chk.Value.Status = row1["STATUS"].ToString();
//监制
this.chk.Value.Producer = row1["producer"].ToString();
//工艺状态
this.chk.Value.ProcessStatus = row1["process_status"].ToString();
//单倍长
this.chk.Value.DbLength = row1["db_length"].ToString();
//单倍重
this.chk.Value.DbHeight = row1["db_height"].ToString();
//轧制长度
this.chk.Value.RollLength = row1["roll_length"].ToString();
//分切数
this.chk.Value.SawNum = row1["saw_num"].ToString();
//目标长度
this.chk.Value.TargetLength = row1["target_length"].ToString();
//最终用户
this.chk.Value.FinishUser = row1["finish_user"].ToString();
//目标库
this.chk.Value.TargetLiabrary = row1["target_liabrary"].ToString();
//品种
this.chk.Value.Varieties = row1["varieties"].ToString();
//成品规格
this.chk.Value.PipeSize = row1["pipe_size"].ToString();
//扣型
this.chk.Value.BuckleType = row1["buckle_type"].ToString();
//长度范围
this.chk.Value.LengthRange = row1["length_range"].ToString();
//轧管判定标准
this.chk.Value.RollStandrad = row1["roll_standrad"].ToString();
//断面
this.chk.Value.PipeSection = row1["pipe_section"].ToString();
//钢种代码
this.chk.Value.SteelCode = row1["steelcode"].ToString();
//钢种名称
this.chk.Value.SteelName = row1["steelname"].ToString();
//钢级代码
this.chk.Value.GradeCode = row1["gradecode"].ToString();
//钢级名称
this.chk.Value.GradeName = row1["gradename"].ToString();
//炼钢判定标准
this.chk.Value.SteelStandrad = row1["steel_standrad"].ToString();
//去向
this.chk.Value.Target = row1["target"].ToString();
//支
this.chk.Value.PlanNum = row1["BRANCH"].ToString();
//吨
this.chk.Value.PlanTon = row1["TON"].ToString();
//切损去向
this.chk.Value.CutTarget = row1["cut_target"].ToString();
//切损长度
this.chk.Value.CutLength = row1["cut_length"].ToString();
//切损重量
this.chk.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
//倍尺数
this.chk.Value.DbNum = row1["DB_NUM"].ToString();
//标准类别代码
this.chk.Value.StdStyle = row1["STD_STYLE"].ToString();
//标准类别描述
this.chk.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
//成品备注
this.chk.Value.ReMark = row1["ReMark"].ToString();
this.chk.UpdateData();
}
}
#endregion
#region 报表
///
/// 打印报表
///
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=RepMilRollingResult.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=RepMilRollingResult.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=RepMilRollingResult.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=RepMilRollingResult250.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=RepMilRollingResult258.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=RepMilRollingResult168.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=RepMilRollingResult460.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=RepMilRollingResult508.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), 3, 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), 3, 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), 3, 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), 3, 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=RepMilRollingResult250.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=RepMilRollingResult258.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=RepMilRollingResult168.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=RepMilRollingResult460.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=RepMilRollingResult508.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
}
}