F_RPT_030106.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  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. DataTable dtTest = new DataTable();
  109. dtTest.Columns.Add("TestFormFlagid", typeof(int));
  110. dtTest.Columns.Add("TestFormFlagname", typeof(string));
  111. DataRow drTest = dtTest.NewRow();
  112. drTest["TestFormFlagid"] = 0;
  113. drTest["TestFormFlagname"] = "全部";
  114. dtTest.Rows.Add(drTest);
  115. drTest = dtTest.NewRow();
  116. drTest["TestFormFlagid"] = 1;
  117. drTest["TestFormFlagname"] = "实验单";
  118. dtTest.Rows.Add(drTest);
  119. drTest = dtTest.NewRow();
  120. drTest["TestFormFlagid"] = 3;
  121. drTest["TestFormFlagname"] = "非实验单";
  122. dtTest.Rows.Add(drTest);
  123. this.dropTestFormFlag.DataSource = dtTest;
  124. this.dropTestFormFlag.ValueMember = "TestFormFlagid";
  125. this.dropTestFormFlag.DisplayMember = "TestFormFlagname";
  126. }
  127. catch (Exception ex)
  128. {
  129. // 对异常进行共通处理
  130. ExceptionManager.HandleEventException(this.ToString(),
  131. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  132. }
  133. }
  134. /// <summary>
  135. /// 自动适应列宽
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  140. {
  141. this.dgvReportModule.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  142. this.dgvReportModuleDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  143. this.dgvDefectDetail.AutoResizeColumns();
  144. this.dgvProDetail.AutoResizeColumns();
  145. }
  146. /// <summary>
  147. /// 窗体关闭事件
  148. /// </summary>
  149. /// <param name="sender"></param>
  150. /// <param name="e"></param>
  151. private void F_RPT_030106_FormClosed(object sender, FormClosedEventArgs e)
  152. {
  153. _instance = null;
  154. }
  155. /// <summary>
  156. /// 关闭按钮
  157. /// </summary>
  158. /// <param name="sender"></param>
  159. /// <param name="e"></param>
  160. private void tsbtnClose_Click(object sender, EventArgs e)
  161. {
  162. this.Close();
  163. }
  164. /// <summary>
  165. /// 查询按钮事件
  166. /// </summary>
  167. /// <param name="sender"></param>
  168. /// <param name="e"></param>
  169. private void btnSearch_Click(object sender, EventArgs e)
  170. {
  171. try
  172. {
  173. //没有对应的生产线权限,返回 因为有无责任工序,则可以不用分配工序的权限,不分配,只能查无责任工序
  174. //if (string.IsNullOrEmpty(this._currentUserLinePuview))
  175. //{
  176. // // 提示未查找到数据
  177. // MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  178. // MessageBoxButtons.OK, MessageBoxIcon.Information);
  179. // return;
  180. //}
  181. // 交接工序必须输入项
  182. if (this.dropRptProcedure.SelectedValue == null)
  183. {
  184. MessageBox.Show(Messages.MSG_CMN_W005, this.Text,
  185. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  186. return;
  187. }
  188. // 登记时间与交接时间必须选择一个
  189. if ((!this.chkCdate.Checked && (this.chkCheckDate.Enabled && !this.chkCheckDate.Checked)) && !this.chkHandOver.Checked)
  190. {
  191. MessageBox.Show("(缺陷)登记时间与交接时间至少选择一个作为查询条件。", this.Text,
  192. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  193. return;
  194. }
  195. CreateSearchCondition();
  196. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)
  197. {
  198. rptsed = rptse;
  199. this.dgvReportModule.DataSource = null;
  200. this.dgvReportModule.DataSource = GetSearchTotalData();
  201. }
  202. else if (this.tblReportModule.SelectedIndex == 1)
  203. {
  204. this.dgvReportModuleDetail.DataSource = null;
  205. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  206. }
  207. else if (this.tblReportModule.SelectedIndex == 2)
  208. {
  209. this.dgvDefectDetail.DataSource = null;
  210. this.dgvDefectDetail.DataSource = GetSearchDefectData();
  211. }
  212. else
  213. {
  214. if (string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  215. {
  216. MessageBox.Show("最少选择一个【生产工序】。", this.Text,
  217. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  218. this.dkProcedureSearchBox1.Focus();
  219. return;
  220. }
  221. this.dgvProDetail.DataSource = null;
  222. this.dgvProDetail.DataSource = GetSearchProData();
  223. }
  224. }
  225. catch (Exception ex)
  226. {
  227. this.btnSearch.Enabled = true;
  228. this.btnClearCondition.Enabled = true;
  229. // 对异常进行共通处理
  230. ExceptionManager.HandleEventException(this.ToString(),
  231. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  232. }
  233. }
  234. /// <summary>
  235. /// 清空条件按钮事件
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void btnClearCondition_Click(object sender, EventArgs e)
  240. {
  241. this.scbGoods.ClearValue();
  242. this.scbGoodsType.ClearValue();
  243. this.dkProcedureSearchBox.ClearControl();
  244. this.dkProcedureSearchBox1.ClearControl();
  245. this.dkproductionLineSearchBox.ClearControl();
  246. this.dkDefectTypeNameSearchBox1.ClearControl();
  247. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  248. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  249. this.dtpHandOverStart.Value = DateTime.Now.Date;
  250. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  251. this.dtpCompleteDateStart.Value = DateTime.Now.Date;
  252. this.dtpCompleteDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  253. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  254. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  255. this.chkCdate.Checked = true;
  256. this.chkHandOver.Checked = false;
  257. this.chkCheckDate.Checked = false;
  258. this.chkKPDDate.Checked = false;
  259. this.dkCompleteProcedure.ClearControl();
  260. this.dkCheckProcedureSearchBox.ClearControl();
  261. this.txtKilnCode.Clear();
  262. this.txtDefectUserCode.Text = "";
  263. this.txtDefectCode.Text = "";
  264. this.txtCheckUserCode.Text = "";
  265. this.txtDefectName.Text = "";
  266. this.txtGoodsCode.Text = "";
  267. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  268. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  269. if (this.dropRptProcedure.Items.Count > 0)
  270. {
  271. this.dropRptProcedure.SelectedIndex = 0;
  272. }
  273. this.dropTestFormFlag.SelectedIndex = 0;
  274. }
  275. /// <summary>
  276. /// 双击单元格事件
  277. /// </summary>
  278. /// <param name="sender"></param>
  279. /// <param name="e"></param>
  280. private void dgvReportModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  281. {
  282. try
  283. {
  284. if (this.dgvReportModule.CurrentRow == null)
  285. {
  286. return;
  287. }
  288. //获取数据信息
  289. DataGridViewRow dgvr = dgvReportModule.CurrentRow;
  290. string defectCode = dgvr.Cells["DefectCode"].Value.ToString();
  291. string defectProcedureName = dgvr.Cells["DefectProcedureName"].Value.ToString();
  292. string productionlinename = dgvr.Cells["Productionlinename"].Value.ToString();
  293. if (defectCode.Equals("小计") || defectProcedureName.Equals("合计") || productionlinename.Equals("总计"))
  294. {
  295. return;
  296. }
  297. else
  298. {
  299. //跳转页
  300. this.tblReportModule.SelectTab(1);
  301. //获取条件
  302. CreateSearchCondition();
  303. string procedureId = dgvr.Cells["Procedureid"].Value.ToString();
  304. string defectProcedureID = dgvr.Cells["DefectProcedureID"].Value.ToString();
  305. string goodsCode = dgvr.Cells["Goodscode"].Value.ToString();
  306. string usercode1 = dgvr.Cells["Usercode1"].Value.ToString();
  307. rptse.CheckProcedureIDS = procedureId.ToString();
  308. rptse.DefectProcedureIDS = defectProcedureID;
  309. rptse.DefectCode = null;
  310. rptse.GoodsCode = null;
  311. rptse.CheckUserCode = null;
  312. rptse.DefectCodeS2D = defectCode;
  313. rptse.GoodsCodeS2D = goodsCode;
  314. rptse.CheckUserCodeS2D = usercode1;
  315. //清空数据
  316. this.dgvReportModuleDetail.DataSource = null;
  317. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  318. }
  319. }
  320. catch (Exception ex)
  321. {
  322. this.btnSearch.Enabled = true;
  323. this.btnClearCondition.Enabled = true;
  324. // 对异常进行共通处理
  325. ExceptionManager.HandleEventException(this.ToString(),
  326. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  327. }
  328. }
  329. private void chkCdate_CheckedChanged(object sender, EventArgs e)
  330. {
  331. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  332. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  333. this.dtpAccountDateStart.Enabled = this.chkCdate.Checked;
  334. this.dtpAccountDateEnd.Enabled = this.chkCdate.Checked;
  335. }
  336. private void chkHandOver_CheckedChanged(object sender, EventArgs e)
  337. {
  338. this.dtpHandOverStart.Value = DateTime.Now.Date;
  339. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  340. this.dtpHandOverStart.Enabled = this.chkHandOver.Checked;
  341. this.dtpHandOverEnd.Enabled = this.chkHandOver.Checked;
  342. }
  343. private void chkCheckDate_CheckedChanged(object sender, EventArgs e)
  344. {
  345. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  346. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  347. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  348. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  349. }
  350. private void tblReportModule_SelectedIndexChanged(object sender, EventArgs e)
  351. {
  352. if (tblReportModule.SelectedIndex == 2 || tblReportModule.SelectedIndex == 3)
  353. {
  354. this.chkCheckDate.Enabled = true;
  355. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  356. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  357. }
  358. else
  359. {
  360. this.chkCheckDate.Enabled = false;
  361. this.dtpCheckDateStart.Enabled = false;
  362. this.dtpCheckDateEnd.Enabled = false;
  363. }
  364. }
  365. #endregion
  366. #region 私有方法
  367. /// <summary>
  368. /// 搜索条件
  369. /// </summary>
  370. /// <returns></returns>
  371. private void CreateSearchCondition()
  372. {
  373. rptse = new RPT030106_SE();
  374. rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  375. rptse.LineIDS = this.dkproductionLineSearchBox.ProductionLineIDS;
  376. rptse.DefectProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  377. //rptse.PurViewUserCodeIDS = this._currentUserCodePuview;//默认查看对应权限工号
  378. if (this.chkCdate.Checked)
  379. {
  380. rptse.CreateTimeStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  381. rptse.CreateTimeEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  382. }
  383. rptse.DefectTypeIDS = this.dkDefectTypeNameSearchBox1.DefectTypeIDS;
  384. rptse.DefectUserCode = this.txtDefectUserCode.Text.Trim();
  385. rptse.CheckUserCode = this.txtCheckUserCode.Text.Trim();
  386. rptse.DefectCode = this.txtDefectCode.Text.Trim();
  387. rptse.DefectName = this.txtDefectName.Text.Trim();
  388. rptse.GoodsCode = this.txtGoodsCode.Text.Trim();
  389. rptse.GoodsIDS = scbGoods.CheckedPKMember;
  390. if (this.dropRptProcedure.SelectedValue != null)
  391. {
  392. rptse.HandOverProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  393. }
  394. if (this.chkHandOver.Checked)
  395. {
  396. rptse.HandOverTimeStart = DateTime.Parse(this.dtpHandOverStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  397. rptse.HandOverTimeEnd = DateTime.Parse(this.dtpHandOverEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  398. }
  399. if (this.chkCheckDate.Enabled && this.chkCheckDate.Checked)
  400. {
  401. rptse.CheckTimeStart = DateTime.Parse(this.dtpCheckDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  402. rptse.CheckTimeEnd = DateTime.Parse(this.dtpCheckDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  403. }
  404. if (this.chkKPDDate.Enabled && this.chkKPDDate.Checked)
  405. {
  406. rptse.KPDTimeStart = this.dtpKPDDateStart.Value.Date;
  407. rptse.KPDTimeEnd = this.dtpKPDDateStart.Value.Date.AddDays(1);
  408. }
  409. if (this.dropTestFormFlag.SelectedValue != null)
  410. {
  411. rptse.TestFormFlag = Convert.ToInt32(this.dropTestFormFlag.SelectedValue);
  412. }
  413. rptse.CheckProcedureIDS = this.dkCheckProcedureSearchBox.ProcedureIDS;
  414. rptse.KilnCode = this.txtKilnCode.Text.Trim();
  415. //if (!string.IsNullOrEmpty(this.dkCompleteProcedure.ProcedureIDS))
  416. //{
  417. // rptse.CompleteProcedureIDS = this.dkCompleteProcedure.ProcedureIDS;
  418. // rptse.CompleteCreateTimeStart = DateTime.Parse(this.dtpCompleteDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  419. // rptse.CompleteCreateTimeEnd = DateTime.Parse(this.dtpCompleteDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  420. //}
  421. if (!string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  422. {
  423. rptse.CompleteProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
  424. }
  425. }
  426. /// <summary>
  427. /// 查询成检缺陷汇总表
  428. /// </summary>
  429. private DataTable GetSearchTotalData()
  430. {
  431. try
  432. {
  433. // 调用服务器端获取数据集
  434. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  435. {
  436. return ReportModuleProxy.Service.GetRPT030106Data(rptse);
  437. }
  438. );
  439. if (sre.Status == Constant.ServiceResultStatus.Success)
  440. {
  441. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  442. {
  443. // 提示未查找到数据
  444. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  445. MessageBoxButtons.OK, MessageBoxIcon.Information);
  446. //清空数据
  447. return null;
  448. }
  449. return sre.Data.Tables[0];
  450. }
  451. return null;
  452. }
  453. catch (Exception ex)
  454. {
  455. throw ex;
  456. }
  457. }
  458. /// <summary>
  459. /// 查询损坏明细表
  460. /// </summary>
  461. private DataTable GetSearchDetailData()
  462. {
  463. try
  464. {
  465. // 调用服务器端获取数据集
  466. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  467. {
  468. return ReportModuleProxy.Service.GetRPT030106IData(rptse);
  469. }
  470. );
  471. if (sre.Status == Constant.ServiceResultStatus.Success)
  472. {
  473. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  474. {
  475. // 提示未查找到数据
  476. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  477. MessageBoxButtons.OK, MessageBoxIcon.Information);
  478. //清空数据
  479. return null;
  480. }
  481. return sre.Data.Tables[0];
  482. }
  483. return null;
  484. }
  485. catch (Exception ex)
  486. {
  487. throw ex;
  488. }
  489. }
  490. /// <summary>
  491. /// 查询缺陷登记明细表
  492. /// </summary>
  493. private DataTable GetSearchDefectData()
  494. {
  495. try
  496. {
  497. // 调用服务器端获取数据集
  498. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  499. {
  500. return ReportModuleProxy.Service.GetRPT030106DData(rptse);
  501. }
  502. );
  503. if (sre.Status == Constant.ServiceResultStatus.Success)
  504. {
  505. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  506. {
  507. // 提示未查找到数据
  508. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  509. MessageBoxButtons.OK, MessageBoxIcon.Information);
  510. //清空数据
  511. return null;
  512. }
  513. return sre.Data.Tables[0];
  514. }
  515. return null;
  516. }
  517. catch (Exception ex)
  518. {
  519. throw ex;
  520. }
  521. }
  522. /// <summary>
  523. /// 查询缺陷登记明细表
  524. /// </summary>
  525. private DataTable GetSearchProData()
  526. {
  527. try
  528. {
  529. // 调用服务器端获取数据集
  530. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  531. {
  532. return ReportModuleProxy.Service.GetRPT030106ProData(rptse);
  533. }
  534. );
  535. if (sre.Status == Constant.ServiceResultStatus.Success)
  536. {
  537. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  538. {
  539. // 提示未查找到数据
  540. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  541. MessageBoxButtons.OK, MessageBoxIcon.Information);
  542. //清空数据
  543. return null;
  544. }
  545. return sre.Data.Tables[0];
  546. }
  547. return null;
  548. }
  549. catch (Exception ex)
  550. {
  551. throw ex;
  552. }
  553. }
  554. /// <summary>
  555. /// 获取权限(生产线)
  556. /// </summary>
  557. protected void getPurviewLine()
  558. {
  559. try
  560. {
  561. StringBuilder sbProcedurePurview = new StringBuilder();
  562. //得到工序查看权限
  563. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  564. {
  565. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  566. }));
  567. if (dsProcedurePurview != null)
  568. {
  569. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  570. if (drPurview.Length == 0)
  571. {
  572. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  573. {
  574. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  575. }
  576. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  577. {
  578. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  579. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  580. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  581. }
  582. }
  583. else
  584. {
  585. ProductionLineEntity line = new ProductionLineEntity();
  586. line.ValueFlags = new object[] { 1 };
  587. dsProcedurePurview = (DataSet)DoAsync(() =>
  588. {
  589. return PCModuleProxy.Service.SearchProductionLine(line);
  590. });
  591. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  592. {
  593. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  594. }
  595. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  596. {
  597. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  598. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  599. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  600. }
  601. }
  602. }
  603. }
  604. catch (Exception ex)
  605. {
  606. throw ex;
  607. }
  608. }
  609. /// <summary>
  610. /// 获取权限
  611. /// </summary>
  612. protected void getPurview()
  613. {
  614. try
  615. {
  616. StringBuilder sbProcedurePurview = new StringBuilder();
  617. //得到工序查看权限
  618. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  619. {
  620. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  621. }));
  622. if (dsProcedurePurview != null)
  623. {
  624. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  625. if (drPurview.Length == 0)
  626. {
  627. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  628. {
  629. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  630. }
  631. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  632. {
  633. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  634. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  635. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  636. }
  637. }
  638. else
  639. {
  640. SearchProductionLineEntity line = new SearchProductionLineEntity();
  641. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  642. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  643. {
  644. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  645. }
  646. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  647. {
  648. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  649. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  650. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  651. }
  652. }
  653. }
  654. }
  655. catch (Exception ex)
  656. {
  657. throw ex;
  658. }
  659. }
  660. /// <summary>
  661. /// 查看工号权限
  662. /// </summary>
  663. protected void getPurviewUserCode()
  664. {
  665. try
  666. {
  667. //StringBuilder sbProcedurePurview = new StringBuilder();
  668. ////得到工序查看权限
  669. //DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  670. //{
  671. // return SystemModuleProxy.Service.GetUserPurview(3, LogInUserInfo.CurrentUser.UserID);
  672. //}));
  673. //if (dsProcedurePurview != null)
  674. //{
  675. // foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  676. // {
  677. // sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  678. // }
  679. // if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  680. // {
  681. // this._currentUserCodePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  682. // }
  683. //}
  684. }
  685. catch (Exception ex)
  686. {
  687. throw ex;
  688. }
  689. }
  690. #endregion
  691. private void chkKPDDate_CheckedChanged(object sender, EventArgs e)
  692. {
  693. this.dtpKPDDateStart.Value = DateTime.Now.Date;
  694. this.dtpKPDDateEnd.Value = DateTime.Now.Date;
  695. this.dtpKPDDateStart.Enabled = this.chkKPDDate.Checked;
  696. this.dtpKPDDateEnd.Enabled = this.chkKPDDate.Checked;
  697. }
  698. }
  699. }