F_PM_0203.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0203.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_0203 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 单例模式
  30. private static F_PM_0203 _instance;
  31. #endregion
  32. #region 构造函数
  33. /// <summary>
  34. /// 注浆日报一览窗体构造
  35. /// </summary>
  36. private F_PM_0203()
  37. {
  38. this.InitializeComponent();
  39. this.InitializeControls();
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_PM_0203 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_PM_0203();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 窗体加载
  61. /// </summary>
  62. private void F_PM_0203_Load(object sender, EventArgs e)
  63. {
  64. try
  65. {
  66. // 按钮权限控制
  67. //FormPermissionManager.FormPermissionControl(this.Name, this,
  68. // LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  69. // LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  70. // 获取成型线类型数据并绑定到控件上
  71. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  72. {
  73. return PMModuleProxyNew.Service.GetFPM0101IData();
  74. }
  75. );
  76. if (sre.Data != null && sre.Data.Tables.Count > 0)
  77. {
  78. this.cboGroutingLineType.DataSource = sre.Data.Tables[0];
  79. }
  80. this.cboGroutingLineType.SelectedValue = null;
  81. }
  82. catch (Exception ex)
  83. {
  84. // 对异常进行共通处理
  85. ExceptionManager.HandleEventException(this.ToString(),
  86. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  87. }
  88. }
  89. /// <summary>
  90. /// 清空条件
  91. /// </summary>
  92. private void btnClearCondition_Click(object sender, EventArgs e)
  93. {
  94. this.txtGroutingBatchNo.Clear();
  95. this.txtRemarks.Clear();
  96. this.txtGoodsCode.Clear();
  97. this.txtGoodsName.Clear();
  98. this.txtGroutingLineCode.Clear();
  99. this.txtGroutingLineName.Clear();
  100. this.txtGroutingMouldCode.Clear();
  101. this.txtGroutingUser.Clear();
  102. this.dtpGroutingDateBegin.Value = DateTime.Now.Date;
  103. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  104. this.cboGroutingLineType.SelectedValue = null;
  105. this.ckbGroutingDate.Checked = false;
  106. this.dtpCreateTimeBegin.Value = DateTime.Now.Date;
  107. this.dtpCreateTimeEnd.Value = DateTime.Now.Date;
  108. }
  109. /// <summary>
  110. /// 查询数据
  111. /// </summary>
  112. private void btnSearch_Click(object sender, System.EventArgs e)
  113. {
  114. try
  115. {
  116. this.dgvBarCodes.DataSource = null;
  117. this.dgvBarCodes.DataSource = this.GetSearchData();
  118. }
  119. catch (Exception ex)
  120. {
  121. // 对异常进行共通处理
  122. ExceptionManager.HandleEventException(this.ToString(),
  123. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  124. }
  125. }
  126. /// <summary>
  127. /// 添加新注浆日报
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void tsbtnReplace_Click(object sender, EventArgs e)
  132. {
  133. try
  134. {
  135. F_PM_0201 frmFPM0201 = new F_PM_0201();
  136. DialogResult dialogresult = frmFPM0201.ShowDialog();
  137. if (dialogresult == DialogResult.OK)
  138. {
  139. string barcode = frmFPM0201.BarCode;
  140. this.dgvBarCodes.DataSource = null;
  141. // 调用服务器端获取数据集
  142. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  143. {
  144. return PMModuleProxyNew.Service.GetFPM0203SData(barcode);
  145. }
  146. );
  147. if (sre.Status == Constant.ServiceResultStatus.Success)
  148. {
  149. this.dgvBarCodes.DataSource = sre.Data.Tables[0];
  150. }
  151. this.btnSearch_Click(sender, e);
  152. }
  153. }
  154. catch (Exception ex)
  155. {
  156. // 对异常进行共通处理
  157. ExceptionManager.HandleEventException(this.ToString(),
  158. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  159. }
  160. }
  161. /// <summary>
  162. /// 选择要替换的条码
  163. /// </summary>
  164. /// <param name="sender"></param>
  165. /// <param name="e"></param>
  166. private void tsbtnSelectBarCode_Click(object sender, EventArgs e)
  167. {
  168. try
  169. {
  170. F_PM_0202 frmPM0202 = F_PM_0202.Instance;
  171. DialogResult dialogResult = frmPM0202.ShowDialog();
  172. // 查询窗体返回值给控件赋值
  173. if (dialogResult == DialogResult.OK)
  174. {
  175. //string barcode = frmPM0202.BarCode;
  176. if (!string.IsNullOrWhiteSpace(frmPM0202.BarCode))
  177. {
  178. F_PM_0201 frmFPM0201 = new F_PM_0201();
  179. frmFPM0201.BarCode = frmPM0202.BarCode;
  180. frmFPM0201.GoodsCode = frmPM0202.GoodsCodeText;
  181. DialogResult dialogresult = frmFPM0201.ShowDialog();
  182. if (dialogresult == DialogResult.OK)
  183. {
  184. string barcode = frmFPM0201.BarCode;
  185. this.dgvBarCodes.DataSource = null;
  186. // 调用服务器端获取数据集
  187. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  188. {
  189. return PMModuleProxyNew.Service.GetFPM0203SData(barcode);
  190. }
  191. );
  192. if (sre.Status == Constant.ServiceResultStatus.Success)
  193. {
  194. this.dgvBarCodes.DataSource = sre.Data.Tables[0];
  195. }
  196. this.btnSearch_Click(sender, e);
  197. }
  198. }
  199. }
  200. }
  201. catch (Exception ex)
  202. {
  203. // 对异常进行共通处理
  204. ExceptionManager.HandleEventException(this.ToString(),
  205. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  206. }
  207. }
  208. /// <summary>
  209. /// 关闭按钮事件
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void tsbtnClose_Click(object sender, EventArgs e)
  214. {
  215. this.Close();
  216. }
  217. /// <summary>
  218. /// 自动列宽事件
  219. /// </summary>
  220. /// <param name="sender"></param>
  221. /// <param name="e"></param>
  222. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  223. {
  224. this.dgvBarCodes.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  225. }
  226. /// <summary>
  227. /// 注浆日期
  228. /// </summary>
  229. /// <param name="sender"></param>
  230. /// <param name="e"></param>
  231. private void ckbGroutingDate_CheckedChanged(object sender, EventArgs e)
  232. {
  233. this.dtpGroutingDateBegin.Enabled = this.ckbGroutingDate.Checked;
  234. this.dtpGroutingDateEnd.Enabled = this.ckbGroutingDate.Checked;
  235. }
  236. /// <summary>
  237. /// 窗体关闭
  238. /// </summary>
  239. /// <param name="sender"></param>
  240. /// <param name="e"></param>
  241. private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e)
  242. {
  243. _instance = null;
  244. }
  245. #endregion
  246. #region 私有方法
  247. /// <summary>
  248. /// 初始化控件
  249. /// </summary>
  250. private void InitializeControls()
  251. {
  252. this.Text = FormTitles.F_PM_0203;
  253. this.tsbtnReplace.Text = ButtonText.TSBTN_REPLACE;
  254. this.tsbtnSelectBarCode.Text = ButtonText.TSBTN_SELECTBARCODE;
  255. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  256. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  257. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  258. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  259. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  260. this.dgvBarCodes.AutoGenerateColumns = false;
  261. this.dgvBarCodes.ReadOnly = true;
  262. }
  263. /// <summary>
  264. /// 根据界面查询条件获取数据集
  265. /// </summary>
  266. private DataTable GetSearchData()
  267. {
  268. try
  269. {
  270. FPM0203_SE se = new FPM0203_SE();
  271. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  272. se.GroutingLineName = this.txtGroutingLineName.Text;
  273. se.GroutingMouldCode = this.txtGroutingMouldCode.Text;
  274. se.GoodsCode = this.txtGoodsCode.Text;
  275. se.GoodsName = this.txtGoodsName.Text;
  276. se.Remarks = this.txtRemarks.Text;
  277. se.DateBegin = this.dtpCreateTimeBegin.Value.Date;
  278. se.DateEnd = this.dtpCreateTimeEnd.Value.Date;
  279. if (this.txtGroutingBatchNo.DataValue.HasValue)
  280. {
  281. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  282. }
  283. if (this.ckbGroutingDate.Checked)
  284. {
  285. se.GroutingDateBegin = this.dtpGroutingDateBegin.Value.Date;
  286. se.GroutingDateEnd = this.dtpGroutingDateEnd.Value.Date;
  287. }
  288. if (this.cboGroutingLineType.SelectedValue != null)
  289. {
  290. se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue);
  291. }
  292. se.GroutingUserCode = this.txtGroutingUser.Text;
  293. // 调用服务器端获取数据集
  294. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  295. {
  296. return PMModuleProxyNew.Service.GetFPM0203SData(se);
  297. }
  298. );
  299. if (sre.Status == Constant.ServiceResultStatus.Success)
  300. {
  301. return sre.Data.Tables[0];
  302. }
  303. return null;
  304. }
  305. catch (Exception ex)
  306. {
  307. throw ex;
  308. }
  309. }
  310. #endregion
  311. }
  312. }