F_PM_0107.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0107.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.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.PMModule
  23. {
  24. /// <summary>
  25. /// 注浆登记一览
  26. /// </summary>
  27. public partial class F_PM_0107 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. // 单例模式
  31. private static F_PM_0107 _instance;
  32. #endregion
  33. #region 构造函数
  34. /// <summary>
  35. /// 注浆日报一览窗体构造
  36. /// </summary>
  37. private F_PM_0107()
  38. {
  39. this.InitializeComponent();
  40. this.Text = FormTitles.F_PM_0107;
  41. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  42. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  43. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  44. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  45. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  46. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  47. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  48. }
  49. #endregion
  50. #region 单例模式
  51. /// <summary>
  52. /// 单例模式,防止重复创建窗体
  53. /// </summary>
  54. public static F_PM_0107 Instance
  55. {
  56. get
  57. {
  58. if (_instance == null)
  59. {
  60. _instance = new F_PM_0107();
  61. }
  62. return _instance;
  63. }
  64. }
  65. #endregion
  66. #region 事件
  67. /// <summary>
  68. /// 窗体加载
  69. /// </summary>
  70. private void F_PM_0107_Load(object sender, EventArgs e)
  71. {
  72. try
  73. {
  74. // 按钮权限控制
  75. FormPermissionManager.FormPermissionControl(this.Name, this,
  76. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  77. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  78. this.dtpGroutingDateFrom.Value = DateTime.Now.Date.AddDays(1);
  79. this.dtpGroutingDateTo.Value = DateTime.Now.Date.AddDays(1);
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  86. }
  87. }
  88. /// <summary>
  89. /// 清空条件
  90. /// </summary>
  91. private void btnClearCondition_Click(object sender, EventArgs e)
  92. {
  93. this.txtRemarks.Clear();
  94. this.txtGoodsCode.Clear();
  95. this.txtGroutingLineCode.Clear();
  96. this.txtGroutingMouldCode.Clear();
  97. this.dtpGroutingDateFrom.Value = DateTime.Now.Date.AddDays(1);
  98. this.dtpGroutingDateTo.Value = DateTime.Now.Date.AddDays(1);
  99. this.txtGroutingBatchNo.Clear();
  100. scbUser.ClearValue();
  101. }
  102. /// <summary>
  103. /// 查询数据
  104. /// </summary>
  105. private void btnSearch_Click(object sender, System.EventArgs e)
  106. {
  107. try
  108. {
  109. dgvDetail.DataSource = null;
  110. // 异步处理,获取信息
  111. ClientRequestEntity cre = new ClientRequestEntity();
  112. cre.NameSpace = "F_PM_0107";
  113. cre.Name = "GetBarcodeDraft";
  114. cre.Properties["GroutingDateFrom"] = dtpGroutingDateFrom.Value;
  115. cre.Properties["GroutingDateTo"] = dtpGroutingDateTo.Value.AddDays(1);
  116. cre.Properties["GroutingLineCode"] = txtGroutingLineCode.Text.Trim();
  117. cre.Properties["GroutingMouldCode"] = txtGroutingMouldCode.Text.Trim();
  118. cre.Properties["GoodsCode"] = txtGoodsCode.Text.Trim();
  119. cre.Properties["GroutingBatchNo"] = txtGroutingBatchNo.Text.Trim();
  120. cre.Properties["Remarks"] = txtRemarks.Text.Trim();
  121. cre.Properties["UserID"] = scbUser.SearchedPKMember;
  122. // 调用服务器端获取数据集
  123. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
  124. {
  125. return PMModuleProxyNew.Service.HandleRequest(cre);
  126. }));
  127. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  128. {
  129. dgvDetail.DataSource = sre.Data.Tables[0];
  130. }
  131. else
  132. {
  133. MessageBox.Show(Messages.I_CMN_S_001,
  134. this.Text,
  135. MessageBoxButtons.OK,
  136. MessageBoxIcon.Information);
  137. }
  138. }
  139. catch (Exception ex)
  140. {
  141. // 对异常进行共通处理
  142. ExceptionManager.HandleEventException(this.ToString(),
  143. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  144. }
  145. }
  146. /// <summary>
  147. /// 新建条码预设
  148. /// </summary>
  149. /// <param name="sender"></param>
  150. /// <param name="e"></param>
  151. private void tsbtnAdd_Click(object sender, EventArgs e)
  152. {
  153. try
  154. {
  155. F_PM_0108 frm = new F_PM_0108();
  156. frm.FormMode = Constant.FormMode.Add;
  157. DialogResult dialogresult = frm.ShowDialog();
  158. if (dialogresult == DialogResult.OK)
  159. {
  160. this.btnSearch_Click(sender, e);
  161. }
  162. }
  163. catch (Exception ex)
  164. {
  165. // 对异常进行共通处理
  166. ExceptionManager.HandleEventException(this.ToString(),
  167. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  168. }
  169. }
  170. /// <summary>
  171. /// 编辑条码预设
  172. /// </summary>
  173. private void tsbtnEdit_Click(object sender, EventArgs e)
  174. {
  175. try
  176. {
  177. DataGridViewRow currentRow = this.dgvDetail.CurrentRow;
  178. if (currentRow != null)
  179. {
  180. F_PM_0108 frm = new F_PM_0108();
  181. frm.FormMode = Constant.FormMode.Edit;
  182. frm.DrRow = (this.dgvDetail.CurrentRow.DataBoundItem as DataRowView).Row;
  183. DialogResult dialogresult = frm.ShowDialog();
  184. if (dialogresult == DialogResult.OK)
  185. {
  186. this.btnSearch_Click(sender, e);
  187. }
  188. }
  189. else
  190. {
  191. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
  192. }
  193. }
  194. catch (Exception ex)
  195. {
  196. // 对异常进行共通处理
  197. ExceptionManager.HandleEventException(this.ToString(),
  198. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  199. }
  200. }
  201. /// <summary>
  202. /// 删除当前成型线当前批次的条码
  203. /// </summary>
  204. /// <param name="sender"></param>
  205. /// <param name="e"></param>
  206. private void tsbtnDelete_Click(object sender, EventArgs e)
  207. {
  208. try
  209. {
  210. // 验证条码重复
  211. DataRow drDetail = (this.dgvDetail.CurrentRow?.DataBoundItem as DataRowView).Row;
  212. if (drDetail == null)
  213. {
  214. MessageBox.Show(string.Format(Messages.W_CMN_C_006, "没有任何数据"),
  215. this.Text,
  216. MessageBoxButtons.OK,
  217. MessageBoxIcon.Warning);
  218. return;
  219. }
  220. DialogResult drs = MessageBox.Show("是否删除"+ Convert.ToDateTime(drDetail["groutingdate"]).ToString("yyyy-MM-dd")
  221. + ",【" + drDetail["GroutingLineCode"] + "】,第"+ drDetail["groutingbatchno"] + "批次的条码数据?",
  222. this.Text,
  223. MessageBoxButtons.YesNo,
  224. MessageBoxIcon.Question);
  225. if (drs == DialogResult.No)
  226. {
  227. return;
  228. }
  229. // 异步处理,获取信息
  230. ClientRequestEntity cre = new ClientRequestEntity();
  231. cre.NameSpace = "F_PM_0108";
  232. cre.Name = "SaveBarcodeDraft";
  233. cre.Properties["groutingdate"] = drDetail["groutingdate"];
  234. cre.Properties["groutinglineid"] = drDetail["groutinglineid"];
  235. cre.Properties["groutingbatchno"] = drDetail["groutingbatchno"];
  236. // 调用服务器端获取数据集
  237. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
  238. {
  239. return PMModuleProxyNew.Service.HandleRequest(cre);
  240. }));
  241. if (sre.OtherStatus > 0)
  242. {
  243. // 提示未查找到数据
  244. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, Text, "删除"),
  245. this.Text,
  246. MessageBoxButtons.OK,
  247. MessageBoxIcon.Warning);
  248. btnSearch_Click(null, null);
  249. }
  250. else if (sre.OtherStatus < 0 && !string.IsNullOrEmpty(sre.Message))
  251. {
  252. // 提示未查找到数据
  253. MessageBox.Show(string.Format(Messages.W_CMN_C_006, sre.Message),
  254. this.Text,
  255. MessageBoxButtons.OK,
  256. MessageBoxIcon.Warning);
  257. }
  258. else
  259. {
  260. // 提示未查找到数据
  261. MessageBox.Show(Messages.MSG_CMN_W007,
  262. this.Text,
  263. MessageBoxButtons.OK,
  264. MessageBoxIcon.Warning);
  265. }
  266. }
  267. catch (Exception ex)
  268. {
  269. //this.SetEditGrid();
  270. // 对异常进行共通处理
  271. ExceptionManager.HandleEventException(this.ToString(),
  272. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  273. }
  274. }
  275. /// <summary>
  276. /// 编辑注浆日报
  277. /// </summary>
  278. private void dgvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  279. {
  280. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  281. {
  282. return;
  283. }
  284. this.tsbtnEdit_Click(sender, null);
  285. }
  286. /// <summary>
  287. /// 关闭按钮事件
  288. /// </summary>
  289. /// <param name="sender"></param>
  290. /// <param name="e"></param>
  291. private void tsbtnClose_Click(object sender, EventArgs e)
  292. {
  293. this.Close();
  294. }
  295. /// <summary>
  296. /// 自动列宽事件
  297. /// </summary>
  298. /// <param name="sender"></param>
  299. /// <param name="e"></param>
  300. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  301. {
  302. this.dgvDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  303. }
  304. /// <summary>
  305. /// 窗体关闭
  306. /// </summary>
  307. /// <param name="sender"></param>
  308. /// <param name="e"></param>
  309. private void F_PM_0107_FormClosed(object sender, FormClosedEventArgs e)
  310. {
  311. _instance = null;
  312. }
  313. #endregion
  314. }
  315. }