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 System.Net;
using Core.StlMes.Client.ZGMil.NodeResultQuery;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using System.Collections;
using Core.StlMes.Client.ZGMil.Popup;
using Core.StlMes.Client.ZGMil.Common;
using CoreFS.SA06;
namespace Core.StlMes.Client.ZGMil.Result
{
public partial class FrmPerforationResult : FrmBase
{
private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
#region 初始化
int PanelSizeFlag = 0;
RollingInfomation rf = new RollingInfomation();
FeedRowPlan QuertFeedplan = new FeedRowPlan();
MilPlan QueryMainPlan = new MilPlan();
FeedRowPlan Feedplan = new FeedRowPlan();
MilPlan MainPlan = new MilPlan();
SawResult FeedSawResult = new SawResult();
private string ActiveResultNo = "";
private string proPlanId = null;//轧管订单编号
private string gxPlanNo = null;//工序排产序号
private string lotNo = null;//生产批号
private int _MouseLocX = 0; //鼠标横坐标
private int _MouseLocY = 0; //鼠标纵坐标
private string ChangeUserID = ""; //接班用户名
private string ChangePassWord = ""; //接班密码
private int ShowMessageFlag = 0; //保存弹窗标识 0 弹出 1 不弹出
MilPerforationResultEntity tempperforation = new MilPerforationResultEntity();
private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号
private string ActiveStatus = null;//主计划活动行的状态
string Shift = "";
string Group = "";
private string Departm = "";//部门
private string PlineCode = "";//产线
string PlanStatusQuery = "29";
string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
private string _UserName = "";
private string _UserID = "";
private string _Url = "";
private int ChangeFlag = 0; //交班标识
public FrmPerforationResult()
{
InitializeComponent();
//this.perforationResult1.UltraGrid1.ClickCellButton += new CellEventHandler(UltraGrid1_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;
}
}
///
/// 交班取消
///
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;
}
NativeMethodNew nass = new NativeMethodNew(this.ob);
nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 2);
ultraGridTC();
DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dtFurResult.Rows.Count > 0)
{
PerResultEditForRack(dtFurResult);
}
GetGridButtonName();
ChangeGridColor();
}
}
protected override void OnLoad(EventArgs e)
{
Shift = UserInfo.GetUserOrder();
Group = UserInfo.GetUserGroup();
base.OnLoad(e);
foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
{
ugc.SortIndicator = SortIndicator.Disabled;
}
rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
perforationResult1.UltraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGrid_GHDL.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
PanelSizeFlag = 0;
splitContainer2.SplitterDistance = 180;
InitControl();
timer1.Tick += new EventHandler(timer1_Tick);
ShowShift();
}
private void ShowShift()
{
colShowShiftGroup1.Ob = this.ob;
colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
colShowShiftGroup1.ShowShift();
colShowShiftGroup1.Timer1.Enabled = true;
}
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;
}
GetGridButtonName();
}
///
/// 页面开启事件
///
///
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();
}
switch (PlineCode)
{
case "C008":
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["bite_angle"].Header.Caption = "轧辊倾角";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dp_gg"].Header.Caption = "导盘中径";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].Header.Caption = "导盘位置左";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].Header.Caption = "导盘位置右";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].Header.Appearance.ForeColor = Color.Gray;
break;
case "C009":
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_speed"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_speed"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dt_code"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dt_code"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["roller_space"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_space"].CellActivation = Activation.NoEdit;
break;
case "C010":
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
break;
case "C017":
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_up"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_up"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_down"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_down"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].CellActivation = Activation.NoEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].Header.Appearance.ForeColor = Color.Gray;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].Header.Caption = "顶头代号";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].MaskInput = "";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].MaxLength = 20;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["roll_motor_speed"].Header.Caption = "轧辊转速(rpm)";
break;
case "C072":
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_zj"].CellActivation = Activation.AllowEdit;
break;
}
Sign();
frmTechnological1.InitMilSet(PlineCode, "40050", this.ob);
PlanQuery();
}
///
/// 签名
///
private void Sign()
{
ColUserName col = new ColUserName();
col.StationId = "2";
col.PlineCode = PlineCode;
col.ColGroup = Group;
col.Ob = this.ob;
col.ShowDialog();
_UserID = col.getUserId();
_UserName = col.getUserName();
}
private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
{
if (this.chkHeatNo.Checked)
{
this.txtJudgeStoveNo.Enabled = true;
}
else
{
this.txtJudgeStoveNo.Enabled = false;
}
}
///
/// 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;
// }
//}
public void GetGridButtonName()
{
if (ultraGrid_GHDL.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGrid_GHDL.Rows)
{
ugr.Cells["SCRAP_SLAB"].Value = "剔除管坯";
ugr.Cells["DELBACK"].Value = "剔料回退";
}
}
if (ultraGridPlan.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGridPlan.Rows)
{
NativeMethodNew NaMethod = new NativeMethodNew(this.ob);
string Judge_Stove_No = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
//if (NaMethod.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;
}
}
}
}
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "DoQuery":
if (chkHeatNo.Checked)
{
if (string.IsNullOrEmpty(txtJudgeStoveNo.Text))
{
MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
if (this.chkLotNo.Checked)
{
if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
{
MessageBox.Show("请输入需查询的轧批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
PlanQuery();
break;
case "DoSave":
PerResultSave();
break;
case "DoNode":
FeedSawResultNode();
break;
case "DoNodeBack":
NodeBack();
break;
case "DoQueryBefore":
QueryBefore();
break;
case "DoStart":
DoStart();
break;
case "DoStartBack":
StartBack();
break;
case "NodeQuery":
NodeQuery();
break;
case "DoToolChange":
DoToolChange();
break;
case "DoSign":
Sign();
break;
case "DoChangeCancel":
ChangeCancel();
break;
case "DoPrint":
PrintResult();
break;
case "Close":
this.Dispose();
this.Close();
break;
}
}
public void PlanQuery()
{
string PrimaKey = "";
UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
if (ugr != null)
{
PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
}
//if (dtStartDate.DateTime > dtEndDate.DateTime)
//{
// MessageBox.Show("开始时间不能大于结束时间。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//}
//if (chkDate.Checked == true)
//{
// QueryMainPlan.StartTime = this.dtStartDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
// QueryMainPlan.EndTime = this.dtEndDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
//}
//else
//{
// QueryMainPlan.StartTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
// QueryMainPlan.EndTime = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd HH:mm:ss");
//}
if (chkHeatNo.Checked == true)
{
QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
}
else
{
QueryMainPlan.JudgeStoveNo = "";
}
if (chkLotNo.Checked == true)
{
QueryMainPlan.LotNo = this.txtLOT_NO.Text;
}
else
{
QueryMainPlan.LotNo = "";
}
dtPlan.Clear();
//查询主表记录
QueryMainPlan.PlineCode = PlineCode;
QueryMainPlan.Status = PlanStatusQuery;
QueryMainPlan.StartStatus = PlanStartStatusQuery;
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 3 }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
//ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
GetGridButtonName();
ChangeGridColor();
if (dt.Rows.Count > 0)
{
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;
}
}
}
}
else
{
if (ShowMessageFlag == 1)
{
MessageBox.Show("没有查询的数据!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
{
dtTC.Clear();
if (this.dtPlan.Rows.Count > 0)
{
UltraGridRow ugr = ultraGridPlan.ActiveRow;
//UltraGridRow ugr = e.Row;
if (ugr != null)
{
//查询主计划信息
string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
lotNo = ugr.Cells["LOT_NO"].Value.ToString();
MainPlan.JudgeStoveNo = HeatNo;
MainPlan.ProPlanId = proPlanId;
MainPlan.GxPlanNo = gxPlanNo;
ActiveJUDGE_STOVE_NO = HeatNo;
ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
ActiveResultNo = ugr.Cells["ID"].Value.ToString();
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
GetRollingCard();
if (ugr.Cells["IS_START"].Value.ToString() != "未开始穿孔")
{
ultraGridTC();
}
else
{
dtTC.Clear();
}
if (dtMP.Rows.Count > 0)
{
GridEdit(dtMP); //轧制计划信息
}
GetGridButtonName();
ChangeGridColor();
DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { HeatNo, proPlanId, gxPlanNo }, this.ob);
if (dtFurResult.Rows.Count > 0)
{
PerResultEdit(dtFurResult, dtMP);
}
else
{
MilPerforationResultEntity pr = new MilPerforationResultEntity();
this.perforationResult1.Value = pr;
}
}
}
}
public void PerResultEdit(DataTable dt, DataTable dtMP)
{
UltraGridRow ugr = this.rollingCard1.UltraGrid4.Rows[0];
if (dt.Rows.Count == 0)
{
MilPerforationResultEntity pr = new MilPerforationResultEntity();
this.perforationResult1.Value = pr;
}
else
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
perforationResult1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
perforationResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, 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(perforationResult1.Value.ScrapNum.ToString()))
{
//合格支数
perforationResult1.Value.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(perforationResult1.Value.ScrapNum.ToString());
}
else
{
perforationResult1.Value.PerforationNum = 0;
}
}
else
{ perforationResult1.Value.PerforationNum = 0; }
}
this.perforationResult1.Value.JzbNum = dt.Rows[0]["jzb_num"].ToString();
this.perforationResult1.Value.FrontExtendingQuantity = dt.Rows[0]["front_extending_quantity"].ToString();
this.perforationResult1.Value.RollerSpace = dt.Rows[0]["roller_space"].ToString();
this.perforationResult1.Value.GuideSpace = dt.Rows[0]["guide_space"].ToString();
if (PlineCode == "C008" || PlineCode == "C009")
{
if (dtMP != null)
{
this.perforationResult1.Value.CapillarySize = dtMP.Rows[0]["PIPE_SECTION"].ToString() + "x" + dtMP.Rows[0]["DB_LENGTH"].ToString();
}
}
else
{
this.perforationResult1.Value.CapillarySize = dt.Rows[0]["CAPILLARY_SIZE"].ToString();
}
this.perforationResult1.Value.CapollaryWallThickness = dt.Rows[0]["capollary_wall_thickness"].ToString();
this.perforationResult1.Value.BiteAngle = dt.Rows[0]["bite_angle"].ToString();
this.perforationResult1.Value.GuideDiscMotorSpeed = dt.Rows[0]["guide_disc_motor_speed"].ToString();
this.perforationResult1.Value.HeadDiameter = dt.Rows[0]["head_diameter"].ToString();
this.perforationResult1.Value.RollMotorSpeed = dt.Rows[0]["roll_motor_speed"].ToString();
this.perforationResult1.Value.RollMotorSjb = dt.Rows[0]["roll_motor_sjb"].ToString();
this.perforationResult1.Value.KzTemp = dt.Rows[0]["kz_temp"].ToString();
this.perforationResult1.Value.AmountOfBorax = dt.Rows[0]["AMOUNT_OF_BORAX"].ToString();
this.perforationResult1.Value.Remark = dt.Rows[0]["Remark"].ToString();
this.perforationResult1.Value.StartTime = dt.Rows[0]["start_time"].ToString();
this.perforationResult1.Value.EndTime = dt.Rows[0]["end_time"].ToString();
this.perforationResult1.Value.BoraxPressure = dt.Rows[0]["borax_pressure"].ToString();
this.perforationResult1.Value.GuideDiscMotorLoca = dt.Rows[0]["guide_disc_motor_loca"].ToString();
this.perforationResult1.Value.DbLoca = dt.Rows[0]["db_loca"].ToString();
this.perforationResult1.Value.DbLocaDown = dt.Rows[0]["db_loca_down"].ToString();
this.perforationResult1.Value.DpGg = dt.Rows[0]["dp_gg"].ToString();
this.perforationResult1.Value.DtCode = dt.Rows[0]["dt_code"].ToString();
this.perforationResult1.Value.ZgZj = dt.Rows[0]["zg_zj"].ToString();
this.perforationResult1.Value.ZgLocaDown = dt.Rows[0]["zg_loca_down"].ToString();
this.perforationResult1.Value.ZgLocaUp = dt.Rows[0]["zg_loca_up"].ToString();
this.perforationResult1.Value.BeginRollingTemp = dt.Rows[0]["BEGIN_ROLLING_TEMP"].ToString();
//this.perforationResult1.Value.ca
this.perforationResult1.UpdateData();
}
if (!string.IsNullOrEmpty(ugr.Cells["ScrapNum4"].Value.ToString()))
{
this.perforationResult1.Value.ScrapNum = ugr.Cells["ScrapNum4"].Value.ToString();
}
else
{
this.perforationResult1.Value.ScrapNum = "0";
}
if (!string.IsNullOrEmpty(ugr.Cells["QualifiedNum4"].Value.ToString()))
{
this.perforationResult1.Value.PerforationNum = ugr.Cells["QualifiedNum4"].Value.ToString();
}
else
{
this.perforationResult1.Value.PerforationNum = "0";
}
}
public void PerResultEditForRack(DataTable dt)
{
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
perforationResult1.Value.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
perforationResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, 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(perforationResult1.Value.ScrapNum.ToString()))
{
//合格支数
perforationResult1.Value.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(perforationResult1.Value.ScrapNum.ToString());
}
else
{
perforationResult1.Value.PerforationNum = 0;
}
}
else
{ perforationResult1.Value.PerforationNum = 0; }
}
this.perforationResult1.Value.JzbNum = dt.Rows[0]["jzb_num"].ToString();
this.perforationResult1.UpdateDataForRack();
}
///
/// 判断是否能开始当前炉次
///
///
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;
}
public void GetRollingCard()
{
UltraGridRow ugr = ultraGridPlan.ActiveRow;
if (ugr != null)
{
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
DataTable dt = new DataTable();
if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
{
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
}
else
{
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
}
RollingCardEditGrid(dt, JudgeStoveNo);
}
}
///
/// 轧制信息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.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();
}
}
//查询计划对应的对列
public void ultraGridTC()
{
dtTC.Clear();
if (this.dtPlan.Rows.Count > 0)
{
UltraGridRow ugr = ultraGridPlan.ActiveRow;
//UltraGridRow ugr = e.Row;
if (ugr != null)
{
string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
MainPlan.JudgeStoveNo = HeatNo;
MainPlan.ProPlanId = proPlanId;
MainPlan.GxPlanNo = gxPlanNo;
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getSingleMainPlanTC", new object[] { MainPlan }, this.ob);
GridHelper.CopyDataToDatatable(ref dtMP, ref this.dtTC, true);
ultraGrid_GHDL.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
}
}
}
// private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
private void DoStart()
{
MilPerforationResultEntity PerResult1 = new MilPerforationResultEntity();
NativeMethodNew NaMethod = new NativeMethodNew(this.ob);
if (ultraGridPlan.Rows.Count > 0)
{
//if (!IsStart())
//{
// return;
//}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
if (ugr == null)
{
MessageBox.Show("未选择任何计划。请选择当前生产计划后再开始穿孔操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string Judge_Stove_No = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
ActiveJUDGE_STOVE_NO = Judge_Stove_No;
ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
NativeMethodNew Nvw = new NativeMethodNew(this.ob);
//if (!Nvw.isBegineNode(Judge_Stove_No, 1))
//{
// MessageBox.Show("炉号【"+Judge_Stove_No.Substring(0,6)+"】未入炉,不能穿孔。");
// return;
//}
if (ActiveStatus == "穿孔完成")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】已完成穿孔操作,不允许再次进行穿孔操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (ActiveStatus == "已开始穿孔")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】已开始穿孔,不允许再次进行穿孔操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (!NaMethod.isBegineNode(Judge_Stove_No, 0))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】未开始锯切,不能进行穿孔!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (ugr != null && ugr.Cells["IS_START"].Value.ToString() != "已开始穿孔")
{
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + MainPlan.JudgeStoveNo + "】穿孔开始?") == DialogResult.No)
//{
// return;
//}
if (tempperforation != null)
{
PerResult1.FrontExtendingQuantity = tempperforation.FrontExtendingQuantity;
PerResult1.RollerSpace = tempperforation.RollerSpace;
PerResult1.GuideSpace = tempperforation.GuideSpace;
PerResult1.CapillarySize = tempperforation.CapillarySize;
PerResult1.CapollaryWallThickness = tempperforation.CapollaryWallThickness;
PerResult1.BiteAngle = tempperforation.BiteAngle;
PerResult1.GuideDiscMotorSpeed = tempperforation.GuideDiscMotorSpeed;
PerResult1.HeadDiameter = tempperforation.HeadDiameter;
PerResult1.RollMotorSpeed = tempperforation.RollMotorSpeed;
PerResult1.RollMotorSjb = tempperforation.RollMotorSjb;
PerResult1.KzTemp = tempperforation.KzTemp;
PerResult1.AmountOfBorax = tempperforation.AmountOfBorax;
PerResult1.Remark = tempperforation.Remark;
PerResult1.StartTime = tempperforation.StartTime;
PerResult1.EndTime = tempperforation.EndTime;
PerResult1.BoraxPressure = tempperforation.BoraxPressure;
PerResult1.GuideDiscMotorLoca = tempperforation.GuideDiscMotorLoca;
PerResult1.DbLoca = tempperforation.DbLoca;
PerResult1.DpGg = tempperforation.DpGg;
PerResult1.DtCode = tempperforation.DtCode;
PerResult1.ZgZj = tempperforation.ZgZj;
PerResult1.ZgLocaDown = tempperforation.ZgLocaDown;
PerResult1.ZgLocaUp = tempperforation.ZgLocaUp;
PerResult1.BeginRollingTemp = tempperforation.BeginRollingTemp;
PerResult1.DbLocaDown = tempperforation.DbLocaDown;
}
perforationResult1.Update();
string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
ActiveJUDGE_STOVE_NO = HeatNo;
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); //轧制计划信息
string PLineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
string LotNo = dtMP.Rows[0]["LOT_NO"].ToString();
string StoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();
string Judge_stove_no = dtMP.Rows[0]["judge_stove_no"].ToString();
UltraGridRow ugr1 = this.perforationResult1.UltraGrid1.Rows[0];
PerResult1.PlineCode = PLineCode;
PerResult1.LotNo = LotNo;
PerResult1.StoveNo = StoveNo;
PerResult1.JudgeStoveNo = Judge_stove_no;
PerResult1.ColMode = "0";
PerResult1.ColGroup = UserInfo.GetUserGroup();
PerResult1.ColShift = UserInfo.GetUserOrder();
PerResult1.ColUser = UserInfo.GetUserName();
PerResult1.ResultNo = ResultNo;
PerResult1.ProPlanId = proPlanId;
PerResult1.GxPlanNo = gxPlanNo;
//int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.UpdatePerforationStatue", new object[] { Feedplan }, this.ob);
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.UpdatePerforationStatue", new object[] { PerResult1 }, this.ob);
NativeMethodNew na = new NativeMethodNew(this.ob);
na.InsertSTAferDoubleClick(Judge_Stove_No, 2, "0", proPlanId, gxPlanNo);
PlanQuery();
ultraGridTC();
GetGridButtonName();
ChangeGridColor();
//if (ugr.Cells["IS_START"].Value.ToString() == "已开始穿孔")
//{
// ultraGridTC();
//}
}
else
{
MessageBox.Show("状态不符,不能穿孔。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
private void perforationResult1_Load(object sender, EventArgs e)
{
}
private void ultraGridMatSeq_ClickCellButton(object sender, CellEventArgs e)
{
MilSlabScrapSeqEntity ScrapSlab = new MilSlabScrapSeqEntity();
UltraGridRow ugr = ultraGrid_GHDL.ActiveRow;
UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
HOTMethod hm = new HOTMethod(this.ob);
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr1.Cells["ID"].Value.ToString();
String MAT_NO = ugr.Cells["MAT_NO"].Value.ToString();
String Seq = ugr.Cells["seq"].Value.ToString();
int Seq1 = int.Parse(Seq);
string PlanStatus = ugr1.Cells["IS_START"].Value.ToString();
string DlSTATUS = ugr.Cells["STATUS"].Value.ToString();
string shif = ugr.Cells["COL_SHIFT"].Value.ToString();
string group = ugr.Cells["COL_GROUP"].Value.ToString();
NativeMethodNew nasssss = new NativeMethodNew(this.ob);
if (nasssss.IsRackOperate(shif, group))
{
MessageBox.Show("序号:【" + Seq + "】管已由" + shif + "," + group + "交班操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (PlanStatus == "未开始穿孔")
{
if (e.Cell.Column.Key == "CHANGE_NUM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else if (e.Cell.Column.Key == "BTNCHANGECOM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成穿孔操作,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔未开始,不能剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
if (PlanStatus == "穿孔完成")
{
if (e.Cell.Column.Key == "CHANGE_NUM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔完成,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔完成,不能剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
if (e.Cell.Column.Key == "SCRAP_SLAB")
{
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;
}
}
}
//查询前几道工序累计剔除多少半成品管(管坯等进行换算)
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
ccp.MethodName = "scrapMatCheck";
ccp.ServerParams = new Object[] { JudgeStoveNo, 3, proPlanId, gxPlanNo };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
if (e.Cell.Column.Key == "SCRAP_SLAB")
{
if (DlSTATUS != "正常轧制")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】该条已经剔除,不能重复剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//if (MessageUtil.ShowYesNoAndQuestion("是否剔除该毛管") == DialogResult.No)
//{
// return;
//}
int i = 0;
foreach (UltraGridRow uRow in ultraGrid_GHDL.Rows)
{
if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) > 2)
{
i = i +1;
}
}
if (int.Parse(Seq) < 3 && i > 0)
{
if (MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,是否确认剔除。") == DialogResult.No)
{
return;
}
}
if (ultraGrid_GHDL.Rows.Count - ScrapNumBefore < Seq1)
{
MessageBox.Show("管号【" + Seq + "】,已被前道工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//if(ugr.Cells["MAT_NO"].Text == "")
//{
// MessageBox.Show("管号【" + Seq + "】,已被前道工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
//管排锯切前判断当前管坯序号是否已剔除
//DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { JudgeStoveNo, Seq }, this.ob);
//if (dtSeq.Rows.Count > 0)
//{
// MessageBox.Show("不存在序号为【" + Seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
ScrapSlab.JudgeStoveNo = JudgeStoveNo;
ScrapSlab.Seq = Seq;
ScrapSlab.ProcessNo = "3";
ScrapSlab.Flag = "0";
ScrapSlab.ColMode = "1";
ScrapSlab.ColUser = UserInfo.GetUserName();
ScrapSlab.ColGroup = UserInfo.GetUserGroup();
ScrapSlab.ColShift = UserInfo.GetUserOrder();
ScrapSlab.ProPlanId = proPlanId;
ScrapSlab.GxPlanNo = gxPlanNo;
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.scrapFurMat", new object[] { ScrapSlab }, this.ob);
//剔除支数+1
int ScrapNum = 0;
if (string.IsNullOrEmpty(perforationResult1.Value.ScrapNum.ToString()))
{
ScrapNum = 1;
}
else
{
ScrapNum = int.Parse(perforationResult1.Value.ScrapNum.ToString()) + count;
}
perforationResult1.Value.ScrapNum = ScrapNum;
perforationResult1.UpdateData();
//UltraGridRow ugr2 = rollingCard1.UltraGrid4.Rows[0];
//string lailiao = ugr2.Cells["QualifiedNum3"].Value.ToString();
//int ck = 0;
//if (string.IsNullOrEmpty(lailiao))
//{
// ck = 0;
//}
//else
//{
// ck = int.Parse(lailiao) - ScrapNum;
//}
//perforationResult1.Value.PerforationNum = ck;
// MessageBox.Show("管序号【" + Seq + "】剔除成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
if (e.Cell.Column.Key == "DELBACK")
{
//if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
//{
// return;
//}
if (!DlSTATUS.Equals("剔除"))
{
MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
NativeMethodNew na = new NativeMethodNew(this.ob);
int counts = na.DeleteSlabSeq(JudgeStoveNo, Seq.ToString(), 3, 1, 0, proPlanId, gxPlanNo);
if (counts > 0)
{
// MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
//交班
if (e.Cell.Column.Key == "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[] { JudgeStoveNo, ResultNo, 2, 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 > ultraGrid_GHDL.Rows.Count - ScrapNumBefore)
{
MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
return;
}
// int Seq = int.Parse(e.Cell.Row.Cells["SEQ"].Value.ToString());
//int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0 }, this.ob);
//ChangeFlag = 1;
hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 2, int.Parse(Seq), 0);
}
//接班
if (e.Cell.Column.Key == "BTNCHANGECOM")
{
int BeforeChangeNum = 0;
//查询上个班交班支数
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 2, 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, "", 2, 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";
//未登录
//if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "2", PlineCode))
//{
//FrmChangeGroup frmCg = new FrmChangeGroup(this.ob);
//frmCg.ShowDialog();
//if (frmCg.DialogResult == DialogResult.OK)
if (this.DoRelogin(DoCheck))
{
//插入接班确认履历表
hm.InsertChangeRemuse(Shift, Group, _UserName, "2", PlineCode);
int Seq2 = int.Parse(Seq);
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0, proPlanId, gxPlanNo }, this.ob);
ChangeFlag = 1;
}
//}
//else
//{
// int Seq2 = int.Parse(Seq);
// int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0 }, this.ob);
// ChangeFlag = 1;
//}
}
//过渡方法,接班后重登陆初始化导致Grid.Row为null
if (ultraGrid_GHDL.Rows == null)
{
return;
}
ultraGridTC();
ultraGrid_GHDL.Refresh();
GetRollingCard();
GetGridButtonName();
ChangeGridColor();
MainPlan.JudgeStoveNo = JudgeStoveNo;
MainPlan.ProPlanId = proPlanId;
MainPlan.GxPlanNo = gxPlanNo;
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dtFurResult.Rows.Count > 0)
{
PerResultEdit(dtFurResult, dtMP);
}
else
{
MilPerforationResultEntity pr = new MilPerforationResultEntity();
this.perforationResult1.Value = pr;
}
}
public string DoCheck(CoreUserInfo User)
{
return "";
}
public void ChangeGridColor()
{
foreach (UltraGridRow ugr in ultraGridPlan.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() == "穿孔完成")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
}
foreach (UltraGridRow ugr in ultraGrid_GHDL.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;
}
}
}
}
///
/// 保存
///
MilPerforationResultEntity PerResult = new MilPerforationResultEntity();
public void PerResultSave()
{
try
{
perforationResult1.UltraGrid1.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
UltraGridRow ugr1 = perforationResult1.UltraGrid1.Rows[0];
UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0];
//string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ActiveResultNo;
if (this.ultraGridPlan.ActiveRow == null && ActiveJUDGE_STOVE_NO == null)
{
MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (this.ultraGridPlan.ActiveRow == null)
{
PerResult.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
}
else
{
PerResult.JudgeStoveNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
}
if (ActiveStatus == "未开始穿孔")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(PerResult.JudgeStoveNo.ToString()) + "】未开始穿孔,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//if (ActiveStatus == "穿孔完成")
//{
// MessageBox.Show("炉号:【" + PerResult.JudgeStoveNo + "】已完成穿孔,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + PerResult.JudgeStoveNo + "】保存实绩?") == DialogResult.No)
//{
// return;
//}
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
//PerResult.JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
//剔除支数
if (!string.IsNullOrEmpty(ugr1.Cells["scrap_num"].Value.ToString()))
{
PerResult.ScrapNum = ugr1.Cells["scrap_num"].Value.ToString();
}
else
{
PerResult.ScrapNum = "0";
}
PerResult.PerforationNum = 0;
// 合格支数
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, 2, 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(PerResult.ScrapNum.ToString()))
{
//合格支数
PerResult.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(PerResult.ScrapNum.ToString());
}
}
}
//入炉支数
string lailiao = ugr2.Cells["QualifiedNum3"].Value.ToString();
PerResult.DbLoca = ugr1.Cells["db_loca_up"].Value.ToString();//导板位置上
PerResult.DbLocaDown = ugr1.Cells["db_loca_down"].Value.ToString();//导板位置下
PerResult.ZgLocaUp = ugr1.Cells["zg_loca_up"].Value.ToString();//轧辊位置上
PerResult.ZgLocaDown = ugr1.Cells["zg_loca_down"].Value.ToString();//轧辊位置下
double DbUp = 0;
double DbDown = 0;
double RollerUp = 0;
double RollerDown = 0;
if (!string.IsNullOrEmpty(PerResult.DbLoca.ToString()))
{
DbUp = double.Parse(PerResult.DbLoca.ToString());
}
if (!string.IsNullOrEmpty(PerResult.DbLocaDown.ToString()))
{
DbDown = double.Parse(PerResult.DbLocaDown.ToString());
}
if (!string.IsNullOrEmpty(PerResult.ZgLocaUp.ToString()))
{
RollerUp = double.Parse(PerResult.ZgLocaUp.ToString());
}
if (!string.IsNullOrEmpty(PerResult.ZgLocaDown.ToString()))
{
RollerDown = double.Parse(PerResult.ZgLocaDown.ToString());
}
PerResult.RollerSpace = ugr1.Cells["roller_space"].Value.ToString();//辊距
PerResult.GuideSpace = ugr1.Cells["guide_space"].Value.ToString();//导距
PerResult.FrontExtendingQuantity = ugr1.Cells["front_extending_quantity"].Value.ToString(); //前伸量7o
PerResult.BiteAngle = ugr1.Cells["bite_angle"].Value.ToString();//咬入角
PerResult.HeadDiameter = ugr1.Cells["head_diameter"].Value.ToString();//顶头直径
PerResult.RollMotorSpeed = ugr1.Cells["roll_motor_speed"].Value.ToString();//轧辊电机速度
PerResult.GuideDiscMotorSpeed = ugr1.Cells["guide_disc_motor_speed"].Value.ToString();//导盘电机速度
PerResult.BoraxPressure = ugr1.Cells["borax_pressure"].Value.ToString();//硼砂压力
PerResult.AmountOfBorax = ugr1.Cells["AMOUNT_OF_BORAX"].Value.ToString();//硼砂量
PerResult.CapillarySize = ugr1.Cells["CapillarySize"].Value.ToString();//毛管壁厚
PerResult.CapollaryWallThickness = ugr1.Cells["capollary_wall_thickness"].Value.ToString();//毛管外径
PerResult.StartTime = ugr1.Cells["start_time"].Value.ToString();//开始时间
PerResult.EndTime = ugr1.Cells["end_time"].Value.ToString();//结束时间
PerResult.Remark = ugr1.Cells["Remark"].Value.ToString();//备注
PerResult.JzbNum = ugr1.Cells["JzbNum"].Value.ToString();//交接班支数
PerResult.KzTemp = ugr1.Cells["kz_temp"].Value.ToString();//开扎温度
PerResult.DpGg = ugr1.Cells["dp_gg"].Value.ToString();//导板规格
PerResult.GuideDiscMotorLoca = ugr1.Cells["guide_disc_motor_loca"].Value.ToString();//导盘位置
PerResult.RollMotorSjb = ugr1.Cells["roll_motor_sjb"].Value.ToString();//轧辊转速升降比
PerResult.ZgZj = ugr1.Cells["zg_zj"].Value.ToString();//轧辊直径
PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();//顶头代码
PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();
PerResult.BeginRollingTemp = ugr1.Cells["beginRollingTemp"].Value.ToString();
PerResult.NodeFurFlag = "0";
PerResult.ProPlanId = proPlanId;
PerResult.GxPlanNo = gxPlanNo;
if (string.IsNullOrEmpty(PerResult.StartTime.ToString()))
{
MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
return;
}
//查询结炉状态,已结炉的计划 结炉时间不能为空
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (int.Parse(dt.Rows[0][0].ToString()) > 29)
{
if (string.IsNullOrEmpty(PerResult.EndTime.ToString()))
{
MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
return;
}
//开始时间必须小于结束时间
if (DateTime.Parse(PerResult.StartTime.ToString()) > DateTime.Parse(PerResult.EndTime.ToString()))
{
MessageBox.Show("结束时间不能小于开始时间。");
return;
}
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.savePerResult", new object[] { PerResult }, this.ob);
if (ShowMessageFlag == 0)
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(PerResult.JudgeStoveNo.ToString()) + "】保存成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
PlanQuery();
}
GetRollingCard();
this.perforationResult1.IsCellSelect = false;
tempperforation = NativeMethod.GetEntityToEntity(tempperforation, PerResult);//保存后全局变量赋值
PlanQuery();
}
///
/// 结炉
///
public void FeedSawResultNode()
{
PerResultSave();
HOTMethod hm = new HOTMethod(this.ob);
try
{
perforationResult1.UltraGrid1.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间格式");
return;
}
UltraGridRow ugr = ultraGridPlan.ActiveRow;
UltraGridRow ugr1 = perforationResult1.UltraGrid1.Rows[0];
UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0];
if (ultraGrid_GHDL.Rows.Count == 0)
{
MessageBox.Show("没有生成管号队列,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//判断是否有重复剔除的坯子
foreach (UltraGridRow ugr4 in ultraGrid_GHDL.Rows)
{
if (ugr4.Cells["MAT_NO"].Value.ToString().Equals("") && ugr4.Cells["STATUS"].Value.ToString().Equals("剔除"))
{
MessageBox.Show("不存在序号第【" + ugr4.Cells["SEQ"].Value.ToString() + "】的坯子,它已被其它工序剔除,不能再次剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
if (ugr != null)
{
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string Status = ugr.Cells["IS_START"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
if (Status == "穿孔完成")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成穿孔操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (Status == "未开始穿孔")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//查看结炉标识
DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetSingleJRLResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dtFlag.Rows.Count > 0)
{
string NodeFlag = dtFlag.Rows[0]["NODE_FUR_FLAG"].ToString();
if (NodeFlag == "0")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】不能结炉。该炉在上一道工序未结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 2) > 0)
{
MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 2) + "】未接班确认,不能结炉");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉?") == DialogResult.No)
{
return;
}
//剔除支数
PerResult.ScrapNum = "0";
//查询本道工序剔除支数
DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtScrapNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
{
PerResult.ScrapNum = dtScrapNum.Rows[0][0].ToString();
}
}
DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, 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(PerResult.ScrapNum.ToString()))
{
//合格支数
PerResult.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(PerResult.ScrapNum.ToString());
}
else
{
PerResult.PerforationNum = 0;
}
}
else
{ PerResult.PerforationNum = 0; }
}
//PerResult.PerforationNum = ck;
PerResult.DbLoca = ugr1.Cells["db_loca_up"].Value.ToString();//导板位置上
PerResult.DbLocaDown = ugr1.Cells["db_loca_down"].Value.ToString();//导板位置下
PerResult.ZgLocaUp = ugr1.Cells["zg_loca_up"].Value.ToString();//轧辊位置上
PerResult.ZgLocaDown = ugr1.Cells["zg_loca_down"].Value.ToString();//轧辊位置下
double DbUp = 0;
double DbDown = 0;
double RollerUp = 0;
double RollerDown = 0;
if (!string.IsNullOrEmpty(PerResult.DbLoca.ToString()))
{
DbUp = double.Parse(PerResult.DbLoca.ToString());
}
if (!string.IsNullOrEmpty(PerResult.DbLocaDown.ToString()))
{
DbDown = double.Parse(PerResult.DbLocaDown.ToString());
}
if (!string.IsNullOrEmpty(PerResult.ZgLocaUp.ToString()))
{
RollerUp = double.Parse(PerResult.ZgLocaUp.ToString());
}
if (!string.IsNullOrEmpty(PerResult.ZgLocaDown.ToString()))
{
RollerDown = double.Parse(PerResult.ZgLocaDown.ToString());
}
PerResult.RollerSpace = ugr1.Cells["roller_space"].Value.ToString();//辊距
PerResult.GuideSpace = ugr1.Cells["guide_space"].Value.ToString();//导距
PerResult.FrontExtendingQuantity = ugr1.Cells["front_extending_quantity"].Value.ToString(); //前伸量
PerResult.BiteAngle = ugr1.Cells["bite_angle"].Value.ToString();//咬入角
PerResult.HeadDiameter = ugr1.Cells["head_diameter"].Value.ToString();//顶头直径
PerResult.RollMotorSpeed = ugr1.Cells["roll_motor_speed"].Value.ToString();//轧辊电机速度
PerResult.GuideDiscMotorSpeed = ugr1.Cells["guide_disc_motor_speed"].Value.ToString();//导盘电机速度
//PerResult.BoraxTank = ugr1.Cells["borax_tank"].Value.ToString();//硼砂罐
PerResult.BoraxPressure = ugr1.Cells["borax_pressure"].Value.ToString();//硼砂压力
PerResult.AmountOfBorax = ugr1.Cells["AMOUNT_OF_BORAX"].Value.ToString();//硼砂量
PerResult.CapillarySize = ugr1.Cells["CapillarySize"].Value.ToString();//毛管规格
PerResult.CapollaryWallThickness = ugr1.Cells["capollary_wall_thickness"].Value.ToString();//毛管外径
PerResult.StartTime = ugr1.Cells["start_time"].Value.ToString();//开始时间
PerResult.EndTime = ugr1.Cells["end_time"].Value.ToString();//结束时间
PerResult.Remark = ugr1.Cells["Remark"].Value.ToString();//备注
PerResult.JzbNum = ugr1.Cells["JzbNum"].Value.ToString();//交接班支数
PerResult.KzTemp = ugr1.Cells["kz_temp"].Value.ToString();//开扎温度
PerResult.DpGg = ugr1.Cells["dp_gg"].Value.ToString();//导板规格
PerResult.GuideDiscMotorLoca = ugr1.Cells["guide_disc_motor_loca"].Value.ToString();//导盘位置
PerResult.RollMotorSjb = ugr1.Cells["roll_motor_sjb"].Value.ToString();//轧辊转速升降比
PerResult.ZgZj = ugr1.Cells["zg_zj"].Value.ToString();//轧辊直径
PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();//顶头代码
PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();
PerResult.BeginRollingTemp = ugr1.Cells["beginRollingTemp"].Value.ToString();
//合格吨
double DBHeight = 0;
double BurnningRate = 0;
double DBNum = 1;
DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (dtDBH.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
{
DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
}
if (!string.IsNullOrEmpty(dtDBH.Rows[0]["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());
}
}
PerResult.QaTon = DBHeight * (1 - (BurnningRate / 100)) * double.Parse(PerResult.PerforationNum.ToString());
PerResult.Status = "30";
PerResult.NodeFurFlag = "1";
PerResult.JudgeStoveNo = JudgeStoveNo;
PerResult.ColGroup = UserInfo.GetUserGroup();
PerResult.ColShift = UserInfo.GetUserOrder();
PerResult.ColUser = _UserName;
PerResult.UserId = _UserID;
PerResult.ProPlanId = proPlanId;
PerResult.GxPlanNo = gxPlanNo;
PerResult.LotNo = lotNo;
PerResult.PlineCode = PlineCode;
//结炉赋值材料号到剔废表、写进程表
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
ccp.MethodName = "updateMilSlab";
ccp.ServerParams = new object[] { JudgeStoveNo, "3", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
ccp.MethodName = "updateProcess";
ccp.ServerParams = new object[] { JudgeStoveNo, "3", "3", proPlanId, gxPlanNo, lotNo, PlineCode };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.nodePerResult", new object[] { PerResult }, this.ob);
if (count1 > 0)
{
//NativeMethodNew na = new NativeMethodNew(this.ob);
//na.InsertSTAferDoubleClick(JudgeStoveNo, 2, "1", proPlanId, gxPlanNo);
int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { JudgeStoveNo, 3, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
NativeMethod.CheckNodeMatStatus(JudgeStoveNo, proPlanId, gxPlanNo, 2, this.ob);
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
}
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
PlanQuery();
ultraGridTC();
}
else
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】加热炉工序未结炉,当前工序不能结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
tempperforation = NativeMethod.GetEntityToEntity(tempperforation, PerResult);//保存后全局变量赋值
this.perforationResult1.IsCellSelect = false;
}
}
///
/// 开始回退
///
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 (nvw.isBegineNode(JudgeStoveNo, 3))
//{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始连轧,不能开始回退!!!!");
// return;
//}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
ultraGridTC();
ChangeGridColor();
GetGridButtonName();
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();
if (NodeFlag != "穿孔完成")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!");
return;
}
//查询结炉班次班组
DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 2, 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 != "30")
{
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, 2, proPlanId, gxPlanNo }, this.ob);
if (dt1.Rows.Count > 0)
{
Seq = int.Parse(dt1.Rows[0][0].ToString());
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, Seq, 0, 3, proPlanId, gxPlanNo, lotNo }, this.ob);
ultraGridTC();
ChangeGridColor();
GetGridButtonName();
PlanQuery();
}
///
/// 打印报表
///
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=RepMilPerforation.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=RepMilPerforation.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=RepMilPerforation.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=RepMilPerforation250.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=RepMilPerforation258.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=RepMilPerforation168.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=RepMilPerforation460.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=RepMilPerforation508.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), 2, 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), 2, 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), 2, 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), 2, 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=RepMilPerforation250.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=RepMilPerforation258.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=RepMilPerforation168.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=RepMilPerforation460.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=RepMilPerforation508.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
private void ultraGrid_GHDL_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
{
if (PanelSizeFlag == 0)
{
PanelSizeFlag = 1;
splitContainer2.SplitterDistance = 180;
}
else
{
PanelSizeFlag = 0;
splitContainer2.SplitterDistance = 90;
}
}
private void ultraButton1_Click(object sender, EventArgs e)
{
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.GetSQLDate.getPlanQuery", new object[] { }, this.ob);
}
///
/// 计划表ROW点击变换判断
///
///
///
private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e)
{
if (this.perforationResult1.IsCellSelect == true)
{
NativeMethodNew na = new NativeMethodNew(this.ob);
if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 2))
{
this.perforationResult1.IsCellSelect = false;
return;
}
//if (MessageBox.Show("提示:穿孔实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
//{
// this.perforationResult1.IsCellSelect = false;
// //保存探伤实绩
//}
else
{
ShowMessageFlag = 1;
PerResultSave();
ShowMessageFlag = 0;
this.perforationResult1.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";
}
}
//StartTime = StartTime + " 00:00:00";
//EndTime = EndTime + " 00:00:00";
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetSingleFurNodeResult", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 3, Date, Shift, Group, this.ob);
frm.ShowDialog();
}
///
/// 当班工具更换
///
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.PerforationResult.toolChangeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
txtQuery frm = new txtQuery(1, Date, Shift, Group, _UserName, PlineCode, this.ob);
frm.ShowDialog();
}
///
/// checkbox点击事件
///
///
///
private void chkDate_CheckedChanged(object sender, EventArgs e)
{
//if (chkDate.Checked)
//{
// dtStartDate.Enabled = true;
// dtEndDate.Enabled = true;
//}
//else
//{
// dtStartDate.Enabled = false;
// dtEndDate.Enabled = false;
//}
if (chkLotNo.Checked)
{
txtLOT_NO.Enabled = true;
}
else
{
txtLOT_NO.Enabled = false;
}
if (chkHeatNo.Checked)
{
txtJudgeStoveNo.Enabled = true;
}
else
{
txtJudgeStoveNo.Enabled = false;
}
if (chkStatusQuery.Checked)
{
PlanStatusQuery = "99";
PlanStartStatusQuery = "30";
}
else
{
PlanStatusQuery = "29";
PlanStartStatusQuery = "00";
}
if (chkAutoRefresh.Checked)
{
timer1.Enabled = true;
}
else
{
timer1.Enabled = false;
}
}
private void frmTechnological1_DoubleClickEvent(DataTable dt)
{
NativeMethodNew NmN = new NativeMethodNew(this.ob);
HOTMethod HOTm = new HOTMethod(this.ob);
if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 2))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始穿孔,不能带入参数。");
return;
}
//if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 2, PlineCode))
//{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成穿孔,不能带入参数。");
// return;
//}
MilPerforationResultEntity PerResultEdit = new MilPerforationResultEntity();
PerResultEdit = (MilPerforationResultEntity)EntityTool.setObjectByDataTable(PerResultEdit, dt);
this.perforationResult1.UpdateDateForPrama(PerResultEdit);
ShowMessageFlag = 1;
PerResultSave();
ShowMessageFlag = 0;
}
///
/// 到点提示交班
///
///
///
private void timer2_Tick_1(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 ultraGridMatSeq_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
e.Handled = true;
UltraGridRow ugr = null;
int Index = ultraGrid_GHDL.ActiveRow.Index;
if (Index < ultraGrid_GHDL.Rows.Count - 1)
{
ugr = ultraGrid_GHDL.Rows[Index - 1];
// ugr = ultraGrid1.ActiveRow;
}
else
{
ugr = ultraGrid_GHDL.ActiveRow;
}
ultraGrid_GHDL.UpdateData();
ultraGrid_GHDL.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, 2, Seq, ScrapReason, Remark }, this.ob);
}
ultraGridTC();
ChangeGridColor();
GetGridButtonName();
}
}
private void perforationResult1_KeyPress(object sender, KeyPressEventArgs e)
{
//if (e.KeyChar == (char)13 || e.KeyChar == (char)9)
//{
e.Handled = true;
UltraGridRow ugr = perforationResult1.UltraGrid1.ActiveRow;
UltraGridCell ugc = perforationResult1.UltraGrid1.ActiveCell;
//perforationResult1.UltraGrid1.UpdateData();
double DbUp = 0;
double DbDown = 0;
double RollerUp = 0;
double RollerDown = 0;
if (!string.IsNullOrEmpty(ugr.Cells["db_loca_up"].Value.ToString()))
{
DbUp = double.Parse(ugr.Cells["db_loca_up"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["db_loca_down"].Value.ToString()))
{
DbDown = double.Parse(ugr.Cells["db_loca_down"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_up"].Value.ToString()))
{
RollerUp = double.Parse(ugr.Cells["zg_loca_up"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_down"].Value.ToString()))
{
RollerDown = double.Parse(ugr.Cells["zg_loca_down"].Value.ToString());
}
if (ugc.Column.Key == "db_loca_up")
{
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
}
if (ugc.Column.Key == "db_loca_down")
{
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
}
if (ugc.Column.Key == "zg_loca_up")
{
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
}
if (ugc.Column.Key == "zg_loca_down")
{
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
}
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
// }
}
private void perforationResult1_GridCellChange(object sender, CellEventArgs e)
{
if (PlineCode == "C008" || PlineCode == "C010")
{
return;
}
if (e.Cell.Column.Key == "db_loca_up" || e.Cell.Column.Key == "db_loca_down" || e.Cell.Column.Key == "zg_loca_up" || e.Cell.Column.Key == "zg_loca_down")
{
UltraGridRow ugr = perforationResult1.UltraGrid1.ActiveRow;
UltraGridCell ugc = perforationResult1.UltraGrid1.ActiveCell;
perforationResult1.UltraGrid1.UpdateData();
double DbUp = 0;
double DbDown = 0;
double RollerUp = 0;
double RollerDown = 0;
if (!string.IsNullOrEmpty(ugr.Cells["db_loca_up"].Value.ToString()))
{
DbUp = double.Parse(ugr.Cells["db_loca_up"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["db_loca_down"].Value.ToString()))
{
DbDown = double.Parse(ugr.Cells["db_loca_down"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_up"].Value.ToString()))
{
RollerUp = double.Parse(ugr.Cells["zg_loca_up"].Value.ToString());
}
if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_down"].Value.ToString()))
{
RollerDown = double.Parse(ugr.Cells["zg_loca_down"].Value.ToString());
}
if (ugc.Column.Key == "db_loca_up")
{
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
}
if (ugc.Column.Key == "db_loca_down")
{
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
}
if (ugc.Column.Key == "zg_loca_up")
{
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
}
if (ugc.Column.Key == "zg_loca_down")
{
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
}
this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
perforationResult1.UpdateDataForGuideSpace();
this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
perforationResult1.UpdateDataForRollerSpace();
}
}
}
}