F_MST_013001.cs 21 KB

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