F_RPT_030106.cs 24 KB

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