F_RPT_030106.cs 26 KB

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