F_RPT_030106.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030106.cs
  5. * 2.功能描述:成检缺陷汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/06/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  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.ReportModule
  22. {
  23. public partial class F_RPT_030106 : DKDockPanelBase
  24. {
  25. #region 成员变量
  26. // 窗体的单例模式
  27. private static F_RPT_030106 _instance;
  28. //实体类
  29. private RPT030106_SE rptse = null;
  30. private RPT030106_SE rptsed = null;
  31. //默认清空工序,重置回用户当前权限工序
  32. private string _currentUserPurview = null;
  33. //默认清空生产线,重置回用户当前权限生产线
  34. private string _currentUserLinePuview = null;
  35. //默认清空查看工号,重置回用户当前权限工号
  36. private string _currentUserCodePuview = null;
  37. #endregion
  38. #region 构造函数
  39. public F_RPT_030106()
  40. {
  41. InitializeComponent();
  42. // 窗体显示的Title
  43. this.Text = FormTitles.F_RPT_030106;
  44. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  45. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  46. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  47. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  48. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  49. }
  50. #endregion
  51. #region 单例模式
  52. /// <summary>
  53. /// 单例模式,防止重复创建窗体
  54. /// </summary>
  55. public static F_RPT_030106 Instance
  56. {
  57. get
  58. {
  59. if (_instance == null || _instance.IsDisposed)
  60. {
  61. _instance = new F_RPT_030106();
  62. }
  63. return _instance;
  64. }
  65. }
  66. #endregion
  67. #region 事件处理
  68. /// <summary>
  69. /// 窗体加载事件
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void F_RPT_030106_Load(object sender, EventArgs e)
  74. {
  75. try
  76. {
  77. // 加载权限
  78. FormPermissionManager.FormPermissionControl(this.Name, this,
  79. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. // 设置表格不自动创建列
  82. this.dgvReportModuleDetail.AutoGenerateColumns = false;
  83. this.dgvReportModule.AutoGenerateColumns = false;
  84. this.dgvDefectDetail.AutoGenerateColumns = false;
  85. //this.dkproductionLineSearchBox.IsEnablePurview = true;
  86. //this.dkProcedureSearchBox.IsEnablePurview = true;
  87. //this.dkOrganizationSearchBox.Focus();
  88. // 初始化时间控件为当前日期
  89. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  90. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  91. this.dtpHandOverStart.Value = DateTime.Now.Date;
  92. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  93. this.dtpCompleteDateStart.Value = DateTime.Now.Date;
  94. this.dtpCompleteDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  95. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  96. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  97. //getPurview();
  98. //getPurviewLine();
  99. // 交接工序
  100. ServiceResultEntity sresource = ReportModuleProxy.Service.GetRptProcedureModule();
  101. if (sresource != null && sresource.Data != null && sresource.Data.Tables.Count > 0)
  102. {
  103. this.dropRptProcedure.DataSource = sresource.Data.Tables[0];
  104. this.dropRptProcedure.ValueMember = "Rptprocedureid";
  105. this.dropRptProcedure.DisplayMember = "Rptprocedurename";
  106. }
  107. }
  108. catch (Exception ex)
  109. {
  110. // 对异常进行共通处理
  111. ExceptionManager.HandleEventException(this.ToString(),
  112. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  113. }
  114. }
  115. /// <summary>
  116. /// 自动适应列宽
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  121. {
  122. this.dgvReportModule.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  123. this.dgvReportModuleDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  124. this.dgvDefectDetail.AutoResizeColumns();
  125. this.dgvProDetail.AutoResizeColumns();
  126. }
  127. /// <summary>
  128. /// 窗体关闭事件
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void F_RPT_030106_FormClosed(object sender, FormClosedEventArgs e)
  133. {
  134. _instance = null;
  135. }
  136. /// <summary>
  137. /// 关闭按钮
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void tsbtnClose_Click(object sender, EventArgs e)
  142. {
  143. this.Close();
  144. }
  145. /// <summary>
  146. /// 查询按钮事件
  147. /// </summary>
  148. /// <param name="sender"></param>
  149. /// <param name="e"></param>
  150. private void btnSearch_Click(object sender, EventArgs e)
  151. {
  152. try
  153. {
  154. //没有对应的生产线权限,返回 因为有无责任工序,则可以不用分配工序的权限,不分配,只能查无责任工序
  155. //if (string.IsNullOrEmpty(this._currentUserLinePuview))
  156. //{
  157. // // 提示未查找到数据
  158. // MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  159. // MessageBoxButtons.OK, MessageBoxIcon.Information);
  160. // return;
  161. //}
  162. // 交接工序必须输入项
  163. if (this.dropRptProcedure.SelectedValue == null)
  164. {
  165. MessageBox.Show(Messages.MSG_CMN_W005, this.Text,
  166. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  167. return;
  168. }
  169. // 登记时间与交接时间必须选择一个
  170. if ((!this.chkCdate.Checked && (this.chkCheckDate.Enabled && !this.chkCheckDate.Checked)) && !this.chkHandOver.Checked)
  171. {
  172. MessageBox.Show("(缺陷)登记时间与交接时间至少选择一个作为查询条件。", this.Text,
  173. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  174. return;
  175. }
  176. CreateSearchCondition();
  177. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)
  178. {
  179. rptsed = rptse;
  180. this.dgvReportModule.DataSource = null;
  181. this.dgvReportModule.DataSource = GetSearchTotalData();
  182. }
  183. else if (this.tblReportModule.SelectedIndex == 1)
  184. {
  185. this.dgvReportModuleDetail.DataSource = null;
  186. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  187. }
  188. else if (this.tblReportModule.SelectedIndex == 2)
  189. {
  190. this.dgvDefectDetail.DataSource = null;
  191. this.dgvDefectDetail.DataSource = GetSearchDefectData();
  192. }
  193. else
  194. {
  195. if (string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  196. {
  197. MessageBox.Show("最少选择一个【生产工序】。", this.Text,
  198. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  199. this.dkProcedureSearchBox1.Focus();
  200. return;
  201. }
  202. this.dgvProDetail.DataSource = null;
  203. this.dgvProDetail.DataSource = GetSearchProData();
  204. }
  205. }
  206. catch (Exception ex)
  207. {
  208. this.btnSearch.Enabled = true;
  209. this.btnClearCondition.Enabled = true;
  210. // 对异常进行共通处理
  211. ExceptionManager.HandleEventException(this.ToString(),
  212. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  213. }
  214. }
  215. /// <summary>
  216. /// 清空条件按钮事件
  217. /// </summary>
  218. /// <param name="sender"></param>
  219. /// <param name="e"></param>
  220. private void btnClearCondition_Click(object sender, EventArgs e)
  221. {
  222. this.scbGoods.ClearValue();
  223. this.scbGoodsType.ClearValue();
  224. this.dkProcedureSearchBox.ClearControl();
  225. this.dkProcedureSearchBox1.ClearControl();
  226. this.dkproductionLineSearchBox.ClearControl();
  227. this.dkDefectTypeNameSearchBox1.ClearControl();
  228. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  229. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  230. this.dtpHandOverStart.Value = DateTime.Now.Date;
  231. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  232. this.dtpCompleteDateStart.Value = DateTime.Now.Date;
  233. this.dtpCompleteDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  234. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  235. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  236. this.chkCdate.Checked = true;
  237. this.chkHandOver.Checked = false;
  238. this.chkCheckDate.Checked = false;
  239. this.chkKPDDate.Checked = false;
  240. this.dkCompleteProcedure.ClearControl();
  241. this.dkCheckProcedureSearchBox.ClearControl();
  242. this.txtKilnCode.Clear();
  243. this.txtDefectUserCode.Text = "";
  244. this.txtDefectCode.Text = "";
  245. this.txtCheckUserCode.Text = "";
  246. this.txtDefectName.Text = "";
  247. this.txtGoodsCode.Text = "";
  248. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  249. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  250. if (this.dropRptProcedure.Items.Count > 0)
  251. {
  252. this.dropRptProcedure.SelectedIndex = 0;
  253. }
  254. }
  255. /// <summary>
  256. /// 双击单元格事件
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void dgvReportModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  261. {
  262. try
  263. {
  264. if (this.dgvReportModule.CurrentRow == null)
  265. {
  266. return;
  267. }
  268. //获取数据信息
  269. DataGridViewRow dgvr = dgvReportModule.CurrentRow;
  270. string defectCode = dgvr.Cells["DefectCode"].Value.ToString();
  271. string defectProcedureName = dgvr.Cells["DefectProcedureName"].Value.ToString();
  272. string productionlinename = dgvr.Cells["Productionlinename"].Value.ToString();
  273. if (defectCode.Equals("小计") || defectProcedureName.Equals("合计") || productionlinename.Equals("总计"))
  274. {
  275. return;
  276. }
  277. else
  278. {
  279. //跳转页
  280. this.tblReportModule.SelectTab(1);
  281. //获取条件
  282. CreateSearchCondition();
  283. string procedureId = dgvr.Cells["Procedureid"].Value.ToString();
  284. string defectProcedureID = dgvr.Cells["DefectProcedureID"].Value.ToString();
  285. string goodsCode = dgvr.Cells["Goodscode"].Value.ToString();
  286. string usercode1 = dgvr.Cells["Usercode1"].Value.ToString();
  287. rptse.CheckProcedureIDS = procedureId.ToString();
  288. rptse.DefectProcedureIDS = defectProcedureID;
  289. rptse.DefectCode = null;
  290. rptse.GoodsCode = null;
  291. rptse.CheckUserCode = null;
  292. rptse.DefectCodeS2D = defectCode;
  293. rptse.GoodsCodeS2D = goodsCode;
  294. rptse.CheckUserCodeS2D = usercode1;
  295. //清空数据
  296. this.dgvReportModuleDetail.DataSource = null;
  297. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  298. }
  299. }
  300. catch (Exception ex)
  301. {
  302. this.btnSearch.Enabled = true;
  303. this.btnClearCondition.Enabled = true;
  304. // 对异常进行共通处理
  305. ExceptionManager.HandleEventException(this.ToString(),
  306. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  307. }
  308. }
  309. private void chkCdate_CheckedChanged(object sender, EventArgs e)
  310. {
  311. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  312. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  313. this.dtpAccountDateStart.Enabled = this.chkCdate.Checked;
  314. this.dtpAccountDateEnd.Enabled = this.chkCdate.Checked;
  315. }
  316. private void chkHandOver_CheckedChanged(object sender, EventArgs e)
  317. {
  318. this.dtpHandOverStart.Value = DateTime.Now.Date;
  319. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  320. this.dtpHandOverStart.Enabled = this.chkHandOver.Checked;
  321. this.dtpHandOverEnd.Enabled = this.chkHandOver.Checked;
  322. }
  323. private void chkCheckDate_CheckedChanged(object sender, EventArgs e)
  324. {
  325. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  326. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  327. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  328. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  329. }
  330. private void tblReportModule_SelectedIndexChanged(object sender, EventArgs e)
  331. {
  332. if (tblReportModule.SelectedIndex == 2 || tblReportModule.SelectedIndex == 3)
  333. {
  334. this.chkCheckDate.Enabled = true;
  335. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  336. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  337. }
  338. else
  339. {
  340. this.chkCheckDate.Enabled = false;
  341. this.dtpCheckDateStart.Enabled = false;
  342. this.dtpCheckDateEnd.Enabled = false;
  343. }
  344. }
  345. #endregion
  346. #region 私有方法
  347. /// <summary>
  348. /// 搜索条件
  349. /// </summary>
  350. /// <returns></returns>
  351. private void CreateSearchCondition()
  352. {
  353. rptse = new RPT030106_SE();
  354. rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  355. rptse.LineIDS = this.dkproductionLineSearchBox.ProductionLineIDS;
  356. rptse.DefectProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  357. //rptse.PurViewUserCodeIDS = this._currentUserCodePuview;//默认查看对应权限工号
  358. if (this.chkCdate.Checked)
  359. {
  360. rptse.CreateTimeStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  361. rptse.CreateTimeEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  362. }
  363. rptse.DefectTypeIDS = this.dkDefectTypeNameSearchBox1.DefectTypeIDS;
  364. rptse.DefectUserCode = this.txtDefectUserCode.Text.Trim();
  365. rptse.CheckUserCode = this.txtCheckUserCode.Text.Trim();
  366. rptse.DefectCode = this.txtDefectCode.Text.Trim();
  367. rptse.DefectName = this.txtDefectName.Text.Trim();
  368. rptse.GoodsCode = this.txtGoodsCode.Text.Trim();
  369. rptse.GoodsIDS = scbGoods.CheckedPKMember;
  370. if (this.dropRptProcedure.SelectedValue != null)
  371. {
  372. rptse.HandOverProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  373. }
  374. if (this.chkHandOver.Checked)
  375. {
  376. rptse.HandOverTimeStart = DateTime.Parse(this.dtpHandOverStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  377. rptse.HandOverTimeEnd = DateTime.Parse(this.dtpHandOverEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  378. }
  379. if (this.chkCheckDate.Enabled && this.chkCheckDate.Checked)
  380. {
  381. rptse.CheckTimeStart = DateTime.Parse(this.dtpCheckDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  382. rptse.CheckTimeEnd = DateTime.Parse(this.dtpCheckDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  383. }
  384. if (this.chkKPDDate.Enabled && this.chkKPDDate.Checked)
  385. {
  386. rptse.KPDTimeStart = this.dtpKPDDateStart.Value.Date;
  387. rptse.KPDTimeEnd = this.dtpKPDDateStart.Value.Date.AddDays(1);
  388. }
  389. rptse.CheckProcedureIDS = this.dkCheckProcedureSearchBox.ProcedureIDS;
  390. rptse.KilnCode = this.txtKilnCode.Text.Trim();
  391. //if (!string.IsNullOrEmpty(this.dkCompleteProcedure.ProcedureIDS))
  392. //{
  393. // rptse.CompleteProcedureIDS = this.dkCompleteProcedure.ProcedureIDS;
  394. // rptse.CompleteCreateTimeStart = DateTime.Parse(this.dtpCompleteDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  395. // rptse.CompleteCreateTimeEnd = DateTime.Parse(this.dtpCompleteDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  396. //}
  397. if (!string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  398. {
  399. rptse.CompleteProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
  400. }
  401. }
  402. /// <summary>
  403. /// 查询成检缺陷汇总表
  404. /// </summary>
  405. private DataTable GetSearchTotalData()
  406. {
  407. try
  408. {
  409. // 调用服务器端获取数据集
  410. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  411. {
  412. return ReportModuleProxy.Service.GetRPT030106Data(rptse);
  413. }
  414. );
  415. if (sre.Status == Constant.ServiceResultStatus.Success)
  416. {
  417. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  418. {
  419. // 提示未查找到数据
  420. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  421. MessageBoxButtons.OK, MessageBoxIcon.Information);
  422. //清空数据
  423. return null;
  424. }
  425. return sre.Data.Tables[0];
  426. }
  427. return null;
  428. }
  429. catch (Exception ex)
  430. {
  431. throw ex;
  432. }
  433. }
  434. /// <summary>
  435. /// 查询损坏明细表
  436. /// </summary>
  437. private DataTable GetSearchDetailData()
  438. {
  439. try
  440. {
  441. // 调用服务器端获取数据集
  442. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  443. {
  444. return ReportModuleProxy.Service.GetRPT030106IData(rptse);
  445. }
  446. );
  447. if (sre.Status == Constant.ServiceResultStatus.Success)
  448. {
  449. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  450. {
  451. // 提示未查找到数据
  452. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  453. MessageBoxButtons.OK, MessageBoxIcon.Information);
  454. //清空数据
  455. return null;
  456. }
  457. return sre.Data.Tables[0];
  458. }
  459. return null;
  460. }
  461. catch (Exception ex)
  462. {
  463. throw ex;
  464. }
  465. }
  466. /// <summary>
  467. /// 查询缺陷登记明细表
  468. /// </summary>
  469. private DataTable GetSearchDefectData()
  470. {
  471. try
  472. {
  473. // 调用服务器端获取数据集
  474. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  475. {
  476. return ReportModuleProxy.Service.GetRPT030106DData(rptse);
  477. }
  478. );
  479. if (sre.Status == Constant.ServiceResultStatus.Success)
  480. {
  481. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  482. {
  483. // 提示未查找到数据
  484. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  485. MessageBoxButtons.OK, MessageBoxIcon.Information);
  486. //清空数据
  487. return null;
  488. }
  489. return sre.Data.Tables[0];
  490. }
  491. return null;
  492. }
  493. catch (Exception ex)
  494. {
  495. throw ex;
  496. }
  497. }
  498. /// <summary>
  499. /// 查询缺陷登记明细表
  500. /// </summary>
  501. private DataTable GetSearchProData()
  502. {
  503. try
  504. {
  505. // 调用服务器端获取数据集
  506. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  507. {
  508. return ReportModuleProxy.Service.GetRPT030106ProData(rptse);
  509. }
  510. );
  511. if (sre.Status == Constant.ServiceResultStatus.Success)
  512. {
  513. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  514. {
  515. // 提示未查找到数据
  516. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  517. MessageBoxButtons.OK, MessageBoxIcon.Information);
  518. //清空数据
  519. return null;
  520. }
  521. return sre.Data.Tables[0];
  522. }
  523. return null;
  524. }
  525. catch (Exception ex)
  526. {
  527. throw ex;
  528. }
  529. }
  530. /// <summary>
  531. /// 获取权限(生产线)
  532. /// </summary>
  533. protected void getPurviewLine()
  534. {
  535. try
  536. {
  537. StringBuilder sbProcedurePurview = new StringBuilder();
  538. //得到工序查看权限
  539. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  540. {
  541. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  542. }));
  543. if (dsProcedurePurview != null)
  544. {
  545. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  546. if (drPurview.Length == 0)
  547. {
  548. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  549. {
  550. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  551. }
  552. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  553. {
  554. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  555. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  556. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  557. }
  558. }
  559. else
  560. {
  561. ProductionLineEntity line = new ProductionLineEntity();
  562. line.ValueFlags = new object[] { 1 };
  563. dsProcedurePurview = (DataSet)DoAsync(() =>
  564. {
  565. return PCModuleProxy.Service.SearchProductionLine(line);
  566. });
  567. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  568. {
  569. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  570. }
  571. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  572. {
  573. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  574. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  575. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  576. }
  577. }
  578. }
  579. }
  580. catch (Exception ex)
  581. {
  582. throw ex;
  583. }
  584. }
  585. /// <summary>
  586. /// 获取权限
  587. /// </summary>
  588. protected void getPurview()
  589. {
  590. try
  591. {
  592. StringBuilder sbProcedurePurview = new StringBuilder();
  593. //得到工序查看权限
  594. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  595. {
  596. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  597. }));
  598. if (dsProcedurePurview != null)
  599. {
  600. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  601. if (drPurview.Length == 0)
  602. {
  603. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  604. {
  605. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  606. }
  607. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  608. {
  609. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  610. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  611. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  612. }
  613. }
  614. else
  615. {
  616. SearchProductionLineEntity line = new SearchProductionLineEntity();
  617. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  618. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  619. {
  620. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  621. }
  622. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  623. {
  624. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  625. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  626. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  627. }
  628. }
  629. }
  630. }
  631. catch (Exception ex)
  632. {
  633. throw ex;
  634. }
  635. }
  636. /// <summary>
  637. /// 查看工号权限
  638. /// </summary>
  639. protected void getPurviewUserCode()
  640. {
  641. try
  642. {
  643. //StringBuilder sbProcedurePurview = new StringBuilder();
  644. ////得到工序查看权限
  645. //DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  646. //{
  647. // return SystemModuleProxy.Service.GetUserPurview(3, LogInUserInfo.CurrentUser.UserID);
  648. //}));
  649. //if (dsProcedurePurview != null)
  650. //{
  651. // foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  652. // {
  653. // sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  654. // }
  655. // if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  656. // {
  657. // this._currentUserCodePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  658. // }
  659. //}
  660. }
  661. catch (Exception ex)
  662. {
  663. throw ex;
  664. }
  665. }
  666. #endregion
  667. private void chkKPDDate_CheckedChanged(object sender, EventArgs e)
  668. {
  669. this.dtpKPDDateStart.Value = DateTime.Now.Date;
  670. this.dtpKPDDateEnd.Value = DateTime.Now.Date;
  671. this.dtpKPDDateStart.Enabled = this.chkKPDDate.Checked;
  672. this.dtpKPDDateEnd.Enabled = this.chkKPDDate.Checked;
  673. }
  674. }
  675. }