164 lines
4.7 KiB
C#
164 lines
4.7 KiB
C#
using SlMesDbIterface;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
namespace MesToMs
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public partial class D_Station : Form
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public From_Opera from_Opera = From_Opera.Insert;
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_StationName = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_工位名称 = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_工序号 = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_工序名称 = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_PLC = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_区域代码 = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_机床类型 = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string D_是否启用MES = "";
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public D_Station()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="from_Opera"></param>
|
||
public D_Station(From_Opera from_Opera,string D_StationName, string D_工位名称, string D_工序号, string D_工序名称, string D_PLC
|
||
, string D_区域代码, string D_机床类型, string D_是否启用MES)
|
||
{
|
||
InitializeComponent();
|
||
|
||
switch (this.from_Opera = from_Opera)
|
||
{
|
||
case From_Opera.Insert:
|
||
Text = "添加工位";
|
||
txt_StationCode.ReadOnly = false;
|
||
break;
|
||
case From_Opera.Update:
|
||
Text = "修改工位";
|
||
txt_StationCode.Text = D_StationName;
|
||
txt_StationName.Text = D_工位名称;
|
||
txt_OpCode.Text = D_工序号;
|
||
txt_OpName.Text = D_工序名称;
|
||
txt_IP.Text = D_PLC;
|
||
txt_Zone.Text = D_区域代码;
|
||
txt_StationType.Text = D_机床类型;
|
||
txt_Enable_MES.Text = D_是否启用MES;
|
||
txt_StationCode.ReadOnly = true;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void btn_Sure_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(txt_StationCode.Text))
|
||
{
|
||
MessageBox.Show("请填写工位号!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_StationName.Text))
|
||
{
|
||
MessageBox.Show("请填写工位名称!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_OpCode.Text))
|
||
{
|
||
MessageBox.Show("请填写工序号!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_OpName.Text))
|
||
{
|
||
MessageBox.Show("请填写工序名称!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_IP.Text))
|
||
{
|
||
MessageBox.Show("请填写IP!");
|
||
return;
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(txt_Zone.Text))
|
||
{
|
||
MessageBox.Show("请填写区域代码!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_StationType.Text))
|
||
{
|
||
MessageBox.Show("请填写工位类型!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(txt_Enable_MES.Text))
|
||
{
|
||
MessageBox.Show("请填写是否启用MES!");
|
||
return;
|
||
}
|
||
|
||
D_StationName = txt_StationCode.Text;
|
||
D_工位名称 = txt_StationName.Text;
|
||
D_工序号 = txt_OpCode.Text;
|
||
D_工序名称 = txt_OpName.Text;
|
||
D_PLC = txt_IP.Text;
|
||
D_区域代码 = txt_Zone.Text;
|
||
D_机床类型 = txt_StationType.Text;
|
||
D_是否启用MES = txt_Enable_MES.Text;
|
||
|
||
DialogResult = DialogResult.OK;
|
||
}
|
||
|
||
private void btn_Cancel_Click(object sender, EventArgs e)
|
||
{
|
||
DialogResult = DialogResult.Cancel;
|
||
}
|
||
}
|
||
}
|