F_RPT_030103_1.cs 22 KB

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