F_RPT_080108.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080108.cs
  5. * 2.功能描述:半检登记明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/07/12 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  19. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  20. namespace Dongke.IBOSS.PRD.Client.ReportModule
  21. {
  22. /// <summary>
  23. /// 半检登记明细表
  24. /// </summary>
  25. public partial class F_RPT_080108 : DockPanelBase
  26. {
  27. #region 成员变量
  28. //单例模式
  29. private static F_RPT_080108 _instance;
  30. #endregion
  31. #region 构造函数
  32. /// <summary>
  33. /// 废弃一览构造
  34. /// </summary>
  35. public F_RPT_080108()
  36. {
  37. InitializeComponent();
  38. this.Text = FormTitles.F_RPT_080108;
  39. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  40. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  41. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  42. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_RPT_080108 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_RPT_080108();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件
  62. /// <summary>
  63. /// 打开新建窗体事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void tsbtnSemiCheck_Click(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. //F_PM_2202 frmFPM2202 = new F_PM_2202(0,"半检登记");
  72. //DialogResult dialogresult = frmFPM2202.ShowDialog();
  73. //if (dialogresult.Equals(DialogResult.OK))
  74. //{
  75. // btnSearch_Click(sender, e);
  76. //}
  77. }
  78. catch (Exception ex)
  79. {
  80. // 对异常进行共通处理
  81. ExceptionManager.HandleEventException(this.ToString(),
  82. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  83. }
  84. }
  85. /// <summary>
  86. /// 查询事件
  87. /// </summary>
  88. /// <param name="sender"></param>
  89. /// <param name="e"></param>
  90. private void btnSearch_Click(object sender, EventArgs e)
  91. {
  92. try
  93. {
  94. this.dgvSemiCheck.DataSource = null;
  95. DataSet dsSemiCheck = (DataSet)DoAsync(new AsyncMethod(() =>
  96. {
  97. return this.GetSemiCheck();
  98. }));
  99. if (dsSemiCheck != null && dsSemiCheck.Tables.Count > 0 && dsSemiCheck.Tables[0].Rows.Count > 0)
  100. {
  101. this.dgvSemiCheck.DataSource = (dsSemiCheck).Tables[Constant.INT_IS_ZERO];
  102. this.dgvSemiCheck.ReadOnly = true;
  103. this.dgvSemiCheck.Rows[0].Selected = true;
  104. }
  105. else
  106. {
  107. // 提示未查找到数据
  108. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  109. MessageBoxButtons.OK, MessageBoxIcon.Information);
  110. }
  111. }
  112. catch (Exception ex)
  113. {
  114. // 对异常进行共通处理
  115. ExceptionManager.HandleEventException(this.ToString(),
  116. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  117. }
  118. }
  119. /// <summary>
  120. /// 时间有效性切换
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void cbCDateTime_CheckedChanged(object sender, EventArgs e)
  125. {
  126. this.txtCDateTimeStart.Enabled = this.cbCDateTime.Checked;
  127. this.txtCDateTimeEnd.Enabled = this.cbCDateTime.Checked;
  128. }
  129. /// <summary>
  130. /// 清空条件
  131. /// </summary>
  132. /// <param name="sender"></param>
  133. /// <param name="e"></param>
  134. private void btnClearCondition_Click(object sender, EventArgs e)
  135. {
  136. this.dkCProcedureSearchBox.ClearControl();
  137. this.cbCDateTime.Checked = false;
  138. // this.txtCDateTimeStart.Value = DateTime.Now;
  139. //this.txtCDateTimeEnd.Value = DateTime.Now;
  140. this.txtCUserCode.Text = string.Empty;
  141. this.scbGoodsType.ClearValue();
  142. this.txtGoodsCode.Text = string.Empty;
  143. this.txtGroutingUserCode.Text = string.Empty;
  144. this.cbGroutingDate.Checked = false;
  145. this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  146. this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  147. this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  148. this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  149. this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  150. this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  151. this.txtBackOutTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  152. this.txtBackOutTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  153. //this.txtGroutingDateTimeStart.Value = DateTime.Now;
  154. //this.txtGroutingDateTimeEnd.Value = DateTime.Now;
  155. this.cbDeliveryDate.Checked = false;
  156. this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  157. this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  158. this.cbSemiCheck.Checked = true;
  159. // this.txtSemiCheckDateTimeStart.Value = DateTime.Now;
  160. // this.txtSemiCheckDateTimeEnd.Value = DateTime.Now;
  161. this.txtSemiCheckUserCode.Text = string.Empty;
  162. this.dkRProcedureSearchBox.ClearControl();
  163. //this.txtReSemiCheckDateTimeStart.Value = DateTime.Now;
  164. //this.txtReSemiCheckDateTimeEnd.Value = DateTime.Now;
  165. this.chkVYes.Checked = false;
  166. //this.chkVNo.Checked = false;
  167. this.cbBackOutTime.Checked = false;
  168. //this.txtBackOutTimeStart.Value = DateTime.Now;
  169. // this.txtBackOutTimeEnd.Value = DateTime.Now;
  170. this.txtBackOutUserCode.Text = string.Empty;
  171. this.txtBarCode.Text = string.Empty;
  172. this.txtDefectCode.Text = string.Empty;
  173. this.dkSemiCheckDefectPositionSearchBox1.ClearControl();
  174. this.dkProcedureSearchBox1.ClearControl();
  175. this.txtDefectUser.Text = string.Empty;
  176. this.chkLast.Checked = false;
  177. }
  178. /// <summary>
  179. /// 编辑窗体打开
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. private void tsbtnReSemiCheck_Click(object sender, EventArgs e)
  184. {
  185. try
  186. {
  187. //F_PM_2204 frmFPM2204 = new F_PM_2204(0, "复检登记");
  188. //DialogResult dialogresult = frmFPM2204.ShowDialog();
  189. //if (dialogresult.Equals(DialogResult.OK))
  190. //{
  191. // btnSearch_Click(sender, e);
  192. //}
  193. }
  194. catch (Exception ex)
  195. {
  196. // 对异常进行共通处理
  197. ExceptionManager.HandleEventException(this.ToString(),
  198. System.Reflection.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 dgvScrapProduct_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  207. {
  208. try
  209. {
  210. //DataGridViewRow currentRow = this.dgvScrapProduct.CurrentRow;
  211. //if (currentRow != null)
  212. //{
  213. // string barCode = currentRow.Cells["BarCode"].Value.ToString();
  214. // int SPId = Convert.ToInt32(currentRow.Cells["ScrapProductID"].Value.ToString());
  215. // F_PM_1102 frmFPM1102 = new F_PM_1102(Constant.FormMode.Edit, barCode, SPId, this.tsbtnApprover.Visible);
  216. // DialogResult dialogresult = frmFPM1102.ShowDialog();
  217. // if (dialogresult.Equals(DialogResult.OK))
  218. // {
  219. // this.dgvScrapProduct.DataSource = null;
  220. // object obScrapResult = DoAsync(new AsyncMethod(GetScrapProduct));
  221. // if (obScrapResult != null)
  222. // {
  223. // DataSet dsScrap = (DataSet)obScrapResult;
  224. // if (dsScrap.Tables.Count != Constant.INT_IS_ZERO)
  225. // {
  226. // this.dgvScrapProduct.DataSource = dsScrap.Tables[Constant.INT_IS_ZERO];
  227. // this.dgvScrapProduct.ReadOnly = true;
  228. // }
  229. // }
  230. // }
  231. //}
  232. //else
  233. //{
  234. // MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
  235. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  236. //}
  237. }
  238. catch (Exception ex)
  239. {
  240. // 对异常进行共通处理
  241. ExceptionManager.HandleEventException(this.ToString(),
  242. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  243. }
  244. }
  245. /// <summary>
  246. /// 关闭一览窗体
  247. /// </summary>
  248. /// <param name="sender"></param>
  249. /// <param name="e"></param>
  250. private void tsbtnClose_Click(object sender, EventArgs e)
  251. {
  252. this.Close();
  253. }
  254. /// <summary>
  255. /// 窗体关闭事件
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. private void F_PM_2201_FormClosed(object sender, FormClosedEventArgs e)
  260. {
  261. _instance = null;
  262. }
  263. /// <summary>
  264. /// 自动列宽
  265. /// </summary>
  266. /// <param name="sender"></param>
  267. /// <param name="e"></param>
  268. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  269. {
  270. this.dgvSemiCheck.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  271. }
  272. /// <summary>
  273. /// 窗体加载
  274. /// </summary>
  275. /// <param name="sender"></param>
  276. /// <param name="e"></param>
  277. private void F_PM_2201_Load(object sender, EventArgs e)
  278. {
  279. try
  280. {
  281. // 加载权限
  282. FormPermissionManager.FormPermissionControl(this.Name, this,
  283. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  284. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  285. this.dgvSemiCheck.AutoGenerateColumns = false;
  286. // 设置日期控件默认值
  287. this.txtCDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  288. this.txtCDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  289. this.txtGroutingDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  290. this.txtGroutingDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  291. this.txtSemiCheckDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  292. this.txtSemiCheckDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  293. this.txtBackOutTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  294. this.txtBackOutTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  295. this.txtDeliveryDateTimeStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
  296. this.txtDeliveryDateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  297. }
  298. catch (Exception ex)
  299. {
  300. // 对异常进行共通处理
  301. ExceptionManager.HandleEventException(this.ToString(),
  302. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  303. }
  304. }
  305. /// <summary>
  306. /// 注浆时间复选框改变事件
  307. /// </summary>
  308. /// <param name="sender"></param>
  309. /// <param name="e"></param>
  310. private void cbGroutingDate_CheckedChanged(object sender, EventArgs e)
  311. {
  312. this.txtGroutingDateTimeStart.Enabled = this.cbGroutingDate.Checked;
  313. this.txtGroutingDateTimeEnd.Enabled = this.cbGroutingDate.Checked;
  314. }
  315. /// <summary>
  316. /// 半检时间复选框改变事件
  317. /// </summary>
  318. /// <param name="sender"></param>
  319. /// <param name="e"></param>
  320. private void cbSemiCheck_CheckedChanged(object sender, EventArgs e)
  321. {
  322. this.txtSemiCheckDateTimeStart.Enabled = this.cbSemiCheck.Checked;
  323. this.txtSemiCheckDateTimeEnd.Enabled = this.cbSemiCheck.Checked;
  324. }
  325. /// <summary>
  326. /// 复检时间复选框改变事件
  327. /// </summary>
  328. /// <param name="sender"></param>
  329. /// <param name="e"></param>
  330. private void cbReSemiCheck_CheckedChanged(object sender, EventArgs e)
  331. {
  332. }
  333. /// <summary>
  334. /// 撤销时间复选框改变事件
  335. /// </summary>
  336. /// <param name="sender"></param>
  337. /// <param name="e"></param>
  338. private void cbBackOutTime_CheckedChanged(object sender, EventArgs e)
  339. {
  340. this.txtBackOutTimeStart.Enabled = this.cbBackOutTime.Checked;
  341. this.txtBackOutTimeEnd.Enabled = this.cbBackOutTime.Checked;
  342. }
  343. private void cbDeliveryDate_CheckedChanged(object sender, EventArgs e)
  344. {
  345. this.txtDeliveryDateTimeStart.Enabled = this.cbDeliveryDate.Checked;
  346. this.txtDeliveryDateTimeEnd.Enabled = this.cbDeliveryDate.Checked;
  347. }
  348. /// <summary>
  349. /// 撤销复检按钮事件
  350. /// </summary>
  351. /// <param name="sender"></param>
  352. /// <param name="e"></param>
  353. private void tsbtnBackReSemiCheck_Click(object sender, EventArgs e)
  354. {
  355. try
  356. {
  357. //F_PM_2205 frmFPM2205 = new F_PM_2205(0, "撤销复检");
  358. //DialogResult dialogresult = frmFPM2205.ShowDialog();
  359. //if (dialogresult.Equals(DialogResult.OK))
  360. //{
  361. // btnSearch_Click(sender, e);
  362. //}
  363. }
  364. catch (Exception ex)
  365. {
  366. // 对异常进行共通处理
  367. ExceptionManager.HandleEventException(this.ToString(),
  368. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  369. }
  370. }
  371. #endregion
  372. #region 私有方法
  373. /// <summary>
  374. /// 根据界面查询条件获取数据集
  375. /// </summary>
  376. private DataSet GetSemiCheck()
  377. {
  378. try
  379. {
  380. SemiCheckEntity entity = new SemiCheckEntity();
  381. entity.CProcedureIDS = this.dkCProcedureSearchBox.ProcedureIDS;
  382. if (cbCDateTime.Checked)
  383. {
  384. entity.CDateTimeStart = this.txtCDateTimeStart.Value;// DateTime.Parse(this.txtCDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  385. entity.CDateTimeEnd = this.txtCDateTimeEnd.Value;// DateTime.Parse(this.txtCDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  386. }
  387. entity.CUserCode = this.txtCUserCode.UserCode.Trim(); //xuwei modify 选择用户取用户编码
  388. entity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  389. entity.GoodsCode = this.txtGoodsCode.Text.Trim();
  390. entity.GroutingUserCode = this.txtGroutingUserCode.UserCode.Trim(); //xuwei modify 选择用户取用户编码
  391. if (cbGroutingDate.Checked)
  392. {
  393. entity.GroutingDateTimeStart = this.txtGroutingDateTimeStart.Value;// DateTime.Parse(this.txtGroutingDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  394. entity.GroutingDateTimeEnd = this.txtGroutingDateTimeEnd.Value;// DateTime.Parse(this.txtGroutingDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  395. }
  396. if (cbDeliveryDate.Checked)
  397. {
  398. entity.DeliveryDateTimeStart = this.txtDeliveryDateTimeStart.Value;// DateTime.Parse(this.txtDeliveryDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  399. entity.DeliveryDateTimeEnd = this.txtDeliveryDateTimeEnd.Value;// DateTime.Parse(this.txtDeliveryDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  400. }
  401. if (cbSemiCheck.Checked)
  402. {
  403. entity.SemiCheckDateTimeStart = this.txtSemiCheckDateTimeStart.Value;// DateTime.Parse(this.txtSemiCheckDateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  404. entity.SemiCheckDateTimeEnd = this.txtSemiCheckDateTimeEnd.Value;// DateTime.Parse(this.txtSemiCheckDateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  405. }
  406. entity.SemiCheckUserCode = this.txtSemiCheckUserCode.UserCode.Trim(); //xuwei modify 选择用户取用户编码
  407. entity.RProcedureIDS = this.dkRProcedureSearchBox.ProcedureIDS;
  408. string strBackOutFlag = "";
  409. if (chkVYes.Checked)
  410. {
  411. strBackOutFlag = "1,";
  412. }
  413. if (chkVNo.Checked)
  414. {
  415. strBackOutFlag += "0";
  416. }
  417. entity.BackOutFlag = strBackOutFlag.TrimEnd(',');
  418. if (cbBackOutTime.Checked)
  419. {
  420. entity.BackOutTimeStart = this.txtBackOutTimeStart.Value;// DateTime.Parse(this.txtBackOutTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  421. entity.BackOutTimeEnd = this.txtBackOutTimeEnd.Value;// DateTime.Parse(this.txtBackOutTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  422. }
  423. entity.BackOutUserCode = this.txtBackOutUserCode.UserCode.Trim(); //xuwei modify 选择用户取用户编码
  424. entity.BarCode = this.txtBarCode.Text.Trim();
  425. entity.DefectCode = this.txtDefectCode.Text.Trim();
  426. entity.DefectPositionIDS = this.dkSemiCheckDefectPositionSearchBox1.DefectPositionIDS;
  427. entity.DefectProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
  428. entity.DefectUser = this.txtDefectUser.Text.Trim();
  429. if (this.chkLast.Checked)
  430. {
  431. entity.SemiCheckType = "1";
  432. }
  433. ServiceResultEntity resultEntity = ReportModuleProxy.Service.GetRPT080108IData(entity);
  434. return resultEntity.Data;
  435. }
  436. catch (Exception ex)
  437. {
  438. throw ex;
  439. }
  440. }
  441. #endregion
  442. }
  443. }