| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PC_0204.cs
- * 2.功能描述:生产线基本信息
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/03/27 1.00 新建
- *******************************************************************************/
- using System;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- /// <summary>
- /// 生产线基本信息
- /// </summary>
- public partial class F_PC_0204 : FormBase
- {
- #region 成员变量
- private int _lineID = -1; //生产线ID
- private string _lineCode; //生产线编码
- private string _lineName; //生产线名称
- private string _remarks; //备注
- private int _valueflag; //启用、禁用标记
- private Constant.FormMode _editStatus; //窗体编辑状态
- #endregion 成员变量
- #region 构造函数
- /// <summary>
- /// 生产线基本信息
- /// </summary>
- public F_PC_0204()
- {
- InitializeComponent();
- // 窗体标题
- this.Text = FormTitles.F_PC_0201;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- }
- /// <summary>
- /// 生产线基本信息
- /// </summary>
- public F_PC_0204(Constant.FormMode editStatus, int lineID, string lineCode, string lineName, string remarks, int valueflag)
- {
- InitializeComponent();
- this._editStatus = editStatus;
- // 窗体标题
- this.Text = FormTitles.F_PC_0201;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CANCEL;
- this._lineID = lineID;
- this.txtLineCode.Text = lineCode;
- this.txtLineName.Text = lineName;
- this.txtRemarks.Text = remarks;
- this.chkValueFlag.Checked = Convert.ToBoolean(valueflag);
- }
- #endregion 构造函数
- #region 属性
- /// <summary>
- /// 生产线ID
- /// </summary>
- public int LineID
- {
- set
- {
- _lineID = value;
- }
- get
- {
- return _lineID;
- }
- }
- /// <summary>
- /// 生产线编码
- /// </summary>
- public string LineCode
- {
- set
- {
- _lineCode = value;
- }
- get
- {
- return _lineCode;
- }
- }
- /// <summary>
- /// 生产线名称
- /// </summary>
- public string LineName
- {
- set
- {
- _lineName = value;
- }
- get
- {
- return _lineName;
- }
- }
- /// <summary>
- /// 备注
- /// </summary>
- public string Remarks
- {
- set
- {
- _remarks = value;
- }
- get
- {
- return _remarks;
- }
- }
- /// <summary>
- /// 启用、禁用标记
- /// </summary>
- public int ValueFlag
- {
- set
- {
- _valueflag = value;
- }
- get
- {
- return _valueflag;
- }
- }
- #endregion 属性
- #region 事件处理
- /// <summary>
- /// 画面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_0204_Load(object sender, System.EventArgs e)
- {
- }
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, System.EventArgs e)
- {
- try
- {
- if (!this.CheckInputValidity())
- {
- return;
- }
- this.LineCode = this.txtLineCode.Text.Trim();
- this.LineName = this.txtLineName.Text.Trim();
- this.Remarks = this.txtRemarks.Text.Trim();
- this.ValueFlag = Convert.ToInt32(chkValueFlag.Checked);
- this.LineID = this._lineID;
- if (this._editStatus == Constant.FormMode.Edit)//编辑只更新生产线信息
- {
- ProductionLineEntity entity = new ProductionLineEntity();
- entity.ProductionLineID = this._lineID;
- entity.ProductionLineCode = txtLineCode.Text.Trim();
- entity.ProductionLineName = txtLineName.Text.Trim();
- entity.Remarks = this.txtRemarks.Text.Trim();
- object[] obj = null;
- if (chkValueFlag.Checked)
- {
- obj = new object[] { 1 };
- }
- else
- {
- obj = new object[] { 0 };
- }
- entity.ValueFlags = obj;
- int result = PCModuleProxy.Service.UpdateProductionLine(entity);
- if (result > Constant.INT_IS_ZERO)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, FormTitles.F_PC_0202, Constant.OPERATE_SAVE),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (result == Constant.RETURN_IS_EXIST)//-3
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "生产线编码"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- this.DialogResult = DialogResult.OK;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion 事件处理
- #region 私有方法
- /// <summary>
- /// 验证输入格式是否正确
- /// </summary>
- /// <returns></returns>
- private bool CheckInputValidity()
- {
- if (string.IsNullOrEmpty(this.txtLineCode.Text.Trim()))
- {
- this.txtLineCode.IsMustInput = true;
- this.txtLineCode.Focus();
- return false;
- }
- if (string.IsNullOrEmpty(this.txtLineName.Text.Trim()))
- {
- this.txtLineName.IsMustInput = true;
- this.txtLineName.Focus();
- return false;
- }
- return true;
- }
- #endregion
- }
- }
|