You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.2 KiB
C#

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.Qingquan.FeedingPlc
{
public partial class FrmModifyPlanNum : Form
{
private int _oldPlanNum = 0;
public FrmModifyPlanNum()
{
InitializeComponent();
}
/// <summary>
/// 构造方法
/// </summary>
/// <param name="oldPlanNum">原始计划数</param>
public FrmModifyPlanNum(int oldPlanNum)
{
InitializeComponent();
this._oldPlanNum = oldPlanNum;
}
#region 属性定义
/// <summary>
/// 设定车次
/// </summary>
public int NewPlanNum
{
get { return Convert.ToInt32(this.txtNewPlanNum.Text); }
}
#endregion
#region 初始化界面文本
/// <summary>
/// 初始化界面文本
/// </summary>
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;
}
/// <summary>
/// 判断字符串是否为数字
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public bool IsDigit(string str)
{
bool flag = true;
foreach (char c in str)
{
if (!Char.IsDigit(c))
{
flag = false;
break;
}
}
return flag;
}
}
}