F_PM_0202.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0202.cs
  5. * 2.功能描述:选择变更条码
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2015/03/25 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. /// <summary>
  24. /// 选择变更条码
  25. /// </summary>
  26. public partial class F_PM_0202 : DKFormBase// DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 单例模式
  30. private static F_PM_0202 _instance;
  31. #endregion
  32. #region 构造函数
  33. /// <summary>
  34. /// 注浆日报一览窗体构造
  35. /// </summary>
  36. private F_PM_0202()
  37. {
  38. this.InitializeComponent();
  39. this.InitializeControls();
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_PM_0202 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_PM_0202();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 属性
  59. /// <summary>
  60. /// 产品条码
  61. /// </summary>
  62. public string BarCode
  63. {
  64. get;
  65. set;
  66. }
  67. /// <summary>
  68. /// 成型工号
  69. /// </summary>
  70. public string GroutingUserCode
  71. {
  72. get;
  73. set;
  74. }
  75. public string GoodsCodeText
  76. {
  77. get;
  78. set;
  79. }
  80. #endregion 属性
  81. #region 事件
  82. /// <summary>
  83. /// 窗体加载
  84. /// </summary>
  85. private void F_PM_0202_Load(object sender, EventArgs e)
  86. {
  87. try
  88. {
  89. // 按钮权限控制
  90. //FormPermissionManager.FormPermissionControl(this.Name, this,
  91. // LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  92. // LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  93. // 获取成型线类型数据并绑定到控件上
  94. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  95. {
  96. return PMModuleProxyNew.Service.GetFPM0101IData();
  97. }
  98. );
  99. if (sre.Data != null && sre.Data.Tables.Count > 0)
  100. {
  101. this.cboGroutingLineType.DataSource = sre.Data.Tables[0];
  102. }
  103. this.cboGroutingLineType.SelectedValue = null;
  104. }
  105. catch (Exception ex)
  106. {
  107. // 对异常进行共通处理
  108. ExceptionManager.HandleEventException(this.ToString(),
  109. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  110. }
  111. }
  112. /// <summary>
  113. /// 清空条件
  114. /// </summary>
  115. private void btnClearCondition_Click(object sender, EventArgs e)
  116. {
  117. this.txtGroutingBatchNo.Clear();
  118. this.txtBarcode.Clear();
  119. this.txtRemarks.Clear();
  120. this.txtGoodsCode.Clear();
  121. this.txtGoodsName.Clear();
  122. this.txtGroutingLineCode.Clear();
  123. this.txtGroutingLineName.Clear();
  124. this.txtGroutingMouldCode.Clear();
  125. this.txtGroutingUser.Clear();
  126. this.chkGroutingDate.Checked = true;
  127. this.dtpGroutingDateBegin.Value = DateTime.Now.Date;
  128. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  129. this.chkDMDate.Checked = false;
  130. this.dtpDMDateBegin.Value = DateTime.Now.Date;
  131. this.dtpDMDateEnd.Value = DateTime.Now.Date;
  132. this.cboGroutingLineType.SelectedValue = null;
  133. }
  134. /// <summary>
  135. /// 查询数据
  136. /// </summary>
  137. private void btnSearch_Click(object sender, System.EventArgs e)
  138. {
  139. try
  140. {
  141. this.dgvBarCode.DataSource = null;
  142. this.dgvBarCode.DataSource = this.GetSearchData();
  143. }
  144. catch (Exception ex)
  145. {
  146. // 对异常进行共通处理
  147. ExceptionManager.HandleEventException(this.ToString(),
  148. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  149. }
  150. }
  151. /// <summary>
  152. /// 自动查询
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void F_PM_0202_1_Shown(object sender, EventArgs e)
  157. {
  158. if (!string.IsNullOrWhiteSpace(this.BarCode) || !string.IsNullOrWhiteSpace(this.GroutingUserCode) || !string.IsNullOrWhiteSpace(this.GoodsCodeText))
  159. {
  160. this.txtBarcode.Text = this.BarCode;
  161. this.txtGroutingUser.Text = this.GroutingUserCode;
  162. this.txtGoodsCode.Text = this.GoodsCodeText;
  163. this.chkGroutingDate.Checked = false;
  164. this.btnSearch_Click(sender, e);
  165. }
  166. }
  167. /// <summary>
  168. ///
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. private void dgvBarCode_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  173. {
  174. if (this.dgvBarCode.CurrentRow != null)
  175. {
  176. this.BarCode = this.dgvBarCode.CurrentRow.Cells["colBarCode"].Value.ToString();
  177. this.GoodsCodeText = this.dgvBarCode.CurrentRow.Cells["GoodsCode"].Value.ToString();
  178. this.DialogResult = DialogResult.OK;
  179. this.Close();
  180. }
  181. }
  182. /// <summary>
  183. /// 关闭按钮事件
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. private void tsbtnClose_Click(object sender, EventArgs e)
  188. {
  189. this.Close();
  190. }
  191. /// <summary>
  192. /// 自动列宽事件
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  197. {
  198. this.dgvBarCode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  199. }
  200. /// <summary>
  201. /// 窗体关闭
  202. /// </summary>
  203. /// <param name="sender"></param>
  204. /// <param name="e"></param>
  205. private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e)
  206. {
  207. _instance = null;
  208. }
  209. /// <summary>
  210. /// 注浆日期
  211. /// </summary>
  212. /// <param name="sender"></param>
  213. /// <param name="e"></param>
  214. private void chkGroutingDate_CheckedChanged(object sender, EventArgs e)
  215. {
  216. this.dtpGroutingDateBegin.Enabled = this.chkGroutingDate.Checked;
  217. this.dtpGroutingDateEnd.Enabled = this.chkGroutingDate.Checked;
  218. }
  219. /// <summary>
  220. /// 交坯日期
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void chkDMDate_CheckedChanged(object sender, EventArgs e)
  225. {
  226. this.dtpDMDateBegin.Enabled = this.chkDMDate.Checked;
  227. this.dtpDMDateEnd.Enabled = this.chkDMDate.Checked;
  228. }
  229. #endregion
  230. #region 私有方法
  231. /// <summary>
  232. /// 初始化控件
  233. /// </summary>
  234. private void InitializeControls()
  235. {
  236. this.Text = FormTitles.F_PM_0202;
  237. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  238. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  239. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  240. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  241. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  242. this.dgvBarCode.AutoGenerateColumns = false;
  243. this.dgvBarCode.ReadOnly = true;
  244. }
  245. /// <summary>
  246. /// 根据界面查询条件获取数据集
  247. /// </summary>
  248. private DataTable GetSearchData()
  249. {
  250. try
  251. {
  252. FPM0202_SE se = new FPM0202_SE();
  253. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  254. se.GroutingLineName = this.txtGroutingLineName.Text;
  255. se.GroutingMouldCode = this.txtGroutingMouldCode.Text;
  256. se.GoodsCode = this.txtGoodsCode.Text;
  257. se.GoodsName = this.txtGoodsName.Text;
  258. se.Remarks = this.txtRemarks.Text;
  259. if (this.txtGroutingBatchNo.DataValue.HasValue)
  260. {
  261. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  262. }
  263. if (this.chkGroutingDate.Checked)
  264. {
  265. se.GroutingDateBegin = this.dtpGroutingDateBegin.Value.Date;
  266. se.GroutingDateEnd = this.dtpGroutingDateEnd.Value.Date;
  267. }
  268. if (this.chkDMDate.Checked)
  269. {
  270. se.DeliverMudDateBegin = this.dtpDMDateBegin.Value.Date;
  271. se.DeliverMudDateEnd = this.dtpDMDateEnd.Value.Date;
  272. }
  273. if (this.cboGroutingLineType.SelectedValue != null)
  274. {
  275. se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue);
  276. }
  277. se.WorkUserCode = this.txtWorkUserCode.Text;
  278. se.GroutingUserCode = this.txtGroutingUser.Text;
  279. se.BarCode = this.txtBarcode.Text;
  280. // 调用服务器端获取数据集
  281. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  282. {
  283. return PMModuleProxyNew.Service.GetFPM0202SData(se);
  284. }
  285. );
  286. if (sre.Status == Constant.ServiceResultStatus.Success)
  287. {
  288. return sre.Data.Tables[0];
  289. }
  290. return null;
  291. }
  292. catch (Exception ex)
  293. {
  294. throw ex;
  295. }
  296. }
  297. #endregion
  298. }
  299. }