F_RPT_030106.cs 22 KB

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