F_RPT_030106.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  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.dkCompleteProcedure.ClearControl();
  240. this.dkCheckProcedureSearchBox.ClearControl();
  241. this.txtKilnCode.Clear();
  242. this.txtDefectUserCode.Text = "";
  243. this.txtDefectCode.Text = "";
  244. this.txtCheckUserCode.Text = "";
  245. this.txtDefectName.Text = "";
  246. this.txtGoodsCode.Text = "";
  247. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  248. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  249. if (this.dropRptProcedure.Items.Count > 0)
  250. {
  251. this.dropRptProcedure.SelectedIndex = 0;
  252. }
  253. }
  254. /// <summary>
  255. /// 双击单元格事件
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. private void dgvReportModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  260. {
  261. try
  262. {
  263. if (this.dgvReportModule.CurrentRow == null)
  264. {
  265. return;
  266. }
  267. //获取数据信息
  268. DataGridViewRow dgvr = dgvReportModule.CurrentRow;
  269. string defectCode = dgvr.Cells["DefectCode"].Value.ToString();
  270. string defectProcedureName = dgvr.Cells["DefectProcedureName"].Value.ToString();
  271. string productionlinename = dgvr.Cells["Productionlinename"].Value.ToString();
  272. if (defectCode.Equals("小计") || defectProcedureName.Equals("合计") || productionlinename.Equals("总计"))
  273. {
  274. return;
  275. }
  276. else
  277. {
  278. //跳转页
  279. this.tblReportModule.SelectTab(1);
  280. //获取条件
  281. CreateSearchCondition();
  282. string procedureId = dgvr.Cells["Procedureid"].Value.ToString();
  283. string defectProcedureID = dgvr.Cells["DefectProcedureID"].Value.ToString();
  284. string goodsCode = dgvr.Cells["Goodscode"].Value.ToString();
  285. string usercode1 = dgvr.Cells["Usercode1"].Value.ToString();
  286. rptse.CheckProcedureIDS = procedureId.ToString();
  287. rptse.DefectProcedureIDS = defectProcedureID;
  288. rptse.DefectCode = null;
  289. rptse.GoodsCode = null;
  290. rptse.CheckUserCode = null;
  291. rptse.DefectCodeS2D = defectCode;
  292. rptse.GoodsCodeS2D = goodsCode;
  293. rptse.CheckUserCodeS2D = usercode1;
  294. //清空数据
  295. this.dgvReportModuleDetail.DataSource = null;
  296. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  297. }
  298. }
  299. catch (Exception ex)
  300. {
  301. this.btnSearch.Enabled = true;
  302. this.btnClearCondition.Enabled = true;
  303. // 对异常进行共通处理
  304. ExceptionManager.HandleEventException(this.ToString(),
  305. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  306. }
  307. }
  308. private void chkCdate_CheckedChanged(object sender, EventArgs e)
  309. {
  310. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  311. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  312. this.dtpAccountDateStart.Enabled = this.chkCdate.Checked;
  313. this.dtpAccountDateEnd.Enabled = this.chkCdate.Checked;
  314. }
  315. private void chkHandOver_CheckedChanged(object sender, EventArgs e)
  316. {
  317. this.dtpHandOverStart.Value = DateTime.Now.Date;
  318. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  319. this.dtpHandOverStart.Enabled = this.chkHandOver.Checked;
  320. this.dtpHandOverEnd.Enabled = this.chkHandOver.Checked;
  321. }
  322. private void chkCheckDate_CheckedChanged(object sender, EventArgs e)
  323. {
  324. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  325. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  326. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  327. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  328. }
  329. private void tblReportModule_SelectedIndexChanged(object sender, EventArgs e)
  330. {
  331. if (tblReportModule.SelectedIndex == 2 || tblReportModule.SelectedIndex == 3)
  332. {
  333. this.chkCheckDate.Enabled = true;
  334. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  335. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  336. }
  337. else
  338. {
  339. this.chkCheckDate.Enabled = false;
  340. this.dtpCheckDateStart.Enabled = false;
  341. this.dtpCheckDateEnd.Enabled = false;
  342. }
  343. }
  344. #endregion
  345. #region 私有方法
  346. /// <summary>
  347. /// 搜索条件
  348. /// </summary>
  349. /// <returns></returns>
  350. private void CreateSearchCondition()
  351. {
  352. rptse = new RPT030106_SE();
  353. rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  354. rptse.LineIDS = this.dkproductionLineSearchBox.ProductionLineIDS;
  355. rptse.DefectProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  356. //rptse.PurViewUserCodeIDS = this._currentUserCodePuview;//默认查看对应权限工号
  357. if (this.chkCdate.Checked)
  358. {
  359. rptse.CreateTimeStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  360. rptse.CreateTimeEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  361. }
  362. rptse.DefectTypeIDS = this.dkDefectTypeNameSearchBox1.DefectTypeIDS;
  363. rptse.DefectUserCode = this.txtDefectUserCode.Text.Trim();
  364. rptse.CheckUserCode = this.txtCheckUserCode.Text.Trim();
  365. rptse.DefectCode = this.txtDefectCode.Text.Trim();
  366. rptse.DefectName = this.txtDefectName.Text.Trim();
  367. rptse.GoodsCode = this.txtGoodsCode.Text.Trim();
  368. rptse.GoodsIDS = scbGoods.CheckedPKMember;
  369. if (this.dropRptProcedure.SelectedValue != null)
  370. {
  371. rptse.HandOverProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  372. }
  373. if (this.chkHandOver.Checked)
  374. {
  375. rptse.HandOverTimeStart = DateTime.Parse(this.dtpHandOverStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  376. rptse.HandOverTimeEnd = DateTime.Parse(this.dtpHandOverEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  377. }
  378. if (this.chkCheckDate.Enabled && this.chkCheckDate.Checked)
  379. {
  380. rptse.CheckTimeStart = DateTime.Parse(this.dtpCheckDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  381. rptse.CheckTimeEnd = DateTime.Parse(this.dtpCheckDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  382. }
  383. rptse.CheckProcedureIDS = this.dkCheckProcedureSearchBox.ProcedureIDS;
  384. rptse.KilnCode = this.txtKilnCode.Text.Trim();
  385. //if (!string.IsNullOrEmpty(this.dkCompleteProcedure.ProcedureIDS))
  386. //{
  387. // rptse.CompleteProcedureIDS = this.dkCompleteProcedure.ProcedureIDS;
  388. // rptse.CompleteCreateTimeStart = DateTime.Parse(this.dtpCompleteDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  389. // rptse.CompleteCreateTimeEnd = DateTime.Parse(this.dtpCompleteDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  390. //}
  391. if (!string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  392. {
  393. rptse.CompleteProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
  394. }
  395. }
  396. /// <summary>
  397. /// 查询成检缺陷汇总表
  398. /// </summary>
  399. private DataTable GetSearchTotalData()
  400. {
  401. try
  402. {
  403. // 调用服务器端获取数据集
  404. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  405. {
  406. return ReportModuleProxy.Service.GetRPT030106Data(rptse);
  407. }
  408. );
  409. if (sre.Status == Constant.ServiceResultStatus.Success)
  410. {
  411. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  412. {
  413. // 提示未查找到数据
  414. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  415. MessageBoxButtons.OK, MessageBoxIcon.Information);
  416. //清空数据
  417. return null;
  418. }
  419. return sre.Data.Tables[0];
  420. }
  421. return null;
  422. }
  423. catch (Exception ex)
  424. {
  425. throw ex;
  426. }
  427. }
  428. /// <summary>
  429. /// 查询损坏明细表
  430. /// </summary>
  431. private DataTable GetSearchDetailData()
  432. {
  433. try
  434. {
  435. // 调用服务器端获取数据集
  436. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  437. {
  438. return ReportModuleProxy.Service.GetRPT030106IData(rptse);
  439. }
  440. );
  441. if (sre.Status == Constant.ServiceResultStatus.Success)
  442. {
  443. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  444. {
  445. // 提示未查找到数据
  446. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  447. MessageBoxButtons.OK, MessageBoxIcon.Information);
  448. //清空数据
  449. return null;
  450. }
  451. return sre.Data.Tables[0];
  452. }
  453. return null;
  454. }
  455. catch (Exception ex)
  456. {
  457. throw ex;
  458. }
  459. }
  460. /// <summary>
  461. /// 查询缺陷登记明细表
  462. /// </summary>
  463. private DataTable GetSearchDefectData()
  464. {
  465. try
  466. {
  467. // 调用服务器端获取数据集
  468. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  469. {
  470. return ReportModuleProxy.Service.GetRPT030106DData(rptse);
  471. }
  472. );
  473. if (sre.Status == Constant.ServiceResultStatus.Success)
  474. {
  475. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  476. {
  477. // 提示未查找到数据
  478. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  479. MessageBoxButtons.OK, MessageBoxIcon.Information);
  480. //清空数据
  481. return null;
  482. }
  483. return sre.Data.Tables[0];
  484. }
  485. return null;
  486. }
  487. catch (Exception ex)
  488. {
  489. throw ex;
  490. }
  491. }
  492. /// <summary>
  493. /// 查询缺陷登记明细表
  494. /// </summary>
  495. private DataTable GetSearchProData()
  496. {
  497. try
  498. {
  499. // 调用服务器端获取数据集
  500. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  501. {
  502. return ReportModuleProxy.Service.GetRPT030106ProData(rptse);
  503. }
  504. );
  505. if (sre.Status == Constant.ServiceResultStatus.Success)
  506. {
  507. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  508. {
  509. // 提示未查找到数据
  510. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  511. MessageBoxButtons.OK, MessageBoxIcon.Information);
  512. //清空数据
  513. return null;
  514. }
  515. return sre.Data.Tables[0];
  516. }
  517. return null;
  518. }
  519. catch (Exception ex)
  520. {
  521. throw ex;
  522. }
  523. }
  524. /// <summary>
  525. /// 获取权限(生产线)
  526. /// </summary>
  527. protected void getPurviewLine()
  528. {
  529. try
  530. {
  531. StringBuilder sbProcedurePurview = new StringBuilder();
  532. //得到工序查看权限
  533. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  534. {
  535. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  536. }));
  537. if (dsProcedurePurview != null)
  538. {
  539. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  540. if (drPurview.Length == 0)
  541. {
  542. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  543. {
  544. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  545. }
  546. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  547. {
  548. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  549. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  550. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  551. }
  552. }
  553. else
  554. {
  555. ProductionLineEntity line = new ProductionLineEntity();
  556. line.ValueFlags = new object[] { 1 };
  557. dsProcedurePurview = (DataSet)DoAsync(() =>
  558. {
  559. return PCModuleProxy.Service.SearchProductionLine(line);
  560. });
  561. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  562. {
  563. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  564. }
  565. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  566. {
  567. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  568. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  569. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  570. }
  571. }
  572. }
  573. }
  574. catch (Exception ex)
  575. {
  576. throw ex;
  577. }
  578. }
  579. /// <summary>
  580. /// 获取权限
  581. /// </summary>
  582. protected void getPurview()
  583. {
  584. try
  585. {
  586. StringBuilder sbProcedurePurview = new StringBuilder();
  587. //得到工序查看权限
  588. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  589. {
  590. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  591. }));
  592. if (dsProcedurePurview != null)
  593. {
  594. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  595. if (drPurview.Length == 0)
  596. {
  597. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  598. {
  599. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  600. }
  601. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  602. {
  603. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  604. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  605. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  606. }
  607. }
  608. else
  609. {
  610. SearchProductionLineEntity line = new SearchProductionLineEntity();
  611. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  612. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  613. {
  614. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  615. }
  616. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  617. {
  618. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  619. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  620. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  621. }
  622. }
  623. }
  624. }
  625. catch (Exception ex)
  626. {
  627. throw ex;
  628. }
  629. }
  630. /// <summary>
  631. /// 查看工号权限
  632. /// </summary>
  633. protected void getPurviewUserCode()
  634. {
  635. try
  636. {
  637. //StringBuilder sbProcedurePurview = new StringBuilder();
  638. ////得到工序查看权限
  639. //DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  640. //{
  641. // return SystemModuleProxy.Service.GetUserPurview(3, LogInUserInfo.CurrentUser.UserID);
  642. //}));
  643. //if (dsProcedurePurview != null)
  644. //{
  645. // foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  646. // {
  647. // sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  648. // }
  649. // if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  650. // {
  651. // this._currentUserCodePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  652. // }
  653. //}
  654. }
  655. catch (Exception ex)
  656. {
  657. throw ex;
  658. }
  659. }
  660. #endregion
  661. }
  662. }