F_PM_2703.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*******************************************************************************
  2. * Copyright(c) 2018 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2703.cs
  5. * 2.功能描述:审核成型报损信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 周兴 2018/3/20 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Client.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.PMModule
  20. {
  21. /// <summary>
  22. /// 审核成型报损信息
  23. /// </summary>
  24. public partial class F_PM_2703 : FormBase
  25. {
  26. #region 成员变量
  27. //审核产品条码
  28. private string _barCode = "";
  29. //成型报损ID
  30. private int _spId;
  31. //0为审批,1为查看
  32. private int _formModeType;
  33. #endregion
  34. #region 构造函数
  35. /// <summary>
  36. /// 窗体构造
  37. /// </summary>
  38. /// <param name="barCode">需审核的条码</param>
  39. /// <param name="formModeType">页面打开模式</param>
  40. public F_PM_2703(string barCode, int formModeType, int SPId)
  41. {
  42. InitializeComponent();
  43. this._barCode = barCode;
  44. this._formModeType = formModeType;
  45. this._spId = SPId;
  46. this.Text = FormTitles.F_PM_2703;
  47. this.btnSave.Text = ButtonText.BTN_SAVE;
  48. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  49. }
  50. #endregion
  51. #region 事件
  52. /// <summary>
  53. /// 窗体加载
  54. /// </summary>
  55. /// <param name="sender"></param>
  56. /// <param name="e"></param>
  57. private void F_PM_2703_Load(object sender, EventArgs e)
  58. {
  59. try
  60. {
  61. if (this._formModeType == Constant.INT_IS_ZERO)
  62. {
  63. this.lblAuditorName.Enabled = true;
  64. this.lblTime.Enabled = true;
  65. this.txtAuditOpinion.Enabled = true;
  66. this.rbAuditStatusOK.Enabled = true;
  67. this.rbAuditStatusNo.Enabled = true;
  68. this.btnSave.Enabled = true;
  69. this.btnSave.Visible = true;
  70. }
  71. else
  72. {
  73. this.txtAuditOpinion.Enabled = false;
  74. this.rbAuditStatusOK.Enabled = false;
  75. this.rbAuditStatusNo.Enabled = false;
  76. this.btnSave.Enabled = false;
  77. this.btnSave.Visible = false;
  78. this.lblAuditorName.Enabled = false;
  79. this.lblTime.Enabled = false;
  80. }
  81. GetEntity();
  82. }
  83. catch (Exception ex)
  84. {
  85. // 对异常进行共通处理
  86. ExceptionManager.HandleEventException(this.ToString(),
  87. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  88. }
  89. }
  90. /// <summary>
  91. /// 窗体关闭
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. private void btnCancel_Click(object sender, EventArgs e)
  96. {
  97. this.Close();
  98. }
  99. /// <summary>
  100. /// 提交审核
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void btnSave_Click(object sender, EventArgs e)
  105. {
  106. try
  107. {
  108. ClientRequestEntity cre = new ClientRequestEntity();
  109. cre.NameSpace = "GroutingScrapProduct";
  110. cre.Name = "AuditGroutingScrapProduct";
  111. cre.Properties["ScrapProductID"] = this._spId;
  112. cre.Properties["AuditOpinion"] = this.txtAuditOpinion.Text.Trim();
  113. cre.Properties["Auditor"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  114. if (this.rbAuditStatusOK.Checked)
  115. {
  116. cre.Properties["AuditStatus"] = Constant.INT_IS_ONE;
  117. }
  118. else
  119. {
  120. cre.Properties["AuditStatus"] = Constant.INT_IS_TWO;
  121. }
  122. ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  123. {
  124. return PMModuleProxyNew.Service.HandleRequest(cre);
  125. }));
  126. int returnRow = (int)result.Result;
  127. if (returnRow > Constant.INT_IS_ZERO)
  128. {
  129. //成功
  130. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型报损", "审核"),
  131. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  132. this.DialogResult = DialogResult.OK;
  133. }
  134. else if (returnRow == -99)
  135. {
  136. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该报损不是待审状态"),
  137. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  138. }
  139. else
  140. {
  141. //失败
  142. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型报损", "审核"),
  143. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  144. }
  145. }
  146. catch (Exception ex)
  147. {
  148. // 对异常进行共通处理
  149. ExceptionManager.HandleEventException(this.ToString(),
  150. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  151. }
  152. }
  153. #endregion
  154. #region 私有方法
  155. /// <summary>
  156. /// 获取需要审核的成型报损实体
  157. /// </summary>
  158. private void GetEntity()
  159. {
  160. try
  161. {
  162. ClientRequestEntity cre = new ClientRequestEntity();
  163. cre.NameSpace = "GroutingScrapProduct";
  164. cre.Name = "GetGroutingScrapProduct";
  165. cre.Properties["ScrapProductID"] = this._spId;
  166. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  167. int auditStatus = -1;
  168. // 给控件赋值
  169. if (result != null && result.Data != null && result.Data.Tables.Count > 0
  170. && result.Data.Tables[0].Rows.Count > 0)
  171. {
  172. DataRow drScrap = result.Data.Tables[0].Rows[0];
  173. if (this._formModeType == Constant.INT_IS_ZERO) //审批看到的是当前
  174. {
  175. this.lblAuditorName.Text = LogInUserInfo.CurrentUser.CurrentUserEntity.UserName;
  176. this.lblTime.Text = CommonModuleProxy.Service.GetAccountDate().ToString("yyyy-MM-dd");
  177. }
  178. else //查看看到的是记录
  179. {
  180. this.lblAuditorName.Text = drScrap["UName"] + "";
  181. this.lblTime.Text = Convert.ToDateTime(drScrap["AuditDate"]).ToString("yyyy-MM-dd");
  182. this.txtAuditOpinion.Text = drScrap["AuditOpinion"] + "";
  183. }
  184. auditStatus = Convert.ToInt32(drScrap["AuditStatus"]);
  185. }
  186. else
  187. {
  188. this.Close();
  189. return;
  190. }
  191. //已经通过审核或已经驳回审核的就不能再修改了
  192. if (auditStatus != Constant.INT_IS_ZERO)
  193. {
  194. this.txtAuditOpinion.Enabled = false;
  195. this.rbAuditStatusOK.Enabled = false;
  196. this.rbAuditStatusNo.Enabled = false;
  197. this.btnSave.Enabled = false;
  198. if (auditStatus == Constant.INT_IS_ONE)
  199. {
  200. this.rbAuditStatusNo.Checked = false;
  201. this.rbAuditStatusOK.Checked = true;
  202. }
  203. else
  204. {
  205. this.rbAuditStatusNo.Checked = true;
  206. this.rbAuditStatusOK.Checked = false;
  207. }
  208. }
  209. }
  210. catch (Exception ex)
  211. {
  212. throw ex;
  213. }
  214. }
  215. #endregion
  216. }
  217. }