F_PM_1103.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_1103.cs
  5. * 2.功能描述:审核产品废弃信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/10/22 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. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  20. namespace Dongke.IBOSS.PRD.Client.PMModule
  21. {
  22. /// <summary>
  23. /// 审核产品废弃信息
  24. /// </summary>
  25. public partial class F_PM_1103 : FormBase
  26. {
  27. #region 成员变量
  28. //审核产品条码
  29. private string _barCode = "";
  30. //废弃产品ID
  31. private int _spId;
  32. //0为审批,1为查看
  33. private int _formModeType;
  34. //审批用废弃产品实体
  35. private ScrapProductEntity _auditEntity;
  36. #endregion
  37. #region 构造函数
  38. /// <summary>
  39. /// 窗体构造
  40. /// </summary>
  41. /// <param name="barCode">需审核的条码</param>
  42. /// <param name="formModeType">页面打开模式</param>
  43. public F_PM_1103(string barCode, int formModeType, int SPId)
  44. {
  45. InitializeComponent();
  46. this._barCode = barCode;
  47. this._formModeType = formModeType;
  48. this._spId = SPId;
  49. this.Text = FormTitles.F_PM_1103;
  50. this.btnSave.Text = ButtonText.BTN_SAVE;
  51. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  52. }
  53. #endregion
  54. #region 事件
  55. /// <summary>
  56. /// 窗体加载
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void F_PM_1103_Load(object sender, EventArgs e)
  61. {
  62. try
  63. {
  64. if (this._formModeType == Constant.INT_IS_ZERO)
  65. {
  66. this.lblAuditorName.Enabled = true;
  67. this.lblTime.Enabled = true;
  68. this.txtAuditOpinion.Enabled = true;
  69. this.rbAuditStatusOK.Enabled = true;
  70. this.rbAuditStatusNo.Enabled = true;
  71. this.btnSave.Enabled = true;
  72. this.btnSave.Visible = true;
  73. }
  74. else
  75. {
  76. this.txtAuditOpinion.Enabled = false;
  77. this.rbAuditStatusOK.Enabled = false;
  78. this.rbAuditStatusNo.Enabled = false;
  79. this.btnSave.Enabled = false;
  80. this.btnSave.Visible = false;
  81. this.lblAuditorName.Enabled = false;
  82. this.lblTime.Enabled = false;
  83. }
  84. GetEntity();
  85. }
  86. catch (Exception ex)
  87. {
  88. // 对异常进行共通处理
  89. ExceptionManager.HandleEventException(this.ToString(),
  90. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  91. }
  92. }
  93. /// <summary>
  94. /// 窗体关闭
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void btnCancel_Click(object sender, EventArgs e)
  99. {
  100. this.Close();
  101. }
  102. /// <summary>
  103. /// 提交审核
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void btnSave_Click(object sender, EventArgs e)
  108. {
  109. try
  110. {
  111. this._auditEntity.Auditor = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  112. this._auditEntity.AuditlDate = CommonModuleProxy.Service.GetAccountDate();
  113. this._auditEntity.AuditOpinion = this.txtAuditOpinion.Text;
  114. if (this.rbAuditStatusOK.Checked == true)
  115. {
  116. this._auditEntity.AuditStatus = 1;
  117. }
  118. else
  119. {
  120. this._auditEntity.AuditStatus = 2;
  121. }
  122. int MyReturn = (int)DoAsync(new BaseAsyncMethod(() =>
  123. {
  124. return PMModuleProxy.Service.AuditScrapProduct(_auditEntity);
  125. }));
  126. if (MyReturn > Constant.INT_IS_ZERO)
  127. {
  128. //成功
  129. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "废弃产品", "审核"),
  130. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  131. this.DialogResult = DialogResult.OK;
  132. }
  133. else if (MyReturn == -500)
  134. {
  135. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  136. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  137. this.Close();
  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. //获取报废产品实体
  163. this._auditEntity = new ScrapProductEntity();
  164. this._auditEntity.ScrapProductID = this._spId;
  165. this._auditEntity.BarCode = this._barCode;
  166. DataSet dsScrap = PMModuleProxy.Service.GetScrapProduct(this._auditEntity);
  167. if (dsScrap != null)
  168. {
  169. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  170. {
  171. DataRow drScrap = dsScrap.Tables[0].Rows[0];
  172. this._auditEntity.ScrapProductID = Convert.ToInt32(drScrap["ScrapProductID"]);
  173. this._auditEntity.BarCode = drScrap["BarCode"].ToString();
  174. //this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]);
  175. if (drScrap["ProductionLineID"] != DBNull.Value)
  176. {
  177. this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]);
  178. }
  179. this._auditEntity.ProductionLineCode = drScrap["ProductionLineCode"].ToString();
  180. this._auditEntity.ProductionLineName = drScrap["ProductionLineName"].ToString();
  181. this._auditEntity.GoodsID = Convert.ToInt32(drScrap["GoodsID"]);
  182. this._auditEntity.GoodsCode = drScrap["GoodsCode"].ToString();
  183. this._auditEntity.GoodsName = drScrap["GoodsName"].ToString();
  184. this._auditEntity.GroutingDailyID = Convert.ToInt32(drScrap["GroutingDailyID"]);
  185. this._auditEntity.GroutingDailyDetailID = Convert.ToInt32(drScrap["GroutingDailyDetailID"]);
  186. this._auditEntity.GroutingDate = Convert.ToDateTime(drScrap["GroutingDate"]);
  187. this._auditEntity.GroutingLineID = Convert.ToInt32(drScrap["GroutingLineID"]);
  188. this._auditEntity.GroutingLineCode = drScrap["GroutingLineCode"].ToString();
  189. this._auditEntity.GroutingLineName = drScrap["GroutingLineName"].ToString();
  190. this._auditEntity.GMouldTypeID = Convert.ToInt32(drScrap["GMouldTypeID"]);
  191. this._auditEntity.GroutingLineDetailID = Convert.ToInt32(drScrap["GroutingLineDetailID"]);
  192. this._auditEntity.GroutingMouldCode = drScrap["GroutingMouldCode"].ToString();
  193. this._auditEntity.MouldCode = drScrap["MouldCode"].ToString();
  194. this._auditEntity.GoodsLevelID = Convert.ToInt32(drScrap["GoodsLevelID"]);
  195. this._auditEntity.GoodsLevelTypeID = Convert.ToInt32(drScrap["GoodsLevelTypeID"]);
  196. this._auditEntity.ScrapDate = Convert.ToDateTime(drScrap["ScrapDate"]);
  197. this._auditEntity.Rreason = drScrap["Rreason"].ToString();
  198. this._auditEntity.Remarks = drScrap["Remarks"].ToString();
  199. this._auditEntity.AuditStatus = Convert.ToInt32(drScrap["AuditStatus"]);
  200. this._auditEntity.ResponType = Convert.ToInt32(drScrap["ResponType"]);
  201. if (drScrap["Auditor"] != DBNull.Value)
  202. {
  203. this._auditEntity.Auditor = Convert.ToInt32(drScrap["Auditor"]);
  204. }
  205. if (drScrap["AuditDate"] != DBNull.Value)
  206. {
  207. this._auditEntity.AuditlDate = Convert.ToDateTime(drScrap["AuditDate"]);
  208. }
  209. if (drScrap["AuditOpinion"] != DBNull.Value)
  210. {
  211. this._auditEntity.AuditOpinion = drScrap["AuditOpinion"].ToString();
  212. this.txtAuditOpinion.Text = this._auditEntity.AuditOpinion.ToString();
  213. }
  214. this._auditEntity.SettlementFlag = Convert.ToInt32(drScrap["SettlementFlag"]);
  215. if (drScrap["ProcedureID"] != DBNull.Value)
  216. {
  217. this._auditEntity.ResponProcedureID = Convert.ToInt32(drScrap["ProcedureID"]);
  218. }
  219. if (drScrap["UserID"] != DBNull.Value)
  220. {
  221. this._auditEntity.ResponUserID = Convert.ToInt32(drScrap["UserID"]);
  222. }
  223. if (drScrap["UserCode"] != DBNull.Value)
  224. {
  225. this._auditEntity.ResponUserCode = drScrap["UserCode"].ToString();
  226. }
  227. if (drScrap["UserName"] != DBNull.Value)
  228. {
  229. this._auditEntity.ResponUserName = drScrap["UserName"].ToString();
  230. }
  231. this._auditEntity.OPTimeStamp = Convert.ToDateTime(drScrap["OPTimeStamp"]);
  232. if (this._formModeType == Constant.INT_IS_ZERO) //审批看到的是当前
  233. {
  234. this.lblAuditorName.Text = LogInUserInfo.CurrentUser.CurrentUserEntity.UserName;
  235. this.lblTime.Text = CommonModuleProxy.Service.GetAccountDate().ToString("yyyy-MM-dd");
  236. }
  237. else //查看看到的是记录
  238. {
  239. this.lblAuditorName.Text = drScrap["UName"].ToString();
  240. this.lblTime.Text = Convert.ToDateTime(this._auditEntity.AuditlDate).ToString("yyyy-MM-dd");
  241. }
  242. //已经通过审核或已经驳回审核的就不能再修改了
  243. if (this._auditEntity.AuditStatus != Constant.INT_IS_ZERO)
  244. {
  245. this.txtAuditOpinion.Enabled = false;
  246. this.rbAuditStatusOK.Enabled = false;
  247. this.rbAuditStatusNo.Enabled = false;
  248. this.btnSave.Enabled = false;
  249. if (this._auditEntity.AuditStatus == Constant.INT_IS_ONE)
  250. {
  251. this.rbAuditStatusNo.Checked = false;
  252. this.rbAuditStatusOK.Checked = true;
  253. }
  254. else
  255. {
  256. this.rbAuditStatusNo.Checked = true;
  257. this.rbAuditStatusOK.Checked = false;
  258. }
  259. }
  260. }
  261. }
  262. else
  263. {
  264. this.Close();
  265. return;
  266. }
  267. }
  268. catch (Exception ex)
  269. {
  270. throw ex;
  271. }
  272. }
  273. #endregion
  274. }
  275. }