F_RPT_030112.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  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. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  277. if (testMouldFlags.Length == 1)
  278. {
  279. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  280. }
  281. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  282. if (temporarilyFlags.Length == 1)
  283. {
  284. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  285. }
  286. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  287. {
  288. return ReportModuleProxy.Service.DoRequest(cre);
  289. });
  290. if (resultEntity == null || resultEntity.Data == null ||
  291. resultEntity.Data.Tables.Count == 0 ||
  292. resultEntity.Data.Tables[0].Rows.Count == 0)
  293. {
  294. this.dgvtemporarily.AutoResizeColumns();
  295. return;
  296. }
  297. else
  298. {
  299. this.dgvtemporarily.DataSource = resultEntity.Data.Tables[0];
  300. this.dgvtemporarily.IsSetInputColumnsColor = true;
  301. this.dgvtemporarily.AutoResizeColumns();
  302. }
  303. }
  304. else if (this.tblScrapTotalModule.SelectedIndex == 5)//裸瓷交接汇总 add by qq 20250605
  305. {
  306. this.dgvlc.DataSource = null;
  307. ClientRequestEntity cre = new ClientRequestEntity();
  308. cre.NameSpace = "R03";
  309. cre.Name = "LCData";
  310. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  311. if (this.chkDateTime.Checked)
  312. {
  313. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  314. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  315. }
  316. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  317. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  318. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  319. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  320. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  321. if (testMouldFlags.Length == 1)
  322. {
  323. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  324. }
  325. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  326. if (temporarilyFlags.Length == 1)
  327. {
  328. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  329. }
  330. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  331. {
  332. return ReportModuleProxy.Service.DoRequest(cre);
  333. });
  334. if (resultEntity == null || resultEntity.Data == null ||
  335. resultEntity.Data.Tables.Count == 0 ||
  336. resultEntity.Data.Tables[0].Rows.Count == 0)
  337. {
  338. this.dgvlc.AutoResizeColumns();
  339. return;
  340. }
  341. else
  342. {
  343. this.dgvlc.DataSource = resultEntity.Data.Tables[0];
  344. this.dgvlc.ReadOnly = true;
  345. this.dgvlc.Rows[0].Selected = true;
  346. this.dgvlc.AutoResizeColumns();
  347. }
  348. }
  349. else if (this.tblScrapTotalModule.SelectedIndex == 6)//裸瓷交接明细表 add by qq 20250605
  350. {
  351. this.dgvlcDetail.DataSource = null;
  352. ClientRequestEntity cre = new ClientRequestEntity();
  353. cre.NameSpace = "R03";
  354. cre.Name = "LCDetail";
  355. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  356. if (this.chkDateTime.Checked)
  357. {
  358. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  359. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  360. }
  361. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  362. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  363. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  364. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  365. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  366. if (testMouldFlags.Length == 1)
  367. {
  368. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  369. }
  370. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  371. if (temporarilyFlags.Length == 1)
  372. {
  373. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  374. }
  375. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  376. {
  377. return ReportModuleProxy.Service.DoRequest(cre);
  378. });
  379. if (resultEntity == null || resultEntity.Data == null ||
  380. resultEntity.Data.Tables.Count == 0 ||
  381. resultEntity.Data.Tables[0].Rows.Count == 0)
  382. {
  383. this.dgvlcDetail.AutoResizeColumns();
  384. return;
  385. }
  386. else
  387. {
  388. this.dgvlcDetail.DataSource = resultEntity.Data.Tables[0];
  389. this.dgvlcDetail.ReadOnly = true;
  390. this.dgvlcDetail.Rows[0].Selected = true;
  391. this.dgvlcDetail.AutoResizeColumns();
  392. }
  393. }
  394. }
  395. catch (Exception ex)
  396. {
  397. this.btnSearch.Enabled = true;
  398. // 对异常进行共通处理
  399. ExceptionManager.HandleEventException(this.ToString(),
  400. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  401. }
  402. }
  403. /// <summary>
  404. /// 清空条件按钮事件
  405. /// </summary>
  406. /// <param name="sender"></param>
  407. /// <param name="e"></param>
  408. private void btnClearCondition_Click(object sender, EventArgs e)
  409. {
  410. this.txtOrderNo.Clear();
  411. this.txtFHUserCode.Clear();
  412. this.chkDateTime.Checked = false;
  413. this.dtpStartTime.Value = DateTime.Now.Date;
  414. this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  415. this.scbGoodsType.ClearValue();
  416. this.txtGoodsCode.Clear();
  417. this.dkLogoSearchBox1.ClearControl();
  418. this.chkTestMouldFlag.AllItemCheck();
  419. this.chkTemporarilyFlag.AllItemCheck();
  420. }
  421. /// <summary>
  422. /// 双击单元格事件
  423. /// </summary>
  424. /// <param name="sender"></param>
  425. /// <param name="e"></param>
  426. private void dgvScrapTotalModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  427. {
  428. try
  429. {
  430. //判断是否为空
  431. if (this.dgvOrder.CurrentRow == null)
  432. {
  433. return;
  434. }
  435. //获取数据信息
  436. DataRowView row = dgvOrder.CurrentRow.DataBoundItem as DataRowView;
  437. //this._orderEntity = _orderCRE;
  438. if (row["fhorderid"] == DBNull.Value)
  439. {
  440. this._orderCRE.OrderID = null;
  441. }
  442. else
  443. {
  444. this._orderCRE.OrderID = Convert.ToInt32(row["fhorderid"]);
  445. }
  446. if (row["goodsid"] == DBNull.Value)
  447. {
  448. this._orderCRE.GoodsID = null;
  449. }
  450. else
  451. {
  452. this._orderCRE.GoodsID = Convert.ToInt32(row["goodsid"]);
  453. }
  454. if (row["logoid"] == DBNull.Value)
  455. {
  456. this._orderCRE.LogoID = null;
  457. }
  458. else
  459. {
  460. this._orderCRE.LogoID = Convert.ToInt32(row["logoid"]);
  461. }
  462. this.dgvOrderDetail.DataSource = null;
  463. this.tblScrapTotalModule.SelectTab(1);
  464. this.dgvOrderDetail.DataSource = GetSearchDetailDataByDouble();
  465. }
  466. catch (Exception ex)
  467. {
  468. this.btnSearch.Enabled = true;
  469. this.btnClearCondition.Enabled = true;
  470. // 对异常进行共通处理
  471. ExceptionManager.HandleEventException(this.ToString(),
  472. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  473. }
  474. }
  475. /// <summary>
  476. /// 复选框按钮事件
  477. /// </summary>
  478. /// <param name="sender"></param>
  479. /// <param name="e"></param>
  480. private void chkDateTime_CheckedChanged(object sender, EventArgs e)
  481. {
  482. this.dtpStartTime.Enabled = chkDateTime.Checked;
  483. this.dtpEndTime.Enabled = chkDateTime.Checked;
  484. }
  485. #endregion
  486. #region 私有方法
  487. /// <summary>
  488. /// 搜索条件
  489. /// </summary>
  490. /// <returns></returns>
  491. private SearchFinishedProductEntity GetOrderEntityFromLayout()
  492. {
  493. this._orderEntity = new SearchFinishedProductEntity();
  494. this._orderEntity.OrderNo = this.txtOrderNo.Text.Trim();
  495. this._orderEntity.FHUserCode = this.txtFHUserCode.Text.Trim();
  496. if (this.chkDateTime.Checked)
  497. {
  498. this._orderEntity.FHTimeStart = this.dtpStartTime.Value;
  499. this._orderEntity.FHTimeEnd = this.dtpEndTime.Value;
  500. }
  501. this._orderEntity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  502. this._orderEntity.GoodsCode = this.txtGoodsCode.Text.Trim();
  503. this._orderEntity.BarCode = this.txtBarcode.Text.Trim();
  504. this._orderEntity.GoodsModel = this.txtGoodsModel.Text.Trim();
  505. this._orderEntity.LogoIDS = this.dkLogoSearchBox1.LogoIDS;
  506. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  507. if (testMouldFlags.Length == 1)
  508. {
  509. _orderEntity.TestMouldFlag = testMouldFlags[0].ToString();
  510. }
  511. object[] temporarilyFlag = this.chkTemporarilyFlag.SelectedValues;
  512. if (temporarilyFlag.Length == 1)
  513. {
  514. _orderEntity.TemporarilyFlag = temporarilyFlag[0].ToString();
  515. }
  516. return this._orderEntity;
  517. }
  518. /// <summary>
  519. /// 明细搜索条件
  520. /// </summary>
  521. /// <returns></returns>
  522. private void CreateSearchConditionDetail()
  523. {
  524. this._rptse = new RPT030102_SE();
  525. this._rptse.ProductionLineID = this._rptse1.ProductionLineID;
  526. this._rptse.GoodsTypeCode = this._rptse1.GoodsTypeCode;
  527. this._rptse.GoodsCode = this._rptse1.GoodsCode;
  528. this._rptse.ProcedureIDS = this._rptse1.ProcedureIDS;
  529. this._rptse.ScrapDateStart = this._rptse1.ScrapDateStart;
  530. this._rptse.ScrapDateEnd = this._rptse1.ScrapDateEnd;
  531. this._rptse.ResponProcedureIDS = this._rptse1.ResponProcedureIDS;
  532. this._rptse.ResponUserIDS = this._rptse1.ResponUserIDS;
  533. this._rptse.CreatUser = this._rptse1.CreatUser;
  534. this._rptse.AuditUser = this._rptse1.AuditUser;
  535. this._rptse.SpecialRepairFlag = this._rptse1.SpecialRepairFlag;
  536. }
  537. /// <summary>
  538. /// 查询损坏汇总表
  539. /// </summary>
  540. private DataTable GetSearchTotalData()
  541. {
  542. try
  543. {
  544. //// 调用服务器端获取数据集
  545. //ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  546. //{
  547. // return ReportModuleProxy.Service.GetRPT0030112SData(this._orderEntity);
  548. //}
  549. //);
  550. //if (sre.Status == Constant.ServiceResultStatus.Success)
  551. //{
  552. // if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  553. // {
  554. // // 提示未查找到数据
  555. // MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  556. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  557. // //清空数据
  558. // return null;
  559. // }
  560. // return sre.Data.Tables[0];
  561. //}
  562. this.dgvOrder.DataSource = null;
  563. ClientRequestEntity cre = new ClientRequestEntity();
  564. cre.NameSpace = "R03";
  565. cre.Name = "R030112Sum";
  566. cre.Properties["OrderNo"] = this.txtOrderNo.Text.Trim();
  567. cre.Properties["FHUserCode"] = this.txtFHUserCode.Text.Trim();
  568. if (this.chkDateTime.Checked)
  569. {
  570. cre.Properties["FHTimeStart"] = this.dtpStartTime.Value;
  571. cre.Properties["FHTimeEnd"] = this.dtpEndTime.Value;
  572. }
  573. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  574. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  575. cre.Properties["GoodsModel"] = this.txtGoodsModel.Text.Trim();
  576. cre.Properties["LogoIDS"] = this.dkLogoSearchBox1.LogoIDS;
  577. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  578. if (testMouldFlags.Length == 1)
  579. {
  580. cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  581. }
  582. object[] temporarilyFlags = this.chkTemporarilyFlag.SelectedValues;
  583. if (temporarilyFlags.Length == 1)
  584. {
  585. cre.Properties["TemporarilyFlag"] = temporarilyFlags[0].ToString();
  586. }
  587. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  588. {
  589. return ReportModuleProxy.Service.DoRequest(cre);
  590. });
  591. if (resultEntity == null || resultEntity.Data == null ||
  592. resultEntity.Data.Tables.Count == 0 ||
  593. resultEntity.Data.Tables[0].Rows.Count == 0)
  594. {
  595. this.dgvOrder.AutoResizeColumns();
  596. return null;
  597. }
  598. else
  599. {
  600. this.dgvOrder.DataSource = resultEntity.Data.Tables[0];
  601. this.dgvOrder.ReadOnly = true;
  602. this.dgvOrder.Rows[0].Selected = true;
  603. this.dgvOrder.AutoResizeColumns();
  604. }
  605. return null;
  606. }
  607. catch (Exception ex)
  608. {
  609. throw ex;
  610. }
  611. }
  612. /// <summary>
  613. /// 查询损坏明细表
  614. /// </summary>
  615. private DataTable GetSearchDetailData()
  616. {
  617. try
  618. {
  619. // 调用服务器端获取数据集
  620. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  621. {
  622. return ReportModuleProxy.Service.GetRPT0030112DetailSData(this._orderEntity);
  623. }
  624. );
  625. if (sre.Status == Constant.ServiceResultStatus.Success)
  626. {
  627. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  628. {
  629. // 提示未查找到数据
  630. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  631. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  632. //清空数据
  633. return null;
  634. }
  635. return sre.Data.Tables[0];
  636. }
  637. return null;
  638. }
  639. catch (Exception ex)
  640. {
  641. throw ex;
  642. }
  643. }
  644. /// <summary>
  645. /// 查询损坏明细表
  646. /// </summary>
  647. private DataTable GetSearchDetailDataByDouble()
  648. {
  649. try
  650. {
  651. // 调用服务器端获取数据集
  652. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  653. {
  654. return ReportModuleProxy.Service.GetRPT0030112DetailSData(this._orderCRE);
  655. }
  656. );
  657. if (sre.Status == Constant.ServiceResultStatus.Success)
  658. {
  659. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  660. {
  661. // 提示未查找到数据
  662. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  663. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  664. //清空数据
  665. return null;
  666. }
  667. return sre.Data.Tables[0];
  668. }
  669. return null;
  670. }
  671. catch (Exception ex)
  672. {
  673. throw ex;
  674. }
  675. }
  676. /// <summary>
  677. /// 同步
  678. /// </summary>
  679. /// <param name="sender"></param>
  680. /// <param name="e"></param>
  681. private void tsbtnSynLog_Click(object sender, EventArgs e)
  682. {
  683. try
  684. {
  685. DataTable dtBarcode = dgvtemporarily.DataSource as DataTable;
  686. if (dtBarcode == null)
  687. {
  688. return;
  689. }
  690. DataTable dtSelBarcode = dtBarcode.Copy();
  691. dtSelBarcode.DefaultView.RowFilter = "Sel = 1";
  692. dtSelBarcode = dtSelBarcode.DefaultView.ToTable();
  693. if (dtSelBarcode.Rows.Count == 0)
  694. {
  695. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, "未选择任何数据");
  696. return;
  697. }
  698. DialogResult dr = MessageBox.Show("是否对所选数据进行同步?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  699. if (dr != System.Windows.Forms.DialogResult.Yes)
  700. {
  701. return;
  702. }
  703. ClientRequestEntity cre = new ClientRequestEntity();
  704. cre.NameSpace = "R03";
  705. cre.Name = "SyncFinishDataLog";
  706. cre.Data = new DataSet();
  707. cre.Data.Tables.Add(dtSelBarcode);
  708. ServiceResultEntity sre = DoAsync(() =>
  709. {
  710. return ReportModuleProxy.Service.DoRequest(cre);
  711. });
  712. if (sre.OtherStatus > 0)
  713. {
  714. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  715. btnSearch_Click(null, null);
  716. }
  717. else
  718. {
  719. MessageBox.Show(this, sre.Message);
  720. }
  721. }
  722. catch (Exception ex)
  723. {
  724. throw ex;
  725. }
  726. }
  727. /// <summary>
  728. /// 勾选事件
  729. /// </summary>
  730. /// <param name="sender"></param>
  731. /// <param name="e"></param>
  732. private void dgvtemporarily_CurrentCellDirtyStateChanged(object sender, EventArgs e)
  733. {
  734. try
  735. {
  736. DataGridViewCell eCell = this.dgvtemporarily.CurrentCell;
  737. string colName = this.dgvtemporarily.Columns[eCell.ColumnIndex].Name;
  738. if ("Sel" != colName)
  739. {
  740. return;
  741. }
  742. int rightFlag = Convert.ToInt32(eCell.EditedFormattedValue);
  743. DataRowView drv = this.dgvtemporarily.CurrentRow.DataBoundItem as DataRowView;
  744. if (drv != null)
  745. {
  746. drv["Sel"] = rightFlag;
  747. drv.EndEdit();
  748. }
  749. object finishedloadbatchno = this.dgvtemporarily.Rows[eCell.RowIndex].Cells["FINISHEDLOADBATCHNO"].Value;
  750. if (finishedloadbatchno == null || finishedloadbatchno == DBNull.Value)
  751. {
  752. return;
  753. }
  754. DataTable returnData = (DataTable)this.dgvtemporarily.DataSource;
  755. if (returnData != null)
  756. {
  757. DataRow[] rows = returnData.Select("FINISHEDLOADBATCHNO = '" + finishedloadbatchno.ToString()+"'");
  758. if (rows == null || rows.Length == 0)
  759. {
  760. return;
  761. }
  762. this.dgvtemporarily.Tag = 1;
  763. for (int i = 0; i < rows.Length; i++)
  764. {
  765. rows[i]["Sel"] = rightFlag;
  766. rows[i].EndEdit();
  767. }
  768. this.dgvtemporarily.Tag = null;
  769. }
  770. }
  771. catch (Exception ex)
  772. {
  773. this.dgvtemporarily.Tag = null;
  774. // 对异常进行共通处理
  775. ExceptionManager.HandleEventException(this.ToString(),
  776. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  777. }
  778. }
  779. #endregion
  780. }
  781. }