F_PM_2404.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*******************************************************************************
  2. * Copyright(c) 2017 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2403.cs
  5. * 2.功能描述:撤销产成品交接
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2017/02/10 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. public partial class F_PM_2404 : DKFormBase
  24. {
  25. #region 成员变量
  26. private string _currentbarcode = "";//当前产品条码
  27. #endregion
  28. #region 构造函数
  29. public F_PM_2404()
  30. {
  31. InitializeComponent();
  32. this.btnClose.Text = ButtonText.BTN_CLOSE;
  33. this.btnSave.Text = ButtonText.BTN_SAVE;
  34. this.Text = FormTitles.F_PM_2404;
  35. }
  36. #endregion
  37. #region 事件
  38. /// <summary>
  39. /// 保存按钮事件
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void btnSave_Click(object sender, EventArgs e)
  44. {
  45. try
  46. {
  47. if (this._currentbarcode.Trim() == "")
  48. {
  49. MessageBox.Show("产品条码不能为空", this.Text,
  50. MessageBoxButtons.OK, MessageBoxIcon.Information);
  51. this.txtBarCode.Focus();
  52. return;
  53. }
  54. if (this.cmbLogo.SelectedValue.ToString() == "-1")
  55. {
  56. MessageBox.Show("请选择生产订单",
  57. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  58. this.cmbLogo.Focus();
  59. return;
  60. }
  61. int orderid = Convert.ToInt32(this.cmbLogo.SelectedValue);
  62. ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  63. {
  64. return PMModuleProxy.Service.SaveChangeFinishedHandoverByBarcode(this._currentbarcode.Trim(), orderid);
  65. }));
  66. if (Convert.ToInt32(returnValue.Result) < 0)
  67. {
  68. MessageBox.Show(returnValue.Message, this.Text,
  69. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  70. this.txtBarCode.Focus();
  71. this.txtBarCode.SelectAll();
  72. return;
  73. }
  74. else if (Convert.ToInt32(returnValue.Result) > 0)
  75. {
  76. MessageBox.Show("变更单号成功", this.Text,
  77. MessageBoxButtons.OK, MessageBoxIcon.Information);
  78. this.txtBarCode.Text = "";//成功后,直接下一个
  79. this._currentbarcode = "";
  80. this.btnSave.Visible = false;
  81. this.txtProductionInfo.Text = "";
  82. this.txtBarCode.Focus();
  83. this.txtOrderNo.Text = "";
  84. this.cmbLogo.SelectedValue = -1;
  85. return;
  86. }
  87. }
  88. catch (Exception ex)
  89. {
  90. // 对异常进行共通处理
  91. ExceptionManager.HandleEventException(this.ToString(),
  92. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  93. }
  94. }
  95. /// <summary>
  96. /// 回车符事件
  97. /// </summary>
  98. /// <param name="sender"></param>
  99. /// <param name="e"></param>
  100. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  101. {
  102. try
  103. {
  104. if (this.txtBarCode.ReadOnly)
  105. {
  106. return;
  107. }
  108. if ((int)e.KeyChar == 13) // 按了回车键
  109. {
  110. this.btnSave.Visible = false;
  111. this.txtProductionInfo.Text = "";
  112. if (this.txtBarCode.Text.Trim() == "")
  113. {
  114. MessageBox.Show("产品条码不能为空", this.Text,
  115. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  116. this.txtBarCode.Focus();
  117. return;
  118. }
  119. //this._currentbarcode = this.txtBarCode.Text.Trim();
  120. // 由产品条码获取注浆信息
  121. ServiceResultEntity entity = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  122. {
  123. return PMModuleProxy.Service.CancelFinishedHandoverBarcode(this.txtBarCode.Text.Trim());
  124. }));
  125. if (Convert.ToInt32(entity.Result) > 0)
  126. {
  127. this._currentbarcode = entity.Data.Tables[0].Rows[0]["BarCode"].ToString();
  128. this.txtProductionInfo.Text = "生产订单:" + entity.Data.Tables[0].Rows[0]["OrderNo"] + "\r\n\r\n";
  129. this.txtProductionInfo.Text += "产品条码:" + this._currentbarcode + "\r\n\r\n";
  130. this.txtProductionInfo.Text += "包装条码:" + entity.Data.Tables[0].Rows[0]["FinishedBarCode"] + "\r\n\r\n";
  131. this.txtProductionInfo.Text += "产品编码:" + entity.Data.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
  132. this.txtProductionInfo.Text += "产品商标:" + entity.Data.Tables[0].Rows[0]["LogoName"] + "\r\n\r\n";
  133. this.txtProductionInfo.Text += "成型工号:" + entity.Data.Tables[0].Rows[0]["GroutingUserCode"] + "\r\n\r\n";
  134. this.txtProductionInfo.Text += "模具编号:" + entity.Data.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
  135. this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(entity.Data.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
  136. this.txtProductionInfo.Text += "交坯日期:" + Convert.ToDateTime(entity.Data.Tables[0].Rows[0]["DeliverTime"]).ToString("yyyy-MM-dd hh:mm:ss") + "\r\n\r\n";
  137. this.cmbLogo.SelectedValue = entity.Data.Tables[0].Rows[0]["FHOrderID"];
  138. this.btnSave.Visible = true;
  139. }
  140. else
  141. {
  142. MessageBox.Show(entity.Message, this.Text,
  143. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  144. this.txtBarCode.SelectAll();
  145. return;
  146. }
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. // 对异常进行共通处理
  152. ExceptionManager.HandleEventException(this.ToString(),
  153. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  154. }
  155. }
  156. /// <summary>
  157. /// 窗体加载数据
  158. /// </summary>
  159. /// <param name="sender"></param>
  160. /// <param name="e"></param>
  161. private void F_PM_2404_Load(object sender, EventArgs e)
  162. {
  163. // 加载订单数据源
  164. DataSet dsResultLogo = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  165. {
  166. return PMModuleProxy.Service.GetOrderList(new OrderEntity());
  167. }));
  168. if (dsResultLogo != null && dsResultLogo.Tables[0].Rows.Count > 0)
  169. {
  170. DataView dv = dsResultLogo.Tables[0].DefaultView;
  171. dv.RowFilter = "ValueFlag=1";
  172. DataTable dtNew = dv.ToTable();
  173. DataRow dr = dtNew.NewRow();
  174. dr["OrderID"] = -1;
  175. dr["OrderNo"] = string.Empty;
  176. dtNew.Rows.InsertAt(dr, 0);
  177. this.cmbLogo.DataSource = dtNew;
  178. this.cmbLogo.ValueMember = "OrderID";
  179. this.cmbLogo.DisplayMember = "OrderNo";
  180. }
  181. }
  182. private void txtOrderNo_KeyPress(object sender, KeyPressEventArgs e)
  183. {
  184. try
  185. {
  186. if (this.txtOrderNo.ReadOnly)
  187. {
  188. return;
  189. }
  190. if ((int)e.KeyChar == 13) // 按了回车键
  191. {
  192. DataTable dt = this.cmbLogo.DataSource as DataTable;
  193. if (dt != null && dt.Rows.Count > 0)
  194. {
  195. DataRow[] dr = dt.Select("OrderNo='" + this.txtOrderNo.Text.Trim() + "'");
  196. if (dr.Length > 0)
  197. {
  198. this.cmbLogo.SelectedValue = Convert.ToInt32(dr[0]["OrderID"]);
  199. }
  200. else
  201. {
  202. this.cmbLogo.SelectedIndex = 0;
  203. }
  204. this.txtOrderNo.Text = string.Empty;
  205. }
  206. }
  207. }
  208. catch (Exception ex)
  209. {
  210. // 对异常进行共通处理
  211. ExceptionManager.HandleEventException(this.ToString(),
  212. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  213. }
  214. }
  215. #endregion
  216. }
  217. }