F_RPT_030103_1.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  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. this.chkTestMouldFlag.AllItemCheck();
  99. // lsq modify 财年默认为空
  100. //begin
  101. ////财年默认本年
  102. //this.txtFyear.Text = DateTime.Now.Year.ToString();
  103. //end
  104. getPurview();
  105. getPurviewLine();
  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. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)
  122. {
  123. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  124. }
  125. else
  126. {
  127. this.dgvRptProcedureDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  128. }
  129. }
  130. /// <summary>
  131. /// 窗体关闭事件
  132. /// </summary>
  133. /// <param name="sender"></param>
  134. /// <param name="e"></param>
  135. private void F_RPT_030103_1_FormClosed(object sender, FormClosedEventArgs e)
  136. {
  137. _instance = null;
  138. }
  139. /// <summary>
  140. /// 关闭按钮
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. private void tsbtnClose_Click(object sender, EventArgs e)
  145. {
  146. this.Close();
  147. }
  148. /// <summary>
  149. /// 查询按钮事件
  150. /// </summary>
  151. /// <param name="sender"></param>
  152. /// <param name="e"></param>
  153. private void btnSearch_Click(object sender, EventArgs e)
  154. {
  155. try
  156. {
  157. if (string.IsNullOrEmpty(this.dropRptProcedure.Text))
  158. {
  159. this.dropRptProcedure.Focus();
  160. MessageBox.Show("数据源是必选项,请选择数据源!", this.Text,
  161. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  162. return;
  163. }
  164. if (string.IsNullOrEmpty(this._currentUserPurview))
  165. {
  166. // 提示未查找到数据
  167. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  168. MessageBoxButtons.OK, MessageBoxIcon.Information);
  169. return;
  170. }
  171. CreateSearchCondition();
  172. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)//出窑数量汇总查询
  173. {
  174. this.dgvRptProcedure.DataSource = null;
  175. this.dgvRptProcedure.DataSource = this.GetSearchTotalData();
  176. }
  177. else //出窑数量明细查询
  178. {
  179. this.dgvRptProcedureDetail.DataSource = null;
  180. this.dgvRptProcedureDetail.DataSource = this.GetSearchDetailData();
  181. }
  182. }
  183. catch (Exception ex)
  184. {
  185. this.btnSearch.Enabled = true;
  186. this.btnClearCondition.Enabled = true;
  187. // 对异常进行共通处理
  188. ExceptionManager.HandleEventException(this.ToString(),
  189. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  190. }
  191. }
  192. /// <summary>
  193. /// 清空条件按钮事件
  194. /// </summary>
  195. /// <param name="sender"></param>
  196. /// <param name="e"></param>
  197. private void btnClearCondition_Click(object sender, EventArgs e)
  198. {
  199. this.scbGoods.ClearValue();
  200. this.scbGoodsType.ClearValue();
  201. this.dkProcedureSearchBox.ClearControl();
  202. this.dkproductionLineSearchBox.ClearControl();
  203. this.dkUserInfoSearchBox.ClearControl();
  204. this.dropKilnCode.SelectedValue = Constant.CBO_SELECT_ALL_VALUE;
  205. //this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  206. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  207. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  208. this.txtGroutingUserCode.Clear();
  209. this.txtSTAFFNAME.Text = string.Empty;
  210. this.txtKcode.Clear();
  211. this.txtFyear.Clear();
  212. this.chkOver.Checked = false;
  213. this.chkOut.Checked = true;
  214. this.dtpOutDateStart.Value = DateTime.Now.Date;
  215. this.dtpOutDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  216. this.chkDDate.Checked = false;
  217. this.chkGDate.Checked = false;
  218. this.chkspecialrepairflag.Checked = false;
  219. this.chkPUserCode.Checked = true;
  220. this.chkTestMouldFlag.AllItemCheck();
  221. }
  222. /// <summary>
  223. /// 双击单元格事件
  224. /// </summary>
  225. /// <param name="sender"></param>
  226. /// <param name="e"></param>
  227. private void dgvRptProcedure_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  228. {
  229. try
  230. {
  231. //判断是否为空
  232. if (this.dgvRptProcedure.CurrentRow == null ||
  233. this.dgvRptProcedure.CurrentRow.Index < 0)
  234. {
  235. return;
  236. }
  237. //获取数据信息
  238. DataGridViewRow dgvr = dgvRptProcedure.CurrentRow;
  239. string goodsId = dgvr.Cells["GoodsId"].Value.ToString();
  240. string userId = dgvr.Cells["Userid"].Value.ToString();
  241. string procedureId = dgvr.Cells["ProcedureId"].Value.ToString();
  242. //判断是否选择统计行
  243. if (!goodsId.Equals("--"))
  244. {
  245. this.dgvRptProcedureDetail.DataSource = null;
  246. this.tblReportModule.SelectTab(1);
  247. //获取条件
  248. CreateSearchCondition();
  249. this.rptse.KilnID = Convert.ToInt32(dgvr.Cells["Kilnid"].Value.ToString());
  250. this.rptse.GoodsIDS = goodsId.ToString();
  251. this.rptse.RptTProcedureIDS = procedureId.ToString();
  252. this.rptse.UserIDS = userId.ToString();
  253. this.dgvRptProcedureDetail.DataSource = null;
  254. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  255. }
  256. else
  257. {
  258. if (string.IsNullOrEmpty(procedureId))
  259. {
  260. this.dgvRptProcedureDetail.DataSource = null;
  261. this.tblReportModule.SelectTab(1);
  262. //获取条件
  263. CreateSearchCondition();
  264. this.dgvRptProcedureDetail.DataSource = null;
  265. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  266. }
  267. else
  268. {
  269. this.dgvRptProcedureDetail.DataSource = null;
  270. this.tblReportModule.SelectTab(1);
  271. //获取条件
  272. CreateSearchCondition();
  273. this.rptse.RptTProcedureIDS = procedureId.ToString();
  274. this.dgvRptProcedureDetail.DataSource = null;
  275. this.dgvRptProcedureDetail.DataSource = GetSearchDetailData();
  276. }
  277. }
  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.chkOver.Checked)
  291. {
  292. this.dtpOverDateStart.Enabled = true;
  293. this.dtpOverDateEnd.Enabled = true;
  294. }
  295. else
  296. {
  297. this.dtpOverDateStart.Enabled = false;
  298. this.dtpOverDateEnd.Enabled = false;
  299. this.dtpOverDateStart.Value = DateTime.Now.Date;
  300. this.dtpOverDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  301. }
  302. }
  303. private void chkOut_CheckedChanged(object sender, EventArgs e)
  304. {
  305. if (this.chkOut.Checked)
  306. {
  307. this.dtpOutDateStart.Enabled = true;
  308. this.dtpOutDateEnd.Enabled = true;
  309. }
  310. else
  311. {
  312. this.dtpOutDateStart.Enabled = false;
  313. this.dtpOutDateEnd.Enabled = false;
  314. this.dtpOutDateStart.Value = DateTime.Now.Date;
  315. this.dtpOutDateEnd.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. rptse = new RPT030103_SE();
  357. this.rptse.RptProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  358. //获取数据来源工序Id
  359. ServiceResultEntity srerptsproc = DoAsync<ServiceResultEntity>(() =>
  360. {
  361. return ReportModuleProxy.Service.GetRptSourceProcedureModule(this.rptse.RptProcedureID);
  362. }
  363. );
  364. this.rptse.RptSProcedureID =
  365. Convert.ToInt32(srerptsproc.Data.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]["Procedureid"].ToString());
  366. this.rptse.RptTProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  367. this.rptse.ProductionLineID = this.dkproductionLineSearchBox.ProductionLineID;
  368. this.rptse.UserIDS = this.dkUserInfoSearchBox.UserIDS;
  369. this.rptse.GoodsIDS = scbGoods.CheckedPKMember;
  370. this.rptse.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  371. this.rptse.StaffName = txtSTAFFNAME.Text.Trim();
  372. if (!this.dropKilnCode.Text.Equals(Constant.CBO_SELECT_ALL_NAME))
  373. {
  374. this.rptse.KilnID = Convert.ToInt32(this.dropKilnCode.SelectedValue);
  375. }
  376. if (this.chkOver.Checked)
  377. {
  378. this.rptse.CreateTimeStart = DateTime.Parse(this.dtpOverDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  379. this.rptse.CreateTimeEnd = DateTime.Parse(this.dtpOverDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  380. }
  381. if (this.chkOut.Checked)
  382. {
  383. this.rptse.OutTimeStart = DateTime.Parse(this.dtpOutDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  384. this.rptse.OutTimeEnd = DateTime.Parse(this.dtpOutDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  385. }
  386. if (this.chkDDate.Checked)
  387. {
  388. this.rptse.DTimeStart = DateTime.Parse(this.dtpDDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  389. this.rptse.DTimeEnd = DateTime.Parse(this.dtpDDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  390. }
  391. if (this.chkGDate.Checked)
  392. {
  393. this.rptse.GTimeStart = DateTime.Parse(this.dtpGDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  394. this.rptse.GTimeEnd = DateTime.Parse(this.dtpGDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  395. }
  396. this.rptse.Specialrepairflag = this.chkspecialrepairflag.Checked;
  397. this.rptse.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  398. this.rptse.Kcode = this.txtKcode.Text.Trim();
  399. this.rptse.Fyear = this.txtFyear.Text.Trim();
  400. this.rptse.DisPUserCode = this.chkPUserCode.Checked;
  401. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  402. if (testMouldFlags.Length == 1)
  403. {
  404. rptse.TestMouldFlag = testMouldFlags[0].ToString();
  405. }
  406. }
  407. /// <summary>
  408. /// 查询出窑数量汇总表
  409. /// </summary>
  410. private DataTable GetSearchTotalData()
  411. {
  412. try
  413. {
  414. // 调用服务器端获取数据集
  415. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  416. {
  417. return ReportModuleProxy.Service.GetRPT030103SData(rptse);
  418. }
  419. );
  420. if (sre.Status == Constant.ServiceResultStatus.Success)
  421. {
  422. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  423. {
  424. // 提示未查找到数据
  425. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  426. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  427. //清空数据
  428. return null;
  429. }
  430. return sre.Data.Tables[0];
  431. }
  432. return null;
  433. }
  434. catch (Exception ex)
  435. {
  436. throw ex;
  437. }
  438. }
  439. /// <summary>
  440. /// 查询出窑数量明细表
  441. /// </summary>
  442. private DataTable GetSearchDetailData()
  443. {
  444. try
  445. {
  446. // 调用服务器端获取数据集
  447. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  448. {
  449. return ReportModuleProxy.Service.GetRPT030103IData(rptse);
  450. }
  451. );
  452. if (sre.Status == Constant.ServiceResultStatus.Success)
  453. {
  454. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  455. {
  456. // 提示未查找到数据
  457. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  458. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  459. //清空数据
  460. return null;
  461. }
  462. return sre.Data.Tables[0];
  463. }
  464. return null;
  465. }
  466. catch (Exception ex)
  467. {
  468. throw ex;
  469. }
  470. }
  471. /// <summary>
  472. /// 绑定下拉列表值
  473. /// </summary>
  474. /// <returns></returns>
  475. private void BindPage()
  476. {
  477. //绑定数据来源下来列表
  478. ServiceResultEntity sresource = DoAsync<ServiceResultEntity>(() =>
  479. {
  480. return ReportModuleProxy.Service.GetRptProcedureModule();
  481. }
  482. );
  483. this.dropRptProcedure.DataSource = sresource.Data.Tables[Constant.INT_IS_ZERO];
  484. this.dropRptProcedure.ValueMember = "Rptprocedureid";
  485. this.dropRptProcedure.DisplayMember = "Rptprocedurename";
  486. ServiceResultEntity srekiln = DoAsync<ServiceResultEntity>(() =>
  487. {
  488. byte byFlage = Convert.ToByte(Constant.ValueFlag.Invalid);
  489. return ReportModuleProxy.Service.GetKilnData(byFlage);
  490. }
  491. );
  492. DataTable dtKilnInfo = srekiln.Data.Tables[Constant.INT_IS_ZERO];
  493. DataRow newRowDic = dtKilnInfo.NewRow();
  494. newRowDic["KilnID"] = Constant.CBO_SELECT_ALL_VALUE;
  495. newRowDic["KilnCode"] = Constant.CBO_SELECT_ALL_NAME;
  496. dtKilnInfo.Rows.InsertAt(newRowDic, Constant.INT_IS_ZERO);
  497. this.dropKilnCode.DataSource = dtKilnInfo;
  498. this.dropKilnCode.ValueMember = "KilnID";
  499. this.dropKilnCode.DisplayMember = "KilnCode";
  500. }
  501. /// <summary>
  502. /// 获取权限(生产线)
  503. /// </summary>
  504. protected void getPurviewLine()
  505. {
  506. try
  507. {
  508. StringBuilder sbProcedurePurview = new StringBuilder();
  509. //得到工序查看权限
  510. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  511. {
  512. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  513. }));
  514. if (dsProcedurePurview != null)
  515. {
  516. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  517. if (drPurview.Length == 0)
  518. {
  519. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  520. {
  521. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  522. }
  523. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  524. {
  525. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  526. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  527. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  528. }
  529. }
  530. else
  531. {
  532. ProductionLineEntity line = new ProductionLineEntity();
  533. line.ValueFlags = new object[] { 1 };
  534. dsProcedurePurview = (DataSet)DoAsync(() =>
  535. {
  536. return PCModuleProxy.Service.SearchProductionLine(line);
  537. });
  538. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  539. {
  540. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  541. }
  542. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  543. {
  544. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  545. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  546. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  547. }
  548. }
  549. }
  550. }
  551. catch (Exception ex)
  552. {
  553. throw ex;
  554. }
  555. }
  556. /// <summary>
  557. /// 获取权限
  558. /// </summary>
  559. protected void getPurview()
  560. {
  561. try
  562. {
  563. StringBuilder sbProcedurePurview = new StringBuilder();
  564. //得到工序查看权限
  565. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  566. {
  567. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  568. }));
  569. if (dsProcedurePurview != null)
  570. {
  571. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  572. if (drPurview.Length == 0)
  573. {
  574. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  575. {
  576. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  577. }
  578. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  579. {
  580. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  581. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  582. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  583. }
  584. }
  585. else
  586. {
  587. SearchProductionLineEntity line = new SearchProductionLineEntity();
  588. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  589. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  590. {
  591. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  592. }
  593. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  594. {
  595. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  596. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  597. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  598. }
  599. }
  600. }
  601. }
  602. catch (Exception ex)
  603. {
  604. throw ex;
  605. }
  606. }
  607. #endregion
  608. private void lblKcode_Click(object sender, EventArgs e)
  609. {
  610. }
  611. private void txtKcode_TextChanged(object sender, EventArgs e)
  612. {
  613. }
  614. private void txtGroutingUserCode_TextChanged(object sender, EventArgs e)
  615. {
  616. }
  617. }
  618. }