F_RPT_030112.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030102_1.cs
  5. * 2.功能描述:产成品交接汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/4/14 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. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  22. using Dongke.IBOSS.PRD.Basics.BaseControls;
  23. namespace Dongke.IBOSS.PRD.Client.ReportModule
  24. {
  25. public partial class F_RPT_030112 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 窗体的单例模式
  29. private static F_RPT_030112 _instance;
  30. //实体类
  31. private RPT030102_SE _rptse = null;
  32. private RPT030102_SE _rptse1 = null;
  33. // 存储查询条件
  34. private SearchFinishedProductEntity _orderEntity = null;
  35. //private SearchFinishedProductEntity _orderEntity2 = null;
  36. private SearchFinishedProductEntity _orderCRE = null;
  37. #endregion
  38. #region 构造函数
  39. public F_RPT_030112()
  40. {
  41. InitializeComponent();
  42. // 窗体显示的Title
  43. this.Text = FormTitles.F_RPT_030112;
  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_030112 Instance
  56. {
  57. get
  58. {
  59. if (_instance == null || _instance.IsDisposed)
  60. {
  61. _instance = new F_RPT_030112();
  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_030102_1_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.dgvOrder.AutoGenerateColumns = false;
  83. this.dgvOrderDetail.AutoGenerateColumns = false;
  84. //this.dtpStartTime.Enabled = false;
  85. //this.dtpEndTime.Enabled = false;
  86. this.dtpStartTime.Value = DateTime.Now.Date;
  87. this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  88. this.chkTestMouldFlag.AllItemCheck();
  89. this.chkTemporarilyFlag.AllItemCheck();
  90. }
  91. catch (Exception ex)
  92. {
  93. // 对异常进行共通处理
  94. ExceptionManager.HandleEventException(this.ToString(),
  95. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  96. }
  97. }
  98. /// <summary>
  99. /// 窗体关闭事件
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void F_RPT_030102_1_FormClosed(object sender, FormClosedEventArgs e)
  104. {
  105. _instance = null;
  106. }
  107. /// <summary>
  108. /// 关闭按钮
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void tsbtnClose_Click(object sender, EventArgs e)
  113. {
  114. this.Close();
  115. }
  116. /// <summary>
  117. /// 自动适应列宽
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  122. {
  123. if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_ZERO)
  124. {
  125. this.dgvOrder.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  126. }
  127. else if(this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_ONE)
  128. {
  129. this.dgvOrderDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  130. }
  131. else if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_FOUR)
  132. {
  133. this.dgvtemporarily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  134. }
  135. else if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_FIVE)
  136. {
  137. this.dgvlc.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  138. }
  139. else if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_SIX)
  140. {
  141. this.dgvlcDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  142. }
  143. }
  144. /// <summary>
  145. /// 查询按钮事件
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void btnSearch_Click(object sender, EventArgs e)
  150. {
  151. try
  152. {
  153. GetOrderEntityFromLayout();// 设置查询实体类
  154. if (this.tblScrapTotalModule.SelectedIndex == 0)//交接汇总查询
  155. {
  156. //this._orderEntity2 = this._orderEntity;
  157. //this.dgvOrder.DataSource = null;
  158. //this.dgvOrder.DataSource = this.GetSearchTotalData();
  159. _orderCRE = this._orderEntity;
  160. this.GetSearchTotalData();
  161. }
  162. else if (this.tblScrapTotalModule.SelectedIndex == 1)//交接明细查询
  163. {
  164. this.dgvOrderDetail.DataSource = null;
  165. this.dgvOrderDetail.DataSource = this.GetSearchDetailData();
  166. }
  167. else if (this.tblScrapTotalModule.SelectedIndex == 2)//交接数量查询
  168. {
  169. this.dgvNum.DataSource = null;
  170. ClientRequestEntity cre = new ClientRequestEntity();
  171. cre.NameSpace = "R03";
  172. cre.Name = "R030112Num";
  173. cre.Properties["OrderNo"] = this.txtOrderNo.Text.Trim();
  174. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  175. if (this.chkDateTime.Checked)
  176. {
  177. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  178. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  179. }
  180. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  181. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  182. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  183. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  184. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  185. if (testMouldFlags.Length == 1)
  186. {
  187. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  188. }
  189. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  190. if (temporarilyFlags.Length == 1)
  191. {
  192. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  193. }
  194. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  195. {
  196. return ReportModuleProxy.Service.DoRequest(cre);
  197. });
  198. if (resultEntity == null || resultEntity.Data == null ||
  199. resultEntity.Data.Tables.Count == 0 ||
  200. resultEntity.Data.Tables[0].Rows.Count == 0)
  201. {
  202. this.dgvNum.AutoResizeColumns();
  203. return;
  204. }
  205. else
  206. {
  207. this.dgvNum.DataSource = resultEntity.Data.Tables[0];
  208. this.dgvNum.ReadOnly = true;
  209. this.dgvNum.Rows[0].Selected = true;
  210. this.dgvNum.AutoResizeColumns();
  211. }
  212. }
  213. else if (this.tblScrapTotalModule.SelectedIndex == 3)//型号数量查询
  214. {
  215. this.dgvGoodsNum.DataSource = null;
  216. ClientRequestEntity cre = new ClientRequestEntity();
  217. cre.NameSpace = "R03";
  218. cre.Name = "R030112GoodsNum";
  219. cre.Properties["OrderNo"] = this.txtOrderNo.Text.Trim();
  220. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  221. if (this.chkDateTime.Checked)
  222. {
  223. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  224. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  225. }
  226. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  227. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  228. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  229. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  230. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  231. if (testMouldFlags.Length == 1)
  232. {
  233. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  234. }
  235. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  236. if (temporarilyFlags.Length == 1)
  237. {
  238. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  239. }
  240. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  241. {
  242. return ReportModuleProxy.Service.DoRequest(cre);
  243. });
  244. if (resultEntity == null || resultEntity.Data == null ||
  245. resultEntity.Data.Tables.Count == 0 ||
  246. resultEntity.Data.Tables[0].Rows.Count == 0)
  247. {
  248. this.dgvGoodsNum.AutoResizeColumns();
  249. return;
  250. }
  251. else
  252. {
  253. this.dgvGoodsNum.DataSource = resultEntity.Data.Tables[0];
  254. this.dgvGoodsNum.ReadOnly = true;
  255. this.dgvGoodsNum.Rows[0].Selected = true;
  256. this.dgvGoodsNum.AutoResizeColumns();
  257. }
  258. }
  259. else if (this.tblScrapTotalModule.SelectedIndex == 4)//暂存数据
  260. {
  261. this.dgvtemporarily.DataSource = null;
  262. ClientRequestEntity cre = new ClientRequestEntity();
  263. cre.NameSpace = "R03";
  264. cre.Name = "TemporarilyDetail";
  265. cre.Properties["OrderNo"] = this.txtOrderNo.Text.Trim();
  266. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  267. if (this.chkDateTime.Checked)
  268. {
  269. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  270. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  271. }
  272. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  273. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  274. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  275. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  276. cre.Properties["MaterialCode"] = this.txtMaterialCode.Text.Trim();
  277. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  278. if (testMouldFlags.Length == 1)
  279. {
  280. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  281. }
  282. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  283. if (temporarilyFlags.Length == 1)
  284. {
  285. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  286. }
  287. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  288. {
  289. return ReportModuleProxy.Service.DoRequest(cre);
  290. });
  291. if (resultEntity == null || resultEntity.Data == null ||
  292. resultEntity.Data.Tables.Count == 0 ||
  293. resultEntity.Data.Tables[0].Rows.Count == 0)
  294. {
  295. this.dgvtemporarily.AutoResizeColumns();
  296. return;
  297. }
  298. else
  299. {
  300. this.dgvtemporarily.DataSource = resultEntity.Data.Tables[0];
  301. this.dgvtemporarily.IsSetInputColumnsColor = true;
  302. this.dgvtemporarily.AutoResizeColumns();
  303. }
  304. }
  305. else if (this.tblScrapTotalModule.SelectedIndex == 5)//裸瓷交接汇总 add by qq 20250605
  306. {
  307. this.dgvlc.DataSource = null;
  308. ClientRequestEntity cre = new ClientRequestEntity();
  309. cre.NameSpace = "R03";
  310. cre.Name = "LCData";
  311. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  312. if (this.chkDateTime.Checked)
  313. {
  314. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  315. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  316. }
  317. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  318. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  319. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  320. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  321. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  322. if (testMouldFlags.Length == 1)
  323. {
  324. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  325. }
  326. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  327. if (temporarilyFlags.Length == 1)
  328. {
  329. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  330. }
  331. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  332. {
  333. return ReportModuleProxy.Service.DoRequest(cre);
  334. });
  335. if (resultEntity == null || resultEntity.Data == null ||
  336. resultEntity.Data.Tables.Count == 0 ||
  337. resultEntity.Data.Tables[0].Rows.Count == 0)
  338. {
  339. this.dgvlc.AutoResizeColumns();
  340. return;
  341. }
  342. else
  343. {
  344. this.dgvlc.DataSource = resultEntity.Data.Tables[0];
  345. this.dgvlc.ReadOnly = true;
  346. this.dgvlc.Rows[0].Selected = true;
  347. this.dgvlc.AutoResizeColumns();
  348. }
  349. }
  350. else if (this.tblScrapTotalModule.SelectedIndex == 6)//裸瓷交接明细表 add by qq 20250605
  351. {
  352. this.dgvlcDetail.DataSource = null;
  353. ClientRequestEntity cre = new ClientRequestEntity();
  354. cre.NameSpace = "R03";
  355. cre.Name = "LCDetail";
  356. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  357. if (this.chkDateTime.Checked)
  358. {
  359. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  360. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  361. }
  362. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  363. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  364. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  365. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  366. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  367. if (testMouldFlags.Length == 1)
  368. {
  369. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  370. }
  371. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  372. if (temporarilyFlags.Length == 1)
  373. {
  374. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  375. }
  376. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  377. {
  378. return ReportModuleProxy.Service.DoRequest(cre);
  379. });
  380. if (resultEntity == null || resultEntity.Data == null ||
  381. resultEntity.Data.Tables.Count == 0 ||
  382. resultEntity.Data.Tables[0].Rows.Count == 0)
  383. {
  384. this.dgvlcDetail.AutoResizeColumns();
  385. return;
  386. }
  387. else
  388. {
  389. this.dgvlcDetail.DataSource = resultEntity.Data.Tables[0];
  390. this.dgvlcDetail.ReadOnly = true;
  391. this.dgvlcDetail.Rows[0].Selected = true;
  392. this.dgvlcDetail.AutoResizeColumns();
  393. }
  394. }
  395. }
  396. catch (Exception ex)
  397. {
  398. this.btnSearch.Enabled = true;
  399. // 对异常进行共通处理
  400. ExceptionManager.HandleEventException(this.ToString(),
  401. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  402. }
  403. }
  404. /// <summary>
  405. /// 清空条件按钮事件
  406. /// </summary>
  407. /// <param name="sender"></param>
  408. /// <param name="e"></param>
  409. private void btnClearCondition_Click(object sender, EventArgs e)
  410. {
  411. this.txtOrderNo.Clear();
  412. this.txtFHUserCode.Clear();
  413. this.chkDateTime.Checked = false;
  414. this.dtpStartTime.Value = DateTime.Now.Date;
  415. this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  416. this.scbGoodsType.ClearValue();
  417. this.txtGoodsCode.Clear();
  418. this.dkLogoSearchBox1.ClearControl();
  419. this.chkTestMouldFlag.AllItemCheck();
  420. this.chkTemporarilyFlag.AllItemCheck();
  421. }
  422. /// <summary>
  423. /// 双击单元格事件
  424. /// </summary>
  425. /// <param name="sender"></param>
  426. /// <param name="e"></param>
  427. private void dgvScrapTotalModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  428. {
  429. try
  430. {
  431. //判断是否为空
  432. if (this.dgvOrder.CurrentRow == null)
  433. {
  434. return;
  435. }
  436. //获取数据信息
  437. DataRowView row = dgvOrder.CurrentRow.DataBoundItem as DataRowView;
  438. //this._orderEntity = _orderCRE;
  439. if (row["fhorderid"] == DBNull.Value)
  440. {
  441. this._orderCRE.OrderID = null;
  442. }
  443. else
  444. {
  445. this._orderCRE.OrderID = Convert.ToInt32(row["fhorderid"]);
  446. }
  447. if (row["goodsid"] == DBNull.Value)
  448. {
  449. this._orderCRE.GoodsID = null;
  450. }
  451. else
  452. {
  453. this._orderCRE.GoodsID = Convert.ToInt32(row["goodsid"]);
  454. }
  455. if (row["logoid"] == DBNull.Value)
  456. {
  457. this._orderCRE.LogoID = null;
  458. }
  459. else
  460. {
  461. this._orderCRE.LogoID = Convert.ToInt32(row["logoid"]);
  462. }
  463. this.dgvOrderDetail.DataSource = null;
  464. this.tblScrapTotalModule.SelectTab(1);
  465. this.dgvOrderDetail.DataSource = GetSearchDetailDataByDouble();
  466. }
  467. catch (Exception ex)
  468. {
  469. this.btnSearch.Enabled = true;
  470. this.btnClearCondition.Enabled = true;
  471. // 对异常进行共通处理
  472. ExceptionManager.HandleEventException(this.ToString(),
  473. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  474. }
  475. }
  476. /// <summary>
  477. /// 复选框按钮事件
  478. /// </summary>
  479. /// <param name="sender"></param>
  480. /// <param name="e"></param>
  481. private void chkDateTime_CheckedChanged(object sender, EventArgs e)
  482. {
  483. this.dtpStartTime.Enabled = chkDateTime.Checked;
  484. this.dtpEndTime.Enabled = chkDateTime.Checked;
  485. }
  486. #endregion
  487. #region 私有方法
  488. /// <summary>
  489. /// 搜索条件
  490. /// </summary>
  491. /// <returns></returns>
  492. private SearchFinishedProductEntity GetOrderEntityFromLayout()
  493. {
  494. this._orderEntity = new SearchFinishedProductEntity();
  495. this._orderEntity.OrderNo = this.txtOrderNo.Text.Trim();
  496. this._orderEntity.FHUserCode = this.txtFHUserCode.Text.Trim();
  497. if (this.chkDateTime.Checked)
  498. {
  499. this._orderEntity.FHTimeStart = this.dtpStartTime.Value;
  500. this._orderEntity.FHTimeEnd = this.dtpEndTime.Value;
  501. }
  502. this._orderEntity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  503. this._orderEntity.GoodsCode = this.txtGoodsCode.Text.Trim();
  504. this._orderEntity.BarCode = this.txtBarcode.Text.Trim();
  505. this._orderEntity.GoodsModel = this.txtGoodsModel.Text.Trim();
  506. this._orderEntity.LogoIDS = this.dkLogoSearchBox1.LogoIDS;
  507. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  508. if (testMouldFlags.Length == 1)
  509. {
  510. _orderEntity.TestMouldFlag = testMouldFlags[0].ToString();
  511. }
  512. object[] temporarilyFlag = this.chkTemporarilyFlag.SelectedValues;
  513. if (temporarilyFlag.Length == 1)
  514. {
  515. _orderEntity.TemporarilyFlag = temporarilyFlag[0].ToString();
  516. }
  517. return this._orderEntity;
  518. }
  519. /// <summary>
  520. /// 明细搜索条件
  521. /// </summary>
  522. /// <returns></returns>
  523. private void CreateSearchConditionDetail()
  524. {
  525. this._rptse = new RPT030102_SE();
  526. this._rptse.ProductionLineID = this._rptse1.ProductionLineID;
  527. this._rptse.GoodsTypeCode = this._rptse1.GoodsTypeCode;
  528. this._rptse.GoodsCode = this._rptse1.GoodsCode;
  529. this._rptse.ProcedureIDS = this._rptse1.ProcedureIDS;
  530. this._rptse.ScrapDateStart = this._rptse1.ScrapDateStart;
  531. this._rptse.ScrapDateEnd = this._rptse1.ScrapDateEnd;
  532. this._rptse.ResponProcedureIDS = this._rptse1.ResponProcedureIDS;
  533. this._rptse.ResponUserIDS = this._rptse1.ResponUserIDS;
  534. this._rptse.CreatUser = this._rptse1.CreatUser;
  535. this._rptse.AuditUser = this._rptse1.AuditUser;
  536. this._rptse.SpecialRepairFlag = this._rptse1.SpecialRepairFlag;
  537. }
  538. /// <summary>
  539. /// 查询损坏汇总表
  540. /// </summary>
  541. private DataTable GetSearchTotalData()
  542. {
  543. try
  544. {
  545. //// 调用服务器端获取数据集
  546. //ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  547. //{
  548. // return ReportModuleProxy.Service.GetRPT0030112SData(this._orderEntity);
  549. //}
  550. //);
  551. //if (sre.Status == Constant.ServiceResultStatus.Success)
  552. //{
  553. // if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  554. // {
  555. // // 提示未查找到数据
  556. // MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  557. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  558. // //清空数据
  559. // return null;
  560. // }
  561. // return sre.Data.Tables[0];
  562. //}
  563. this.dgvOrder.DataSource = null;
  564. ClientRequestEntity cre = new ClientRequestEntity();
  565. cre.NameSpace = "R03";
  566. cre.Name = "R030112Sum";
  567. cre.Properties["OrderNo"] = this.txtOrderNo.Text.Trim();
  568. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  569. if (this.chkDateTime.Checked)
  570. {
  571. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  572. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  573. }
  574. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  575. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  576. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  577. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  578. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  579. if (testMouldFlags.Length == 1)
  580. {
  581. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  582. }
  583. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  584. if (temporarilyFlags.Length == 1)
  585. {
  586. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  587. }
  588. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  589. {
  590. return ReportModuleProxy.Service.DoRequest(cre);
  591. });
  592. if (resultEntity == null || resultEntity.Data == null ||
  593. resultEntity.Data.Tables.Count == 0 ||
  594. resultEntity.Data.Tables[0].Rows.Count == 0)
  595. {
  596. this.dgvOrder.AutoResizeColumns();
  597. return null;
  598. }
  599. else
  600. {
  601. this.dgvOrder.DataSource = resultEntity.Data.Tables[0];
  602. this.dgvOrder.ReadOnly = true;
  603. this.dgvOrder.Rows[0].Selected = true;
  604. this.dgvOrder.AutoResizeColumns();
  605. }
  606. return null;
  607. }
  608. catch (Exception ex)
  609. {
  610. throw ex;
  611. }
  612. }
  613. /// <summary>
  614. /// 查询损坏明细表
  615. /// </summary>
  616. private DataTable GetSearchDetailData()
  617. {
  618. try
  619. {
  620. // 调用服务器端获取数据集
  621. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  622. {
  623. return ReportModuleProxy.Service.GetRPT0030112DetailSData(this._orderEntity);
  624. }
  625. );
  626. if (sre.Status == Constant.ServiceResultStatus.Success)
  627. {
  628. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  629. {
  630. // 提示未查找到数据
  631. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  632. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  633. //清空数据
  634. return null;
  635. }
  636. return sre.Data.Tables[0];
  637. }
  638. return null;
  639. }
  640. catch (Exception ex)
  641. {
  642. throw ex;
  643. }
  644. }
  645. /// <summary>
  646. /// 查询损坏明细表
  647. /// </summary>
  648. private DataTable GetSearchDetailDataByDouble()
  649. {
  650. try
  651. {
  652. // 调用服务器端获取数据集
  653. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  654. {
  655. return ReportModuleProxy.Service.GetRPT0030112DetailSData(this._orderCRE);
  656. }
  657. );
  658. if (sre.Status == Constant.ServiceResultStatus.Success)
  659. {
  660. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  661. {
  662. // 提示未查找到数据
  663. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  664. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  665. //清空数据
  666. return null;
  667. }
  668. return sre.Data.Tables[0];
  669. }
  670. return null;
  671. }
  672. catch (Exception ex)
  673. {
  674. throw ex;
  675. }
  676. }
  677. /// <summary>
  678. /// 同步
  679. /// </summary>
  680. /// <param name="sender"></param>
  681. /// <param name="e"></param>
  682. private void tsbtnSynLog_Click(object sender, EventArgs e)
  683. {
  684. try
  685. {
  686. DataTable dtBarcode = dgvtemporarily.DataSource as DataTable;
  687. if (dtBarcode == null)
  688. {
  689. return;
  690. }
  691. DataTable dtSelBarcode = dtBarcode.Copy();
  692. dtSelBarcode.DefaultView.RowFilter = "Sel = 1";
  693. dtSelBarcode = dtSelBarcode.DefaultView.ToTable();
  694. if (dtSelBarcode.Rows.Count == 0)
  695. {
  696. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, "未选择任何数据");
  697. return;
  698. }
  699. DialogResult dr = MessageBox.Show("是否对所选数据进行同步?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  700. if (dr != System.Windows.Forms.DialogResult.Yes)
  701. {
  702. return;
  703. }
  704. ClientRequestEntity cre = new ClientRequestEntity();
  705. cre.NameSpace = "R03";
  706. cre.Name = "SyncFinishDataLog";
  707. cre.Data = new DataSet();
  708. cre.Data.Tables.Add(dtSelBarcode);
  709. ServiceResultEntity sre = DoAsync(() =>
  710. {
  711. return ReportModuleProxy.Service.DoRequest(cre);
  712. });
  713. if (sre.OtherStatus > 0)
  714. {
  715. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  716. btnSearch_Click(null, null);
  717. }
  718. else
  719. {
  720. MessageBox.Show(this, sre.Message);
  721. }
  722. }
  723. catch (Exception ex)
  724. {
  725. throw ex;
  726. }
  727. }
  728. /// <summary>
  729. /// 勾选事件
  730. /// </summary>
  731. /// <param name="sender"></param>
  732. /// <param name="e"></param>
  733. private void dgvtemporarily_CurrentCellDirtyStateChanged(object sender, EventArgs e)
  734. {
  735. try
  736. {
  737. DataGridViewCell eCell = this.dgvtemporarily.CurrentCell;
  738. string colName = this.dgvtemporarily.Columns[eCell.ColumnIndex].Name;
  739. if ("Sel" != colName)
  740. {
  741. return;
  742. }
  743. int rightFlag = Convert.ToInt32(eCell.EditedFormattedValue);
  744. DataRowView drv = this.dgvtemporarily.CurrentRow.DataBoundItem as DataRowView;
  745. if (drv != null)
  746. {
  747. drv["Sel"] = rightFlag;
  748. drv.EndEdit();
  749. }
  750. object finishedloadbatchno = this.dgvtemporarily.Rows[eCell.RowIndex].Cells["FINISHEDLOADBATCHNO"].Value;
  751. if (finishedloadbatchno == null || finishedloadbatchno == DBNull.Value)
  752. {
  753. return;
  754. }
  755. DataTable returnData = (DataTable)this.dgvtemporarily.DataSource;
  756. if (returnData != null)
  757. {
  758. DataRow[] rows = returnData.Select("FINISHEDLOADBATCHNO = '" + finishedloadbatchno.ToString()+"'");
  759. if (rows == null || rows.Length == 0)
  760. {
  761. return;
  762. }
  763. this.dgvtemporarily.Tag = 1;
  764. for (int i = 0; i < rows.Length; i++)
  765. {
  766. rows[i]["Sel"] = rightFlag;
  767. rows[i].EndEdit();
  768. }
  769. this.dgvtemporarily.Tag = null;
  770. }
  771. }
  772. catch (Exception ex)
  773. {
  774. this.dgvtemporarily.Tag = null;
  775. // 对异常进行共通处理
  776. ExceptionManager.HandleEventException(this.ToString(),
  777. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  778. }
  779. }
  780. /// <summary>
  781. /// 勾选事件
  782. /// </summary>
  783. /// <param name="sender"></param>
  784. /// <param name="e"></param>
  785. private void dgvtemporarily_CellClick(object sender, DataGridViewCellEventArgs e)
  786. {
  787. try
  788. {
  789. DataGridViewCell eCell = this.dgvtemporarily.CurrentCell;
  790. string colName = this.dgvtemporarily.Columns[eCell.ColumnIndex].Name;
  791. if ("Sel" != colName)
  792. {
  793. return;
  794. }
  795. int rightFlag = Convert.ToInt32(eCell.EditedFormattedValue);
  796. DataRowView drv = this.dgvtemporarily.CurrentRow.DataBoundItem as DataRowView;
  797. if (drv != null)
  798. {
  799. drv["Sel"] = rightFlag;
  800. drv.EndEdit();
  801. }
  802. object finishedloadbatchno = this.dgvtemporarily.Rows[eCell.RowIndex].Cells["FINISHEDLOADBATCHNO"].Value;
  803. if (finishedloadbatchno == null || finishedloadbatchno == DBNull.Value)
  804. {
  805. return;
  806. }
  807. DataTable returnData = (DataTable)this.dgvtemporarily.DataSource;
  808. if (returnData != null)
  809. {
  810. DataRow[] rows = returnData.Select("FINISHEDLOADBATCHNO = '" + finishedloadbatchno.ToString() + "'");
  811. if (rows == null || rows.Length == 0)
  812. {
  813. return;
  814. }
  815. this.dgvtemporarily.Tag = 1;
  816. for (int i = 0; i < rows.Length; i++)
  817. {
  818. rows[i]["Sel"] = rightFlag;
  819. rows[i].EndEdit();
  820. }
  821. this.dgvtemporarily.Tag = null;
  822. }
  823. }
  824. catch (Exception ex)
  825. {
  826. this.dgvtemporarily.Tag = null;
  827. // 对异常进行共通处理
  828. ExceptionManager.HandleEventException(this.ToString(),
  829. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  830. }
  831. }
  832. #endregion
  833. }
  834. }