F_MST_012001.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_012001.cs
  5. * 2.功能描述:票据信息一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/01/26 1.00 新建
  9. * 周兴 2016/03/11 1.00 编辑
  10. *******************************************************************************/
  11. using System;
  12. using System.Data;
  13. using System.Reflection;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. using Dongke.WinForm.Controls;
  20. namespace Dongke.IBOSS.PRD.Client.Controls
  21. {
  22. public partial class F_MST_012001 : DKDockPanelBase
  23. {
  24. #region 静态变量
  25. /// <summary>
  26. /// 条码打印模板
  27. /// </summary>
  28. public static string TITLE_F_MST_012001 = "条码打印模板";
  29. /// <summary>
  30. /// 新建条码打印模板
  31. /// </summary>
  32. public static string TITLE_F_MST_012001_ADD = "新建条码打印模板";
  33. /// <summary>
  34. /// 编辑条码打印模板
  35. /// </summary>
  36. public static string TITLE_F_MST_012001_EDIT = "编辑条码打印模板";
  37. /// <summary>
  38. /// 新建条码打印模板-{0}
  39. /// </summary>
  40. public static string TITLE_F_MST_012001_NEW = "新建条码打印模板-{0}";
  41. /// <summary>
  42. /// 编辑条码打印模板-{0}
  43. /// </summary>
  44. public static string TITLE_F_MST_012002_EDIT = "编辑条码打印模板-{0}";
  45. #endregion
  46. #region 成员变量
  47. private ClientRequestEntity _clientRequestEntity = null; // 查询条件实体
  48. private int _invoiceLayoutID; // 票据格式ID
  49. //private int _selectedRowIndex; // 记录当前选择行的索引
  50. private static F_MST_012001 _instance = null; // 窗体单例模式
  51. #endregion
  52. #region 构造函数
  53. public F_MST_012001()
  54. {
  55. InitializeComponent();
  56. // 窗口标题
  57. this.Text = F_MST_012001.TITLE_F_MST_012001;
  58. // 工具栏按钮文本赋值
  59. this.tsbtnAddInvoice.Text = ButtonText.TSBTN_ADD;
  60. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  61. this.tsbtnEditInvoice.Text = "编辑格式(&L)";
  62. this.tsbtnPreviewInvoice.Text = "预览(&P)";
  63. this.tsbtnDelete.Text = ButtonText.TSBTN_DELETE;
  64. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  65. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  66. //this.tsbtnExport.Text = ButtonText.TSBTN_EXPORT;
  67. //this.tsbtnImport.Text = ButtonText.TSBTN_IMPORT;
  68. // 查询、清空条件按钮文本赋值
  69. this.tsbtnSearch.Text = ButtonText.BTN_SEARCH;
  70. this.tsbtnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  71. // 设置表格不自动创建列
  72. this.dgvInvoice.AutoGenerateColumns = false;
  73. this.chkValueFlag.FlagBoxChecked = FlagCheckBoxChecked.Yes;
  74. // 编辑、导出和预览按钮不可用
  75. this.tsbtnEditInvoice.Enabled = false;
  76. this.tsbtnEdit.Enabled = false;
  77. this.tsbtnPreviewInvoice.Enabled = false;
  78. this.tsbtnExport.Enabled = false;
  79. this.tsbtnDelete.Enabled = false;
  80. }
  81. #endregion
  82. #region 单例模式
  83. /// <summary>
  84. /// 单例模式,防止重复创建窗体
  85. /// </summary>
  86. public static F_MST_012001 Instance
  87. {
  88. get
  89. {
  90. if (_instance == null)
  91. {
  92. _instance = new F_MST_012001();
  93. }
  94. return _instance;
  95. }
  96. }
  97. #endregion
  98. #region 控件事件
  99. /// <summary>
  100. /// 画面打开
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void F_MST_012001_Load(object sender, EventArgs e)
  105. {
  106. try
  107. {
  108. DataSet logoInfo = SystemModuleProxy.Service.GetLogoInfo();
  109. if (logoInfo != null && logoInfo.Tables.Count > 0)
  110. {
  111. this.ckcLogo.DataSource = logoInfo.Tables[0];
  112. this.ckcLogo.DisplayMember = "LogoNameCode";
  113. this.ckcLogo.ValueMember = "LogoID";
  114. }
  115. }
  116. catch (Exception ex)
  117. {
  118. // 对异常进行共通处理
  119. ExceptionManager.HandleEventException(this.ToString(),
  120. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  121. }
  122. }
  123. /// <summary>
  124. /// 画面关闭
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void F_MST_012001_FormClosed(object sender, FormClosedEventArgs e)
  129. {
  130. _instance = null;
  131. }
  132. /// <summary>
  133. /// 查询
  134. /// </summary>
  135. /// <param name="sender"></param>
  136. /// <param name="e"></param>
  137. private void tsbtnSearch_Click(object sender, EventArgs e)
  138. {
  139. try
  140. {
  141. this.QueryDataFromOther();
  142. }
  143. catch (Exception ex)
  144. {
  145. // 对异常进行共通处理
  146. ExceptionManager.HandleEventException(this.ToString(),
  147. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  148. }
  149. }
  150. /// <summary>
  151. /// 清空查询条件
  152. /// </summary>
  153. /// <param name="sender"></param>
  154. /// <param name="e"></param>
  155. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  156. {
  157. this.ClearConditions();
  158. }
  159. /// <summary>
  160. /// 点击新建票据按钮,新建票据
  161. /// </summary>
  162. /// <param name="sender"></param>
  163. /// <param name="e"></param>
  164. private void tsbtnAddInvoice_Click(object sender, System.EventArgs e)
  165. {
  166. try
  167. {
  168. F_MST_012002 frm012002 = new F_MST_012002();
  169. DialogResult dialogresult = frm012002.ShowDialog();
  170. if (DialogResult.OK == dialogresult)
  171. {
  172. QueryDataFromOther();
  173. }
  174. }
  175. catch (Exception ex)
  176. {
  177. // 对异常进行共通处理
  178. ExceptionManager.HandleEventException(this.ToString(),
  179. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  180. }
  181. }
  182. /// <summary>
  183. /// 点击编辑按钮,编辑现有票据基本信息
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. private void tsbtnEdit_Click(object sender, EventArgs e)
  188. {
  189. try
  190. {
  191. // 获取活动行
  192. DataGridViewRow currentRow = this.dgvInvoice.CurrentRow;
  193. if (currentRow != null)
  194. {
  195. this._invoiceLayoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
  196. // 弹出填写票据基本信息窗体
  197. F_MST_012004 frmI012004 = new F_MST_012004();
  198. frmI012004.LayoutID = this._invoiceLayoutID;
  199. frmI012004.FromForm = 3;
  200. DialogResult dialogResult = frmI012004.ShowDialog();
  201. if (DialogResult.OK == dialogResult)
  202. {
  203. QueryDataFromOther();
  204. }
  205. }
  206. }
  207. catch (Exception ex)
  208. {
  209. // 对异常进行共通处理
  210. ExceptionManager.HandleEventException(this.ToString(),
  211. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  212. }
  213. }
  214. /// <summary>
  215. /// 点击编辑票据格式按钮,编辑现有的票据格式
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. private void tsbtnEditInvoice_Click(object sender, System.EventArgs e)
  220. {
  221. try
  222. {
  223. // 获取活动行
  224. DataGridViewRow currentRow = this.dgvInvoice.CurrentRow;
  225. if (currentRow != null)
  226. {
  227. this._invoiceLayoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
  228. // 给票据编辑画面赋值,并打开
  229. F_MST_012003 frm012003 = new F_MST_012003(this._invoiceLayoutID);
  230. if (DialogResult.OK == frm012003.ShowDialog())
  231. {
  232. QueryDataFromOther();
  233. }
  234. }
  235. }
  236. catch (Exception ex)
  237. {
  238. // 对异常进行共通处理
  239. ExceptionManager.HandleEventException(this.ToString(),
  240. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  241. }
  242. }
  243. /// <summary>
  244. /// 预览票据按钮按下
  245. /// </summary>
  246. /// <param name="sender"></param>
  247. /// <param name="e"></param>
  248. private void tsbtnPreviewInvoice_Click(object sender, EventArgs e)
  249. {
  250. try
  251. {
  252. // 获取活动行
  253. DataGridViewRow currentRow = this.dgvInvoice.CurrentRow;
  254. if (currentRow != null)
  255. {
  256. // 给票据预览画面赋值,并打开
  257. F_MST_012005 frm012005 = new F_MST_012005();
  258. frm012005.LayoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
  259. frm012005.ShowDialog();
  260. }
  261. }
  262. catch (Exception ex)
  263. {
  264. // 对异常进行共通处理
  265. ExceptionManager.HandleEventException(this.ToString(),
  266. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  267. }
  268. }
  269. /// <summary>
  270. /// 点击删除按钮
  271. /// </summary>
  272. /// <param name="sender"></param>
  273. /// <param name="e"></param>
  274. private void tsbtnDelete_Click(object sender, EventArgs e)
  275. {
  276. try
  277. {
  278. // 获取活动行
  279. DataGridViewRow currentRow = this.dgvInvoice.CurrentRow;
  280. if (currentRow != null)
  281. {
  282. DialogResult dr = MessageBox.Show("是否删除当前选择条码打印模板。", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  283. if (dr != System.Windows.Forms.DialogResult.Yes)
  284. {
  285. return;
  286. }
  287. int layoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
  288. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  289. {
  290. ClientRequestEntity cre = new ClientRequestEntity();
  291. cre.NameSpace = "InvoiceLayout";
  292. cre.Name = "DeleteBarCodePrintLayout";
  293. cre.Properties["LayoutID"] = layoutID;
  294. return SystemModuleProxy.Service.DoBarCodePrint(cre);
  295. }
  296. );
  297. if (sre.Status == Dongke.IBOSS.PRD.Basics.BaseResources.Constant.ServiceResultStatus.Success)
  298. {
  299. MessageBox.Show(string.Format("{0}的{1}操作成功完成了。", "条码打印模板", "删除"),
  300. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  301. QueryDataFromOther();
  302. }
  303. }
  304. else
  305. {
  306. MessageBox.Show("没有选择任何条码打印模板。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  307. }
  308. }
  309. catch (Exception ex)
  310. {
  311. // 对异常进行共通处理
  312. ExceptionManager.HandleEventException(this.ToString(),
  313. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  314. }
  315. }
  316. /// <summary>
  317. /// 票据的导出
  318. /// </summary>
  319. /// <param name="sender"></param>
  320. /// <param name="e"></param>
  321. private void tsbtnExport_Click(object sender, EventArgs e)
  322. {
  323. try
  324. {
  325. // 获取活动行
  326. //DataGridViewRow currentRow = this.dgvInvoice.CurrentRow;
  327. //if (currentRow != null)
  328. //{
  329. // _invoiceLayoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
  330. // // 准备打开保存文件对话框
  331. // SaveFileDialog saveFileDialogExport = new SaveFileDialog();
  332. // saveFileDialogExport.Filter = "东科票据文件(*.DK)|*.DK";
  333. // saveFileDialogExport.Title = "导出票据格式";
  334. // saveFileDialogExport.FileName = currentRow.Cells["LayoutName"].Value.ToString();
  335. // saveFileDialogExport.RestoreDirectory = true;
  336. // if (DialogResult.OK == saveFileDialogExport.ShowDialog())
  337. // {
  338. // ServiceResultEntity resultEntity;
  339. // bool result = this.DoAsync<ServiceResultEntity>(() =>
  340. // {
  341. // return this.GetInvoiceData(this._invoiceLayoutID);
  342. // }, out resultEntity);
  343. // DataSet LayoutDataSet = resultEntity.Data;
  344. // SoapFormatter formatter = new SoapFormatter();
  345. // FileStream stream = new FileStream(saveFileDialogExport.FileName, FileMode.Create, FileAccess.Write);
  346. // formatter.Serialize(stream, LayoutDataSet);
  347. // stream.Close();
  348. // MessageBox.Show("票据格式导出成功",
  349. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  350. // }
  351. //}
  352. }
  353. catch (Exception ex)
  354. {
  355. // 对异常进行共通处理
  356. ExceptionManager.HandleEventException(this.ToString(),
  357. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  358. }
  359. }
  360. /// <summary>
  361. /// 票据的导入
  362. /// </summary>
  363. /// <param name="sender"></param>
  364. /// <param name="e"></param>
  365. private void tsbtnImport_Click(object sender, EventArgs e)
  366. {
  367. try
  368. {
  369. //OpenFileDialog ofdOpenFile = new OpenFileDialog();
  370. //ofdOpenFile.InitialDirectory = Environment.SpecialFolder.MyComputer.ToString();
  371. //ofdOpenFile.Title = "选择导入文件";
  372. //ofdOpenFile.Filter = "东科票据文件(*.DK)|*.DK";
  373. //ofdOpenFile.CheckFileExists = true;
  374. //ofdOpenFile.CheckPathExists = true;
  375. //ofdOpenFile.ValidateNames = true;
  376. //if (DialogResult.OK == ofdOpenFile.ShowDialog())
  377. //{
  378. // if (!string.IsNullOrEmpty(ofdOpenFile.FileName))
  379. // {
  380. // SoapFormatter formatter = new SoapFormatter();
  381. // FileStream stream = new FileStream(ofdOpenFile.FileName, FileMode.Open, FileAccess.Read);
  382. // DataSet readData = (DataSet)formatter.Deserialize(stream);
  383. // stream.Close();
  384. // // 弹出填写票据基本信息窗体
  385. // F_MST_012004 frmI012004 = new F_MST_012004();
  386. // frmI012004.InvoiceName = readData.Tables[0].Rows[0]["LayoutName"].ToString();
  387. // frmI012004.InvoiceType = readData.Tables[0].Rows[0]["InvoiceCode"].ToString();
  388. // frmI012004.FromForm = 2;
  389. // DialogResult dialogResult = frmI012004.ShowDialog();
  390. // if (DialogResult.OK == dialogResult)
  391. // {
  392. // // 插入数据库数据
  393. // readData.Tables[0].Rows[0]["OrganizationID"] = frmI012004.OrganizationID;
  394. // readData.Tables[0].Rows[0]["OrganizationCode"] = frmI012004.OrganizationCode;
  395. // readData.Tables[0].Rows[0]["OrganizationName"] = frmI012004.OrganizationName;
  396. // readData.Tables[0].Rows[0]["OrganizationFullName"] = "";
  397. // readData.Tables[0].Rows[0]["Remarks"] = "导入票据格式";
  398. // readData.Tables[0].Rows[0]["LayoutName"] = frmI012004.InvoiceName;
  399. // ServiceResultEntity resultEntity2;
  400. // bool result = this.DoAsync<ServiceResultEntity>(() =>
  401. // {
  402. // return this.SaveAddLayoutData(readData);
  403. // }, out resultEntity2);
  404. // int invoiceLayoutID = Convert.ToInt32(resultEntity2.Result);// this.SaveAddLayoutData(readData);
  405. // if (invoiceLayoutID > 0)
  406. // {
  407. // MessageBox.Show(string.Format("{0}的{1}操作成功完成了。", "票据格式", "票据导入"),
  408. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  409. // int[] IDList = new int[] { invoiceLayoutID };
  410. // // 查询时先清空数据源
  411. // this.dgvInvoice.DataSource = null;
  412. // this.tsbtnEditInvoice.Enabled = false;
  413. // this.tsbtnEdit.Enabled = false;
  414. // this.tsbtnPreviewInvoice.Enabled = false;
  415. // this.tsbtnExport.Enabled = false;
  416. // this.tsbtnDelete.Enabled = false;
  417. // SearchSelectEntity();
  418. // ServiceResultEntity resultEntity;
  419. // result = this.DoAsync<ServiceResultEntity>(() =>
  420. // {
  421. // return this.GetInvoiceLayout();
  422. // }, out resultEntity);
  423. // DataSet invoiceInfo = resultEntity.Data;
  424. // if (invoiceInfo != null && invoiceInfo.Tables.Count > 0
  425. // && invoiceInfo.Tables[0].Rows.Count > 0)
  426. // {
  427. // this.dgvInvoice.DataSource = invoiceInfo.Tables[0];
  428. // // 设置编辑按钮可用
  429. // this.tsbtnEditInvoice.Enabled = true;
  430. // this.tsbtnEdit.Enabled = true;
  431. // this.tsbtnPreviewInvoice.Enabled = true;
  432. // this.tsbtnExport.Enabled = true;
  433. // this.tsbtnDelete.Enabled = true;
  434. // }
  435. // }
  436. // else
  437. // {
  438. // MessageBox.Show(string.Format("{0}的{1}操作没有更新任何数据,请确认该数据是否存在。", "导入票据", "保存"),
  439. // this.Text,
  440. // MessageBoxButtons.OK,
  441. // MessageBoxIcon.Warning);
  442. // }
  443. // }
  444. // }
  445. //}
  446. }
  447. catch (Exception ex)
  448. {
  449. // 对异常进行共通处理
  450. ExceptionManager.HandleEventException(this.ToString(),
  451. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  452. }
  453. }
  454. /// <summary>
  455. /// 单击自适应列宽,将所有的列宽都自动去适应内容
  456. /// </summary>
  457. /// <param name="sender"></param>
  458. /// <param name="e"></param>
  459. private void tsbtnAdaptive_Click(object sender, System.EventArgs e)
  460. {
  461. this.dgvInvoice.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  462. }
  463. /// <summary>
  464. /// KeyDown事件
  465. /// </summary>
  466. /// <param name="sender"></param>
  467. /// <param name="e"></param>
  468. private void dgvInvoice_KeyDown(object sender, KeyEventArgs e)
  469. {
  470. try
  471. {
  472. if (e.KeyData == (Keys.Control | Keys.C))
  473. {
  474. if (dgvInvoice.CurrentRow != null
  475. && !string.IsNullOrEmpty(dgvInvoice.CurrentRow.Cells
  476. [dgvInvoice.CurrentCell.ColumnIndex].EditedFormattedValue + ""))
  477. {
  478. try
  479. {
  480. Clipboard.SetText(dgvInvoice.CurrentRow.Cells
  481. [dgvInvoice.CurrentCell.ColumnIndex].EditedFormattedValue + "");
  482. }
  483. catch { }
  484. }
  485. }
  486. }
  487. catch (Exception ex)
  488. {
  489. // 对异常进行共通处理
  490. ExceptionManager.HandleEventException(this.ToString(),
  491. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  492. }
  493. }
  494. /// <summary>
  495. /// 关闭页面
  496. /// </summary>
  497. /// <param name="sender"></param>
  498. /// <param name="e"></param>
  499. private void tsbtnClose_Click(object sender, EventArgs e)
  500. {
  501. this.Close();
  502. }
  503. /// <summary>
  504. /// 所选数据发生改变时
  505. /// </summary>
  506. /// <param name="sender"></param>
  507. /// <param name="e"></param>
  508. private void dgvInvoice_SelectionChanged(object sender, EventArgs e)
  509. {
  510. try
  511. {
  512. if (this.dgvInvoice.CurrentCell == null
  513. || this.dgvInvoice.SelectedRows.Count == 0)
  514. {
  515. this.tsbtnEditInvoice.Enabled = false;
  516. this.tsbtnEdit.Enabled = false;
  517. this.tsbtnExport.Enabled = false;
  518. this.tsbtnPreviewInvoice.Enabled = false;
  519. this.tsbtnDelete.Enabled = false;
  520. }
  521. else
  522. {
  523. if (!this.tsbtnEditInvoice.Enabled)
  524. {
  525. this.tsbtnEditInvoice.Enabled = true;
  526. }
  527. if (!this.tsbtnEdit.Enabled)
  528. {
  529. this.tsbtnEdit.Enabled = true;
  530. }
  531. if (!this.tsbtnPreviewInvoice.Enabled)
  532. {
  533. this.tsbtnPreviewInvoice.Enabled = true;
  534. }
  535. if (!this.tsbtnExport.Enabled)
  536. {
  537. this.tsbtnExport.Enabled = true;
  538. }
  539. this.tsbtnDelete.Enabled = true;
  540. }
  541. }
  542. catch (Exception ex)
  543. {
  544. // 对异常进行共通处理
  545. ExceptionManager.HandleEventException(this.ToString(),
  546. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  547. }
  548. }
  549. /// <summary>
  550. /// 双击进入编辑页面
  551. /// </summary>
  552. /// <param name="sender"></param>
  553. /// <param name="e"></param>
  554. private void dgvInvoice_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  555. {
  556. if (-1 < e.RowIndex && -1 < e.ColumnIndex && this.tsbtnEditInvoice.Enabled)
  557. {
  558. this.tsbtnEditInvoice_Click(sender, e);
  559. }
  560. }
  561. #endregion
  562. #region 重写方法
  563. /// <summary>
  564. /// 查询数据
  565. /// </summary>
  566. /// <returns>验证通过true,其他false</returns>
  567. private void QueryDataFromOther()
  568. {
  569. try
  570. {
  571. this.SearchSelectEntity();
  572. this.dgvInvoice.DataSource = null;
  573. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  574. {
  575. return SystemModuleProxy.Service.DoBarCodePrint(this._clientRequestEntity);
  576. }
  577. );
  578. if (sre.Status == Constant.ServiceResultStatus.Success)
  579. {
  580. // 查询成功
  581. this.dgvInvoice.DataSource = sre.Data.Tables[0];
  582. if (sre.Data.Tables[0].Rows.Count > 0)
  583. {
  584. this.dgvInvoice.Rows[0].Selected = true;
  585. }
  586. }
  587. }
  588. catch (Exception ex)
  589. {
  590. throw ex;
  591. }
  592. }
  593. /// <summary>
  594. /// 清除查询条件
  595. /// </summary>
  596. public void ClearConditions()
  597. {
  598. this.txtInvoiceName.Text = string.Empty;
  599. this.scbGoodsType.ClearValue();
  600. this.txtRemarks.Text = string.Empty;
  601. this.chkValueFlag.FlagBoxChecked = FlagCheckBoxChecked.Yes;
  602. this.ckcLogo.ClearValue();
  603. }
  604. #endregion
  605. #region 私有方法
  606. /// <summary>
  607. /// 获取查询实体
  608. /// </summary>
  609. private void SearchSelectEntity()
  610. {
  611. this._clientRequestEntity = new ClientRequestEntity();
  612. this._clientRequestEntity.NameSpace = "InvoiceLayout";
  613. this._clientRequestEntity.Name = "GetBarCodePrintLayoutList";
  614. // 模板名称
  615. this._clientRequestEntity.Properties["layoutname"] = this.txtInvoiceName.Text.Trim();
  616. this._clientRequestEntity.Properties["remarks"] = this.txtRemarks.Text.Trim();
  617. this._clientRequestEntity.Properties["goodstypecode"] = scbGoodsType.SearchedValue;
  618. if (this.ckcLogo.CheckedValues.Length > 0)
  619. {
  620. this._clientRequestEntity.Properties["logos"] = "," + this.ckcLogo.CheckedValue + ",";
  621. }
  622. // 正常标识
  623. if (this.chkValueFlag.FlagBoxChecked == FlagCheckBoxChecked.Yes)
  624. {
  625. this._clientRequestEntity.Properties["valueflag"] = "1";
  626. }
  627. else if (this.chkValueFlag.FlagBoxChecked == FlagCheckBoxChecked.No)
  628. {
  629. this._clientRequestEntity.Properties["valueflag"] = "0";
  630. }
  631. }
  632. #endregion
  633. }
  634. }