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.NodeResultQuery;
using Core.StlMes.Client.ZGMil.Entity;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using System.Collections;
using System.Timers;
using Core.StlMes.Client.ZGMil.Signature;
using Core.StlMes.Client.ZGMil.Common;
using Core.StlMes.Client.ZGMil.Popup;
using Microsoft.Win32;
using CoreFS.SA06;
using System.Text.RegularExpressions;
namespace Core.StlMes.Client.ZGMil.Result
{
public partial class FrmFeedSawingResult : FrmBase
{
#region 初始化
private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
RollingInfomation rf = new RollingInfomation();
FeedRowPlan QuertFeedplan = new FeedRowPlan();
MilPlan QueryMainPlan = new MilPlan();
FeedRowPlan Feedplan = new FeedRowPlan();
MilPlan MainPlan = new MilPlan();
FeedSawResultEntity FeedSawResult = new FeedSawResultEntity();
string GirdSizeFlag = "";
string PlanStatusQuery = "09"; //查询结炉实绩状态
string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
string Shift = "";
string Group = "";
string _User = "";
private string ResultNo = "";
private string proPlanId = null;//轧管订单编号
private string gxPlanNo = null;//工序排产序号
private string lotNo = null;//生产批号
private string Departm = "";//部门
private string PlineCode = "";//产线
private int ChangeSeq = 0; //交班Seq
private string ChangeUserID = ""; //接班用户名
private string ChangePassWord = ""; //接班密码
int ShowMessageFlag = 0;
private string _UserName = ""; //签名 姓名
private string _Url = ""; //签名 Url
private string _UserID = ""; //签名 签名ID
private int _MouseLocX = 0; //鼠标横坐标
private int _MouseLocY = 0; //鼠标纵坐标
private int ChangeFlag = 0; //交班标识
public Infragistics.Win.UltraWinGrid.UltraGrid Grid
{
get { return _grid; }
}
public FrmFeedSawingResult()
{
Shift = UserInfo.GetUserOrder();
Group = UserInfo.GetUserGroup();
InitializeComponent();
GirdSizeFlag = "1";
//this.feedSaw1.UltraGrid4.ClickCellButton += new CellEventHandler(UltraGrid4_ClickCellButton);
if (GirdSizeFlag == "1")
{
splitContainer2.SplitterDistance = 180;
GirdSizeFlag = "0";
}
//管号队列Grid未拉伸
else
{
splitContainer2.SplitterDistance = 90;
GirdSizeFlag = "1";
}
//获取鼠标坐标
Point formPoint = this.PointToClient(Control.MousePosition);
_MouseLocX = Convert.ToInt32(formPoint.X);
_MouseLocY = Convert.ToInt32(formPoint.Y);
}
///
/// 交班取消
///
///
///
public void UltraGrid4_ClickCellButton(object sender, CellEventArgs e)
{
string JudgeStoveNo = "";
string Status = "";
string ResultNo = "";
string FeedRowNo = "";
UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
if (ugr != null)
{
if (!ugr.HasParent())
{
JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
Status = ugr.Cells["IS_START"].Value.ToString();
ResultNo = ugr.Cells["ID"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
MessageBox.Show("请选择需要交班取消的上料行。");
return;
}
else
{
UltraGridRow ugrp = ugr.ParentRow;
JudgeStoveNo = ugrp.Cells["JUDGE_STOVE_NO"].Value.ToString();
Status = ugrp.Cells["IS_START"].Value.ToString();
ResultNo = ugrp.Cells["ID"].Value.ToString();
FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
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;
}
if (e.Cell.Column.Key == "CHANGENUMCANCEL")
{
ArrayList FeedRowNoList = new ArrayList(); //上料行ID
ArrayList BeforeSeqList = new ArrayList(); //上料行前道班交班SEQ
ArrayList FeedStartSeq = new ArrayList(); //上料行起始SEQ
ArrayList BeforeCountList = new ArrayList(); //上料行前道班交班支数
int ChangeCancelCount = 0; //所有上料行交班取消总支数之和 上料行取消交班支数 = 上料行交班支数-(前道班交班SEQ-上料行起始SEQ+1)
//查询上个班上料行交班Seq
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
{
for (int i = 0; i < dtChangeNum.Rows.Count; i++)
{
FeedRowNoList.Add(dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString());
BeforeSeqList.Add(dtChangeNum.Rows[i]["SEQ"].ToString());
}
}
//查询当前炉次上料行起始Seq
DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
FeedStartSeq.Add(dtFeedSeq.Rows[i]["SEQ"].ToString());
}
};
//查询上个班上料行交班支数
DataTable dtChangeCount = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedChangeNum", new object[] { JudgeStoveNo }, this.ob);
{
for (int i = 0; i < dtChangeCount.Rows.Count; i++)
{
BeforeCountList.Add(dtChangeCount.Rows[i]["CHANGE_NUM"].ToString());
}
}
for (int i = 0; i < FeedRowNoList.Count; i++)
{
ChangeCancelCount += int.Parse(BeforeCountList[i].ToString()) - (int.Parse(BeforeSeqList[i].ToString()) - int.Parse(FeedStartSeq[i].ToString()) + 1);
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeCancel", new object[] { JudgeStoveNo, ResultNo, FeedRowNoList, BeforeSeqList, FeedStartSeq, ChangeCancelCount }, this.ob);
//NativeMethodNew nass = new NativeMethodNew(this.ob);
//nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 0);
GetFeedRack();
GetGridButtonName();
ChangeGridColor();
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
if (dtFP.Rows.Count > 0)
{
FeedRowEditGridForRack(dtFP);//上料计 划信息
}
}
}
}
///
/// 交班取消
///
private void ChangeCancel()
{
string JudgeStoveNo = "";
string Status = "";
string ResultNo = "";
string FeedRowNo = "";
UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
if (ugr != null)
{
if (!ugr.HasParent())
{
JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
Status = ugr.Cells["IS_START"].Value.ToString();
ResultNo = ugr.Cells["ID"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
//MessageBox.Show("请选择需要交班取消的上料行。");
return;
}
else
{
UltraGridRow ugrp = ugr.ParentRow;
JudgeStoveNo = ugrp.Cells["JUDGE_STOVE_NO"].Value.ToString();
Status = ugrp.Cells["IS_START"].Value.ToString();
ResultNo = ugrp.Cells["ID"].Value.ToString();
FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
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;
}
ArrayList FeedRowNoList = new ArrayList(); //上料行ID
ArrayList BeforeSeqList = new ArrayList(); //上料行前道班交班SEQ
ArrayList FeedStartSeq = new ArrayList(); //上料行起始SEQ
ArrayList BeforeCountList = new ArrayList(); //上料行前道班交班支数
ArrayList FeedChangeNum = new ArrayList(); //上料行交班支数
int ChangeCancelCount = 0; //所有上料行交班取消总支数之和 上料行取消交班支数 = 上料行交班支数-(前道班交班SEQ-上料行起始SEQ+1)
//查询当前炉次上料行起始Seq
DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
FeedRowNoList.Add(dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString());
FeedStartSeq.Add(dtFeedSeq.Rows[i]["SEQ"].ToString());
}
};
////查询当班上料行交班支数
DataTable dtChangeCount = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedChangeNum", new object[] { JudgeStoveNo }, this.ob);
{
if (dtChangeCount.Rows.Count != 0)
{
for (int i = 0; i < dtChangeCount.Rows.Count; i++)
{
FeedChangeNum.Add(dtChangeCount.Rows[i]["CHANGE_NUM"].ToString());
}
}
else
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
FeedChangeNum.Add(0);
}
}
}
//查询上个班上料行交班Seq 上个班
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
{
if (dtChangeNum.Rows.Count != 0)
{
for (int i = 0; i < dtChangeNum.Rows.Count; i++)
{
BeforeSeqList.Add(dtChangeNum.Rows[i]["SEQ"].ToString());
if (dtChangeNum.Rows[i]["SEQ"].ToString() == "0")
{
BeforeCountList.Add(0);
}
else
{
BeforeCountList.Add(int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString()) - int.Parse(FeedStartSeq[i].ToString()));
}
}
}
else
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
BeforeCountList.Add(0);
BeforeSeqList.Add(0);
}
}
}
int Flag = 0;
//前道班有交班
if (dtChangeNum.Rows.Count > 0)
{
for (int i = 0; i < FeedRowNoList.Count; i++)
{
ChangeCancelCount += int.Parse(FeedChangeNum[i].ToString()) - (int.Parse(BeforeSeqList[i].ToString()) - int.Parse(FeedStartSeq[i].ToString()) + 1);
}
Flag = 1;
}
//前道班没交班
else
{
for (int i = 0; i < FeedRowNoList.Count; i++)
{
ChangeCancelCount += int.Parse(FeedChangeNum[i].ToString());
}
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeCancel", new object[] { JudgeStoveNo, ResultNo, FeedRowNoList, BeforeSeqList, FeedStartSeq, ChangeCancelCount, Flag }, this.ob);
//NativeMethodNew nass = new NativeMethodNew(this.ob);
//nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 0);
GetFeedRack();
GetGridButtonName();
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
if (dtFP.Rows.Count > 0)
{
FeedRowEditGridForRack(dtFP);//上料计 划信息
}
}
PlanQuery();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//屏蔽Grid筛选条件
rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
feedSaw1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
chkNodeQuery.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGridMatSeq.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ChangeGridColor();
InitControl();
GirdSizeFlag = "0";
ShowShift();
splitContainer2.SplitterDistance = 180;
timer1.Tick += new EventHandler(timer1_Tick);
}
///
/// 定时器事件
///
///
///
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 OnShown(EventArgs e)
{
base.OnShown(e);
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();
}
foreach (UltraGridRow ugr in chkNodeQuery.Rows)
{
if (ugr.HasChild())
{
ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
}
}
//选择操作人
Sign();
PlanQuery();
}
///
/// 签名
///
private void Sign()
{
ColUserName col = new ColUserName();
col.StationId = "0";
col.PlineCode = PlineCode;
col.ColGroup = Group;
col.Ob = this.ob;
col.ShowDialog();
_UserID = col.getUserId();
_UserName = col.getUserName();
}
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 (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 (ultraGridMatSeq.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
{
ugr.Cells["FEED_BACK"].Value = "上料回退";
}
}
GetGridButtonName();
}
#endregion
#region 查询 控件赋值 方法
///
/// 刷新
///
public override void Refresh()
{
ChangeGridColor();
GetRollingCard();
GetFeedRack();
GetGridButtonName();
PlanQuery();
}
///
/// 判断是否能开始当前炉次
///
///
private bool IsStart()
{
bool Start = true;
foreach (UltraGridRow ugr in chkNodeQuery.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;
}
///
/// GridButton赋名字
///
public void GetGridButtonName()
{
if (ultraGridMatSeq.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
{
ugr.Cells["btnScrapFeedSlab"].Value = "切前剔除";
ugr.Cells["btnScrapDBSlab"].Value = "切后剔除";
ugr.Cells["DELBACK"].Value = "剔料回退";
}
}
if (chkNodeQuery.Rows.Count > 0)
{
foreach (UltraGridRow ugr in chkNodeQuery.Rows)
{
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;
}
}
}
}
}
///
/// 得到上料锯切开始结束时间
///
/// 0 - 开始时间 1 - 结束时间
///
public string GetTime(string Flag, string JudgeStoveNo)
{
string StartTime = "";
string EndTime = "";
// UltraGridRow ugr = chkNodeQuery.ActiveRow;
//string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
StartTime = dt.Rows[0]["START_TIME"].ToString();
EndTime = dt.Rows[0]["END_TIME"].ToString();
}
if (Flag == "0")
{
return StartTime;
}
else
{
return EndTime;
}
}
///
/// 更改girdRow颜色
///
public void ChangeGridColor()
{
if (chkNodeQuery.Rows.Count > 0)
{
foreach (UltraGridRow ugr in chkNodeQuery.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() == "已完成锯切")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
if (ugr.HasChild())
{
foreach (UltraGridRow ugr1 in ugr.ChildBands[0].Rows)
{
if (ugr1.Cells["SAW_FALG"].Value.ToString() == "已上料")
{
ugr1.Appearance.BackColor = Color.YellowGreen;
}
else if (ugr1.Cells["SAW_FALG"].Value.ToString() == "锯切完成")
{
ugr1.Appearance.BackColor = Color.YellowGreen;
}
}
}
}
}
if (ultraGridMatSeq.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
{
if (ugr != null)
{
switch (ugr.Cells["STATUS"].Value.ToString())
{
case "切前剔除":
ugr.Appearance.BackColor = Color.Yellow;
break;
case "切后剔除":
ugr.Appearance.BackColor = Color.YellowGreen;
break;
}
switch (ugr.Cells["CHANGE_FLAG"].Value.ToString())
{
case "待接班确认":
ugr.Appearance.BackColor = Color.LightGreen;
break;
}
}
}
}
}
///
/// 查询上料管号队列
///
public void GetFeedRack()
{
Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
UltraGridRow ugr = chkNodeQuery.ActiveRow;
if (ugr != null)
{
string JudgeStoveNo = "";
string FeedRowNo = "";
dtMatSeq.Clear();
JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
if (ugr.HasParent())
{
FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getFeedRackSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
if (dt.Rows.Count > 0)
{
GridHelper.CopyDataToDatatable(ref dt, ref dtMatSeq, true);
ultraGridMatSeq.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
if (dt.Rows[0]["DB_NUM"] != null)
{
int ScrapDBNum = int.Parse(dt.Rows[0]["DB_NUM"].ToString());
valueList.ValueListItems.Add("", "");
for (int i = 0; i < ScrapDBNum; i++)
{
valueList.ValueListItems.Add((i + 1).ToString(), (i + 1).ToString());
}
}
else
{
valueList.ValueListItems.Add("0", "0");
}
ultraGridMatSeq.DisplayLayout.Bands[0].Columns["SCRAP_DBNUM"].ValueList = valueList;
}
GridHelper.CopyDataToDatatable(ref dt, ref dtMatSeq, true);
}
}
///
/// 查询流通卡信息
///
public void GetRollingCard()
{
UltraGridRow ugr = chkNodeQuery.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);
//string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
//DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
//if (dt.Rows.Count > 0)
//{
// RollingCardEditGrid(dt, JudgeStoveNo);
//}
//else
//{
// rollingCard1.Value.Clear();
// GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4);
//}
}
}
///
/// 查询结炉实绩
///
public void NodeQuery()
{
string Group = UserInfo.GetUserGroup();
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string StartTime = SeverTime.ToString("yyyy-MM-dd");
string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
string Date = StartTime;
string Time = SeverTime.ToLongTimeString();
//晚班
if (Shift == "3")
{
Time = Time.Replace(":", "");
if (int.Parse(Time) > 205900)
{
StartTime += " " + "21:00:00";
EndTime += " " + "10:00:00";
}
else
{
StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00";
}
}
else
{
StartTime = StartTime + " 00:00:00";
EndTime = EndTime + " 00:00:00";
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSingleFeedNodeResult", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 1, Date, Shift, Group, this.ob);
frm.ShowDialog();
}
#endregion
#region 事件
///
/// ToolBar按钮
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "DoQuery":
PlanQuery();
break;
case "DoSave":
FeedRowSave();
break;
case "SaveRemark":
DoSave();
break;
case "DoNode":
FeedSawResultNode();
break;
case "DoNodeBack":
NodeBack();
break;
case "DoNodeQuery":
NodeQuery();
break;
//case "DoUpdateDate":
// UpdateDatePlan();
// break;
case "DoSign":
Sign();
break;
case "DoPrint":
PrintResult();
break;
case "DoQueryBefore":
QueryBefore();
break;
case "DoStart":
DoStart();
break;
case "DoChangeCancel":
ChangeCancel();
break;
case "DoFeedBack":
DoFeedBack();
break;
case "DoBackFurSlab":
BackFurSlab();
break;
case "UpdateTube":
updateTubeType();
break;
case "Close":
this.Dispose();
this.Close();
break;
}
}
private void updateTubeType()
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
ccp.MethodName = "updateTubeType";
ccp.ServerParams = new object[] { };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("同步成功!"))
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 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 = "10";
}
else
{
PlanStatusQuery = "09";
PlanStartStatusQuery = "00";
}
if (chkAutoRefresh.Checked)
{
timer1.Enabled = true;
}
else
{
timer1.Enabled = false;
}
}
///
/// 数据同步
///
//public void UpdateDatePlan()
//{
// SyncPro frm = new SyncPro(this.ob, PlineCode);
// frm.ShowDialog();
// //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.GetSQLDate.getPlanQuery", new object[] { }, this.ob);
// //MessageBox.Show("计划同步完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// PlanQuery();
//}
///
/// 查询按钮
///
public void PlanQuery()
{
if (chkHeatNo.Checked)
{
if (string.IsNullOrEmpty(txtJudgeStoveNo.Text))
{
MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
if (this.chkLotNo.Checked)
{
if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
{
MessageBox.Show("请输入需查询的轧批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
//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;
QuertFeedplan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
}
else
{
QueryMainPlan.JudgeStoveNo = "";
QuertFeedplan.JudgeStoveNo = "";
}
if (chkLotNo.Checked == true)
{
QueryMainPlan.LotNo = this.txtLOT_NO.Text;
QuertFeedplan.LotNo = this.txtLOT_NO.Text;
}
else
{
QueryMainPlan.LotNo = "";
QuertFeedplan.LotNo = "";
}
string PrimaKey = "";
string SencodKey = "";
UltraGridRow ugr = this.chkNodeQuery.ActiveRow;
if (ugr != null)
{
PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
if (ugr.HasParent())
{
SencodKey = ugr.Cells["FEED_ROW_NO"].Value.ToString();
}
string NodeFlag = "";
if (ugr.HasParent())
{
UltraGridRow ugrp = ugr.ParentRow;
ResultNo = ugrp.Cells["ID"].Value.ToString();
NodeFlag = ugrp.Cells["IS_START"].Value.ToString();
}
else
{
ResultNo = ugr.Cells["ID"].Value.ToString();
NodeFlag = ugr.Cells["IS_START"].Value.ToString();
}
}
//ugr.Cells["ID"].Value.ToString();
dtMatSeq.Clear();
dtFeedPlan.Clear();
dtPlan.Clear();
QueryMainPlan.PlineCode = PlineCode;
QuertFeedplan.PlineCode = PlineCode;
QueryMainPlan.Status = PlanStatusQuery;
QueryMainPlan.StartStatus = PlanStartStatusQuery;
//查询主表记录
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
//chkNodeQuery.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
foreach (UltraGridColumn ugc in chkNodeQuery.DisplayLayout.Bands[0].Columns)
{
ugc.SortIndicator = SortIndicator.Disabled;
}
if (dt.Rows.Count > 0)
{
//查询从表记录
QuertFeedplan.SawFalg = PlanStatusQuery;
QuertFeedplan.StartStatus = PlanStartStatusQuery;
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlan", new object[] { QuertFeedplan }, this.ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dtFeedPlan, true);
chkNodeQuery.DisplayLayout.Bands[1].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
ChangeGridColor();
}
else
{
if (ShowMessageFlag == 0)
{
MessageBox.Show("未查询到数据!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
if (ugr != null)
{
foreach (UltraGridRow ugr1 in chkNodeQuery.Rows)
{
//子行
if (ugr.HasParent())
{
foreach (UltraGridRow ugr2 in ugr1.ChildBands[0].Rows)
{
if (ugr2.Cells["FEED_ROW_NO"].Value.ToString() == SencodKey && ugr2.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
{
UltraGridRow ugrParents = ugr2.ParentRow;
ugrParents.ExpandAll();
ugr2.Activated = true;
}
}
}
else
{
if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
{
ugr1.Activated = true;
ugr1.ExpandAll();
}
}
}
//
}
}
///
/// 保存备注
///
private void DoSave()
{
if (this.chkNodeQuery.Rows.Count > 0)
{
try
{
feedSaw1.UltraGrid4.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
UltraGridRow ugr = chkNodeQuery.ActiveRow;
if (ugr.HasParent())
{
feedSaw1.UltraGrid4.UpdateData();
string Remark = this.feedSaw1.UltraGrid4.Rows[0].Cells["Remark"].Value.ToString();
string StartTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["StartTime"].Value.ToString();
string EndTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["EndTime"].Value.ToString();
string JudgeStoveNo = ugr.ParentRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr.ParentRow.Cells["ID"].Value.ToString();
string proPlanId = ugr.ParentRow.Cells["PRO_PLAN_ID"].Value.ToString();
string gxPlanNo = ugr.ParentRow.Cells["GX_PLAN_NO"].Value.ToString();
if (string.IsNullOrEmpty(StartTime))
{
MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
return;
}
//查询结炉状态,已结炉的计划 结炉时间不能为空
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (int.Parse(dt.Rows[0][0].ToString()) > 9)
{
if (string.IsNullOrEmpty(EndTime))
{
MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
return;
}
//开始时间必须小于结束时间
if (DateTime.Parse(StartTime) > DateTime.Parse(EndTime))
{
MessageBox.Show("结束时间不能小于开始时间。");
return;
}
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.SaveRemark", new object[] { JudgeStoveNo, ResultNo, Remark, StartTime, EndTime, proPlanId, gxPlanNo }, this.ob);
MessageBox.Show("保存成功。");
}
else
{
MessageBox.Show("请选择需要保存的上料行。");
}
}
}
///
/// 单击计划行
///
///
///
private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
{
dtMatSeq.Clear();
if (this.dtPlan.Rows.Count > 0)
{
UltraGridRow ugr = chkNodeQuery.ActiveRow;
//UltraGridRow ugr = e.Row;
if (ugr != null)
{
this.feedSaw1.DataClear();
//查询主计划信息
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;
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
// string Status = dtMP.Rows[0]["IS_START"].ToString();
if (dtMP.Rows.Count > 0)
{
GridEdit(dtMP); //轧制计划信息
if (ugr.HasParent()) //子行
{
string FeedNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
Feedplan.JudgeStoveNo = HeatNo;
Feedplan.FeedRowNo = FeedNo;
Feedplan.PlineCode = PlineCode;
Feedplan.SawFalg = PlanStatusQuery;
Feedplan.ProPlanId = proPlanId;
Feedplan.GxPlanNo = gxPlanNo;
MainPlan.Status = PlanStatusQuery;
FeedSawResult.JudgeStoveNo = HeatNo;
//查询上料行信息
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { Feedplan.JudgeStoveNo, Feedplan.FeedRowNo, proPlanId, gxPlanNo }, this.ob);
//查询上料锯切实绩信息
//DataTable dtFSResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedResult.SingleFeedSawResult", new object[] { FeedSawRuslt }, this.ob);
if (dtFP.Rows.Count > 0)
{
FeedRowEditGrid(dtFP);//上料计 划信息
}
else
{
feedSaw1.DataClear();
}
GetFeedRack();
}
}
GetGridButtonName();
ChangeGridColor();
GetRollingCard();
}
}
}
///
/// 双击开始上料
///
///
///
private void DoStart()
// private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
{
if (chkNodeQuery.Rows.Count > 0)
{
//if (!IsStart())
//{
// return;
//}
UltraGridRow ugr = chkNodeQuery.ActiveRow;
if (ugr != null)
{
string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = "";
//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;
if (ugr.HasParent())
{
ResultNo = ugr.ParentRow.Cells["ID"].Value.ToString();
string strtus = ugr.ParentRow.Cells["IS_START"].Value.ToString();
if (strtus == "已完成锯切")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成锯切操作,不允许进行上料操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
else
{
ResultNo = ugr.Cells["ID"].Value.ToString();
}
DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
GridEdit(dtMP); //轧制计划信息
if ("0".Equals(dtMP.Rows[0]["IS_LOAD"].ToString()))
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已撤销出库,不允许进行上料操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Refresh();
return;
}
if (ugr.HasParent()) //子行
{
string FeedNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
Feedplan.JudgeStoveNo = HeatNo;
Feedplan.PlineCode = PlineCode;
Feedplan.FeedRowNo = FeedNo;
Feedplan.LotNo = "";
Feedplan.SawFalg = PlanStatusQuery;
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { Feedplan.JudgeStoveNo, Feedplan.FeedRowNo, proPlanId, gxPlanNo }, this.ob);
FeedRowEditGrid(dtFP);//上料计划信息
string SawFlag = dtFP.Rows[0]["SAW_FALG"].ToString();
string PLineCode = dtFP.Rows[0]["PLINE_CODE"].ToString();
//string PLineCode = "460机组";
string LotNo = dtFP.Rows[0]["LOT_NO"].ToString();
string StoveNo = dtFP.Rows[0]["STOVE_NO"].ToString();
Feedplan.ResultNo = ResultNo;
Feedplan.LotNo = LotNo;
Feedplan.StoveNo = StoveNo;
Feedplan.PlineCode = PLineCode;
Feedplan.ColMode = "0";
Feedplan.ReMark = PlanStatusQuery;
Feedplan.ColGroup = UserInfo.GetUserGroup();
Feedplan.ColShift = UserInfo.GetUserOrder();
Feedplan.ColUser = UserInfo.GetUserName();
Feedplan.CutTarget = dtFP.Rows[0]["CUT_TARGET"].ToString();
Feedplan.ProPlanId = proPlanId;
Feedplan.GxPlanNo = gxPlanNo;
//查询当前生产批最大流水号
DataTable dtLotSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getLotSeq", new object[] { LotNo }, this.ob);
string LotSeq = "";
if (!string.IsNullOrEmpty(dtLotSeq.Rows[0][0].ToString()))
{
LotSeq = dtLotSeq.Rows[0][0].ToString();
LotSeq = LotSeq.Substring(0, LotSeq.Length - 3) + (int.Parse(LotSeq.Substring(LotSeq.Length - 3, 3)) + 1).ToString().PadLeft(3, '0');
}
else
{
LotSeq = LotNo + "001";
}
Feedplan.LotSeq = LotSeq;
switch (SawFlag)
{
case "未上料":
SawFlag = "0";
break;
case "已上料":
SawFlag = "1";
break;
default:
SawFlag = "2";
break;
}
Feedplan.SawFalg = "1";
//
if (SawFlag == "1" || SawFlag == "2")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(Feedplan.JudgeStoveNo) + "】已上料或锯切完成,不能再次上料!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (SawFlag == "0")
{
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + Feedplan.JudgeStoveNo + "】开始锯切?") == DialogResult.No)
//{
// return;
//}
//修改MSSQL中入炉计划状态为:20
ArrayList FeedRowIDList = new ArrayList();
if (ugr.HasChild())
{
foreach (UltraGridRow ugrs in ugr.ChildBands[0].Rows)
{
if (ugrs.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
{
FeedRowIDList.Add(ugrs.Cells["FEED_ROW_NO"].Value.ToString());
}
}
}
else
{
UltraGridRow ugrP = ugr.ParentRow;
foreach (UltraGridRow ugrs in ugrP.ChildBands[0].Rows)
{
if (ugrs.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
{
FeedRowIDList.Add(ugrs.Cells["FEED_ROW_NO"].Value.ToString());
}
}
}
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToShortDateString().Replace("/", "");
string Temp = Time + PlineCode;
int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertFeedSeq", new object[] { HeatNo, ResultNo, Temp }, this.ob);//上料插入上料顺序
// int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.updateMSQLStartStatus", new object[] { FeedRowIDList }, this.ob); ;
//修改上料行上料标识,新增上料锯切实绩
//int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedRowStatue1", new object[] { Feedplan }, this.ob);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
ccp.MethodName = "UpdateFeedRowStatue1";
ccp.ServerParams = new object[] { Feedplan };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("生成成功!"))
{
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRack", new object[] { Feedplan, PlanStatusQuery }, this.ob);
FeedRowEditGrid(dtFP);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
//if (count > 0)
//{
// //DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
// //string Time = SeverTime.ToShortDateString().Trim("/");
// //string FeedNo = Time + PlineCode;
// //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertFeedSeq", new object[] { HeatNo, ResultNo, FeedNo }, this.ob);
// count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRack", new object[] { Feedplan, PlanStatusQuery }, this.ob);
// FeedRowEditGrid(dtFP);
//}
}
}
//父行
else
{
}
}
}
Refresh();
}
///
/// 上料回退
///
private void DoFeedBack()
{
ArrayList FeedRow = new ArrayList();
ArrayList FeedNum = new ArrayList();
if (chkNodeQuery.Rows.Count > 0)
{
if (chkNodeQuery.ActiveRow != null)
{
UltraGridRow ugr = chkNodeQuery.ActiveRow;
string NodeStatus = "";
string JudgeStoveNo = 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();
string ResultNo = "";
if (ugr.HasParent())
{
UltraGridRow ugrp = ugr.ParentRow;
NodeStatus = ugrp.Cells["IS_START"].Value.ToString();
ResultNo = ugrp.Cells["ID"].Value.ToString();
foreach (UltraGridRow ugrch in ugrp.ChildBands[0].Rows)
{
FeedRow.Add(ugrch.Cells["FEED_ROW_NO"].Value.ToString());
FeedNum.Add(ugrch.Cells["FEED_NUM_PLAN"].Value.ToString());
}
}
else
{
NodeStatus = ugr.Cells["IS_START"].Value.ToString();
ResultNo = ugr.Cells["ID"].Value.ToString();
foreach (UltraGridRow ugrch in ugr.ChildBands[0].Rows)
{
FeedRow.Add(ugrch.Cells["FEED_ROW_NO"].Value.ToString());
FeedNum.Add(ugrch.Cells["FEED_NUM_PLAN"].Value.ToString());
}
}
if (NodeStatus == "已完成锯切")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已锯切完成,不能上料回退!!!");
return;
}
NativeMethodNew nvw = new NativeMethodNew(this.ob);
if (nvw.isBegineNode(JudgeStoveNo, 1))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始入炉,不能上料回退!!!!");
return;
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.feedBack", new object[] { JudgeStoveNo, ResultNo, FeedRow, FeedNum, proPlanId, gxPlanNo }, this.ob);
//int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.deleteMilProcesses", new object[] { BaseMethod.getJudgeStoveNo(JudgeStoveNo), ResultNo }, this.ob);
Refresh();
}
else
{
MessageBox.Show("请选择需要回退的炉号");
}
}
}
///
/// 上料行 锯切完成
///
///
public void FeedRowSave()
{
List UgrList = new List();
FeedRowPlan Feedplan = new FeedRowPlan();
ArrayList FeedRowNo = new ArrayList();
string ResultNo = "";
if (chkNodeQuery.Rows.Count > 0)
{
if (chkNodeQuery.ActiveRow != null)
{
string JudgeStoveNo = chkNodeQuery.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
UltraGridRow ugr = null;
if (chkNodeQuery.ActiveRow.HasParent())
{
ResultNo = chkNodeQuery.ActiveRow.ParentRow.Cells["ID"].Value.ToString();
proPlanId = chkNodeQuery.ActiveRow.ParentRow.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = chkNodeQuery.ActiveRow.ParentRow.Cells["GX_PLAN_NO"].Value.ToString();
foreach (UltraGridRow ugrCh in chkNodeQuery.ActiveRow.ParentRow.ChildBands[0].Rows)
{
if (ugrCh.Cells[1].Value.ToString() == "未上料")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 未开始上料,不能锯切!!!");
return;
}
if (ugrCh.Cells[1].Value.ToString() == "锯切完成")
{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 锯切完成,不能再次锯切!!!");
return;
}
if (ugrCh.Cells[1].Value.ToString() == "已上料")
{
FeedRowNo.Add(ugrCh.Cells["FEED_ROW_NO"].Value.ToString());
}
}
}
else
{
ResultNo = chkNodeQuery.ActiveRow.Cells["ID"].Value.ToString();
foreach (UltraGridRow ugrCh in chkNodeQuery.ActiveRow.ChildBands[0].Rows)
{
if (ugrCh.Cells[1].Value.ToString() == "未上料")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 未开始上料,不能锯切!!!");
return;
}
if (ugrCh.Cells[1].Value.ToString() == "锯切完成")
{
// MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 锯切完成,不能再次锯切!!!");
return;
}
if (ugrCh.Cells[1].Value.ToString() == "已上料")
{
FeedRowNo.Add(ugrCh.Cells["FEED_ROW_NO"].Value.ToString());
}
}
}
for (int i = 0; i < FeedRowNo.Count; i++)
{
chkNodeQuery.ActiveRow = ugr;
string feedNo = FeedRowNo[i].ToString();
//查询上料行信息
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, feedNo, proPlanId, gxPlanNo }, this.ob);
if (dtFP.Rows.Count > 0)
{
FeedRowEditGrid(dtFP);//上料计 划信息
}
DoSaw(JudgeStoveNo, feedNo, Feedplan, ResultNo, proPlanId, gxPlanNo);
}
#region 所有上料行锯切完成后自动结炉代码(勿动)
Refresh();
UltraGridRow ugrp = null;
if (chkNodeQuery.Rows.Count > 0)
{
foreach (UltraGridRow prow in chkNodeQuery.DisplayLayout.Bands[0].Layout.Rows)
{
if (prow.Cells["JUDGE_STOVE_NO"].Value.ToString() == JudgeStoveNo.ToString())
{
ugrp = prow;
if (prow.HasChild())
{
foreach (UltraGridRow crow in prow.ChildBands["Relation1"].Rows)
{
if (crow.Cells["SAW_FALG"].Value.ToString().Contains("上料"))
{//
Refresh();
return;
}
if (crow.Cells["FEED_ROW_NO"].Value.ToString() == Feedplan.FeedRowNo)
{
chkNodeQuery.ActiveRow = crow;
}
}
if (MessageBox.Show("所有上料行均已锯切完成,是否结炉。", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
FeedSawResultNode();
Refresh();
return;
}
else
{
Refresh();
return;
}
}
}
if (chkNodeQuery.Rows.Count < 1)
{
break;
}
// Refresh();
}
}
#endregion
}
}
Refresh();
}
///
/// 锯切上料行
///
/// 需要锯切的子行
private void DoSaw(string JudgeNo, string FeedRowNo, FeedRowPlan Feedplan1, string ResultNo, string ProPlanId, string GxPlanNo)
{
try
{
feedSaw1.UltraGrid4.UpdateData();
}
catch (Exception e)
{
MessageBox.Show("请输入正确的时间。");
return;
}
//UltraGridRow ugr = null;
//if (chkNodeQuery.DisplayLayout.Bands[0].Layout.ActiveRow != null)
//{
// ugr = chkNodeQuery.DisplayLayout.Bands[0].Layout.ActiveRow;
//}
//else
//{
// ugr = chkNodeQuery.DisplayLayout.Bands[1].Layout.ActiveRow;
//}
UltraGridRow ugr1 = this.feedSaw1.UltraGrid4.Rows[0];
//if (ugr != null)
//{
this.feedSaw1.UltraGrid4.UpdateData();
Feedplan1.JudgeStoveNo = JudgeNo;
Feedplan1.FeedRowNo = FeedRowNo;
Feedplan1.ProPlanId = ProPlanId;
Feedplan1.GxPlanNo = GxPlanNo;
//string FeedRowFlag = ugr.Cells[1].Value.ToString();
//if (FeedRowFlag == "未上料")
//{
// MessageBox.Show("炉号【" + Feedplan1.BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】上料行【" + Feedplan1.FeedRowNo + "】未上料 不能锯切完成。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
//if (FeedRowFlag == "锯切完成")
//{
// MessageBox.Show("炉号【" + Feedplan1.BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】上料行【" + Feedplan1.FeedRowNo + "】已锯切 不能再次锯切。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
//}
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + Feedplan1.JudgeStoveNo + "】上料行【" + Feedplan1.FeedRowNo + "】完成锯切?") == DialogResult.No)
//{
// return;
//}
//查询上料行 上料状态 (0- 不允许锯切完成 1-允许锯切完成)
//DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedResult", new object[] { Feedplan1 }, this.ob);
//剔除上料支数
if (string.IsNullOrEmpty(ugr1.Cells["ScrapFeedNum"].Value.ToString()))
{
Feedplan1.ScrapFeednum = "0";
}
else
{
Feedplan1.ScrapFeednum = ugr1.Cells["ScrapFeedNum"].Value.ToString();
}
//剔除单倍坯支数
if (string.IsNullOrEmpty(ugr1.Cells["ScrapDBNum"].Value.ToString()))
{
Feedplan1.ScrapDbnum = "0";
}
else
{
Feedplan1.ScrapDbnum = ugr1.Cells["ScrapDBNum"].Value.ToString();
}
//单倍坯合格支数
Feedplan1.QualifiedNum = ugr1.Cells["QualityDBNum"].Value.ToString();
//切损总长度
Feedplan1.CutLength = ugr1.Cells["WasterLength"].Value.ToString();
//切损总重量
Feedplan1.CutWeight = ugr1.Cells["WasterHeight"].Value.ToString();
//备注
Feedplan1.ReMark = ugr1.Cells["Remark"].Value.ToString();
//标识
Feedplan1.SawFalg = "2";
//上料时间
Feedplan1.StartTime = ugr1.Cells["StartTime"].Value.ToString();
//交接班支数
if (!string.IsNullOrEmpty(ugr1.Cells["ChangeGroupNum"].Value.ToString()))
{
Feedplan1.ChangeNum = ugr1.Cells["ChangeGroupNum"].Value.ToString();
}
else
{
Feedplan1.ChangeNum = "0";
}
string StartTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["StartTime"].Value.ToString();
string EndTime = this.feedSaw1.UltraGrid4.Rows[0].Cells["EndTime"].Value.ToString();
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateFeedResult", new object[] { Feedplan1 }, this.ob);
count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.SaveRemark", new object[] { JudgeNo, ResultNo, Feedplan1.ReMark, StartTime, EndTime, ProPlanId, GxPlanNo }, this.ob);
//MessageBox.Show("炉号【" + Feedplan1.JudgeStoveNo + "】上料行【" + Feedplan1.FeedRowNo + "】锯切完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//#region 所有上料行锯切完成后自动结炉代码(勿动)
////Refresh();
//UltraGridRow ugrp = null;
//if (chkNodeQuery.Rows.Count > 0)
//{
// foreach (UltraGridRow prow in chkNodeQuery.DisplayLayout.Bands[0].Layout.Rows)
// {
// if (prow.Cells["JUDGE_STOVE_NO"].Value.ToString() == Feedplan1.JudgeStoveNo.ToString())
// {
// ugrp = prow;
// if (prow.HasChild())
// {
// foreach (UltraGridRow crow in prow.ChildBands["Relation1"].Rows)
// {
// if (crow.Cells["SAW_FALG"].Value.ToString().Contains("上料"))
// {//
// Refresh();
// return;
// }
// if (crow.Cells["FEED_ROW_NO"].Value.ToString() == FeedRowNo)
// {
// chkNodeQuery.ActiveRow = crow;
// }
// }
// //if (MessageBox.Show("所有上料行均已锯切完成,是否结炉。", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
// //{
// // FeedSawResultNode();
// // Refresh();
// // //return;
// //}
// //else
// //{
// // Refresh();
// // return;
// //}
// }
// }
// if (chkNodeQuery.Rows.Count < 1)
// {
// break;
// }
// // Refresh();
// }
//}
// #endregion
}
///
/// 管号队列剔除事件
///
///
///
private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
{
MilSlabScrapSeqEntity ScrapSlab = new MilSlabScrapSeqEntity();
UltraGridRow ugr = ultraGridMatSeq.ActiveRow;
HOTMethod hm = new HOTMethod(this.ob);
string Statuss = "";
string ResultNo = "";
UltraGridRow ugr1 = this.chkNodeQuery.ActiveRow;
string JudgeStoveNo1 = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
if (ugr1.HasParent())
{
Statuss = ugr1.ParentRow.Cells["IS_START"].Value.ToString();
ResultNo = ugr1.ParentRow.Cells["ID"].Value.ToString();
}
else
{
Statuss = ugr1.Cells["IS_START"].Value.ToString();
ResultNo = ugr1.Cells["ID"].Value.ToString();
}
if (Statuss == "已完成锯切")
{
if (e.Cell.Column.Key == "CHANGE_NUM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else if (e.Cell.Column.Key == "BTNCHANGECOM")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo1) + "】已完成锯切操作,不允许进行剔除操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
return;
}
int ScrapFeedNumcount = 0;
int ScrapDBNumcount = 0;
if (ugr != null)
{
string MatNo = ugr.Cells["MAT_NO"].Value.ToString();
string Seq = ugr.Cells["SEQ"].Value.ToString();
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string FeedRowNo = ugr.Cells["FEED_ROW_NO"].Value.ToString();
int DBNum = int.Parse(ugr.Cells["DB_NUM"].Value.ToString());
string Status = ugr.Cells["STATUS"].Value.ToString();
string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
ScrapSlab.ProPlanId = proPlanId;
ScrapSlab.GxPlanNo = gxPlanNo;
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 (e.Cell.Column.Key == "btnScrapFeedSlab")
{
if (Status == "未上料" || Status == "切前剔除" || Status == "切后剔除" || Status == "锯切完成")
{
MessageBox.Show("序号:【" + Seq + "】管坯状态为【" + Status + "】,不能剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (int.Parse(Seq) < 3)
{
if (MessageUtil.ShowYesNoAndQuestion("该坯料可能是样管,是否继续剔除?") == DialogResult.No)
{
return;
}
}
ScrapSlab.FeedRowNo = FeedRowNo;
ScrapSlab.JudgeStoveNo = JudgeStoveNo;
ScrapSlab.Seq = Seq;
ScrapSlab.ProcessNo = "0";
//ScrapSlab.MatNo = MatNo;
ScrapSlab.Flag = "0";
ScrapSlab.ColMode = "1";
ScrapSlab.ColUser = UserInfo.GetUserName();
ScrapSlab.ColGroup = UserInfo.GetUserGroup();
ScrapSlab.ColShift = UserInfo.GetUserOrder();
ScrapSlab.MatNo = MatNo;
ScrapSlab.Status = "3";
ScrapFeedNumcount = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapFeedMat", new object[] { ScrapSlab, "0" }, this.ob);
}
//切后剔除
else if (e.Cell.Column.Key == "btnScrapDBSlab")
{
if (Status == "未上料" || Status == "切前剔除" || Status == "切后剔除") //|| Status == "锯切完成")
{
MessageBox.Show("序号:【" + Seq + "】管坯状态为【" + Status + "】,不能剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (int.Parse(Seq) < 3)
{
if (MessageUtil.ShowYesNoAndQuestion("该坯料可能是样管,是否继续剔除?") == DialogResult.No)
{
return;
}
}
if (string.IsNullOrEmpty(ugr.Cells["SCRAP_DBNUM"].Value.ToString()))
{
MessageBox.Show("请选择需要剔除的单倍坯支数!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int ScrapDBNum = int.Parse(ugr.Cells["SCRAP_DBNUM"].Value.ToString());
for (int i = 0; i < ScrapDBNum; i++)
{
ScrapSlab.FeedRowNo = FeedRowNo;
ScrapSlab.JudgeStoveNo = JudgeStoveNo;
ScrapSlab.Seq = ((int.Parse(Seq) - 1) * DBNum + i + 1).ToString();
ScrapSlab.SeqForUpdate = Seq;
ScrapSlab.ProcessNo = "1";
// ScrapSlab.MatNo = MatNo;
ScrapSlab.Flag = "0";
ScrapSlab.ColMode = "1";
ScrapSlab.ColUser = UserInfo.GetUserName();
ScrapSlab.ColGroup = UserInfo.GetUserGroup();
ScrapSlab.ColShift = UserInfo.GetUserOrder();
ScrapSlab.ScrapDbnum = ScrapDBNum;
ScrapSlab.Status = "4";
ScrapSlab.ProPlanId = proPlanId;
ScrapSlab.GxPlanNo = gxPlanNo;
try
{
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapFeedMat", new object[] { ScrapSlab, "1" }, this.ob);
ScrapDBNumcount += count;
}
catch (Exception ex)
{
GetFeedRack();
ChangeGridColor();
GetGridButtonName();
}
}
}
else if (e.Cell.Column.Key == "DELBACK")
{
//if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
//{
// return;
//}
if (!ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Contains("剔除"))
{
MessageBox.Show("该上料行未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
NativeMethodNew na = new NativeMethodNew(this.ob);
if (ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Equals("切前剔除"))//切前剔除回退
{
//锯切完成不能回退切前剔除的坯料
string FeedRowNoForRack = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSawFlag", new object[] { FeedRowNoForRack }, this.ob);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0][0].ToString() == "2")
{
MessageBox.Show("上料行【" + FeedRowNoForRack + "】已经锯切完成,不能回退切前剔除的坯料");
return;
}
}
int count = na.DeleteFeedSlabSeq(JudgeStoveNo, FeedRowNo, Seq, 0, 1, DBNum, proPlanId, gxPlanNo);
}
else if (ultraGridMatSeq.ActiveRow.Cells["STATUS"].Value.ToString().Equals("切后剔除"))
{
int num = 0;
if (!string.IsNullOrEmpty(ultraGridMatSeq.ActiveRow.Cells["SCRAP_DBNUM"].Value.ToString()))
{
num = int.Parse(ultraGridMatSeq.ActiveRow.Cells["SCRAP_DBNUM"].Value.ToString());
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetRackScrpNum", new object[] { JudgeStoveNo, Seq }, this.ob);
if (dt.Rows.Count > 0)
{
num = int.Parse(dt.Rows[0]["SCRAP_DBNUM"].ToString());
}
int count = na.DeleteFeedSlabSeq(JudgeStoveNo, FeedRowNo, Seq, 1, num, DBNum, proPlanId, gxPlanNo);
if (count > 0)
{
// MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
// MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
}
//交班
else if (e.Cell.Column.Key == "CHANGE_NUM")
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
int BeforeChangeNum = 0; //前道工序交接班支数
int FeedStartSeq = 1; //上料行起始Seq
//string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
//查询上个班上料行交班Seq
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
if (dtChangeNum.Rows.Count > 0)
{
for (int i = 0; i < dtChangeNum.Rows.Count; i++)
{
if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
{
BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
}
}
}
//查询当前坯料上料行起始Seq
DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
if (dtFeedSeq.Rows.Count > 0)
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
{
FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
}
}
}
ChangeSeq = int.Parse(Seq);
int Seq1 = int.Parse(Seq);
if (Seq1 <= BeforeChangeNum)
{
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, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0 }, this.ob);
//ChangeFlag = 1;
hm.UpdateChangeFlag(JudgeStoveNo, ResultNo, FeedRowNo, 0, Seq1, 0);
}
//交班确认
else if (e.Cell.Column.Key == "BTNCHANGECOM")
{
int WaitChangeSeq = hm.GetWaitChangeSeq(JudgeStoveNo, ResultNo, FeedRowNo, 0, 0, proPlanId, gxPlanNo);
if (WaitChangeSeq == 0)
{
MessageBox.Show("没有待交班确认的管号。");
return;
}
if (WaitChangeSeq != int.Parse(Seq))
{
MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确认上料行号:【" + FeedRowNo + "】序号:【" + Seq + "】交班?") == DialogResult.No)
{
return;
}
//查询是否有该班接班记录
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
//string Time = DateTime.Now.ToLongTimeString();
string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
Time = Time.Replace(":", "");
switch (Shift)
{
case "1":
if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000)
{
StartTime = SeverTime.ToShortDateString() + " 06:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 08:00:00";
}
if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000)
{
StartTime = SeverTime.ToShortDateString() + " 13:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 15:00:00";
}
break;
case "2":
if (int.Parse(Time) > 130000 && int.Parse(Time) < 150000)
{
StartTime = SeverTime.ToShortDateString() + " 13:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 15:00:00";
}
if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000)
{
StartTime = SeverTime.ToShortDateString() + " 20:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 22:00:00";
}
break;
case "3":
if (int.Parse(Time) > 200000 && int.Parse(Time) < 220000)
{
StartTime = SeverTime.ToShortDateString() + " 20:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 22:00:00";
}
if (int.Parse(Time) > 60000 && int.Parse(Time) < 80000)
{
StartTime = SeverTime.ToShortDateString() + " 06:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 08:00:00";
}
break;
}
//未登录
//if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "0", PlineCode))
//{
if (this.DoRelogin(DoCheck))
{
//FrmChangeGroup frmCg = new FrmChangeGroup(this.ob);
//frmCg.ShowDialog();
//if (frmCg.DialogResult == DialogResult.OK)
//{
//string Shift = UserInfo.GetUserOrder();
//string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
//插入接班确认履历表
hm.InsertChangeRemuse(Shift, Group, _UserName, "0", PlineCode);
int BeforeChangeNum = 0; //前道工序交接班支数
int FeedStartSeq = 1; //上料行起始Seq
//string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
//查询上个班上料行交班Seq
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
if (dtChangeNum.Rows.Count > 0)
{
for (int i = 0; i < dtChangeNum.Rows.Count; i++)
{
if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
{
BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
}
}
}
//查询当前坯料上料行起始Seq
DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
if (dtFeedSeq.Rows.Count > 0)
{
for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
{
if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
{
FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
}
}
}
ChangeSeq = int.Parse(Seq);
int Seq1 = int.Parse(Seq);
if (Seq1 <= BeforeChangeNum)
{
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, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0, proPlanId, gxPlanNo }, this.ob);
// int FeedRowEndSeq = ultraGridMatSeq.Rows.Count + FeedStartSeq -1; //上料行结束Seq
//修改上料行管号队列开始时间
DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
if (dtFeedRow.Rows.Count > 0)
{
string ChangeFeedRowNo = dtFeedRow.Rows[0][0].ToString();
MessageBox.Show("上料行【" + ChangeFeedRowNo + "】需要交班确认。");
//foreach (UltraGridRow ugrf in chkNodeQuery.DisplayLayout.Bands[1].Layout.Rows)
//{
// if (ugrf.Cells["FEED_ROW_NO"].Value.ToString() == ChangeFeedRowNo)
// {
// chkNodeQuery.ActiveRow = ugrf;
// }
//}
}
else
{
ChangeFlag = 1;
}
// frmCg.Close();
//}
}
// }
// else
// {
// // string Shift = UserInfo.GetUserOrder();
// // string Group = UserInfo.GetUserGroup();
// string User = UserInfo.GetUserName();
// int BeforeChangeNum = 0; //前道工序交接班支数
// int FeedStartSeq = 1; //上料行起始Seq
// //string FeedRowNo = ultraGridMatSeq.ActiveRow.Cells["FEED_ROW_NO"].Value.ToString();
// //查询上个班上料行交班Seq
// DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, FeedRowNo, 0, PlineCode, Shift, Group }, this.ob);
// if (dtChangeNum.Rows.Count > 0)
// {
// for (int i = 0; i < dtChangeNum.Rows.Count; i++)
// {
// if (FeedRowNo == dtChangeNum.Rows[i]["FEED_ROW_NO"].ToString())
// {
// BeforeChangeNum = int.Parse(dtChangeNum.Rows[i]["SEQ"].ToString());
// }
// }
// }
// //查询当前坯料上料行起始Seq
// DataTable dtFeedSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getStartSeq", new object[] { JudgeStoveNo, FeedRowNo }, this.ob);
// if (dtFeedSeq.Rows.Count > 0)
// {
// for (int i = 0; i < dtFeedSeq.Rows.Count; i++)
// {
// if (FeedRowNo == dtFeedSeq.Rows[i]["FEED_ROW_NO"].ToString())
// {
// FeedStartSeq = int.Parse(dtFeedSeq.Rows[i]["SEQ"].ToString());
// }
// }
// }
// ChangeSeq = int.Parse(Seq);
// int Seq1 = int.Parse(Seq);
// if (Seq1 <= BeforeChangeNum)
// {
// 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, FeedRowNo, Seq1, BeforeChangeNum, FeedStartSeq, PlineCode, Shift, Group, _UserName, 1, 0 }, this.ob);
// DataTable dtFeedRow = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQuery", new object[] { JudgeStoveNo, ResultNo, FeedRowNo }, this.ob);
// if (dtFeedRow.Rows.Count > 0)
// {
// string ChangeFeedRowNo = dtFeedRow.Rows[0][0].ToString();
// MessageBox.Show("上料行【" + ChangeFeedRowNo + "】需要交班确认。");
// //foreach (UltraGridRow ugrf in chkNodeQuery.DisplayLayout.Bands[1].Layout.Rows)
// //{
// // if (ugrf.Cells["FEED_ROW_NO"].Value.ToString() == ChangeFeedRowNo)
// // {
// // chkNodeQuery.ActiveRow = ugrf;
// // }
// //}
// }
// else
// {
// ChangeFlag = 1;
// }
// }
}
//过渡方法,接班后重登陆初始化导致Grid.Row为null
if (chkNodeQuery.Rows == null)
{
return;
}
//查询上料行信息
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleFeedPlanForFeedRowNo", new object[] { JudgeStoveNo, FeedRowNo, proPlanId, gxPlanNo }, this.ob);
if (dtFP.Rows.Count > 0)
{
FeedRowEditGridForRack(dtFP);//上料计 划信息
}
GetFeedRack();
ChangeGridColor();
GetGridButtonName();
PlanQuery();
}
}
public string DoCheck(CoreUserInfo User)
{
return "";
}
///
/// 结炉按钮
///
public void FeedSawResultNode()
{
DoSave();
HOTMethod hm = new HOTMethod(this.ob);
this.feedSaw1.UltraGrid4.UpdateData();
if (chkNodeQuery.Rows.Count > 0)
{
UltraGridRow ugr = chkNodeQuery.ActiveRow;
if (ugr != null)
{
string JudgeStoveNo = 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();
if (!ugr.HasParent())
{
ResultNo = ugr.Cells["ID"].Value.ToString();
}
else
{
UltraGridRow ugrp = ugr.ParentRow;
ResultNo = ugrp.Cells["ID"].Value.ToString();
}
//if (!string.IsNullOrEmpty(ugr.Cells["IS_START"].Value.ToString()))
//{
// string s = ugr.Cells["IS_START"].Value.ToString();
// if (s == "已完成锯切")
// {
// MessageBox.Show("炉号:【" + JudgeStoveNo + "】已完成锯切操作,不允许进行结炉操作!!!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
//}
string Status = "";
if (ugr.HasParent())
{
UltraGridRow ugr1 = ugr.ParentRow;
Status = ugr1.Cells["IS_START"].Value.ToString();
//ResultNo = ugr1.Cells["ID"].Value.ToString();
if (Status == "已完成锯切")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成锯切操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
else if (ugr.HasChild())
{
// ResultNo = ugr.Cells["ID"].Value.ToString();
}
else if (!string.IsNullOrEmpty(ugr.Cells["IS_START"].Value.ToString()))
{
string s = ugr.Cells["IS_START"].Value.ToString();
if (s == "已完成锯切")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成锯切操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
DataRow[] drArr = dtFeedPlan.Select("JUDGE_STOVE_NO = '" + JudgeStoveNo + "'");
foreach (DataRow dr in drArr)
{
if (dr["SAW_FALG"].ToString() == "未上料" || dr["SAW_FALG"].ToString() == "已上料")
{
string FeedRowNo = dr["FEED_ROW_NO"].ToString();
MessageBox.Show("上料行【" + FeedRowNo + "】还未锯切完成,请锯切后结炉。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
}
//if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉?") == DialogResult.No)
//{
// return;
//}
if (hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 0) > 0)
{
MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 0) + "】未接班确认,不能结炉");
return;
}
//判断
//DataTable dtPROCESS = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getInputWeigtht", new object[] { JudgeStoveNo }, this.ob);
//if (dtPROCESS.Rows.Count > 0)
//{
// if (double.Parse(dtPROCESS.Rows[0]["INPUT_WEIGHT"].ToString3()) <= 0)
// {
// MessageBox.Show("该炉的锯切有问题,请【上料退回】后,重新操作!");
// return;
// }
//}
DataTable dtFP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getToltalFeedPlan", new object[] { JudgeStoveNo }, this.ob);
//剔除上料支数
if (!string.IsNullOrEmpty(dtFP.Rows[0]["BEFORE_SCRAP_NUM"].ToString()))
{
FeedSawResult.BeforeScrapNum = dtFP.Rows[0]["BEFORE_SCRAP_NUM"].ToString();
}
else
{
FeedSawResult.BeforeScrapNum = "0";
}
//剔除单倍坯支数
if (!string.IsNullOrEmpty(dtFP.Rows[0]["AFTER_SCRAP_NUM"].ToString()))
{
FeedSawResult.AfterScrapNum = dtFP.Rows[0]["AFTER_SCRAP_NUM"].ToString();
}
else
{
FeedSawResult.AfterScrapNum = "0";
}
//合格支数
FeedSawResult.CutNum = dtFP.Rows[0]["CUT_NUM"].ToString();
//切损长度
FeedSawResult.CutLength = dtFP.Rows[0]["CUT_LENGTH"].ToString();
//切损重量
FeedSawResult.CutWeight = dtFP.Rows[0]["CUT_WEIGHT"].ToString();
//结炉标识
FeedSawResult.NodeFurFlag = "1";
//备注
UltraGridRow ugr2 = this.feedSaw1.UltraGrid4.Rows[0];
FeedSawResult.Remark = ugr2.Cells["Remark"].Value.ToString();
//上料支数 = 计划上料支数 - 实际剔除上料支数
int PlanFeedNum = int.Parse(dtFP.Rows[0]["FEED_NUM"].ToString());
//int ScrapFeedNum = 0;
//if (!string.IsNullOrEmpty(FeedSawResult.BeforeScrapNum))
//{
// ScrapFeedNum = int.Parse(FeedSawResult.BeforeScrapNum);
//}
//单倍重
double DBNum = 1;
double DBHeight = 0;
DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (dtDBH.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
{
DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
}
if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString()))
{
DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString());
}
}
if (DBHeight <= 0.0)
{
MessageBox.Show("该炉的计划有问题,没有单倍重,请撤销计划重新下发!");
return;
}
//if (!ugr.Cells["LOT_NO"].Value.ToString().Equals("无"))
//{
// if (int.Parse(FeedSawResult.CutNum) <= 0)
// {
// MessageBox.Show("该炉的锯切有问题,请【上料退回】后,重新操作!");
// return;
// }
//}
FeedSawResult.QaTon = (DBHeight * double.Parse(FeedSawResult.CutNum)).ToString();
FeedSawResult.FeedNum = (PlanFeedNum).ToString();
FeedSawResult.Statue = "10";
FeedSawResult.ColUser = _UserName;
FeedSawResult.ColGroup = UserInfo.GetUserGroup();
FeedSawResult.ColShift = UserInfo.GetUserOrder();
FeedSawResult.JudgeStoveNo = JudgeStoveNo;
FeedSawResult.UserId = _UserID;
FeedSawResult.ProPlanId = proPlanId;
FeedSawResult.GxPlanNo = gxPlanNo;
FeedSawResult.LotNo = lotNo;
FeedSawResult.PlineCode = PlineCode;
FeedSawResult.SesultNo = ResultNo;
//写进程表
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
ccp.MethodName = "updateProcess";
ccp.ServerParams = new object[] { JudgeStoveNo, "0", "0", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.FeedSawResultNode", new object[] { FeedSawResult }, this.ob);
if (count > 0)
{
int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { JudgeStoveNo, 1, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
//int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.insertHeatNo", new object[] { JudgeStoveNo, ResultNo }, this.ob);
try
{
//GeneratePlanStoveD(ResultNo, JudgeStoveNo, UserInfo.GetUserName(), ob);
}catch(Exception e)
{
}
}
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dtMatSeq.Clear();
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
Refresh();
}
}
///
/// 生成轧管炉计划(以及镦拔扩虚拟炉计划)
///
/// 实绩编号
/// 判定炉号
/// 操作人
/// OpeBase
public static void GeneratePlanStoveD(string resultNo, string judgeStoveNo, string userName, OpeBase ob)
{
OpeBase ob1 = new OpeBase();
//string url1 = CoreUserInfo.UrlList["PSSServer"].Url; //"服务名" = PSSServer
ob1.MainUrl = "http://172.16.2.130:8081/PSSServer/remoting/HessianRemoting";
ServerHelper.SetData("com.steering.pss.plnsaleord.planStove.StoveCommon.generatePlanStove", new string[] { resultNo, judgeStoveNo, userName }, ob1);
}
///
/// 撤销轧管炉计划(以及镦拔扩虚拟炉计划)
///
/// 实绩编号
/// 判定炉号
/// 操作人
/// OpeBase
public static void deletePlanStove(string judgeStoveNo,OpeBase ob)
{
OpeBase ob1 = new OpeBase();
//string url1 = CoreUserInfo.UrlList["PSSServer"].Url; //"服务名" = PSSServer
ob1.MainUrl = "http://172.16.2.130:8081/PSSServer/remoting/HessianRemoting";
ServerHelper.SetData("com.steering.pss.plnsaleord.planStove.StoveCommon.deletePlanStove", new string[] {judgeStoveNo}, ob1);
}
///
/// 结炉回退
///
private void NodeBack()
{
if (this.chkNodeQuery.ActiveRow == null)
{
MessageBox.Show("请选择需要回退的炉号!!!");
return;
}
UltraGridRow ugr = chkNodeQuery.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = "";
string NodeFlag = "";
if (ugr.HasParent())
{
UltraGridRow ugrp = ugr.ParentRow;
ResultNo = ugrp.Cells["ID"].Value.ToString();
NodeFlag = ugrp.Cells["IS_START"].Value.ToString();
}
else
{
ResultNo = ugr.Cells["ID"].Value.ToString();
NodeFlag = ugr.Cells["IS_START"].Value.ToString();
}
if (NodeFlag != "已完成锯切")
{
MessageBox.Show("炉号【" + JudgeStoveNo + "】未结炉,不能结炉回退!!!!");
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 "20":
NodeProcess = "环形加热炉";
break;
case "30":
NodeProcess = "穿孔";
break;
case "40":
NodeProcess = "连轧";
break;
case "50":
NodeProcess = "再加热炉";
break;
case "60":
NodeProcess = "定径";
break;
case "70":
NodeProcess = "分切";
break;
case "80":
NodeProcess = "矫直";
break;
case "90":
NodeProcess = "探伤";
break;
case "96":
NodeProcess = "质检";
break;
}
if (NodeStatus != "10")
{
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, 0, proPlanId, gxPlanNo }, this.ob);
if (dt1.Rows.Count > 0)
{
Seq = int.Parse(dt1.Rows[0][0].ToString());
}
try
{
deletePlanStove(JudgeStoveNo, ob);
}
catch
{
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 0, PlineCode, Seq, 0, 0, proPlanId, gxPlanNo, lotNo }, this.ob);
GetFeedRack();
ChangeGridColor();
GetGridButtonName();
PlanQuery();
}
}
///
/// 回炉坯组炉
///
private void BackFurSlab()
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
FrmBackSlab FrmBS = new FrmBackSlab(Shift, Shift, _UserName,this.ob,PlineCode);
FrmBS.ShowDialog();
PlanQuery();
}
///
/// 双击管号队列grid变更大小
///
///
///
private void ultraGridMatSeq_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
{
//管号队列Grid已拉伸
if (GirdSizeFlag == "1")
{
splitContainer2.SplitterDistance = 180;
GirdSizeFlag = "0";
}
//管号队列Grid未拉伸
else
{
splitContainer2.SplitterDistance = 90;
GirdSizeFlag = "1";
}
}
///
/// 打印报表
///
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=RepMilFeedSawResult.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=RepMilFeedSawResult.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=RepMilFeedSawResult.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=RepMilFeedSawResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
break;
case "C009": //258
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
break;
case "C010": //168
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
break;
case "C012": //Arssel
break;
case "C017": //460
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
break;
case "C072": //508
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID + "&format = pdf";
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), 0, 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), 0, 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), 0, 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), 0, 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=RepMilFeedSawResult250.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=RepMilFeedSawResult258.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=RepMilFeedSawResult168.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=RepMilFeedSawResult460.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=RepMilFeedSawResult508.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
break;
}
FrmRepExcel fre = new FrmRepExcel(ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
#endregion
#region 卡片赋值
///
/// 轧制信息Grid赋值
///
/// 轧制计划信息datatable
public void GridEdit(DataTable dt)
{
if (dt.Rows.Count > 0)
{
DataRow row1 = dt.Rows[0];
//熔炼炉号
this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
//炉号
this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
//生产批号
this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
//工序合同号
this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
//执行工艺号
this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
//执行工艺号路径
this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
//产线代码
this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
//状态
this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
//监制
this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
//工艺状态
this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
//单倍长
this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
//单倍重
this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
//轧制长度
this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
//分切数
this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
//目标长度
this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
//最终用户
this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
//目标库
this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
//品种
this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
//成品规格
this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
//扣型
this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
//长度范围
this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
//轧管判定标准
this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
//断面
this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
//钢种代码
this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
//钢种名称
this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
//钢级代码
this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
//钢级名称
this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
//炼钢判定标准
this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
//去向
this.rollingInfomation1.Value.Target = row1["target"].ToString();
//支
this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
//吨
this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
//切损去向
this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
//切损长度
this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
//切损重量
this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
//倍尺数
this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
//标准类别代码
this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
//标准类别描述
this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
//成品备注
this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
this.rollingInfomation1.UpdateData();
}
}
///
/// 上料行信息Grid赋值
///
/// 上料行计划信息datatable
public void FeedRowEditGrid(DataTable dtFP)
{
if (dtFP.Rows.Count > 0)
{
DataRow dr = dtFP.Rows[0];
//计划上料支数
this.feedSaw1.Value.FeedNumPlan = dr["FEED_NUM_PLAN"].ToString();
//上料支数
this.feedSaw1.Value.FeedNum = dr["FEED_NUM"].ToString();
//上料长度
this.feedSaw1.Value.FeedLength = dr["FEED_LENGTH"].ToString();
//使用长度
this.feedSaw1.Value.UseLength = dr["USE_LENGTH"].ToString();
//未使用长度
this.feedSaw1.Value.NonUseLength = dr["NON_USE_LENGTH"].ToString();
//切损去向
this.feedSaw1.Value.CutTarget = dr["CUT_TARGET"].ToString();
//倍尺数
this.feedSaw1.Value.DBNum = dr["DB_NUM"].ToString();
//单倍长度
this.feedSaw1.Value.DBLength = dr["DB_LENGTH"].ToString();
//单倍重
this.feedSaw1.Value.DBHeight = dr["DB_HEIGHT"].ToString();
//单支重量
this.feedSaw1.Value.MatHeight = dr["MAT_HEIGHT"].ToString();
//总重量
this.feedSaw1.Value.MatTotalHeight = dr["MAT_TOTAL_HEIGHT"].ToString();
//切损长度
this.feedSaw1.Value.CutLength = dr["CUT_LENGTH"].ToString();
//切损总重量
this.feedSaw1.Value.CutWeight = dr["CUT_WEIGHT"].ToString();
//切损单支重 = 切损重量/上料支数
double CutDZWeight = double.Parse(dr["CUT_WEIGHT"].ToString3()) / (double.Parse(dr["FEED_NUM_PLAN"].ToString3()));
//切前剔除支数
this.feedSaw1.Value.ScrapNumOld = dr["SCRAP_FEEDNUM"].ToString();
//切后剔除支数
this.feedSaw1.Value.ScrapNum = dr["SCRAP_DBNUM"].ToString();
//交接班支数
if (!string.IsNullOrEmpty(dr["CHANGE_NUM"].ToString()))
{
this.feedSaw1.Value.ChangeNum = dr["CHANGE_NUM"].ToString();
}
else
{
this.feedSaw1.Value.ChangeNum = "0";
}
//交接班总支数
if (!string.IsNullOrEmpty(dr["CHANGE_NUM_TOTAL"].ToString()))
{
this.feedSaw1.Value.ChangeNumTotal = dr["CHANGE_NUM_TOTAL"].ToString();
}
else
{
this.feedSaw1.Value.ChangeNumTotal = "0";
}
if (!string.IsNullOrEmpty(GetTime("0", dr["JUDGE_STOVE_NO"].ToString())))
{
//开始时间
this.feedSaw1.Value.StartTime = GetTime("0", dr["JUDGE_STOVE_NO"].ToString());
}
else
{
//开始时间
this.feedSaw1.Value.StartTime = "";
}
if (!string.IsNullOrEmpty(GetTime("1", dr["JUDGE_STOVE_NO"].ToString())))
{
//结束时间
this.feedSaw1.Value.EndTime = GetTime("1", dr["JUDGE_STOVE_NO"].ToString());
}
else
{
//结束时间
this.feedSaw1.Value.EndTime = "";
}
this.feedSaw1.Value.ReMark = dr["REMARK"].ToString();
this.feedSaw1.UpdateData(CutDZWeight);
}
}
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();
}
}
#endregion
private void chkNodeQuery_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
}
///
/// 上料行信息Grid赋值 -用于操作
///
/// 上料行计划信息datatable
public void FeedRowEditGridForRack(DataTable dtFP)
{
if (dtFP.Rows.Count > 0)
{
DataRow dr = dtFP.Rows[0];
//无料总重量
this.feedSaw1.Value.MatTotalHeight = dr["MAT_TOTAL_HEIGHT"].ToString();
//切损长度
this.feedSaw1.Value.CutLength = dr["CUT_LENGTH"].ToString();
//切损重量
this.feedSaw1.Value.CutWeight = dr["CUT_WEIGHT"].ToString();
//切前剔除支数
this.feedSaw1.Value.ScrapNumOld = dr["SCRAP_FEEDNUM"].ToString();
//切后剔除支数
this.feedSaw1.Value.ScrapNum = dr["SCRAP_DBNUM"].ToString();
//实际上料支数
this.feedSaw1.Value.FeedNum = dr["FEED_NUM"].ToString();
//交接班支数
if (!string.IsNullOrEmpty(dr["CHANGE_NUM"].ToString()))
{
this.feedSaw1.Value.ChangeNum = dr["CHANGE_NUM"].ToString();
}
else
{
this.feedSaw1.Value.ChangeNum = "0";
}
//交接班总支数
if (!string.IsNullOrEmpty(dr["CHANGE_NUM_TOTAL"].ToString()))
{
this.feedSaw1.Value.ChangeNumTotal = dr["CHANGE_NUM_TOTAL"].ToString();
}
else
{
this.feedSaw1.Value.ChangeNumTotal = "0";
}
//切损单支重 = 切损重量/上料支数
double CutDZWeight = double.Parse(dr["CUT_WEIGHT"].ToString()) / (double.Parse(dr["FEED_NUM_PLAN"].ToString()));
this.feedSaw1.UpdateDataForRack(CutDZWeight);
}
}
///
/// 到点提示交班
///
///
///
private void timer2_Tick(object sender, EventArgs e)
{
if (!PlineCode.Equals("C072"))
{
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
Time = Time.Replace(":", "");
if (ChangeFlag == 0)
{
if (int.Parse(Time) > 065459 && int.Parse(Time) < 065600 || int.Parse(Time) > 070359 && int.Parse(Time) < 070500)
{
if (Shift == "3")
{
if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
{
}
ChangeFlag = 1;
return;
}
}
if (int.Parse(Time) > 135359 && int.Parse(Time) < 135500 || int.Parse(Time) > 140359 && int.Parse(Time) < 140500)
{
if (Shift == "1")
{
if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
{
}
ChangeFlag = 1;
return;
}
}
if (int.Parse(Time) > 205359 && int.Parse(Time) < 205500 || int.Parse(Time) > 210359 && int.Parse(Time) < 210500)
{
if (Shift == "2")
{
if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
{
}
ChangeFlag = 1;
return;
}
}
}
}
}
}
}