F_RPT_030107.cs 20 KB

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