using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using Mesnac.Action.Base;
using System.Text;
using System.Windows.Forms;
namespace Mesnac.Action.Feeding.FeedingPlc
{
public partial class FrmModifyPlanNum : Form
{
private int _oldPlanNum = 0;
public FrmModifyPlanNum()
{
InitializeComponent();
}
///
/// 构造方法
///
/// 原始计划数
public FrmModifyPlanNum(int oldPlanNum)
{
InitializeComponent();
this._oldPlanNum = oldPlanNum;
}
#region 属性定义
///
/// 设定车次
///
public int NewPlanNum
{
get { return Convert.ToInt32(this.txtNewPlanNum.Text); }
}
#endregion
#region 初始化界面文本
///
/// 初始化界面文本
///
public void InitUI()
{
this.Text = LanguageService.Instance.Read(133);
this.label1.Text = LanguageService.Instance.Read(134);
this.label2.Text = LanguageService.Instance.Read(135);
this.btnOK.Text = LanguageService.Instance.Read(18);
this.btnCancel.Text = LanguageService.Instance.Read(19);
this.lblCurrentPlanNum.Text = BasicInfo.PlcData.Instance.RecipeSetNumber.LastValue.ToInt().ToString();
//this.lblCurrentPlanNum.Text = this._oldPlanNum.ToString();
}
#endregion
private void FrmModifyPlanNum_Load(object sender, EventArgs e)
{
this.InitUI();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(this.txtNewPlanNum.Text))
{
string msg = LanguageService.Instance.Read(136); //设定车次不能为空,请输入!
MessageBox.Show(msg, LanguageService.Instance.Read(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!this.IsDigit(this.txtNewPlanNum.Text))
{
string msg = LanguageService.Instance.Read(137); //设定车次必须为数字,请重新输入!
MessageBox.Show(msg, LanguageService.Instance.Read(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
///
/// 判断字符串是否为数字
///
///
///
public bool IsDigit(string str)
{
bool flag = true;
foreach (char c in str)
{
if (!Char.IsDigit(c))
{
flag = false;
break;
}
}
return flag;
}
}
}