F_RPT_030103_1.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. 
  2. /*******************************************************************************
  3. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  4. * 类的信息:
  5. * 1.程序名称:F_RPT_030103_1.cs
  6. * 2.功能描述:出窑数量汇总表
  7. * 编辑履历:
  8. * 作者 日期 版本 修改内容
  9. * 袁新成 2015/4/14 1.00 新建
  10. *******************************************************************************/
  11. using System;
  12. using System.Data;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.ReportModule
  23. {
  24. /// <summary>
  25. /// 出窑数量汇总表
  26. /// </summary>
  27. public partial class F_RPT_030103_1 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. // 窗体的单例模式
  31. private static F_RPT_030103_1 _instance;
  32. //实体类
  33. private RPT030103_SE rptse = new RPT030103_SE();
  34. //默认清空工序,重置回用户当前权限工序
  35. private string _currentUserPurview = null;
  36. //默认清空生产线,重置回用户当前权限生产线
  37. private string _currentUserLinePuview = null;
  38. #endregion
  39. #region 构造函数
  40. public F_RPT_030103_1()
  41. {
  42. InitializeComponent();
  43. // 窗体显示的Title
  44. this.Text = FormTitles.F_RPT_030103;
  45. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  46. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  47. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  48. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  49. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  50. }
  51. #endregion
  52. #region 单例模式
  53. /// <summary>
  54. /// 单例模式,防止重复创建窗体
  55. /// </summary>
  56. public static F_RPT_030103_1 Instance
  57. {
  58. get
  59. {
  60. if (_instance == null || _instance.IsDisposed)
  61. {
  62. _instance = new F_RPT_030103_1();
  63. }
  64. return _instance;
  65. }
  66. }
  67. #endregion
  68. #region 事件处理
  69. /// <summary>
  70. /// 窗体加载事件
  71. /// </summary>
  72. /// <param name="sender"></param>
  73. /// <param name="e"></param>
  74. private void F_RPT_030103_1_Load(object sender, EventArgs e)
  75. {
  76. try
  77. {
  78. // 加载权限
  79. FormPermissionManager.FormPermissionControl(this.Name, this,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. //绑定下了列表
  82. BindPage();
  83. // 设置表格不自动创建列
  84. this.dgvRptProcedureDetail.AutoGenerateColumns = false;
  85. this.dgvRptProcedure.AutoGenerateColumns = false;
  86. this.dkproductionLineSearchBox.IsEnablePurview = true;
  87. this.dkProcedureSearchBox.IsEnablePurview = true;
  88. this.dropRptProcedure.Focus();
  89. // 初始化时间控件为当前日期
  90. this.dtpOverDateStart.Value = DateTime.Now.Date;
  91. this.dtpOverDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  92. this.dtpOutDateStart.Value = DateTime.Now.Date;
  93. this.dtpOutDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  94. this.dtpDDateStart.Value = DateTime.Now.Date;
  95. this.dtpDDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  96. this.dtpGDateStart.Value = DateTime.Now.Date;
  97. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  98. getPurview();
  99. getPurviewLine();
  100. }
  101. catch (Exception ex)
  102. {
  103. // 对异常进行共通处理
  104. ExceptionManager.HandleEventException(this.ToString(),
  105. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  106. }
  107. }
  108. /// <summary>
  109. /// 自动适应列宽
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  114. {
  115. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)
  116. {
  117. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  118. }
  119. else
  120. {
  121. this.dgvRptProcedureDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  122. }
  123. }
  124. /// <summary>
  125. /// 窗体关闭事件
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void F_RPT_030103_1_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. if (string.IsNullOrEmpty(this.dropRptProcedure.Text))
  152. {
  153. this.dropRptProcedure.Focus();
  154. MessageBox.Show("数据源是必选项,请选择数据源!", this.Text,
  155. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  156. return;
  157. }
  158. if (string.IsNullOrEmpty(this._currentUserPurview))
  159. {
  160. // 提示未查找到数据
  161. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  162. MessageBoxButtons.OK, MessageBoxIcon.Information);
  163. return;
  164. }
  165. CreateSearchCondition();
  166. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)//出窑数量汇总查询
  167. {
  168. this.dgvRptProcedure.DataSource = null;
  169. this.dgvRptProcedure.DataSource = this.GetSearchTotalData();
  170. }
  171. else //出窑数量明细查询
  172. {
  173. this.dgvRptProcedureDetail.DataSource = null;
  174. this.dgvRptProcedureDetail.DataSource = this.GetSearchDetailData();
  175. }
  176. }
  177. catch (Exception ex)
  178. {
  179. this.btnSearch.Enabled = true;
  180. this.btnClearCondition.Enabled = true;
  181. // 对异常进行共通处理
  182. ExceptionManager.HandleEventException(this.ToString(),
  183. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  184. }
  185. }
  186. /// <summary>
  187. /// 清空条件按钮事件
  188. /// </summary>
  189. /// <param name="sender"></param>
  190. /// <param name="e"></param>
  191. private void btnClearCondition_Click(object sender, EventArgs e)
  192. {
  193. this.scbGoods.ClearValue();
  194. this.scbGoodsType.ClearValue();
  195. this.dkProcedureSearchBox.ClearControl();
  196. this.dkproductionLineSearchBox.ClearControl();
  197. this.dkUserInfoSearchBox.ClearControl();
  198. this.dropKilnCode.SelectedValue = Constant.CBO_SELECT_ALL_VALUE;
  199. //this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  200. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  201. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  202. this.txtGroutingUserCode.Clear();
  203. this.chkOver.Checked = false;
  204. this.chkOut.Checked = true;
  205. this.dtpOutDateStart.Value = DateTime.Now.Date;
  206. this.dtpOutDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  207. this.chkDDate.Checked = false;
  208. this.chkGDate.Checked = false;
  209. this.chkspecialrepairflag.Checked = false;
  210. this.chkPUserCode.Checked = true;
  211. }
  212. /// <summary>
  213. /// 双击单元格事件
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="e"></param>
  217. private void dgvRptProcedure_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  218. {
  219. try
  220. {
  221. //判断是否为空
  222. if (this.dgvRptProcedure.CurrentRow == null ||
  223. this.dgvRptProcedure.CurrentRow.Index < 0)
  224. {
  225. return;
  226. }
  227. //获取数据信息
  228. DataGridViewRow dgvr = dgvRptProcedure.CurrentRow;
  229. string goodsId = dgvr.Cells["GoodsId"].Value.ToString();
  230. string userId = dgvr.Cells["Userid"].Value.ToString();
  231. string procedureId = dgvr.Cells["ProcedureId"].Value.ToString();
  232. //判断是否选择统计行
  233. if (!goodsId.Equals("--"))
  234. {
  235. this.dgvRptProcedureDetail.DataSource = null;
  236. this.tblReportModule.SelectTab(1);
  237. //获取条件
  238. CreateSearchCondition();
  239. this.rptse.KilnID = Convert.ToInt32(dgvr.Cells["Kilnid"].Value.ToString());
  240. this.rptse.GoodsIDS = goodsId.ToString();
  241. this.rptse.RptTProcedureIDS = procedureId.ToString();
  242. this.rptse.UserIDS = userId.ToString();
  243. this.dgvRptProcedureDetail.DataSource = null;
  244. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  245. }
  246. else
  247. {
  248. if (string.IsNullOrEmpty(procedureId))
  249. {
  250. this.dgvRptProcedureDetail.DataSource = null;
  251. this.tblReportModule.SelectTab(1);
  252. //获取条件
  253. CreateSearchCondition();
  254. this.dgvRptProcedureDetail.DataSource = null;
  255. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  256. }
  257. else
  258. {
  259. this.dgvRptProcedureDetail.DataSource = null;
  260. this.tblReportModule.SelectTab(1);
  261. //获取条件
  262. CreateSearchCondition();
  263. this.rptse.RptTProcedureIDS = procedureId.ToString();
  264. this.dgvRptProcedureDetail.DataSource = null;
  265. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  266. }
  267. }
  268. }
  269. catch (Exception ex)
  270. {
  271. this.btnSearch.Enabled = true;
  272. this.btnClearCondition.Enabled = true;
  273. // 对异常进行共通处理
  274. ExceptionManager.HandleEventException(this.ToString(),
  275. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  276. }
  277. }
  278. private void chkOver_CheckedChanged(object sender, EventArgs e)
  279. {
  280. if (this.chkOver.Checked)
  281. {
  282. this.dtpOverDateStart.Enabled = true;
  283. this.dtpOverDateEnd.Enabled = true;
  284. }
  285. else
  286. {
  287. this.dtpOverDateStart.Enabled = false;
  288. this.dtpOverDateEnd.Enabled = false;
  289. this.dtpOverDateStart.Value = DateTime.Now.Date;
  290. this.dtpOverDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  291. }
  292. }
  293. private void chkOut_CheckedChanged(object sender, EventArgs e)
  294. {
  295. if (this.chkOut.Checked)
  296. {
  297. this.dtpOutDateStart.Enabled = true;
  298. this.dtpOutDateEnd.Enabled = true;
  299. }
  300. else
  301. {
  302. this.dtpOutDateStart.Enabled = false;
  303. this.dtpOutDateEnd.Enabled = false;
  304. this.dtpOutDateStart.Value = DateTime.Now.Date;
  305. this.dtpOutDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  306. }
  307. }
  308. private void chkDDate_CheckedChanged(object sender, EventArgs e)
  309. {
  310. if (this.chkDDate.Checked)
  311. {
  312. this.dtpDDateStart.Enabled = true;
  313. this.dtpDDateEnd.Enabled = true;
  314. }
  315. else
  316. {
  317. this.dtpDDateStart.Enabled = false;
  318. this.dtpDDateEnd.Enabled = false;
  319. this.dtpDDateStart.Value = DateTime.Now.Date;
  320. this.dtpDDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  321. }
  322. }
  323. private void chkGDate_CheckedChanged(object sender, EventArgs e)
  324. {
  325. if (this.chkGDate.Checked)
  326. {
  327. this.dtpGDateStart.Enabled = true;
  328. this.dtpGDateEnd.Enabled = true;
  329. }
  330. else
  331. {
  332. this.dtpGDateStart.Enabled = false;
  333. this.dtpGDateEnd.Enabled = false;
  334. this.dtpGDateStart.Value = DateTime.Now.Date;
  335. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  336. }
  337. }
  338. #endregion
  339. #region 私有方法
  340. /// <summary>
  341. /// 搜索条件
  342. /// </summary>
  343. /// <returns></returns>
  344. private void CreateSearchCondition()
  345. {
  346. rptse = new RPT030103_SE();
  347. this.rptse.RptProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  348. //获取数据来源工序Id
  349. ServiceResultEntity srerptsproc = DoAsync<ServiceResultEntity>(() =>
  350. {
  351. return ReportModuleProxy.Service.GetRptSourceProcedureModule(this.rptse.RptProcedureID);
  352. }
  353. );
  354. this.rptse.RptSProcedureID =
  355. Convert.ToInt32(srerptsproc.Data.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]["Procedureid"].ToString());
  356. this.rptse.RptTProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  357. this.rptse.ProductionLineID = this.dkproductionLineSearchBox.ProductionLineID;
  358. this.rptse.UserIDS = this.dkUserInfoSearchBox.UserIDS;
  359. this.rptse.GoodsIDS = scbGoods.CheckedPKMember;
  360. this.rptse.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  361. if (!this.dropKilnCode.Text.Equals(Constant.CBO_SELECT_ALL_NAME))
  362. {
  363. this.rptse.KilnID = Convert.ToInt32(this.dropKilnCode.SelectedValue);
  364. }
  365. if (this.chkOver.Checked)
  366. {
  367. this.rptse.CreateTimeStart = DateTime.Parse(this.dtpOverDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  368. this.rptse.CreateTimeEnd = DateTime.Parse(this.dtpOverDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  369. }
  370. if (this.chkOut.Checked)
  371. {
  372. this.rptse.OutTimeStart = DateTime.Parse(this.dtpOutDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  373. this.rptse.OutTimeEnd = DateTime.Parse(this.dtpOutDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  374. }
  375. if (this.chkDDate.Checked)
  376. {
  377. this.rptse.DTimeStart = DateTime.Parse(this.dtpDDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  378. this.rptse.DTimeEnd = DateTime.Parse(this.dtpDDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  379. }
  380. if (this.chkGDate.Checked)
  381. {
  382. this.rptse.GTimeStart = DateTime.Parse(this.dtpGDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  383. this.rptse.GTimeEnd = DateTime.Parse(this.dtpGDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  384. }
  385. this.rptse.Specialrepairflag = this.chkspecialrepairflag.Checked;
  386. this.rptse.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  387. this.rptse.DisPUserCode = this.chkPUserCode.Checked;
  388. }
  389. /// <summary>
  390. /// 查询出窑数量汇总表
  391. /// </summary>
  392. private DataTable GetSearchTotalData()
  393. {
  394. try
  395. {
  396. // 调用服务器端获取数据集
  397. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  398. {
  399. return ReportModuleProxy.Service.GetRPT030103SData(rptse);
  400. }
  401. );
  402. if (sre.Status == Constant.ServiceResultStatus.Success)
  403. {
  404. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  405. {
  406. // 提示未查找到数据
  407. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  408. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  409. //清空数据
  410. return null;
  411. }
  412. return sre.Data.Tables[0];
  413. }
  414. return null;
  415. }
  416. catch (Exception ex)
  417. {
  418. throw ex;
  419. }
  420. }
  421. /// <summary>
  422. /// 查询出窑数量明细表
  423. /// </summary>
  424. private DataTable GetSearchDetailData()
  425. {
  426. try
  427. {
  428. // 调用服务器端获取数据集
  429. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  430. {
  431. return ReportModuleProxy.Service.GetRPT030103IData(rptse);
  432. }
  433. );
  434. if (sre.Status == Constant.ServiceResultStatus.Success)
  435. {
  436. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  437. {
  438. // 提示未查找到数据
  439. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  440. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  441. //清空数据
  442. return null;
  443. }
  444. return sre.Data.Tables[0];
  445. }
  446. return null;
  447. }
  448. catch (Exception ex)
  449. {
  450. throw ex;
  451. }
  452. }
  453. /// <summary>
  454. /// 绑定下拉列表值
  455. /// </summary>
  456. /// <returns></returns>
  457. private void BindPage()
  458. {
  459. //绑定数据来源下来列表
  460. ServiceResultEntity sresource = DoAsync<ServiceResultEntity>(() =>
  461. {
  462. return ReportModuleProxy.Service.GetRptProcedureModule();
  463. }
  464. );
  465. this.dropRptProcedure.DataSource = sresource.Data.Tables[Constant.INT_IS_ZERO];
  466. this.dropRptProcedure.ValueMember = "Rptprocedureid";
  467. this.dropRptProcedure.DisplayMember = "Rptprocedurename";
  468. ServiceResultEntity srekiln = DoAsync<ServiceResultEntity>(() =>
  469. {
  470. byte byFlage = Convert.ToByte(Constant.ValueFlag.Invalid);
  471. return ReportModuleProxy.Service.GetKilnData(byFlage);
  472. }
  473. );
  474. DataTable dtKilnInfo = srekiln.Data.Tables[Constant.INT_IS_ZERO];
  475. DataRow newRowDic = dtKilnInfo.NewRow();
  476. newRowDic["KilnID"] = Constant.CBO_SELECT_ALL_VALUE;
  477. newRowDic["KilnCode"] = Constant.CBO_SELECT_ALL_NAME;
  478. dtKilnInfo.Rows.InsertAt(newRowDic, Constant.INT_IS_ZERO);
  479. this.dropKilnCode.DataSource = dtKilnInfo;
  480. this.dropKilnCode.ValueMember = "KilnID";
  481. this.dropKilnCode.DisplayMember = "KilnCode";
  482. }
  483. /// <summary>
  484. /// 获取权限(生产线)
  485. /// </summary>
  486. protected void getPurviewLine()
  487. {
  488. try
  489. {
  490. StringBuilder sbProcedurePurview = new StringBuilder();
  491. //得到工序查看权限
  492. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  493. {
  494. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  495. }));
  496. if (dsProcedurePurview != null)
  497. {
  498. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  499. if (drPurview.Length == 0)
  500. {
  501. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  502. {
  503. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  504. }
  505. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  506. {
  507. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  508. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  509. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  510. }
  511. }
  512. else
  513. {
  514. ProductionLineEntity line = new ProductionLineEntity();
  515. line.ValueFlags = new object[] { 1 };
  516. dsProcedurePurview = (DataSet)DoAsync(() =>
  517. {
  518. return PCModuleProxy.Service.SearchProductionLine(line);
  519. });
  520. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  521. {
  522. sbProcedurePurview.Append(dr["productionlineID"].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. }
  532. }
  533. catch (Exception ex)
  534. {
  535. throw ex;
  536. }
  537. }
  538. /// <summary>
  539. /// 获取权限
  540. /// </summary>
  541. protected void getPurview()
  542. {
  543. try
  544. {
  545. StringBuilder sbProcedurePurview = new StringBuilder();
  546. //得到工序查看权限
  547. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  548. {
  549. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  550. }));
  551. if (dsProcedurePurview != null)
  552. {
  553. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  554. if (drPurview.Length == 0)
  555. {
  556. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  557. {
  558. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  559. }
  560. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  561. {
  562. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  563. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  564. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  565. }
  566. }
  567. else
  568. {
  569. SearchProductionLineEntity line = new SearchProductionLineEntity();
  570. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  571. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  572. {
  573. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  574. }
  575. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  576. {
  577. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  578. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  579. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  580. }
  581. }
  582. }
  583. }
  584. catch (Exception ex)
  585. {
  586. throw ex;
  587. }
  588. }
  589. #endregion
  590. }
  591. }