F_RPT_030106.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030106.cs
  5. * 2.功能描述:成检缺陷汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/06/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. public partial class F_RPT_030106 : DKDockPanelBase
  24. {
  25. #region 成员变量
  26. // 窗体的单例模式
  27. private static F_RPT_030106 _instance;
  28. //实体类
  29. private RPT030106_SE rptse = null;
  30. private RPT030106_SE rptsed = null;
  31. //默认清空工序,重置回用户当前权限工序
  32. private string _currentUserPurview = null;
  33. //默认清空生产线,重置回用户当前权限生产线
  34. private string _currentUserLinePuview = null;
  35. //默认清空查看工号,重置回用户当前权限工号
  36. private string _currentUserCodePuview = null;
  37. #endregion
  38. #region 构造函数
  39. public F_RPT_030106()
  40. {
  41. InitializeComponent();
  42. // 窗体显示的Title
  43. this.Text = FormTitles.F_RPT_030106;
  44. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  45. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  46. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  47. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  48. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  49. }
  50. #endregion
  51. #region 单例模式
  52. /// <summary>
  53. /// 单例模式,防止重复创建窗体
  54. /// </summary>
  55. public static F_RPT_030106 Instance
  56. {
  57. get
  58. {
  59. if (_instance == null || _instance.IsDisposed)
  60. {
  61. _instance = new F_RPT_030106();
  62. }
  63. return _instance;
  64. }
  65. }
  66. #endregion
  67. #region 事件处理
  68. /// <summary>
  69. /// 窗体加载事件
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void F_RPT_030106_Load(object sender, EventArgs e)
  74. {
  75. try
  76. {
  77. // 加载权限
  78. FormPermissionManager.FormPermissionControl(this.Name, this,
  79. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. // 设置表格不自动创建列
  82. this.dgvReportModuleDetail.AutoGenerateColumns = false;
  83. this.dgvReportModule.AutoGenerateColumns = false;
  84. this.dgvDefectDetail.AutoGenerateColumns = false;
  85. //this.dkproductionLineSearchBox.IsEnablePurview = true;
  86. //this.dkProcedureSearchBox.IsEnablePurview = true;
  87. //this.dkOrganizationSearchBox.Focus();
  88. // 初始化时间控件为当前日期
  89. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  90. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  91. this.dtpHandOverStart.Value = DateTime.Now.Date;
  92. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  93. this.dtpCompleteDateStart.Value = DateTime.Now.Date;
  94. this.dtpCompleteDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  95. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  96. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  97. // lsq modify 财年默认为空
  98. //begin
  99. ////财年默认当年
  100. //this.txtFyear.Text = DateTime.Now.Year.ToString();
  101. //end
  102. //getPurview();
  103. //getPurviewLine();
  104. // 交接工序
  105. ServiceResultEntity sresource = ReportModuleProxy.Service.GetRptProcedureModule();
  106. if (sresource != null && sresource.Data != null && sresource.Data.Tables.Count > 0)
  107. {
  108. this.dropRptProcedure.DataSource = sresource.Data.Tables[0];
  109. this.dropRptProcedure.ValueMember = "Rptprocedureid";
  110. this.dropRptProcedure.DisplayMember = "Rptprocedurename";
  111. }
  112. this.chkTestMouldFlag.AllItemCheck();
  113. //实验单
  114. DataTable dtTest = new DataTable();
  115. dtTest.Columns.Add("TestFormFlagid",typeof(int));
  116. dtTest.Columns.Add("TestFormFlagname", typeof(string));
  117. DataRow drTest = dtTest.NewRow();
  118. drTest["TestFormFlagid"] = 0;
  119. drTest["TestFormFlagname"] = "全部";
  120. dtTest.Rows.Add(drTest);
  121. drTest = dtTest.NewRow();
  122. drTest["TestFormFlagid"] = 1;
  123. drTest["TestFormFlagname"] = "实验单";
  124. dtTest.Rows.Add(drTest);
  125. drTest = dtTest.NewRow();
  126. drTest["TestFormFlagid"] = 2;
  127. drTest["TestFormFlagname"] = "研发实验单";
  128. dtTest.Rows.Add(drTest);
  129. this.dropTestFormFlag.DataSource = dtTest;
  130. this.dropTestFormFlag.ValueMember = "TestFormFlagid";
  131. this.dropTestFormFlag.DisplayMember = "TestFormFlagname";
  132. }
  133. catch (Exception ex)
  134. {
  135. // 对异常进行共通处理
  136. ExceptionManager.HandleEventException(this.ToString(),
  137. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  138. }
  139. }
  140. /// <summary>
  141. /// 自动适应列宽
  142. /// </summary>
  143. /// <param name="sender"></param>
  144. /// <param name="e"></param>
  145. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  146. {
  147. this.dgvReportModule.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  148. this.dgvReportModuleDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  149. this.dgvDefectDetail.AutoResizeColumns();
  150. this.dgvProDetail.AutoResizeColumns();
  151. }
  152. /// <summary>
  153. /// 窗体关闭事件
  154. /// </summary>
  155. /// <param name="sender"></param>
  156. /// <param name="e"></param>
  157. private void F_RPT_030106_FormClosed(object sender, FormClosedEventArgs e)
  158. {
  159. _instance = null;
  160. }
  161. /// <summary>
  162. /// 关闭按钮
  163. /// </summary>
  164. /// <param name="sender"></param>
  165. /// <param name="e"></param>
  166. private void tsbtnClose_Click(object sender, EventArgs e)
  167. {
  168. this.Close();
  169. }
  170. /// <summary>
  171. /// 查询按钮事件
  172. /// </summary>
  173. /// <param name="sender"></param>
  174. /// <param name="e"></param>
  175. private void btnSearch_Click(object sender, EventArgs e)
  176. {
  177. try
  178. {
  179. //没有对应的生产线权限,返回 因为有无责任工序,则可以不用分配工序的权限,不分配,只能查无责任工序
  180. //if (string.IsNullOrEmpty(this._currentUserLinePuview))
  181. //{
  182. // // 提示未查找到数据
  183. // MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  184. // MessageBoxButtons.OK, MessageBoxIcon.Information);
  185. // return;
  186. //}
  187. // 交接工序必须输入项
  188. if (this.dropRptProcedure.SelectedValue == null)
  189. {
  190. MessageBox.Show(Messages.MSG_CMN_W005, this.Text,
  191. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  192. return;
  193. }
  194. //// 登记时间与交接时间必须选择一个
  195. //if ((!this.chkCdate.Checked && (this.chkCheckDate.Enabled && !this.chkCheckDate.Checked)) && !this.chkHandOver.Checked)
  196. //{
  197. // MessageBox.Show("(缺陷)登记时间与交接时间至少选择一个作为查询条件。", this.Text,
  198. // MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  199. // return;
  200. //}
  201. CreateSearchCondition();
  202. if (this.tblReportModule.SelectedIndex == Constant.INT_IS_ZERO)
  203. {
  204. rptsed = rptse;
  205. this.dgvReportModule.DataSource = null;
  206. this.dgvReportModule.DataSource = GetSearchTotalData();
  207. }
  208. else if (this.tblReportModule.SelectedIndex == 1)
  209. {
  210. this.dgvReportModuleDetail.DataSource = null;
  211. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  212. }
  213. else if (this.tblReportModule.SelectedIndex == 2)
  214. {
  215. this.dgvDefectDetail.DataSource = null;
  216. this.dgvDefectDetail.DataSource = GetSearchDefectData();
  217. }
  218. else
  219. {
  220. if (string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  221. {
  222. MessageBox.Show("最少选择一个【生产工序】。", this.Text,
  223. MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  224. this.dkProcedureSearchBox1.Focus();
  225. return;
  226. }
  227. this.dgvProDetail.DataSource = null;
  228. this.dgvProDetail.DataSource = GetSearchProData();
  229. }
  230. }
  231. catch (Exception ex)
  232. {
  233. this.btnSearch.Enabled = true;
  234. this.btnClearCondition.Enabled = true;
  235. // 对异常进行共通处理
  236. ExceptionManager.HandleEventException(this.ToString(),
  237. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  238. }
  239. }
  240. /// <summary>
  241. /// 清空条件按钮事件
  242. /// </summary>
  243. /// <param name="sender"></param>
  244. /// <param name="e"></param>
  245. private void btnClearCondition_Click(object sender, EventArgs e)
  246. {
  247. this.scbGoods.ClearValue();
  248. this.scbGoodsType.ClearValue();
  249. this.dkProcedureSearchBox.ClearControl();
  250. this.dkProcedureSearchBox1.ClearControl();
  251. this.dkproductionLineSearchBox.ClearControl();
  252. this.dkDefectTypeNameSearchBox1.ClearControl();
  253. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  254. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  255. this.dtpHandOverStart.Value = DateTime.Now.Date;
  256. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  257. this.dtpCompleteDateStart.Value = DateTime.Now.Date;
  258. this.dtpCompleteDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  259. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  260. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  261. //this.chkCdate.Checked = true;
  262. this.chkHandOver.Checked = false;
  263. this.chkCheckDate.Checked = false;
  264. this.dkCompleteProcedure.ClearControl();
  265. this.dkCheckProcedureSearchBox.ClearControl();
  266. this.txtKilnCode.Clear();
  267. this.txtDefectUserCode.Text = "";
  268. this.txtDefectCode.Text = "";
  269. this.txtCheckUserCode.Text = "";
  270. this.txtDefectName.Text = "";
  271. this.txtGoodsCode.Text = "";
  272. this.txtKcode.Text = "";
  273. this.txtFyear.Text = "";
  274. this.dkProcedureSearchBox.ProcedureIDS = this._currentUserPurview;
  275. this.dkproductionLineSearchBox.ProductionLineIDS = this._currentUserLinePuview;
  276. if (this.dropRptProcedure.Items.Count > 0)
  277. {
  278. this.dropRptProcedure.SelectedIndex = 0;
  279. }
  280. this.dropTestFormFlag.SelectedIndex = 0;
  281. this.chkTestMouldFlag.AllItemCheck();
  282. }
  283. /// <summary>
  284. /// 双击单元格事件
  285. /// </summary>
  286. /// <param name="sender"></param>
  287. /// <param name="e"></param>
  288. private void dgvReportModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  289. {
  290. try
  291. {
  292. if (this.dgvReportModule.CurrentRow == null)
  293. {
  294. return;
  295. }
  296. //获取数据信息
  297. DataGridViewRow dgvr = dgvReportModule.CurrentRow;
  298. string defectCode = dgvr.Cells["DefectCode"].Value.ToString();
  299. string defectProcedureName = dgvr.Cells["DefectProcedureName"].Value.ToString();
  300. string productionlinename = dgvr.Cells["Productionlinename"].Value.ToString();
  301. if (defectCode.Equals("小计") || defectProcedureName.Equals("合计") || productionlinename.Equals("总计"))
  302. {
  303. return;
  304. }
  305. else
  306. {
  307. //跳转页
  308. this.tblReportModule.SelectTab(1);
  309. //获取条件
  310. CreateSearchCondition();
  311. string procedureId = dgvr.Cells["Procedureid"].Value.ToString();
  312. string defectProcedureID = dgvr.Cells["DefectProcedureID"].Value.ToString();
  313. string goodsCode = dgvr.Cells["Goodscode"].Value.ToString();
  314. string usercode1 = dgvr.Cells["Usercode1"].Value.ToString();
  315. rptse.CheckProcedureIDS = procedureId.ToString();
  316. rptse.DefectProcedureIDS = defectProcedureID;
  317. rptse.DefectCode = null;
  318. rptse.GoodsCode = null;
  319. rptse.CheckUserCode = null;
  320. rptse.DefectCodeS2D = defectCode;
  321. rptse.GoodsCodeS2D = goodsCode;
  322. rptse.CheckUserCodeS2D = usercode1;
  323. //清空数据
  324. this.dgvReportModuleDetail.DataSource = null;
  325. this.dgvReportModuleDetail.DataSource = GetSearchDetailData();
  326. }
  327. }
  328. catch (Exception ex)
  329. {
  330. this.btnSearch.Enabled = true;
  331. this.btnClearCondition.Enabled = true;
  332. // 对异常进行共通处理
  333. ExceptionManager.HandleEventException(this.ToString(),
  334. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  335. }
  336. }
  337. private void chkCdate_CheckedChanged(object sender, EventArgs e)
  338. {
  339. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  340. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  341. //this.dtpAccountDateStart.Enabled = this.chkCdate.Checked;
  342. //this.dtpAccountDateEnd.Enabled = this.chkCdate.Checked;
  343. }
  344. private void chkHandOver_CheckedChanged(object sender, EventArgs e)
  345. {
  346. this.dtpHandOverStart.Value = DateTime.Now.Date;
  347. this.dtpHandOverEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  348. this.dtpHandOverStart.Enabled = this.chkHandOver.Checked;
  349. this.dtpHandOverEnd.Enabled = this.chkHandOver.Checked;
  350. }
  351. private void chkCheckDate_CheckedChanged(object sender, EventArgs e)
  352. {
  353. this.dtpCheckDateStart.Value = DateTime.Now.Date;
  354. this.dtpCheckDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  355. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  356. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  357. }
  358. private void tblReportModule_SelectedIndexChanged(object sender, EventArgs e)
  359. {
  360. if (tblReportModule.SelectedIndex == 2 || tblReportModule.SelectedIndex == 3)
  361. {
  362. this.chkCheckDate.Enabled = true;
  363. this.dtpCheckDateStart.Enabled = this.chkCheckDate.Checked;
  364. this.dtpCheckDateEnd.Enabled = this.chkCheckDate.Checked;
  365. }
  366. else
  367. {
  368. this.chkCheckDate.Enabled = false;
  369. this.dtpCheckDateStart.Enabled = false;
  370. this.dtpCheckDateEnd.Enabled = false;
  371. }
  372. }
  373. #endregion
  374. #region 私有方法
  375. /// <summary>
  376. /// 搜索条件
  377. /// </summary>
  378. /// <returns></returns>
  379. private void CreateSearchCondition()
  380. {
  381. rptse = new RPT030106_SE();
  382. rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  383. rptse.LineIDS = this.dkproductionLineSearchBox.ProductionLineIDS;
  384. rptse.DefectProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  385. //rptse.PurViewUserCodeIDS = this._currentUserCodePuview;//默认查看对应权限工号
  386. //if (this.chkCdate.Checked)
  387. //{
  388. rptse.CreateTimeStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  389. rptse.CreateTimeEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  390. //}
  391. rptse.DefectTypeIDS = this.dkDefectTypeNameSearchBox1.DefectTypeIDS;
  392. rptse.DefectUserCode = this.txtDefectUserCode.Text.Trim();
  393. rptse.CheckUserCode = this.txtCheckUserCode.Text.Trim();
  394. rptse.DefectCode = this.txtDefectCode.Text.Trim();
  395. rptse.Kcode = this.txtKcode.Text.Trim();
  396. rptse.Fyear = this.txtFyear.Text.Trim();
  397. rptse.DefectName = this.txtDefectName.Text.Trim();
  398. rptse.GoodsCode = this.txtGoodsCode.Text.Trim();
  399. rptse.GoodsIDS = scbGoods.CheckedPKMember;
  400. if (this.dropRptProcedure.SelectedValue != null)
  401. {
  402. rptse.HandOverProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  403. }
  404. if (this.dropTestFormFlag.SelectedValue != null)
  405. {
  406. rptse.TestFormFlag = Convert.ToInt32(this.dropTestFormFlag.SelectedValue);
  407. }
  408. if (this.chkHandOver.Checked)
  409. {
  410. rptse.HandOverTimeStart = DateTime.Parse(this.dtpHandOverStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  411. rptse.HandOverTimeEnd = DateTime.Parse(this.dtpHandOverEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  412. }
  413. if (this.chkCheckDate.Enabled && this.chkCheckDate.Checked)
  414. {
  415. rptse.CheckTimeStart = DateTime.Parse(this.dtpCheckDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  416. rptse.CheckTimeEnd = DateTime.Parse(this.dtpCheckDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  417. }
  418. rptse.CheckProcedureIDS = this.dkCheckProcedureSearchBox.ProcedureIDS;
  419. rptse.KilnCode = this.txtKilnCode.Text.Trim();
  420. //if (!string.IsNullOrEmpty(this.dkCompleteProcedure.ProcedureIDS))
  421. //{
  422. // rptse.CompleteProcedureIDS = this.dkCompleteProcedure.ProcedureIDS;
  423. // rptse.CompleteCreateTimeStart = DateTime.Parse(this.dtpCompleteDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  424. // rptse.CompleteCreateTimeEnd = DateTime.Parse(this.dtpCompleteDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  425. //}
  426. if (!string.IsNullOrEmpty(this.dkProcedureSearchBox1.ProcedureIDS))
  427. {
  428. rptse.CompleteProcedureIDS = this.dkProcedureSearchBox1.ProcedureIDS;
  429. }
  430. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  431. if (testMouldFlags.Length == 1)
  432. {
  433. rptse.TestMouldFlag = testMouldFlags[0].ToString();
  434. }
  435. }
  436. /// <summary>
  437. /// 查询成检缺陷汇总表
  438. /// </summary>
  439. private DataTable GetSearchTotalData()
  440. {
  441. try
  442. {
  443. // 调用服务器端获取数据集
  444. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  445. {
  446. return ReportModuleProxy.Service.GetRPT030106Data(rptse);
  447. }
  448. );
  449. if (sre.Status == Constant.ServiceResultStatus.Success)
  450. {
  451. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  452. {
  453. // 提示未查找到数据
  454. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  455. MessageBoxButtons.OK, MessageBoxIcon.Information);
  456. //清空数据
  457. return null;
  458. }
  459. return sre.Data.Tables[0];
  460. }
  461. return null;
  462. }
  463. catch (Exception ex)
  464. {
  465. throw ex;
  466. }
  467. }
  468. /// <summary>
  469. /// 查询损坏明细表
  470. /// </summary>
  471. private DataTable GetSearchDetailData()
  472. {
  473. try
  474. {
  475. // 调用服务器端获取数据集
  476. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  477. {
  478. return ReportModuleProxy.Service.GetRPT030106IData(rptse);
  479. }
  480. );
  481. if (sre.Status == Constant.ServiceResultStatus.Success)
  482. {
  483. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  484. {
  485. // 提示未查找到数据
  486. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  487. MessageBoxButtons.OK, MessageBoxIcon.Information);
  488. //清空数据
  489. return null;
  490. }
  491. return sre.Data.Tables[0];
  492. }
  493. return null;
  494. }
  495. catch (Exception ex)
  496. {
  497. throw ex;
  498. }
  499. }
  500. /// <summary>
  501. /// 查询缺陷登记明细表
  502. /// </summary>
  503. private DataTable GetSearchDefectData()
  504. {
  505. try
  506. {
  507. // 调用服务器端获取数据集
  508. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  509. {
  510. return ReportModuleProxy.Service.GetRPT030106DData(rptse);
  511. }
  512. );
  513. if (sre.Status == Constant.ServiceResultStatus.Success)
  514. {
  515. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  516. {
  517. // 提示未查找到数据
  518. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  519. MessageBoxButtons.OK, MessageBoxIcon.Information);
  520. //清空数据
  521. return null;
  522. }
  523. return sre.Data.Tables[0];
  524. }
  525. return null;
  526. }
  527. catch (Exception ex)
  528. {
  529. throw ex;
  530. }
  531. }
  532. /// <summary>
  533. /// 查询缺陷登记明细表
  534. /// </summary>
  535. private DataTable GetSearchProData()
  536. {
  537. try
  538. {
  539. // 调用服务器端获取数据集
  540. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  541. {
  542. return ReportModuleProxy.Service.GetRPT030106ProData(rptse);
  543. }
  544. );
  545. if (sre.Status == Constant.ServiceResultStatus.Success)
  546. {
  547. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  548. {
  549. // 提示未查找到数据
  550. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  551. MessageBoxButtons.OK, MessageBoxIcon.Information);
  552. //清空数据
  553. return null;
  554. }
  555. return sre.Data.Tables[0];
  556. }
  557. return null;
  558. }
  559. catch (Exception ex)
  560. {
  561. throw ex;
  562. }
  563. }
  564. /// <summary>
  565. /// 获取权限(生产线)
  566. /// </summary>
  567. protected void getPurviewLine()
  568. {
  569. try
  570. {
  571. StringBuilder sbProcedurePurview = new StringBuilder();
  572. //得到工序查看权限
  573. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  574. {
  575. return SystemModuleProxy.Service.GetUserPurview(7, LogInUserInfo.CurrentUser.UserID);
  576. }));
  577. if (dsProcedurePurview != null)
  578. {
  579. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  580. if (drPurview.Length == 0)
  581. {
  582. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  583. {
  584. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  585. }
  586. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  587. {
  588. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  589. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  590. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  591. }
  592. }
  593. else
  594. {
  595. ProductionLineEntity line = new ProductionLineEntity();
  596. line.ValueFlags = new object[] { 1 };
  597. dsProcedurePurview = (DataSet)DoAsync(() =>
  598. {
  599. return PCModuleProxy.Service.SearchProductionLine(line);
  600. });
  601. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  602. {
  603. sbProcedurePurview.Append(dr["productionlineID"].ToString() + ",");
  604. }
  605. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  606. {
  607. this.dkproductionLineSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  608. this.dkproductionLineSearchBox.ProductionLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  609. this._currentUserLinePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  610. }
  611. }
  612. }
  613. }
  614. catch (Exception ex)
  615. {
  616. throw ex;
  617. }
  618. }
  619. /// <summary>
  620. /// 获取权限
  621. /// </summary>
  622. protected void getPurview()
  623. {
  624. try
  625. {
  626. StringBuilder sbProcedurePurview = new StringBuilder();
  627. //得到工序查看权限
  628. DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  629. {
  630. return SystemModuleProxy.Service.GetUserPurview(9, LogInUserInfo.CurrentUser.UserID);
  631. }));
  632. if (dsProcedurePurview != null)
  633. {
  634. DataRow[] drPurview = dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Select("PurviewID=-1");
  635. if (drPurview.Length == 0)
  636. {
  637. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  638. {
  639. sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  640. }
  641. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  642. {
  643. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  644. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  645. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  646. }
  647. }
  648. else
  649. {
  650. SearchProductionLineEntity line = new SearchProductionLineEntity();
  651. dsProcedurePurview = SystemModuleProxy.Service.GetProdureList(line);
  652. foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  653. {
  654. sbProcedurePurview.Append(dr["ProcedureID"].ToString() + ",");
  655. }
  656. if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  657. {
  658. this.dkProcedureSearchBox.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  659. this.dkProcedureSearchBox.ProcedureIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  660. this._currentUserPurview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  661. }
  662. }
  663. }
  664. }
  665. catch (Exception ex)
  666. {
  667. throw ex;
  668. }
  669. }
  670. /// <summary>
  671. /// 查看工号权限
  672. /// </summary>
  673. protected void getPurviewUserCode()
  674. {
  675. try
  676. {
  677. //StringBuilder sbProcedurePurview = new StringBuilder();
  678. ////得到工序查看权限
  679. //DataSet dsProcedurePurview = (DataSet)DoAsync(new AsyncMethod(() =>
  680. //{
  681. // return SystemModuleProxy.Service.GetUserPurview(3, LogInUserInfo.CurrentUser.UserID);
  682. //}));
  683. //if (dsProcedurePurview != null)
  684. //{
  685. // foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
  686. // {
  687. // sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
  688. // }
  689. // if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
  690. // {
  691. // this._currentUserCodePuview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
  692. // }
  693. //}
  694. }
  695. catch (Exception ex)
  696. {
  697. throw ex;
  698. }
  699. }
  700. #endregion
  701. private void c_Label6_Click(object sender, EventArgs e)
  702. {
  703. }
  704. private void txtGoodsCode_TextChanged(object sender, EventArgs e)
  705. {
  706. }
  707. private void dgvReportModule_CellContentClick(object sender, DataGridViewCellEventArgs e)
  708. {
  709. }
  710. private void txtDefectCode_TextChanged(object sender, EventArgs e)
  711. {
  712. }
  713. }
  714. }