F_MST_1302.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_1302.cs
  5. * 2.功能描述:新增/编辑装具管理
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 冯林勇 2022/07/25 1.00 新建
  9. *******************************************************************************/
  10. using Dongke.IBOSS.PRD.Basics.BaseControls;
  11. using Dongke.IBOSS.PRD.Basics.BaseResources;
  12. using Dongke.IBOSS.PRD.Client.CommonModule;
  13. using Dongke.IBOSS.PRD.Client.Controls;
  14. using Dongke.IBOSS.PRD.WCF.DataModels;
  15. using Dongke.IBOSS.PRD.WCF.Proxys;
  16. using System;
  17. using System.Data;
  18. using System.Windows.Forms;
  19. namespace Dongke.IBOSS.PRD.Client.PCModule
  20. {
  21. /// <summary>
  22. /// 新增/编辑装具管理
  23. /// </summary>
  24. public partial class F_MST_1302 : DKFormBase
  25. {
  26. #region 成员变量
  27. /// <summary>
  28. /// 页面状态
  29. /// </summary>
  30. public string FromStatus
  31. {
  32. get;
  33. set;
  34. }
  35. #endregion
  36. #region 构造函数
  37. public F_MST_1302(string entruckingCode)
  38. {
  39. InitializeComponent();
  40. this.btnSave.Text = ButtonText.BTN_SAVE;
  41. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  42. //装具条码
  43. this.txtEntruckingCode.Text = string.Empty;
  44. //容量
  45. this.txtTruckSize.Text = string.Empty;
  46. //停用标识
  47. this.cmbValueFlag.Text = string.Empty;
  48. //备注
  49. this.txtRemarks.Text = string.Empty;
  50. DataTable dtValueFlag = new DataTable();
  51. DataRow drValueFlag = dtValueFlag.NewRow();
  52. dtValueFlag.Columns.Add("ValueFlagID");
  53. dtValueFlag.Columns.Add("ValueFlagName");
  54. drValueFlag[0] = "1";
  55. drValueFlag[1] = "正常";
  56. dtValueFlag.Rows.Add(drValueFlag);
  57. drValueFlag = dtValueFlag.NewRow();
  58. drValueFlag[0] = "2";
  59. drValueFlag[1] = "停用";
  60. dtValueFlag.Rows.Add(drValueFlag);
  61. cmbValueFlag.DisplayMember = "ValueFlagName";
  62. cmbValueFlag.ValueMember = "ValueFlagID";
  63. cmbValueFlag.DataSource = dtValueFlag;
  64. if (!string.IsNullOrEmpty(entruckingCode))
  65. {
  66. FromStatus = "Edit";
  67. ClientRequestEntity cre = new ClientRequestEntity();
  68. cre.NameSpace = "F_MST_1301";
  69. cre.Name = "GetEntruckingInfo";
  70. cre.Properties["EntruckingCode"] = entruckingCode;
  71. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  72. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  73. {
  74. //装具条码
  75. this.txtEntruckingCode.Text = entruckingCode;
  76. //容量
  77. this.txtTruckSize.Text = sre.Data.Tables[0].Rows[0]["TRUCKSIZE"].ToString();
  78. //停用标识
  79. this.cmbValueFlag.SelectedValue = sre.Data.Tables[0].Rows[0]["VALUEFLAG"].ToString();
  80. //备注
  81. this.txtRemarks.Text = sre.Data.Tables[0].Rows[0]["REMARKS"].ToString();
  82. }
  83. }
  84. else
  85. {
  86. FromStatus = "Add";
  87. //装具条码
  88. this.txtEntruckingCode.Text = string.Empty;
  89. //容量
  90. this.txtTruckSize.Text = string.Empty;
  91. //停用标识
  92. this.cmbValueFlag.SelectedValue = 1;
  93. //备注
  94. this.txtRemarks.Text = string.Empty;
  95. }
  96. }
  97. #endregion
  98. #region 事件
  99. /// <summary>
  100. /// 窗体加载事件
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void F_MST_1302_Load(object sender, EventArgs e)
  105. {
  106. try
  107. {
  108. }
  109. catch (Exception ex)
  110. {
  111. // 对异常进行共通处理
  112. ExceptionManager.HandleEventException(this.ToString(),
  113. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  114. }
  115. }
  116. /// <summary>
  117. /// 保存按钮事件
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void btnSave_Click(object sender, EventArgs e)
  122. {
  123. try
  124. {
  125. #region 数据啊校验
  126. //装具条码
  127. if (string.IsNullOrEmpty(this.txtEntruckingCode.Text.ToString()))
  128. {
  129. //必须输入
  130. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "装具条码"),
  131. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  132. this.txtEntruckingCode.Focus();
  133. return;
  134. }
  135. //容量
  136. if (string.IsNullOrEmpty(this.txtTruckSize.Text.ToString()))
  137. {
  138. //必须输入
  139. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "容量"),
  140. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  141. this.txtTruckSize.Focus();
  142. return;
  143. }
  144. #endregion
  145. #region 保存方法
  146. ClientRequestEntity cre = new ClientRequestEntity();
  147. cre.NameSpace = "F_MST_1301";
  148. cre.Name = "InsertEntruckingInfo";
  149. //装具条码
  150. cre.Properties["txtEntruckingCode"] = this.txtEntruckingCode.Text.ToString();
  151. //容量
  152. cre.Properties["txtTruckSize"] = this.txtTruckSize.Text.ToString();
  153. //备注
  154. cre.Properties["txtRemarks"] = this.txtRemarks.Text.ToString();
  155. //停用标识
  156. cre.Properties["cmbValueFlag"] = this.cmbValueFlag.SelectedValue.ToString() == "" ? null : this.cmbValueFlag.SelectedValue.ToString();
  157. //页面状态
  158. cre.Properties["FromStatus"] = FromStatus.ToString();
  159. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  160. if (sre.OtherStatus > 0)
  161. {
  162. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  163. Close();
  164. return;
  165. }
  166. else if (Convert.ToInt32(sre.OtherStatus) == -1001)
  167. {
  168. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  169. "存在相同装具条码"),
  170. "",
  171. MessageBoxButtons.OK,
  172. MessageBoxIcon.Warning);
  173. return;
  174. }
  175. else if (Convert.ToInt32(sre.OtherStatus) == -1002)
  176. {
  177. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  178. "装具条码使用状态下装具条码"),
  179. "",
  180. MessageBoxButtons.OK,
  181. MessageBoxIcon.Warning);
  182. return;
  183. }
  184. else if (Convert.ToInt32(sre.OtherStatus) == -1003)
  185. {
  186. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  187. "未更新任何数据"),
  188. "",
  189. MessageBoxButtons.OK,
  190. MessageBoxIcon.Warning);
  191. return;
  192. }
  193. #endregion
  194. }
  195. catch (Exception ex)
  196. {
  197. // 对异常进行共通处理
  198. ExceptionManager.HandleEventException(this.ToString(),
  199. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  200. }
  201. }
  202. /// <summary>
  203. /// 取消按钮事件
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. private void btnCancel_Click(object sender, EventArgs e)
  208. {
  209. this.Close();
  210. }
  211. #endregion
  212. #region 私有方法
  213. #endregion
  214. }
  215. }