F_PC_0204.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0204.cs
  5. * 2.功能描述:生产线基本信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/03/27 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Basics.BaseControls;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.WCF.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
  18. namespace Dongke.IBOSS.PRD.Client.PCModule
  19. {
  20. /// <summary>
  21. /// 生产线基本信息
  22. /// </summary>
  23. public partial class F_PC_0204 : FormBase
  24. {
  25. #region 成员变量
  26. private int _lineID = -1; //生产线ID
  27. private string _lineCode; //生产线编码
  28. private string _lineName; //生产线名称
  29. private string _remarks; //备注
  30. private int _valueflag; //启用、禁用标记
  31. private Constant.FormMode _editStatus; //窗体编辑状态
  32. #endregion 成员变量
  33. #region 构造函数
  34. /// <summary>
  35. /// 生产线基本信息
  36. /// </summary>
  37. public F_PC_0204()
  38. {
  39. InitializeComponent();
  40. // 窗体标题
  41. this.Text = FormTitles.F_PC_0201;
  42. this.btnSave.Text = ButtonText.BTN_SAVE;
  43. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  44. }
  45. /// <summary>
  46. /// 生产线基本信息
  47. /// </summary>
  48. public F_PC_0204(Constant.FormMode editStatus, int lineID, string lineCode, string lineName, string remarks, int valueflag)
  49. {
  50. InitializeComponent();
  51. this._editStatus = editStatus;
  52. // 窗体标题
  53. this.Text = FormTitles.F_PC_0201;
  54. this.btnSave.Text = ButtonText.BTN_SAVE;
  55. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  56. this._lineID = lineID;
  57. this.txtLineCode.Text = lineCode;
  58. this.txtLineName.Text = lineName;
  59. this.txtRemarks.Text = remarks;
  60. this.chkValueFlag.Checked = Convert.ToBoolean(valueflag);
  61. }
  62. #endregion 构造函数
  63. #region 属性
  64. /// <summary>
  65. /// 生产线ID
  66. /// </summary>
  67. public int LineID
  68. {
  69. set
  70. {
  71. _lineID = value;
  72. }
  73. get
  74. {
  75. return _lineID;
  76. }
  77. }
  78. /// <summary>
  79. /// 生产线编码
  80. /// </summary>
  81. public string LineCode
  82. {
  83. set
  84. {
  85. _lineCode = value;
  86. }
  87. get
  88. {
  89. return _lineCode;
  90. }
  91. }
  92. /// <summary>
  93. /// 生产线名称
  94. /// </summary>
  95. public string LineName
  96. {
  97. set
  98. {
  99. _lineName = value;
  100. }
  101. get
  102. {
  103. return _lineName;
  104. }
  105. }
  106. /// <summary>
  107. /// 备注
  108. /// </summary>
  109. public string Remarks
  110. {
  111. set
  112. {
  113. _remarks = value;
  114. }
  115. get
  116. {
  117. return _remarks;
  118. }
  119. }
  120. /// <summary>
  121. /// 启用、禁用标记
  122. /// </summary>
  123. public int ValueFlag
  124. {
  125. set
  126. {
  127. _valueflag = value;
  128. }
  129. get
  130. {
  131. return _valueflag;
  132. }
  133. }
  134. #endregion 属性
  135. #region 事件处理
  136. /// <summary>
  137. /// 画面加载
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void F_PC_0204_Load(object sender, System.EventArgs e)
  142. {
  143. }
  144. /// <summary>
  145. /// 保存按钮事件
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void btnSave_Click(object sender, System.EventArgs e)
  150. {
  151. try
  152. {
  153. if (!this.CheckInputValidity())
  154. {
  155. return;
  156. }
  157. this.LineCode = this.txtLineCode.Text.Trim();
  158. this.LineName = this.txtLineName.Text.Trim();
  159. this.Remarks = this.txtRemarks.Text.Trim();
  160. this.ValueFlag = Convert.ToInt32(chkValueFlag.Checked);
  161. this.LineID = this._lineID;
  162. if (this._editStatus == Constant.FormMode.Edit)//编辑只更新生产线信息
  163. {
  164. ProductionLineEntity entity = new ProductionLineEntity();
  165. entity.ProductionLineID = this._lineID;
  166. entity.ProductionLineCode = txtLineCode.Text.Trim();
  167. entity.ProductionLineName = txtLineName.Text.Trim();
  168. entity.Remarks = this.txtRemarks.Text.Trim();
  169. object[] obj = null;
  170. if (chkValueFlag.Checked)
  171. {
  172. obj = new object[] { 1 };
  173. }
  174. else
  175. {
  176. obj = new object[] { 0 };
  177. }
  178. entity.ValueFlags = obj;
  179. int result = PCModuleProxy.Service.UpdateProductionLine(entity);
  180. if (result > Constant.INT_IS_ZERO)
  181. {
  182. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, FormTitles.F_PC_0202, Constant.OPERATE_SAVE),
  183. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  184. }
  185. else if (result == Constant.RETURN_IS_EXIST)//-3
  186. {
  187. MessageBox.Show(string.Format(Messages.MSG_CMN_W006, "生产线编码"),
  188. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  189. return;
  190. }
  191. }
  192. this.DialogResult = DialogResult.OK;
  193. }
  194. catch (Exception ex)
  195. {
  196. // 对异常进行共通处理
  197. ExceptionManager.HandleEventException(this.ToString(),
  198. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  199. }
  200. }
  201. #endregion 事件处理
  202. #region 私有方法
  203. /// <summary>
  204. /// 验证输入格式是否正确
  205. /// </summary>
  206. /// <returns></returns>
  207. private bool CheckInputValidity()
  208. {
  209. if (string.IsNullOrEmpty(this.txtLineCode.Text.Trim()))
  210. {
  211. this.txtLineCode.IsMustInput = true;
  212. this.txtLineCode.Focus();
  213. return false;
  214. }
  215. if (string.IsNullOrEmpty(this.txtLineName.Text.Trim()))
  216. {
  217. this.txtLineName.IsMustInput = true;
  218. this.txtLineName.Focus();
  219. return false;
  220. }
  221. return true;
  222. }
  223. #endregion
  224. }
  225. }