using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CoreFS.CA06;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Control;
using com.steering.mes.zgmil.entity;
using Infragistics.Win.UltraWinGrid;
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.Popup;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using Core.StlMes.Client.ZGMil.Common;
using CoreFS.SA06;
using System.Collections;
namespace Core.StlMes.Client.ZGMil.Result
{
public partial class FrmHotSimple : FrmBase
{
#region 初始化
MilPlan QueryMainPlan = new MilPlan();
MilPlan MainPlan = new MilPlan();
UltraGridRow actugr = null;
private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
string PLineCode = "";//产线代码
string PlanStatusQuery = "99"; //查询结炉实绩结炉状态
string PlanStartStatusQuery = "01"; //查询结炉实绩起始状态
string ActiveJUDGE_STOVE_NO = string.Empty;//主计划活动行的判定炉号
string ActiveResultNo = string.Empty;//主计划活动行的判定炉号
private string proPlanId = null;//轧管订单编号
private string gxPlanNo = null;//工序排产序号
private string ActiveStatus = null;//主计划活动行的状态
MilSizingResultEntity tempsizingresult = new MilSizingResultEntity();
MilHotCheckEntity HotCheckEntity = new MilHotCheckEntity();
MilHotCheckDetailEntity HotCheckDetailEntity = new MilHotCheckDetailEntity();
string Shift = "";
string Group = "";
private string Departm = "";//部门
private string PlineCod = "";//产线
private int _MouseLocX = 0; //鼠标横坐标
private int _MouseLocY = 0; //鼠标纵坐标
private string _UserName = "";
private string _UserID = "";
private int ShowMessageFlag = 0; //显示提示Flag 0-显示 1-不显示
int HotFlag = 0;
private string CutHeadBefore = "";
private string CutTrailBefore = "";
private string CutOrderBefore = "";
int CopyFlag = 0;
// MilHotCheckDetailEntity HotCheckCopyEntity = new MilHotCheckDetailEntity(); //用于复制
MilHotCheckResultEntity MilHotCheckSave = new com.steering.mes.zgmil.entity.MilHotCheckResultEntity();
string CutHead = "";
string CutOrder = "";
string CutTrail = "";
Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
public Infragistics.Win.UltraWinGrid.UltraGrid Grid
{
get { return _grid; }
}
public FrmHotSimple()
{
InitializeComponent();
InitControl();
Shift = UserInfo.GetUserOrder();
Group = UserInfo.GetUserGroup();
//获取鼠标坐标
Point formPoint = this.PointToClient(Control.MousePosition);
_MouseLocX = Convert.ToInt32(formPoint.X);
_MouseLocY = Convert.ToInt32(formPoint.Y);
valueList.ValueListItems.Add("0", "管头");
valueList.ValueListItems.Add("1", "管体");
valueList.ValueListItems.Add("2", "管尾");
valueList.SelectedIndex = 0;
ultraGrid1.DisplayLayout.Bands[0].Columns["pipe_location"].ValueList = valueList;
ultraGrid1.DisplayLayout.Bands[0].Columns["pipe_location"].CellActivation = Activation.NoEdit;
}
///
/// 定时器事件
///
///
///
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;
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
colHotCheck1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
splitContainer2.SplitterDistance = 180;
foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
{
ugc.SortIndicator = SortIndicator.Disabled;
}
timer1.Tick += new EventHandler(timer1_Tick);
//ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;
//ultraGrid1.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.True;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD_P"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL_P"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER_P"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CHECK_DATE"].CellActivation = Activation.AllowEdit;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = true;
//switch (PLineCode)
//{
//}
}
///
/// 页面开启事件
///
///
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
string hostname = Dns.GetHostName();
NativeMethodNew na = new NativeMethodNew(this.ob);
Departm = UserInfo.GetDepartment();
PLineCode = na.GetPCode(Departm);
PlineCod = na.GetPCode(Departm);//获取 用户 对应的产线
if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.Equals("C017") || PlineCod.Equals("C072"))
{
this.rollingCard1.ChangCard();
}
switch (PLineCode)
{
case "C008":
ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
break;
case "C009":
ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
break;
case "C010":
ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Caption = "实际长度";
break;
case "C012":
ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
break;
case "C017":
ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
//colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
//colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
//colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
//colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
break;
}
Sign();
PlanQuery();
}
///
/// 签名
///
private void Sign()
{
ColUserName col = new ColUserName();
col.StationId = "10";
col.PlineCode = PLineCode;
col.ColGroup = Group;
col.Ob = this.ob;
col.ShowDialog();
_UserID = col.getUserId();
_UserName = col.getUserName();
}
///
/// 初始化控件
///
public void InitControl()
{
if (chkLotNo.Checked)
{
txtLOT_NO.Enabled = true;
}
else
{
txtLOT_NO.Enabled = false;
}
if (chkHeatNo.Checked)
{
txtJudgeStoveNo.Enabled = true;
}
else
{
txtJudgeStoveNo.Enabled = false;
}
}
#endregion
#region 控制赋值 方法
///
/// 刷新
///
public void ReFresh()
{
ChangeGridColor();
PlanQuery();
}
///
/// 更改剔除坯料行颜色
///
public void ChangeGridColor()
{
if (ultraGridPlan.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGridPlan.Rows)
{
if (ugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
}
}
}
///
/// 复制(把上一炉的实绩信息带到下一炉)
///
private void DoStart()
{
if (MilHotCheckSave != null)
{
//colHotCheck1.SizingDataSource1.Rows[0]["INSPECTOR"] = MilHotCheckSave.Inspector;
//colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B1"] = MilHotCheckSave.DoubleB1;
//colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B2"] = MilHotCheckSave.DoubleB2;
//colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B3"] = MilHotCheckSave.DoubleB3;
//colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B4"] = MilHotCheckSave.DoubleB4;
//colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES1"] = MilHotCheckSave.PassSeries1;
//colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES2"] = MilHotCheckSave.PassSeries2;
//colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES3"] = MilHotCheckSave.PassSeries3;
//colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES4"] = MilHotCheckSave.PassSeries4;
//colHotCheck1.SizingDataSource1.Rows[0]["START_TEMP"] = MilHotCheckSave.Standard;
//colHotCheck1.SizingDataSource1.Rows[0]["END_TEMP"] = MilHotCheckSave.EndTemp;
//this.colHotCheck1.Value.Inspector = MilHotCheckSave.Inspector;
this.colHotCheck1.Value.DoubleB1 = MilHotCheckSave.DoubleB1;
this.colHotCheck1.Value.DoubleB2 = MilHotCheckSave.DoubleB2;
this.colHotCheck1.Value.DoubleB3 = MilHotCheckSave.DoubleB3;
//this.colHotCheck1.Value.DoubleB4 = MilHotCheckSave.DoubleB4;
this.colHotCheck1.Value.PassSeries1 = MilHotCheckSave.PassSeries1;
this.colHotCheck1.Value.PassSeries2 = MilHotCheckSave.PassSeries2;
this.colHotCheck1.Value.PassSeries3 = MilHotCheckSave.PassSeries3;
this.colHotCheck1.Value.Outdiameter = MilHotCheckSave.Outdiameter;
this.colHotCheck1.Value.Wallthick = MilHotCheckSave.Wallthick;
//this.colHotCheck1.Value.PassSeries4 = MilHotCheckSave.PassSeries4;
//this.colHotCheck1.Value.Standard = MilHotCheckSave.Standard;
//this.colHotCheck1.Value.EndTemp = MilHotCheckSave.EndTemp;
this.colHotCheck1.Value.StartTemp = MilHotCheckSave.StartTemp;
this.colHotCheck1.Value.EndTemp = MilHotCheckSave.EndTemp;
this.colHotCheck1.Value.Remark = MilHotCheckSave.Remark;
if (PLineCode.Equals("C010"))
{
this.colHotCheck1.Value.DoubleB4 = MilHotCheckSave.DoubleB4;
this.colHotCheck1.Value.PassSeries4 = MilHotCheckSave.PassSeries4;
}
switch (PLineCode)
{
case "C008": //250
case "C010": //168
case "C017": //460
this.colHotCheck1.Value.CutHead = CutHead;
this.colHotCheck1.Value.CutTrail = CutTrail;
this.colHotCheck1.Value.CutOrder = CutOrder;
break;
}
}
colHotCheck1.UpdateDate();
}
///
/// 查询流通卡信息
///
public void GetRollingCard()
{
UltraGridRow ugr = ultraGridPlan.ActiveRow;
if (ugr != null)
{
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
DataTable dt = new DataTable();
if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.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);
}
}
#endregion
#region L
///
/// ToolBar按钮
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "DoQuery":
PlanQuery();
break;
case "DoStart":
DoStart();
break;
case "DoSave":
ResultSave();
break;
case "DoAdd":
ResultAdd();
break;
case "DoDelete":
ResultDelete();
break;
case "DoNodeBack":
NodeBack();
break;
case "DoNode":
Node();
break;
case "DoPrint":
PrintResult();
break;
case "DoSign":
Sign();
break;
//case "DoQueryBefore":
// QueryBefore();
// break;
case "Close":
this.Dispose();
this.Close();
break;
}
}
///
/// checkbox点击事件
///
///
///
private void chkDate_CheckedChanged(object sender, EventArgs e)
{
if (chkLotNo.Checked)
{
txtLOT_NO.Enabled = true;
}
else
{
txtLOT_NO.Enabled = false;
}
if (chkHeatNo.Checked)
{
txtJudgeStoveNo.Enabled = true;
}
else
{
txtJudgeStoveNo.Enabled = false;
}
if (chkStatusQuery.Checked)
{
HotFlag = 1;
}
else
{
HotFlag = 0;
}
if (chkAutoRefresh.Checked)
{
timer1.Enabled = true;
}
else
{
timer1.Enabled = false;
}
}
///
/// 计划查询
///
public void PlanQuery()
{
string PrimaKey = "";
UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
if (ugr != null)
{
PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
}
if (chkHeatNo.Checked == true)
{
if (string.IsNullOrEmpty(this.txtJudgeStoveNo.Text))
{
MessageBox.Show("请输入判定炉号后再执行查询操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
}
else
{
QueryMainPlan.JudgeStoveNo = "";
}
if (chkLotNo.Checked == true)
{
if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
{
MessageBox.Show("请输入生产批号后再执行查询操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
QueryMainPlan.LotNo = this.txtLOT_NO.Text;
}
else
{
QueryMainPlan.LotNo = "";
}
dtHotCheck.Clear();
dtPlan.Clear();
QueryMainPlan.PlineCode = PlineCod;
QueryMainPlan.Status = PlanStatusQuery;
QueryMainPlan.StartStatus = PlanStartStatusQuery;
//查询计划记录
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSingleMainPlan", new object[] { QueryMainPlan, 6, HotFlag }, this.ob);
if (dt.Rows.Count == 0)
{
if (ShowMessageFlag == 0)
{
MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
if (ugr != null)
{
foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
{
//ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString());
if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
{
ugr1.Activated = true;
}
}
}
ChangeGridColor();
}
///
/// 查询结果Gird单击事件
///
///
///
private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
{
dtMatSeq.Clear();
dtHotCheck.Clear();
if (this.dtPlan.Rows.Count > 0)
{
actugr = ultraGridPlan.ActiveRow;
UltraGridRow ugr = ultraGridPlan.ActiveRow;
if (ugr != null)
{
//查询主计划信息
dtMatSeq.Clear();
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
ActiveJUDGE_STOVE_NO = JudgeStoveNo;
ActiveResultNo = ugr.Cells["ID"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
MainPlan.JudgeStoveNo = JudgeStoveNo;
MainPlan.ProPlanId = proPlanId;
MainPlan.GxPlanNo = gxPlanNo;
string Status = ugr.Cells["HOT_CHECK_FLAG"].Value.ToString();
ActiveStatus = Status;
string ColShift = "";
string ColGroup = "";
// PLineCode = ugr.Cells["Pline_Code"].Value.ToString();
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
if (dtMP.Rows.Count > 0)
{
PLineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
GridEdit(dtMP); //轧制计划信息
//查询流通卡信息
DataTable dtRollingCard = new DataTable();
if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.Equals("C017"))
{
dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
}
else
{
dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
}
if (dtRollingCard.Rows.Count > 0)
{
RollingCardEditGrid(dtRollingCard, JudgeStoveNo);
}
else
{
//清空流通卡值
rollingCard1.Value.Clear();
GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4);
}
//查询热取样实绩信息
if (!chkStatusQuery.Checked)
{
ColShift = Shift;
ColGroup = Group;
}
DataTable dtHotResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.CheckHotCheckDetail", new object[] { JudgeStoveNo, ActiveResultNo, ColShift, ColGroup }, this.ob);
if (dtHotResult.Rows.Count > 0)
{
GridHelper.CopyDataToDatatable(ref dtHotResult, ref dtHotCheck, true);
}
else
{
}
//查询主实绩区实绩
DataTable dtMainResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.GetHotCheckMainResult", new object[] { JudgeStoveNo, ActiveResultNo }, this.ob);
if (dtMainResult.Rows.Count > 0)
{
HotCheckMainResultEdit(dtMainResult);
}
else
{
}
if (dtHotCheck.Rows.Count == 0)
{
AddHotCheckDetailInfo();
}
SetResultGray();
ChangeGridColor();
}
}
}
}
private void AddHotCheckDetailInfo()
{
DataRow newRow;
DataRow newRow1;
DataRow newRow2;
newRow = dtHotCheck.NewRow();
newRow1 = dtHotCheck.NewRow();
newRow2 = dtHotCheck.NewRow();
newRow["pipe_location"] = "管头";
newRow1["pipe_location"] = "管体";
newRow2["pipe_location"] = "管尾";
dtHotCheck.Rows.Add(newRow);
dtHotCheck.Rows.Add(newRow1);
dtHotCheck.Rows.Add(newRow2);
}
///
/// 新增一组热取样详细数据
///
private void ResultAdd()
{
if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
{
MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能新增");
return;
}
AddHotCheckDetailInfo();
ShowMessageFlag = 1;
ResultSave();
ShowMessageFlag = 0;
PlanQuery();
}
///
/// 删除最后一组热取样数据
///
private void ResultDelete()
{
if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
{
MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能删除");
return;
}
if (dtHotCheck.Rows.Count > 3)
{
dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 1);
dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 2);
dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 3);
}
ShowMessageFlag = 1;
ResultSave();
ShowMessageFlag = 0;
PlanQuery();
}
///
/// 保存
///
public void ResultSave()
{
colHotCheck1.UltraGrid2.UpdateData();
ultraGrid1.UpdateData();
try
{
colHotCheck1.UltraGrid2.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
if (this.ultraGridPlan.ActiveRow == null)
{
return;
}
//保存主实绩信息
MilHotCheckSave.Inspector = colHotCheck1.SizingDataSource1.Rows[0]["INSPECTOR"].ToString();
MilHotCheckSave.DoubleB1 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B1"].ToString();
MilHotCheckSave.DoubleB2 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B2"].ToString();
MilHotCheckSave.DoubleB3 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B3"].ToString();
MilHotCheckSave.DoubleB4 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B4"].ToString();
MilHotCheckSave.PassSeries1 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES1"].ToString();
MilHotCheckSave.PassSeries2 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES2"].ToString();
MilHotCheckSave.PassSeries3 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES3"].ToString();
MilHotCheckSave.PassSeries4 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES4"].ToString();
MilHotCheckSave.StartTemp = colHotCheck1.SizingDataSource1.Rows[0]["START_TEMP"].ToString();
MilHotCheckSave.EndTemp = colHotCheck1.SizingDataSource1.Rows[0]["END_TEMP"].ToString();
MilHotCheckSave.Wallthick = colHotCheck1.SizingDataSource1.Rows[0]["WALLTHICK"].ToString();
MilHotCheckSave.Outdiameter = colHotCheck1.SizingDataSource1.Rows[0]["OUTDIAMETER"].ToString();
CutHead = colHotCheck1.SizingDataSource1.Rows[0]["CUT_HEAD"].ToString();
CutOrder = colHotCheck1.SizingDataSource1.Rows[0]["CUT_ORDER"].ToString();
CutTrail = colHotCheck1.SizingDataSource1.Rows[0]["CUT_TRAIL"].ToString();
MilHotCheckSave.CheckDate = "sysdate";
if (!string.IsNullOrEmpty(colHotCheck1.SizingDataSource1.Rows[0]["CHECK_DATE"].ToString()))
{
MilHotCheckSave.CheckDate = colHotCheck1.SizingDataSource1.Rows[0]["CHECK_DATE"].ToString();
}
MilHotCheckSave.Remark = colHotCheck1.SizingDataSource1.Rows[0]["REMARK"].ToString();
MilHotCheckSave.ColGroup = UserInfo.GetUserGroup();
MilHotCheckSave.ColShift = UserInfo.GetUserOrder();
MilHotCheckSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
MilHotCheckSave.PlineCode = PLineCode;
MilHotCheckSave.ResultNo = ActiveResultNo;
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.saveHotCheck", new object[] { MilHotCheckSave, CutHead, CutTrail, CutOrder }, this.ob);
ArrayList ListEntity = new ArrayList();
//保存抽检详细信息
if (ultraGrid1.Rows.Count > 0)
{
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
if (string.IsNullOrEmpty(ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString()))
{
MessageBox.Show("请选择管位置。");
return;
}
MilHotCheckDetailEntity CheckDetailSave = new MilHotCheckDetailEntity();
CheckDetailSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
CheckDetailSave.PassSeries = ultraGrid1.Rows[i].Cells["PASS_SERIES"].Value.ToString();
CheckDetailSave.DoubleB = ultraGrid1.Rows[i].Cells["DOUBLE_B"].Value.ToString();
CheckDetailSave.D1 = ultraGrid1.Rows[i].Cells["d1"].Value.ToString();
CheckDetailSave.D2 = ultraGrid1.Rows[i].Cells["d2"].Value.ToString();
CheckDetailSave.D3 = ultraGrid1.Rows[i].Cells["d3"].Value.ToString();
CheckDetailSave.D4 = ultraGrid1.Rows[i].Cells["d4"].Value.ToString();
CheckDetailSave.S1 = ultraGrid1.Rows[i].Cells["s1"].Value.ToString();
CheckDetailSave.S2 = ultraGrid1.Rows[i].Cells["s2"].Value.ToString();
CheckDetailSave.S3 = ultraGrid1.Rows[i].Cells["s3"].Value.ToString();
CheckDetailSave.S4 = ultraGrid1.Rows[i].Cells["s4"].Value.ToString();
CheckDetailSave.S5 = ultraGrid1.Rows[i].Cells["s5"].Value.ToString();
CheckDetailSave.S6 = ultraGrid1.Rows[i].Cells["s6"].Value.ToString();
CheckDetailSave.S7 = ultraGrid1.Rows[i].Cells["s7"].Value.ToString();
CheckDetailSave.S8 = ultraGrid1.Rows[i].Cells["s8"].Value.ToString();
CheckDetailSave.ColShift = Shift;
CheckDetailSave.ColGroup = Group;
CheckDetailSave.ColUser = _UserName;
CheckDetailSave.ColTime = "sysdate";
if (!string.IsNullOrEmpty(ultraGrid1.Rows[i].Cells["COL_TIME"].Value.ToString()))
{
CheckDetailSave.ColTime = ultraGrid1.Rows[i].Cells["COL_TIME"].Value.ToString();
}
string PipeLocation = "";
if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "1")
{
PipeLocation = "1";
}
else if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "2")
{
PipeLocation = "2";
}
else if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "0")
{
PipeLocation = "0";
}
else
{
switch (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString())
{
case "管头":
PipeLocation = "0";
break;
case "管体":
PipeLocation = "1";
break;
case "管尾":
PipeLocation = "2";
break;
}
}
CheckDetailSave.PipeLocation = PipeLocation;
CheckDetailSave.ResultNo = ActiveResultNo;
ListEntity.Add(CheckDetailSave);
}
}
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.saveHotCheckDetail", new object[] { ListEntity, ActiveJUDGE_STOVE_NO, ActiveResultNo,Shift,Group }, this.ob);
if (ShowMessageFlag == 0)
{
MessageBox.Show("实绩保存成功");
}
CutHeadBefore = CutHead;
CutOrderBefore = CutOrder;
CutTrailBefore = CutTrail;
ReFresh();
}
///
/// 取样判定完成
///
private void Node()
{
ShowMessageFlag = 1;
ResultSave();
ShowMessageFlag = 0;
if (ActiveJUDGE_STOVE_NO == null)
{
MessageBox.Show("请选择需要热取样炉计划");
return;
}
if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
{
MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能再次判定完成");
return;
}
//查询是否存在该炉计划的取样实绩
//DataTable dtHotResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.CheckHotCheckDetail", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
if (ultraGrid1.Rows.Count < 3)
{
MessageBox.Show("热取样实绩未录入完整,请完善后判定完成。");
return;
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.updateCheckFlag", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, "1" }, this.ob);
MessageBox.Show("热取样完成");
ReFresh();
}
///
/// 取样判定回退
///
private void NodeBack()
{
if (ActiveJUDGE_STOVE_NO == null)
{
MessageBox.Show("请选择需要回退的热取样炉计划");
return;
}
if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "未完成抽检")
{
MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】未取样完成不能回退");
return;
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.updateCheckFlag", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, "0" }, this.ob);
MessageBox.Show("热取样回退成功");
ReFresh();
}
///
/// 点击添加热取样实绩
///
///
///
private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
{
valueList.SelectedIndex = 0;
}
///
/// 置灰切头、切尾、定尺录入
///
private void SetResultGray()
{
//查询分切是否已经开始切头操作
//DataTable dtPlan = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSawCutIsStart", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
//if (dtPlan.Rows.Count > 0)
//{
// if (!string.IsNullOrEmpty(dtPlan.Rows[0]["CUT_HEAD_LENGTH"].ToString()))
// {
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.NoEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.NoEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.NoEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.Gray;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.Gray;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.Gray;
// }
// else
// {
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.AllowEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.AllowEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.NoEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.Gray;
// }
//}
//else
//{
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.AllowEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.AllowEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.AllowEdit;
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
// colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
//}
//已判定完成的炉次显示班次班组操作人
if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
{
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = false;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = false;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = false;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = false;
}
else
{
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = true;
ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = true;
}
}
#endregion
#region 卡片赋值
///
/// 轧制信息Grid赋值
///
/// 轧制计划信息datatable
public void GridEdit(DataTable dt)
{
if (dt.Rows.Count > 0)
{
DataRow row1 = dt.Rows[0];
//熔炼炉号
this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
//炉号
this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
//生产批号
this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
//工序合同号
this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
//执行工艺号
this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
//执行工艺号路径
this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
//产线代码
this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
//状态
this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
//监制
this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
//工艺状态
this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
//单倍长
this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
//单倍重
this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
//轧制长度
this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
//分切数
this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
//目标长度
this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
//最终用户
this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
//目标库
this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
//品种
this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
//成品规格
this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
//扣型
this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
//长度范围
this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
//轧管判定标准
this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
//断面
this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
//钢种代码
this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
//钢种名称
this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
//钢级代码
this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
//钢级名称
this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
//炼钢判定标准
this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
//去向
this.rollingInfomation1.Value.Target = row1["target"].ToString();
//支
this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
//吨
this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
//切损去向
this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
//切损长度
this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
//切损重量
this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
//倍尺数
this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
//标准类别代码
this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
//标准类别描述
this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
//成品备注
this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
this.rollingInfomation1.UpdateData();
}
}
///
/// 流通卡赋值
///
///
public void RollingCardEditGrid(DataTable dt, string heatno)
{
if (dt.Rows.Count > 0)
{
//上料切前剔除支数
this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
//上料切前合格支数
this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
//上料剔除支数
this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
//上料合格支数
this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
//加热炉剔除支数
this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
//加热炉合格支数
this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
//穿孔剔除支数
this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
//穿孔合格支数
this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
//连轧剔除支数
this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
//连轧合格支数
this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
//再加热炉剔除支数
this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
//再加热炉合格支数
this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
//定径剔除支数
this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
//定径合格支数
this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
//分切前剔除支数
this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
//分切前合格支数
this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
//分切剔除支数
this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
//分切合格支数
this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
//矫直剔除支数
this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
//矫直合格支数
this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
//矫直下线支数
this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
//探伤剔除支数
this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
//探伤合格支数
this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
NativeMethodNew na = new NativeMethodNew(this.ob);
if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
{
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
}
else
{
if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
{
this.rollingCard1.Value.OfflineTesting = "";
}
else
{
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
}
}
//表检合格支数
this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
//表检废品支数
this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
//表检下线支数
this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
//表检返线支数
//this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
this.rollingCard1.UpdateData();
}
else
{
this.rollingCard1.ClearData();
}
}
///
/// 热取样实绩赋值
///
public void HotCheckMainResultEdit(DataTable dt)
{
if (dt.Rows.Count > 0)
{
DataRow row1 = dt.Rows[0];
//抽检人
this.colHotCheck1.Value.Inspector = row1["INSPECTOR"].ToString();
//孔型系列1
this.colHotCheck1.Value.PassSeries1 = row1["PASS_SERIES1"].ToString();
//孔型系列2
this.colHotCheck1.Value.PassSeries2 = row1["PASS_SERIES2"].ToString();
//孔型系列3
this.colHotCheck1.Value.PassSeries3 = row1["PASS_SERIES3"].ToString();
//孔型系列4
this.colHotCheck1.Value.PassSeries4 = row1["PASS_SERIES4"].ToString();
//2B值1
this.colHotCheck1.Value.DoubleB1 = row1["DOUBLE_B1"].ToString();
//2B值2
this.colHotCheck1.Value.DoubleB2 = row1["DOUBLE_B2"].ToString();
//2B值3
this.colHotCheck1.Value.DoubleB3 = row1["DOUBLE_B3"].ToString();
//2B值4
this.colHotCheck1.Value.DoubleB4 = row1["DOUBLE_B4"].ToString();
//开轧温度
this.colHotCheck1.Value.StartTemp = row1["START_TEMP"].ToString();
//终轧温度
this.colHotCheck1.Value.EndTemp = row1["END_TEMP"].ToString();
//外径
this.colHotCheck1.Value.Outdiameter = row1["OUTDIAMETER"].ToString();
//壁厚
this.colHotCheck1.Value.Wallthick = row1["WALLTHICK"].ToString();
//抽检时间
this.colHotCheck1.Value.CheckDate = row1["CHECK_DATE"].ToString();
//计划切头长度
this.colHotCheck1.Value.CutHeadP = row1["CUT_HEAD_LENGTHP"].ToString();
//计划切尾长度
this.colHotCheck1.Value.CutTrailP = row1["CUT_TRAIL_LENGTHP"].ToString();
//计划切定尺长度
this.colHotCheck1.Value.CutOrderP = row1["TARGET_LENGTH"].ToString();
DataTable dtPlan = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSingleMainPlanNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
if (dtPlan.Rows.Count > 0)
{
if (int.Parse(dtPlan.Rows[0]["NODE_STATUS"].ToString()) < 61)
{
//切头长度
if (!string.IsNullOrEmpty(row1["CUT_HEAD_LENGTHA"].ToString()))
{
this.colHotCheck1.Value.CutHead = row1["CUT_HEAD_LENGTHA"].ToString();
}
else
{
this.colHotCheck1.Value.CutHead = CutHeadBefore;
}
//切尾长度
if (!string.IsNullOrEmpty(row1["CUT_TRAIL_LENGTHA"].ToString()))
{
this.colHotCheck1.Value.CutTrail = row1["CUT_TRAIL_LENGTHA"].ToString();
}
else
{
this.colHotCheck1.Value.CutTrail = CutTrailBefore;
}
//切定尺长度
if (!string.IsNullOrEmpty(row1["ORDER_LENGTHA"].ToString()))
{
this.colHotCheck1.Value.CutOrder = row1["ORDER_LENGTHA"].ToString();
}
else
{
this.colHotCheck1.Value.CutOrder = CutOrderBefore;
}
}
else
{
this.colHotCheck1.Value.CutHead = row1["CUT_HEAD_LENGTHA"].ToString();
this.colHotCheck1.Value.CutTrail = row1["CUT_TRAIL_LENGTHA"].ToString();
this.colHotCheck1.Value.CutOrder = row1["ORDER_LENGTHA"].ToString();
}
}
//抽检员
string Inspector = "";
if (!string.IsNullOrEmpty(row1["INSPECTOR"].ToString()))
{
Inspector = row1["INSPECTOR"].ToString();
}
else
{
Inspector = _UserName;
}
this.colHotCheck1.Value.Inspector = Inspector;
//备注
this.colHotCheck1.Value.Remark = row1["REMARK"].ToString();
this.colHotCheck1.UpdateDate();
}
}
#endregion
private void ultraGrid1_CellChange(object sender, CellEventArgs e)
{
if (e.Cell.Column.Key == "pipe_location")
{
//e.Cell.Row.Index
ultraGrid1.UpdateData();
IQueryable urows = ultraGrid1.Rows.AsQueryable().Where(a => !a.Equals(e.Cell.Row));
foreach (UltraGridRow ugr in urows)
{
if (ugr.Cells["pipe_location"].Text.ToString() == e.Cell.Text.ToString())
{
string PipeLocation = e.Cell.Value.ToString();
switch (e.Cell.Value.ToString())
{
case "0":
PipeLocation = "管头";
break;
case "1":
PipeLocation = "管体";
break;
case "2":
PipeLocation = "管尾";
break;
}
MessageBox.Show("管位置【" + PipeLocation + "】已添加不能重复添加。");
dtHotCheck.Rows.RemoveAt(e.Cell.Row.Index);
return;
}
}
}
}
///
/// 打印报表
///
private void PrintResult()
{
Group = UserInfo.GetUserGroup();
Shift = UserInfo.GetUserOrder();
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
string StartTime = ""; // 开始时间 用于报表查询
string EndTime = ""; // 结束时间 用于报表查询
string strurl = "";
//晚班
Time = Time.Replace(":", "");
if (Shift == "3")
{
//查询晚班前一天20点40后到当天07点20前所有记录
if (int.Parse(Time) < 072000)
{
StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
EndTime = SeverTime.ToShortDateString() + " 07:20:00";
//string Date2 = SeverTime.ToString("yyyy-MM-dd");
}
//查询当天晚班的所有数据
else if (int.Parse(Time) > 204000)
{
StartTime = SeverTime.ToShortDateString() + " 20:40:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
}
}
//白班 中班
else
{
StartTime = SeverTime.ToShortDateString() + " 00:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
}
switch (PLineCode)
{
case "C008": //250
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality250.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=RepMilSamplingQuality258.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=RepMilSamplingQuality168.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=RepMilSamplingQuality460.cpt&format=pdf&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), 10, 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), 10, 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), 10, 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), 10, 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=RepMilSamplingQuality250.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=RepMilSamplingQuality258.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=RepMilSamplingQuality168.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=RepMilSamplingQuality460.cpt&format=pdf&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();
}
private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
}
}
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
{
// if (e.Control & e.KeyCode == Keys.C)
// {
// //HotCheckCopyEntity.PipeLocation = ultraGrid1.ActiveRow.Cells["pipe_location"].Text.ToString();
// HotCheckCopyEntity.D1 = ultraGrid1.ActiveRow.Cells["d1"].Value.ToString();
// HotCheckCopyEntity.D2 = ultraGrid1.ActiveRow.Cells["d2"].Value.ToString();
// HotCheckCopyEntity.D3 = ultraGrid1.ActiveRow.Cells["d3"].Value.ToString();
// HotCheckCopyEntity.D4 = ultraGrid1.ActiveRow.Cells["d4"].Value.ToString();
// HotCheckCopyEntity.S1 = ultraGrid1.ActiveRow.Cells["s1"].Value.ToString();
// HotCheckCopyEntity.S2 = ultraGrid1.ActiveRow.Cells["s2"].Value.ToString();
// HotCheckCopyEntity.S3 = ultraGrid1.ActiveRow.Cells["s3"].Value.ToString();
// HotCheckCopyEntity.S4 = ultraGrid1.ActiveRow.Cells["s4"].Value.ToString();
// HotCheckCopyEntity.S5 = ultraGrid1.ActiveRow.Cells["s5"].Value.ToString();
// HotCheckCopyEntity.S6 = ultraGrid1.ActiveRow.Cells["s6"].Value.ToString();
// HotCheckCopyEntity.S7 = ultraGrid1.ActiveRow.Cells["s7"].Value.ToString();
// HotCheckCopyEntity.S8 = ultraGrid1.ActiveRow.Cells["s8"].Value.ToString();
// CopyFlag = 1;
// MessageBox.Show("复制成功!");
// }
// if (e.Control & e.KeyCode == Keys.V)
// {
// if (CopyFlag == 1)
// {
// int index = ultraGrid1.ActiveRow.Index;
// //dtHotCheck.Rows[index]["pipe_location"] = HotCheckCopyEntity.PipeLocation;
// dtHotCheck.Rows[index]["s1"] = HotCheckCopyEntity.S1;
// dtHotCheck.Rows[index]["s2"] = HotCheckCopyEntity.S2;
// dtHotCheck.Rows[index]["s3"] = HotCheckCopyEntity.S3;
// dtHotCheck.Rows[index]["s4"] = HotCheckCopyEntity.S4;
// dtHotCheck.Rows[index]["s5"] = HotCheckCopyEntity.S5;
// dtHotCheck.Rows[index]["s6"] = HotCheckCopyEntity.S6;
// dtHotCheck.Rows[index]["s7"] = HotCheckCopyEntity.S7;
// dtHotCheck.Rows[index]["s8"] = HotCheckCopyEntity.S8;
// dtHotCheck.Rows[index]["d1"] = HotCheckCopyEntity.D1;
// dtHotCheck.Rows[index]["d2"] = HotCheckCopyEntity.D2;
// dtHotCheck.Rows[index]["d3"] = HotCheckCopyEntity.D3;
// dtHotCheck.Rows[index]["d4"] = HotCheckCopyEntity.D4;
// //CopyFlag = 0;
// }
// }
}
}
}