F_RPT_030106.cs 26 KB

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