F_PM_1103.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. this._auditEntity.BarCode = _barCode;
  115. if (this.rbAuditStatusOK.Checked == true)
  116. {
  117. this._auditEntity.AuditStatus = 1;
  118. }
  119. else
  120. {
  121. this._auditEntity.AuditStatus = 2;
  122. }
  123. int MyReturn = (int)DoAsync(new BaseAsyncMethod(() =>
  124. {
  125. return PMModuleProxy.Service.AuditScrapProduct(_auditEntity);
  126. }));
  127. if (MyReturn > 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 (MyReturn == -500)
  135. {
  136. MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
  137. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  138. this.Close();
  139. }
  140. else
  141. {
  142. //失败
  143. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "废弃产品", "审核"),
  144. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. // 对异常进行共通处理
  150. ExceptionManager.HandleEventException(this.ToString(),
  151. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  152. }
  153. }
  154. #endregion
  155. #region 私有方法
  156. /// <summary>
  157. /// 获取需要审核的废弃产品实体
  158. /// </summary>
  159. private void GetEntity()
  160. {
  161. try
  162. {
  163. //获取报废产品实体
  164. this._auditEntity = new ScrapProductEntity();
  165. this._auditEntity.ScrapProductID = this._spId;
  166. this._auditEntity.BarCode = this._barCode;
  167. DataSet dsScrap = PMModuleProxy.Service.GetScrapProduct(this._auditEntity);
  168. if (dsScrap != null)
  169. {
  170. if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  171. {
  172. DataRow drScrap = dsScrap.Tables[0].Rows[0];
  173. this._auditEntity.ScrapProductID = Convert.ToInt32(drScrap["ScrapProductID"]);
  174. this._auditEntity.BarCode = drScrap["BarCode"].ToString();
  175. //this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]);
  176. if (drScrap["ProductionLineID"] != DBNull.Value)
  177. {
  178. this._auditEntity.ProductionLineID = Convert.ToInt32(drScrap["ProductionLineID"]);
  179. }
  180. this._auditEntity.ProductionLineCode = drScrap["ProductionLineCode"].ToString();
  181. this._auditEntity.ProductionLineName = drScrap["ProductionLineName"].ToString();
  182. this._auditEntity.GoodsID = Convert.ToInt32(drScrap["GoodsID"]);
  183. this._auditEntity.GoodsCode = drScrap["GoodsCode"].ToString();
  184. this._auditEntity.GoodsName = drScrap["GoodsName"].ToString();
  185. this._auditEntity.GroutingDailyID = Convert.ToInt32(drScrap["GroutingDailyID"]);
  186. this._auditEntity.GroutingDailyDetailID = Convert.ToInt32(drScrap["GroutingDailyDetailID"]);
  187. this._auditEntity.GroutingDate = Convert.ToDateTime(drScrap["GroutingDate"]);
  188. this._auditEntity.GroutingLineID = Convert.ToInt32(drScrap["GroutingLineID"]);
  189. this._auditEntity.GroutingLineCode = drScrap["GroutingLineCode"].ToString();
  190. this._auditEntity.GroutingLineName = drScrap["GroutingLineName"].ToString();
  191. this._auditEntity.GMouldTypeID = Convert.ToInt32(drScrap["GMouldTypeID"]);
  192. this._auditEntity.GroutingLineDetailID = Convert.ToInt32(drScrap["GroutingLineDetailID"]);
  193. this._auditEntity.GroutingMouldCode = drScrap["GroutingMouldCode"].ToString();
  194. this._auditEntity.MouldCode = drScrap["MouldCode"].ToString();
  195. this._auditEntity.GoodsLevelID = Convert.ToInt32(drScrap["GoodsLevelID"]);
  196. this._auditEntity.GoodsLevelTypeID = Convert.ToInt32(drScrap["GoodsLevelTypeID"]);
  197. this._auditEntity.ScrapDate = Convert.ToDateTime(drScrap["ScrapDate"]);
  198. this._auditEntity.Rreason = drScrap["Rreason"].ToString();
  199. this._auditEntity.Remarks = drScrap["Remarks"].ToString();
  200. this._auditEntity.AuditStatus = Convert.ToInt32(drScrap["AuditStatus"]);
  201. this._auditEntity.ResponType = Convert.ToInt32(drScrap["ResponType"]);
  202. if (drScrap["Auditor"] != DBNull.Value)
  203. {
  204. this._auditEntity.Auditor = Convert.ToInt32(drScrap["Auditor"]);
  205. }
  206. if (drScrap["AuditDate"] != DBNull.Value)
  207. {
  208. this._auditEntity.AuditlDate = Convert.ToDateTime(drScrap["AuditDate"]);
  209. }
  210. if (drScrap["AuditOpinion"] != DBNull.Value)
  211. {
  212. this._auditEntity.AuditOpinion = drScrap["AuditOpinion"].ToString();
  213. this.txtAuditOpinion.Text = this._auditEntity.AuditOpinion.ToString();
  214. }
  215. this._auditEntity.SettlementFlag = Convert.ToInt32(drScrap["SettlementFlag"]);
  216. if (drScrap["ProcedureID"] != DBNull.Value)
  217. {
  218. this._auditEntity.ResponProcedureID = Convert.ToInt32(drScrap["ProcedureID"]);
  219. }
  220. if (drScrap["UserID"] != DBNull.Value)
  221. {
  222. this._auditEntity.ResponUserID = Convert.ToInt32(drScrap["UserID"]);
  223. }
  224. if (drScrap["UserCode"] != DBNull.Value)
  225. {
  226. this._auditEntity.ResponUserCode = drScrap["UserCode"].ToString();
  227. }
  228. if (drScrap["UserName"] != DBNull.Value)
  229. {
  230. this._auditEntity.ResponUserName = drScrap["UserName"].ToString();
  231. }
  232. this._auditEntity.OPTimeStamp = Convert.ToDateTime(drScrap["OPTimeStamp"]);
  233. if (this._formModeType == Constant.INT_IS_ZERO) //审批看到的是当前
  234. {
  235. this.lblAuditorName.Text = LogInUserInfo.CurrentUser.CurrentUserEntity.UserName;
  236. this.lblTime.Text = CommonModuleProxy.Service.GetAccountDate().ToString("yyyy-MM-dd");
  237. }
  238. else //查看看到的是记录
  239. {
  240. this.lblAuditorName.Text = drScrap["UName"].ToString();
  241. this.lblTime.Text = Convert.ToDateTime(this._auditEntity.AuditlDate).ToString("yyyy-MM-dd");
  242. }
  243. //已经通过审核或已经驳回审核的就不能再修改了
  244. if (this._auditEntity.AuditStatus != Constant.INT_IS_ZERO)
  245. {
  246. this.txtAuditOpinion.Enabled = false;
  247. this.rbAuditStatusOK.Enabled = false;
  248. this.rbAuditStatusNo.Enabled = false;
  249. this.btnSave.Enabled = false;
  250. if (this._auditEntity.AuditStatus == Constant.INT_IS_ONE)
  251. {
  252. this.rbAuditStatusNo.Checked = false;
  253. this.rbAuditStatusOK.Checked = true;
  254. }
  255. else
  256. {
  257. this.rbAuditStatusNo.Checked = true;
  258. this.rbAuditStatusOK.Checked = false;
  259. }
  260. }
  261. }
  262. }
  263. else
  264. {
  265. this.Close();
  266. return;
  267. }
  268. }
  269. catch (Exception ex)
  270. {
  271. throw ex;
  272. }
  273. }
  274. #endregion
  275. }
  276. }