/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_0603.cs
* 2.功能描述:撤销入窑
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2015/05/12 1.00 设计窗体布局
*******************************************************************************/
using System;
using System.Data;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Basics.Library;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
namespace Dongke.IBOSS.PRD.Client.PMModule
{
public partial class F_PM_0603 : FormBase
{
#region 成员变量
// 配置文件的全路径
private string _iniFilePath = LocalPath.RootPath + Constant.INI_FILE_NAME;
// 工序ID
private int _procedureID;
//窑车实体类
CheckKilnCarResultEntity _kilnCarEntity = null;
#endregion
#region 构造函数
public F_PM_0603()
{
InitializeComponent();
this.btnClose.Text = ButtonText.BTN_SAVE;
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
public F_PM_0603(int procedureID)
{
InitializeComponent();
this._procedureID = procedureID;
this.btnClose.Text = ButtonText.BTN_SAVE;
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
#endregion
#region 事件
///
/// 窗体加载事件
///
///
///
private void F_PM_0603_Load(object sender, EventArgs e)
{
try
{
//string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
// Constant.INI_KEY_KILN_CODE, this._iniFilePath);
string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
Constant.INI_KEY_KILN_CODE, LocalPath.LocalINIFilePath);
if (getKiln != string.Empty)
{
this.txtKiln.Text = getKiln;
this.txtKilnCarCode.Focus();
}
else
{
this.txtKiln.Focus();
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 窑炉验证事件
///
///
///
private void txtKiln_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
try
{
if (this.txtKiln.Text.Trim() == string.Empty)
{
this._kilnCarEntity = null;
return;
}
if (this.txtKiln.Text.Trim() != "")
{
if (!this.txtKiln.ReadOnly)
{
DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
{
return SystemModuleProxy.Service.GetAllKilntInfo();
}));
if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
{
DataView dv = dsResultAccount.Tables[0].DefaultView;
dv.RowFilter = "ValueFlag=1 and KilnCode='" + this.txtKiln.Text.Trim() + "'";
DataTable dt = dv.ToTable();
if (dt.Rows.Count == 0)
{
// 提示信息
MessageBox.Show("不存在此窑炉编号",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtKiln.SelectAll();
this.txtKiln.Focus();
return;
}
// 保存业务系统配置
Utility.WriteIniFile(Constant.INI_SECTION_SETTINGS, Constant.INI_KEY_KILN_CODE,
this.txtKiln.Text.Trim(), this._iniFilePath);
}
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
///
/// 保存按钮事件
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (txtKiln.Text.Trim() == "")
{
txtKiln.Focus();
return;
}
if (txtKilnCarCode.Text.Trim() == "")
{
txtKilnCarCode.Focus();
return;
}
int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
{
return PMModuleProxy.Service.CheckKilnCarByIntoCar2(this.txtKiln.Text.Trim() + this.txtKilnCarCode.Text.Trim(), this._procedureID);
}));
if (returnRow == -99)
{
MessageBox.Show("窑炉车号无效",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtKilnCarCode.Focus();
return;
}
if (returnRow == -98)
{
MessageBox.Show("窑车己无产品",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtKilnCarCode.Focus();
return;
}
if (returnRow == -97)
{
MessageBox.Show("窑车没有入窑,不可以撤销",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtKilnCarCode.Focus();
return;
}
if (returnRow == -1)
{
MessageBox.Show("保存失败",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtKilnCarCode.Focus();
return;
}
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
}
}