F_RPT_030107.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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. this.txtSTAFFNAME.Text = string.Empty;
  214. }
  215. /// <summary>
  216. /// 双击单元格事件
  217. /// </summary>
  218. /// <param name="sender"></param>
  219. /// <param name="e"></param>
  220. private void dgvRptProcedure_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  221. {
  222. try
  223. {
  224. //判断是否为空
  225. if (this.dgvRptProcedure.CurrentRow == null ||
  226. this.dgvRptProcedure.CurrentRow.Index < 0)
  227. {
  228. return;
  229. }
  230. //获取数据信息
  231. DataGridViewRow dgvr = dgvRptProcedure.CurrentRow;
  232. string goodsId = dgvr.Cells["GoodsId"].Value.ToString();
  233. string userId = dgvr.Cells["Userid"].Value.ToString();
  234. string procedureId = dgvr.Cells["ProcedureId"].Value.ToString();
  235. string goodstypecode2 = dgvr.Cells["goodstypecode2"].Value.ToString();
  236. //判断是否选择统计行
  237. if (!goodsId.Equals("--"))
  238. {
  239. this.dgvRptProcedureDetail.DataSource = null;
  240. this.tblReportModule.SelectTab(1);
  241. //获取条件
  242. this.CreateSearchConditionDetail();
  243. this._rptse.GoodsID = goodsId;
  244. this._rptse.ProcedureIDS = procedureId;
  245. this._rptse.UserIDS = userId;
  246. this.dgvRptProcedureDetail.DataSource = null;
  247. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  248. return;
  249. }
  250. if (!string.IsNullOrEmpty(goodstypecode2))
  251. {
  252. this.dgvRptProcedureDetail.DataSource = null;
  253. this.tblReportModule.SelectTab(1);
  254. //获取条件
  255. this.CreateSearchConditionDetail();
  256. this._rptse.ProcedureIDS = procedureId;
  257. this._rptse.GoodsTypeCode = goodstypecode2;
  258. this.dgvRptProcedureDetail.DataSource = null;
  259. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  260. return;
  261. }
  262. if (!string.IsNullOrEmpty(procedureId))
  263. {
  264. this.dgvRptProcedureDetail.DataSource = null;
  265. this.tblReportModule.SelectTab(1);
  266. //获取条件
  267. this.CreateSearchConditionDetail();
  268. this._rptse.ProcedureIDS = procedureId;
  269. this.dgvRptProcedureDetail.DataSource = null;
  270. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  271. return;
  272. }
  273. this.dgvRptProcedureDetail.DataSource = null;
  274. this.tblReportModule.SelectTab(1);
  275. //获取条件
  276. this.CreateSearchConditionDetail();
  277. this.dgvRptProcedureDetail.DataSource = null;
  278. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  279. }
  280. catch (Exception ex)
  281. {
  282. this.btnSearch.Enabled = true;
  283. this.btnClearCondition.Enabled = true;
  284. // 对异常进行共通处理
  285. ExceptionManager.HandleEventException(this.ToString(),
  286. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  287. }
  288. }
  289. private void chkOver_CheckedChanged(object sender, EventArgs e)
  290. {
  291. if (this.chkPDate.Checked)
  292. {
  293. this.dtpPDateStart.Enabled = true;
  294. this.dtpPDateEnd.Enabled = true;
  295. }
  296. else
  297. {
  298. this.dtpPDateStart.Enabled = false;
  299. this.dtpPDateEnd.Enabled = false;
  300. this.dtpPDateStart.Value = DateTime.Now.Date;
  301. this.dtpPDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  302. }
  303. }
  304. private void chkOut_CheckedChanged(object sender, EventArgs e)
  305. {
  306. if (this.chkOver.Checked)
  307. {
  308. this.dtpOverDateStart.Enabled = true;
  309. this.dtpOverDateEnd.Enabled = true;
  310. }
  311. else
  312. {
  313. this.dtpOverDateStart.Enabled = false;
  314. this.dtpOverDateEnd.Enabled = false;
  315. this.dtpOverDateStart.Value = DateTime.Now.Date;
  316. this.dtpOverDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  317. }
  318. }
  319. private void chkDDate_CheckedChanged(object sender, EventArgs e)
  320. {
  321. if (this.chkDDate.Checked)
  322. {
  323. this.dtpDDateStart.Enabled = true;
  324. this.dtpDDateEnd.Enabled = true;
  325. }
  326. else
  327. {
  328. this.dtpDDateStart.Enabled = false;
  329. this.dtpDDateEnd.Enabled = false;
  330. this.dtpDDateStart.Value = DateTime.Now.Date;
  331. this.dtpDDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  332. }
  333. }
  334. private void chkGDate_CheckedChanged(object sender, EventArgs e)
  335. {
  336. if (this.chkGDate.Checked)
  337. {
  338. this.dtpGDateStart.Enabled = true;
  339. this.dtpGDateEnd.Enabled = true;
  340. }
  341. else
  342. {
  343. this.dtpGDateStart.Enabled = false;
  344. this.dtpGDateEnd.Enabled = false;
  345. this.dtpGDateStart.Value = DateTime.Now.Date;
  346. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  347. }
  348. }
  349. #endregion
  350. #region 私有方法
  351. /// <summary>
  352. /// 搜索条件
  353. /// </summary>
  354. /// <returns></returns>
  355. private void CreateSearchCondition()
  356. {
  357. this._rptse = new RPT030107_SE();
  358. this._rptse.ProductionLineID = this.dkproductionLineSearchBox.ProductionLineID;
  359. this._rptse.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  360. this._rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  361. this._rptse.GoodsCode = this.txtGoodCode.Text.Trim();
  362. this._rptse.ProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  363. this._rptse.UserIDS = this.dkUserInfoSearchBox.UserIDS;
  364. this._rptse.OverProcedureIDS = this.dkHandOverProcedure.ProcedureIDS;
  365. this._rptse.OverUserIDS = this.dkHandOverUser.UserIDS;
  366. this._rptse.StaffName = this.txtSTAFFNAME.Text.Trim();
  367. if (this.chkPDate.Checked)
  368. {
  369. this._rptse.PTimeStart = DateTime.Parse(this.dtpPDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  370. this._rptse.PTimeEnd = DateTime.Parse(this.dtpPDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  371. }
  372. if (this.chkOver.Checked)
  373. {
  374. this._rptse.OverTimeStart = DateTime.Parse(this.dtpOverDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  375. this._rptse.OverTimeEnd = DateTime.Parse(this.dtpOverDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  376. }
  377. if (this.chkDDate.Checked)
  378. {
  379. this._rptse.DTimeStart = DateTime.Parse(this.dtpDDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  380. this._rptse.DTimeEnd = DateTime.Parse(this.dtpDDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  381. }
  382. if (this.chkGDate.Checked)
  383. {
  384. this._rptse.GTimeStart = DateTime.Parse(this.dtpGDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  385. this._rptse.GTimeEnd = DateTime.Parse(this.dtpGDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  386. }
  387. this._rptse.Specialrepairflag = this.chkspecialrepairflag.Checked;
  388. this._rptse.DisPUserCode = this.chkPUserCode.Checked;
  389. }
  390. /// <summary>
  391. /// 明细搜索条件
  392. /// </summary>
  393. /// <returns></returns>
  394. private void CreateSearchConditionDetail()
  395. {
  396. this._rptse = new RPT030107_SE();
  397. this._rptse.ProductionLineID = this._rptse1.ProductionLineID;
  398. this._rptse.GroutingUserCode = this._rptse1.GroutingUserCode;
  399. this._rptse.GoodsTypeCode = this._rptse1.GoodsTypeCode;
  400. this._rptse.GoodsCode = this._rptse1.GoodsCode;
  401. this._rptse.ProcedureIDS = this._rptse1.ProcedureIDS;
  402. this._rptse.UserIDS = this._rptse1.UserIDS;
  403. this._rptse.OverProcedureIDS = this._rptse1.OverProcedureIDS;
  404. this._rptse.OverUserIDS = this._rptse1.OverUserIDS;
  405. this._rptse.PTimeStart = this._rptse1.PTimeStart;
  406. this._rptse.PTimeEnd = this._rptse1.PTimeEnd;
  407. this._rptse.OverTimeStart = this._rptse1.OverTimeStart;
  408. this._rptse.OverTimeEnd = this._rptse1.OverTimeEnd;
  409. this._rptse.DTimeStart = this._rptse1.DTimeStart;
  410. this._rptse.DTimeEnd = this._rptse1.DTimeEnd;
  411. this._rptse.GTimeStart = this._rptse1.GTimeStart;
  412. this._rptse.GTimeEnd = this._rptse1.GTimeEnd;
  413. this._rptse.Specialrepairflag = this._rptse1.Specialrepairflag;
  414. this._rptse.DisPUserCode = this._rptse1.DisPUserCode;
  415. }
  416. /// <summary>
  417. /// 查询出窑数量汇总表
  418. /// </summary>
  419. private DataTable GetSearchTotalData()
  420. {
  421. try
  422. {
  423. // 调用服务器端获取数据集
  424. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  425. {
  426. return ReportModuleProxy.Service.GetRPT030107SData(_rptse);
  427. }
  428. );
  429. if (sre.Status == Constant.ServiceResultStatus.Success)
  430. {
  431. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  432. {
  433. // 提示未查找到数据
  434. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  435. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  436. //清空数据
  437. return null;
  438. }
  439. return sre.Data.Tables[0];
  440. }
  441. return null;
  442. }
  443. catch (Exception ex)
  444. {
  445. throw ex;
  446. }
  447. }
  448. /// <summary>
  449. /// 查询出窑数量明细表
  450. /// </summary>
  451. private DataTable GetSearchDetailData()
  452. {
  453. try
  454. {
  455. // 调用服务器端获取数据集
  456. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  457. {
  458. return ReportModuleProxy.Service.GetRPT030107IData(_rptse);
  459. }
  460. );
  461. if (sre.Status == Constant.ServiceResultStatus.Success)
  462. {
  463. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  464. {
  465. // 提示未查找到数据
  466. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  467. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  468. //清空数据
  469. return null;
  470. }
  471. return sre.Data.Tables[0];
  472. }
  473. return null;
  474. }
  475. catch (Exception ex)
  476. {
  477. throw ex;
  478. }
  479. }
  480. /// <summary>
  481. /// 获取权限(生产线)
  482. /// </summary>
  483. protected void getPurviewLine()
  484. {
  485. try
  486. {
  487. StringBuilder sbProcedurePurview = new StringBuilder();
  488. //得到工序查看权限
  489. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  490. {
  491. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  492. }));
  493. if (dsProcedurePurview != null)
  494. {
  495. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  496. if (drPurview.Length == 0)
  497. {
  498. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  499. {
  500. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  501. }
  502. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  503. {
  504. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  505. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  506. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  507. }
  508. }
  509. else
  510. {
  511. ProductionLineEntity line = new ProductionLineEntity();
  512. line.ValueFlags = new object[] { 1 };
  513. dsProcedurePurview = (DataSet)DoAsync(() =>
  514. {
  515. return PCModuleProxy.Service.SearchProductionLine(line);
  516. });
  517. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  518. {
  519. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  520. }
  521. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  522. {
  523. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  524. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  525. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  526. }
  527. }
  528. }
  529. }
  530. catch (Exception ex)
  531. {
  532. throw ex;
  533. }
  534. }
  535. /// <summary>
  536. /// 获取权限
  537. /// </summary>
  538. protected void getPurview()
  539. {
  540. try
  541. {
  542. StringBuilder sbProcedurePurview = new StringBuilder();
  543. //得到工序查看权限
  544. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  545. {
  546. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  547. }));
  548. if (dsProcedurePurview != null)
  549. {
  550. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  551. if (drPurview.Length == 0)
  552. {
  553. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  554. {
  555. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  556. }
  557. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  558. {
  559. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  560. //this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  561. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  562. }
  563. }
  564. else
  565. {
  566. SearchProductionLineEntity line = new SearchProductionLineEntity();
  567. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  568. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  569. {
  570. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  571. }
  572. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  573. {
  574. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  575. //this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  576. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  577. }
  578. }
  579. }
  580. }
  581. catch (Exception ex)
  582. {
  583. throw ex;
  584. }
  585. }
  586. #endregion
  587. }
  588. }