using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CoreFS.CA06;
using Core.Mes.Client.Common;
using System.Collections;
using Core.LgMes.Client.Comm;
namespace Core.LgMes.Client.LgJobMgt
{
public partial class frmJobPlanInfo : Form
{
///
///
///
///
/// 岗位名称
/// 岗位
/// 是否是提钒
public frmJobPlanInfo(string szGW, string szDev)
{
InitializeComponent();
this.m_szStationName = szGW;
_DevicePos = szDev;
}
#region " Variable"
private string m_szStationName = ""; // 岗位名称
private string _DevicePos = ""; // 设备位置
public string _currSmeltingID = "";
public string deviceName = "";
public string Van="";
public string strVanStatus = "";
public OpeBase ob = null;
#endregion
#region " Init"
private void frmJobPlanInfo_Load(object sender, EventArgs e)
{
this.Text = this.m_szStationName + this.Text;
GetPlaningInfo();
if (_DevicePos.Length < 3 || _DevicePos.Substring(0, 3) != "BOF")
this.btnOk.Enabled = false;
else
this.btnOk.Enabled = true;
}
#endregion
private void SetCaption()
{
this.ultraGrid1.DisplayLayout.Bands[0].Columns["rownum"].Width = 40;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["rownum"].Header.Caption = "ID";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["rownum"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["rownum"].Header.VisiblePosition = 1;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_GON_ID"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_GON_ID"].Header.Caption = "订单行号";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_GON_ID"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_GON_ID"].Header.VisiblePosition = 2;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEATNO"].Width = 85;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEATNO"].Header.Caption = "熔炼号";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEATNO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEATNO"].Header.VisiblePosition = 3;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["AIM_GRADE_CODE"].Width = 60;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["AIM_GRADE_CODE"].Header.Caption = "目标钢号";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["AIM_GRADE_CODE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["AIM_GRADE_CODE"].Header.VisiblePosition = 4;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_ID"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_ID"].Header.Caption = "铸机号";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_ID"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_ID"].Header.VisiblePosition = 5;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_NO"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_NO"].Header.Caption = "浇次号";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_NO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_NO"].Header.VisiblePosition = 6;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEAT_NUM"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEAT_NUM"].Header.Caption = "浇次内炉数";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEAT_NUM"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEAT_NUM"].Header.VisiblePosition = 7;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_SEQ"].Width = 60;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_SEQ"].Header.Caption = "浇次内炉顺序";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_SEQ"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["CAST_SEQ"].Header.VisiblePosition = 8;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["PLAN_CCM_STR_TIME"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["PLAN_CCM_STR_TIME"].Header.Caption = "开浇时间";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["PLAN_CCM_STR_TIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["PLAN_CCM_STR_TIME"].Header.VisiblePosition = 9;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].Width = 70;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].Header.Caption = "说明";
this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_NAME"].Header.VisiblePosition = 10;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["HEAT_STATE"].Hidden = true;
}
///
/// 获取计划信息
///
private void GetPlaningInfo()
{
string szWhere = "";
szWhere = "where t.aim_grade_code=t1.steelcode and HEAT_STATE='03' AND (substr(heatno,3,1)='" + _DevicePos.Substring(4, 1) + "' "
+" OR INSTR(FACT_ROUTE,'C" + _DevicePos.Substring(4, 1) + "') > 0)"; //and substr(heatno,3,1)='" + _DevicePos.Substring(4, 1) + "'";// and t.HEAT_STATE = '03' and substr(t.heatno,3,1)='" + _DevicePos.Substring(4, 1) + "'";
string strErr = "";
ArrayList arry = new ArrayList();
arry.Add("GetPlaningInfo.Select");//此ID为XML文件ID
arry.Add(_DevicePos.Substring(4, 1));
arry.Add(_DevicePos.Substring(4, 1));
CommonClientToServer cctos = new CommonClientToServer();
cctos.ob = ob;
//查询作业计划信息
DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.LgJobMgt.ClassBofJob",
"GetPlaningInfo", arry, out strErr);
if (strErr == "" && ds != null)
{
this.ultraGrid1.DataSource = ds.Tables[0];
if (ds.Tables != null && ds.Tables[0].Rows.Count > 0)
SetCaption();
//analysPlanPath();
}
}
///
/// 解析作业路线
///
private void analysPlanPath()
{
foreach(Infragistics.Win.UltraWinGrid.UltraGridRow rw in this.ultraGrid1.Rows )
{
rw.Cells["PLAN_ROUTE"].Value = CStaticMethod.analysPath(rw.Cells["PLAN_ROUTE"].Value.ToString());
}
}
private void btnOk_Click(object sender, EventArgs e)
{
if (_currSmeltingID != string.Empty) this.Close();
if (this.ultraGrid1.ActiveRow == null)
{
MessageBox.Show("请选择一个熔炼号!", "提示");
return;
}
string strSmetingID = "";
strSmetingID = this.ultraGrid1.ActiveRow.Cells["HEATNO"].Value.ToString();
//如果熔炼号没有变化,则返回空串,主窗体不做处理,
//否则将新的熔炼号返回。
if (_currSmeltingID == strSmetingID)
{
_currSmeltingID = "";
}
else
{
switch (MessageBox.Show("您选择了新的熔炼号,是否确认?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
{
case DialogResult.Yes:
_currSmeltingID = strSmetingID;
break;
case DialogResult.No:
_currSmeltingID = "";
break;
case DialogResult.Cancel:
break;
}
}
this.Close();
}
private void btnNo_Click(object sender, EventArgs e)
{
this._currSmeltingID = string.Empty;
this.Close();
}
}
}