F_MST_013005.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_013005.cs
  5. * 2.功能描述:新票据信息操作
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/02/18 1.00 新建
  9. * 周兴 2016/03/11 1.00 编辑
  10. *******************************************************************************/
  11. using System;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.WCF.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.WinForm.Controls;
  18. using Dongke.WinForm.Controls.InvoiceLayout;
  19. namespace Dongke.IBOSS.PRD.Client.Controls
  20. {
  21. public partial class F_MST_013005 : DKFormBase
  22. {
  23. #region 成员变量
  24. private ClientRequestEntity _clientRequestEntity = new ClientRequestEntity();
  25. #endregion
  26. #region 属性
  27. /// <summary>
  28. /// 模板ID
  29. /// </summary>
  30. public int LayoutID
  31. {
  32. get;
  33. set;
  34. }
  35. /// <summary>
  36. /// 模板名称
  37. /// </summary>
  38. public string LayoutName
  39. {
  40. get;
  41. set;
  42. }
  43. /// <summary>
  44. /// 产品类别名
  45. /// </summary>
  46. public string GoodsTypeName
  47. {
  48. get;
  49. set;
  50. }
  51. /// <summary>
  52. /// 产品商标名
  53. /// </summary>
  54. public string LogoName
  55. {
  56. get;
  57. set;
  58. }
  59. /// <summary>
  60. /// 纸张大小
  61. /// </summary>
  62. public string PageSizeName
  63. {
  64. get;
  65. set;
  66. }
  67. /// <summary>
  68. /// 备注
  69. /// </summary>
  70. public string Remarks
  71. {
  72. get;
  73. set;
  74. }
  75. /// <summary>
  76. /// 打印模板
  77. /// </summary>
  78. public byte[] LayoutData
  79. {
  80. get;
  81. set;
  82. }
  83. #endregion
  84. #region 构造函数
  85. /// <summary>
  86. /// 构造函数
  87. /// </summary>
  88. /// <param name="invoiceLayoutID">票据格式ID</param>
  89. public F_MST_013005()
  90. {
  91. InitializeComponent();
  92. this.printDialog.Document = lbxPreview.PrintDocument;
  93. this.pageSetupDialog.Document = lbxPreview.PrintDocument;
  94. this.InitializeControlText();
  95. }
  96. #endregion
  97. #region 控件事件
  98. /// <summary>
  99. /// 页面加载
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void F_INV_0303_Load(object sender, System.EventArgs e)
  104. {
  105. try
  106. {
  107. // 多张打印设置不可用
  108. //this.gbxMultiPrint.Enabled = false;
  109. // 加载票据格式基本信息
  110. this.LoadInvoiceLayout();
  111. // 加载实例数据
  112. this.LoadInvoiceData();
  113. // 设置翻页按钮可用状态
  114. this.SetMoveButtonEnable();
  115. }
  116. catch (Exception ex)
  117. {
  118. // 对异常进行共通处理
  119. ExceptionManager.HandleEventException(this.ToString(),
  120. System.Reflection.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 tsbtnPageSetting_Click(object sender, System.EventArgs e)
  129. {
  130. try
  131. {
  132. this.pageSetupDialog.ShowDialog();
  133. }
  134. catch (Exception ex)
  135. {
  136. // 对异常进行共通处理
  137. ExceptionManager.HandleEventException(this.ToString(),
  138. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  139. }
  140. }
  141. /// <summary>
  142. /// 打印机设置
  143. /// </summary>
  144. /// <param name="sender"></param>
  145. /// <param name="e"></param>
  146. private void tsbtnPrinterSetting_Click(object sender, System.EventArgs e)
  147. {
  148. try
  149. {
  150. this.printDialog.ShowDialog();
  151. }
  152. catch (Exception ex)
  153. {
  154. // 对异常进行共通处理
  155. ExceptionManager.HandleEventException(this.ToString(),
  156. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  157. }
  158. }
  159. /// <summary>
  160. /// 票据打印预览按钮按下
  161. /// </summary>
  162. /// <param name="sender"></param>
  163. /// <param name="e"></param>
  164. private void tsbtnPrintPreview_Click(object sender, System.EventArgs e)
  165. {
  166. try
  167. {
  168. if (lbxPreview.DataSource != null)
  169. {
  170. DataSet ds = lbxPreview.DataSource as DataSet;
  171. lbxPreview.PrintDataSource = ds.Copy();
  172. lbxPreview.PrintDataMember = lbxPreview.DataMember;
  173. }
  174. lbxPreview.PrintAreaVisible = true;
  175. lbxPreview.PrintBackground = cbxBackground.Checked;
  176. // 纸张方向
  177. lbxPreview.Landscape = pageSetupDialog.PageSettings.Landscape;
  178. // 单张
  179. if (this.rbtnSinglePrint.Checked)
  180. {
  181. // 左边余白
  182. lbxPreview.PrintOffsetX = (float)nmrToRight.Value;
  183. // 上边余白
  184. lbxPreview.PrintOffsetY = (float)nmrToBottom.Value;
  185. // 打印份数
  186. lbxPreview.NumberOfCopies = (int)nmrPrintCopy.Value;
  187. lbxPreview.PrintPreview();
  188. }
  189. // 多张打印
  190. else
  191. {
  192. // 打印份数
  193. lbxPreview.NumberOfCopies = (int)nmrPrintRecord.Value;
  194. // 跳过页数
  195. lbxPreview.AllocationSkipCount = (int)nmrSkip.Value;
  196. // 横向个数
  197. lbxPreview.AllocationNumX = (int)nmrHorizontal.Value;
  198. // 纵向个数
  199. lbxPreview.AllocationNumY = (int)nmrVertical.Value;
  200. // 纵向间隔
  201. lbxPreview.AllocationVirticalSpace = (float)nmrVerticalSpace.Value;
  202. // 横向间隔
  203. lbxPreview.AllocationHorizontalSpace = (float)nmrHorizontalSpace.Value;
  204. // 左边余白
  205. lbxPreview.MarginLeft = (float)nmrLeft.Value;
  206. // 右边余白
  207. lbxPreview.MarginRight = (float)nmrRight.Value;
  208. // 上边余白
  209. lbxPreview.MarginTop = (float)nmrUpper.Value;
  210. // 下边余白
  211. lbxPreview.MarginBottom = (float)nmrBottom.Value;
  212. lbxPreview.AllocationPrintPreview();
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. // 对异常进行共通处理
  218. ExceptionManager.HandleEventException(this.ToString(),
  219. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  220. }
  221. }
  222. /// <summary>
  223. /// 打印按钮按下
  224. /// </summary>
  225. /// <param name="sender"></param>
  226. /// <param name="e"></param>
  227. private void tsbtnPrint_Click(object sender, System.EventArgs e)
  228. {
  229. try
  230. {
  231. if (lbxPreview.DataSource != null)
  232. {
  233. // 设置打印的数据源
  234. DataSet ds = lbxPreview.DataSource as DataSet;
  235. lbxPreview.PrintDataSource = ds.Copy();
  236. lbxPreview.PrintDataMember = lbxPreview.DataMember;
  237. }
  238. // 背景否打印
  239. lbxPreview.PrintAreaVisible = true;
  240. lbxPreview.PrintBackground = cbxBackground.Checked;
  241. // 打印时不打印虚线
  242. this.lbxPreview.PrintAreaVisible = false;
  243. // 纸张方向
  244. lbxPreview.Landscape = pageSetupDialog.PageSettings.Landscape;
  245. // 单张
  246. if (this.rbtnSinglePrint.Checked)
  247. {
  248. // 左边余白
  249. lbxPreview.PrintOffsetX = (float)nmrToRight.Value;
  250. // 上边余白
  251. lbxPreview.PrintOffsetY = (float)nmrToBottom.Value;
  252. // 打印份数
  253. lbxPreview.NumberOfCopies = (int)nmrPrintCopy.Value;
  254. lbxPreview.Print();
  255. }
  256. // 多张打印
  257. else
  258. {
  259. // 打印份数
  260. lbxPreview.NumberOfCopies = (int)nmrPrintRecord.Value;
  261. // 跳过页数
  262. lbxPreview.AllocationSkipCount = (int)nmrSkip.Value;
  263. // 横向个数
  264. lbxPreview.AllocationNumX = (int)nmrHorizontal.Value;
  265. // 纵向个数
  266. lbxPreview.AllocationNumY = (int)nmrVertical.Value;
  267. // 纵向间隔
  268. lbxPreview.AllocationVirticalSpace = (float)nmrVerticalSpace.Value;
  269. // 横向间隔
  270. lbxPreview.AllocationHorizontalSpace = (float)nmrHorizontalSpace.Value;
  271. // 左边余白
  272. lbxPreview.MarginLeft = (float)nmrLeft.Value;
  273. // 右边余白
  274. lbxPreview.MarginRight = (float)nmrRight.Value;
  275. // 上边余白
  276. lbxPreview.MarginTop = (float)nmrUpper.Value;
  277. // 下边余白
  278. lbxPreview.MarginBottom = (float)nmrBottom.Value;
  279. lbxPreview.AllocationPrint();
  280. }
  281. //// 更新打印次数
  282. //ServiceResultEntity resultEntity = null;
  283. //// 异步提交信息,进行数据库操作
  284. //bool result = this.DoAsync<ServiceResultEntity>(() =>
  285. //{
  286. // return this.SetUpdatePrintTimes();
  287. //}, out resultEntity);
  288. //if (result)
  289. //{
  290. // if (resultEntity.Status == ServiceResultStatus.Success)
  291. // {
  292. // MessageBox.Show(string.Format(Dongke.IBOSS.PRD.Basics.BaseResources.Constant.I_CMN_C_002, this.Text, "打印"),
  293. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  294. // this.DialogResult = System.Windows.Forms.DialogResult.OK;
  295. // this.Close();
  296. // }
  297. // else
  298. // {
  299. // StateMessageClass.GetErrorMessageByStatus(this, resultEntity.Status);
  300. // }
  301. //}
  302. }
  303. catch (Exception ex)
  304. {
  305. // 对异常进行共通处理
  306. ExceptionManager.HandleEventException(this.ToString(),
  307. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  308. }
  309. }
  310. /// <summary>
  311. /// 移动到第一页
  312. /// </summary>
  313. /// <param name="sender"></param>
  314. /// <param name="e"></param>
  315. private void tsbtnFirst_Click(object sender, System.EventArgs e)
  316. {
  317. try
  318. {
  319. lbxPreview.SetPageNum(1);
  320. this.SetMoveButtonEnable();
  321. }
  322. catch (Exception ex)
  323. {
  324. // 对异常进行共通处理
  325. ExceptionManager.HandleEventException(this.ToString(),
  326. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  327. }
  328. }
  329. /// <summary>
  330. /// 移动到前一页
  331. /// </summary>
  332. /// <param name="sender"></param>
  333. /// <param name="e"></param>
  334. private void tsbtnPrevious_Click(object sender, System.EventArgs e)
  335. {
  336. try
  337. {
  338. lbxPreview.SetPageNum(lbxPreview.CurrentPageNum - 1);
  339. this.SetMoveButtonEnable();
  340. }
  341. catch (Exception ex)
  342. {
  343. // 对异常进行共通处理
  344. ExceptionManager.HandleEventException(this.ToString(),
  345. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  346. }
  347. }
  348. /// <summary>
  349. /// 移动到下一页
  350. /// </summary>
  351. /// <param name="sender"></param>
  352. /// <param name="e"></param>
  353. private void tsbtnNext_Click(object sender, System.EventArgs e)
  354. {
  355. try
  356. {
  357. lbxPreview.SetPageNum(lbxPreview.CurrentPageNum + 1);
  358. this.SetMoveButtonEnable();
  359. }
  360. catch (Exception ex)
  361. {
  362. // 对异常进行共通处理
  363. ExceptionManager.HandleEventException(this.ToString(),
  364. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  365. }
  366. }
  367. /// <summary>
  368. /// 移动到最后一页
  369. /// </summary>
  370. /// <param name="sender"></param>
  371. /// <param name="e"></param>
  372. private void tsbtnLast_Click(object sender, System.EventArgs e)
  373. {
  374. try
  375. {
  376. lbxPreview.SetPageNum(lbxPreview.TotalPageNum);
  377. this.SetMoveButtonEnable();
  378. }
  379. catch (Exception ex)
  380. {
  381. // 对异常进行共通处理
  382. ExceptionManager.HandleEventException(this.ToString(),
  383. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  384. }
  385. }
  386. private void tsbtnClose_Click(object sender, System.EventArgs e)
  387. {
  388. this.Close();
  389. }
  390. /// <summary>
  391. /// 当单张打印选择状态改变后
  392. /// </summary>
  393. /// <param name="sender"></param>
  394. /// <param name="e"></param>
  395. private void rbtnSinglePrint_CheckedChanged(object sender, EventArgs e)
  396. {
  397. this.gbxSinglePrint.Enabled = this.rbtnSinglePrint.Checked;
  398. this.gbxMultiPrint.Enabled = !this.rbtnSinglePrint.Checked;
  399. }
  400. /// <summary>
  401. /// 当多张打印选择状态改变后
  402. /// </summary>
  403. /// <param name="sender"></param>
  404. /// <param name="e"></param>
  405. private void rbtnMultiPrint_CheckedChanged(object sender, EventArgs e)
  406. {
  407. this.gbxSinglePrint.Enabled = !this.rbtnMultiPrint.Checked;
  408. this.gbxMultiPrint.Enabled = this.rbtnMultiPrint.Checked;
  409. }
  410. #endregion
  411. #region 私有函数/方法
  412. /// <summary>
  413. /// 页面初始化给各控件文本赋值
  414. /// </summary>
  415. private void InitializeControlText()
  416. {
  417. // 设置控件的文本内容
  418. this.Text = "模具标签打印预览";
  419. this.tsbtnPageSetting.Text = "页面设置(&G)";
  420. this.tsbtnPrinterSetting.Text = "打印机设置(&R)";
  421. this.tsbtnPrintPreview.Text = "打印预览(&W)";
  422. this.tsbtnPrint.Text = "打印(&P)";
  423. this.tsbtnClose.Text = "关闭(&X)";
  424. }
  425. /// <summary>
  426. /// 设置翻页按钮可用状态
  427. /// </summary>
  428. private void SetMoveButtonEnable()
  429. {
  430. this.tsbtnFirst.Enabled = (this.lbxPreview.CurrentPageNum != 1);
  431. this.tsbtnPrevious.Enabled = (this.lbxPreview.CurrentPageNum != 1);
  432. this.tsbtnNext.Enabled = (this.lbxPreview.CurrentPageNum != this.lbxPreview.TotalPageNum);
  433. this.tsbtnLast.Enabled = (this.lbxPreview.CurrentPageNum != this.lbxPreview.TotalPageNum);
  434. }
  435. private ServiceResultEntity GetInvoiceData(int invoiceLayoutID)
  436. {
  437. try
  438. {
  439. this._clientRequestEntity = new ClientRequestEntity();
  440. this._clientRequestEntity.NameSpace = "MouldLableLayout";
  441. this._clientRequestEntity.Name = "GetMouldLablePrintLayout";
  442. this._clientRequestEntity.Properties["LayoutID"] = invoiceLayoutID;
  443. return SystemModuleProxy.Service.DoBarCodePrint(this._clientRequestEntity);
  444. }
  445. catch (Exception ex)
  446. {
  447. throw ex;
  448. }
  449. }
  450. /// <summary>
  451. /// 更新打印次数
  452. /// </summary>
  453. /// <param name="invoiceLayoutID"></param>
  454. /// <returns></returns>
  455. private ServiceResultEntity SetUpdatePrintTimes()
  456. {
  457. //try
  458. //{
  459. // this._clientRequestEntity = new ClientRequestEntity();
  460. // this._clientRequestEntity.NameSpace = "Common";
  461. // this._clientRequestEntity.Name = "SetUpdatePrintTimes";
  462. // this._clientRequestEntity.OpenTransaction = true;
  463. // this._clientRequestEntity.Properties["InvoiceID"] = this._invoiceID;
  464. // this._clientRequestEntity.Properties["InvoiceCode"] = this._invoiceCode;
  465. // this._clientRequestEntity.Properties["LayoutID"] = this._invoiceLayoutID;
  466. // return CommonModuleProxy.Service.DoRequest(this._clientRequestEntity);
  467. //}
  468. //catch (Exception ex)
  469. //{
  470. // throw ex;
  471. //}
  472. return null;
  473. }
  474. /// <summary>
  475. /// 查询票据项目预览信息
  476. /// </summary>
  477. /// <param name="invoiceLayoutID"></param>
  478. /// <returns></returns>
  479. private ServiceResultEntity GetInvoiceItemData(int invoiceLayoutID)
  480. {
  481. //try
  482. //{
  483. // this._clientRequestEntity = new ClientRequestEntity();
  484. // this._clientRequestEntity.NameSpace = "InvoiceLayout";
  485. // this._clientRequestEntity.Name = "GetInvoiceItemData";
  486. // this._clientRequestEntity.OpenTransaction = false;
  487. // this._clientRequestEntity.Properties["InvoiceLayoutID"] = invoiceLayoutID;
  488. // return SystemModuleProxy.Service.DoRequest(this._clientRequestEntity);
  489. //}
  490. //catch (Exception ex)
  491. //{
  492. // throw ex;
  493. //}
  494. return null;
  495. }
  496. /// <summary>
  497. /// 加载票据格式数据
  498. /// </summary>
  499. private void LoadInvoiceLayout()
  500. {
  501. try
  502. {
  503. if (this.LayoutID > 0)
  504. {
  505. ServiceResultEntity result = this.GetInvoiceData(this.LayoutID);
  506. // 根据ID取得票据格式数据
  507. DataSet LayoutDataSet = result.Data;
  508. if (LayoutDataSet != null && LayoutDataSet.Tables.Count > 1)
  509. {
  510. // 页面项目赋值
  511. if (LayoutDataSet.Tables[0].Rows[0]["goodstypename"] != null || LayoutDataSet.Tables[0].Rows[0]["goodstypename"] != DBNull.Value)
  512. {
  513. this.txtGoodsType.Text = LayoutDataSet.Tables[0].Rows[0]["goodstypename"].ToString() + "【" + LayoutDataSet.Tables[0].Rows[0]["goodstypecode"].ToString() + "】";
  514. }
  515. this.txtInvoiceName.Text = LayoutDataSet.Tables[0].Rows[0]["LayoutName"].ToString();
  516. this.txtRemarks.Text = LayoutDataSet.Tables[0].Rows[0]["Remarks"].ToString();
  517. //this.txtLogo.Text = LayoutDataSet.Tables[0].Rows[0]["LogoName"].ToString();
  518. this.txtInvoiceSize.Text = string.Format("{0:0}mm×{1:0}mm",
  519. LayoutDataSet.Tables[0].Rows[0]["Width"],
  520. LayoutDataSet.Tables[0].Rows[0]["Height"]);
  521. //this._invoiceCode = LayoutDataSet.Tables[0].Rows[0]["InvoiceCode"].ToString();
  522. // Layout格式读取
  523. byte[] bytes = LayoutDataSet.Tables[0].Rows[0]["LayoutData"] as byte[];
  524. if (bytes != null)
  525. {
  526. bool isSuccessed = this.lbxPreview.ReadLayout(bytes);
  527. //if (isSuccessed)
  528. //{
  529. // lbxPreview.LayoutMode = LayoutMode.Preview;
  530. //}
  531. }
  532. }
  533. }
  534. else
  535. {
  536. this.txtGoodsType.Text = this.GoodsTypeName;
  537. this.txtInvoiceName.Text = this.LayoutName;
  538. this.txtRemarks.Text = this.Remarks;
  539. this.txtInvoiceSize.Text = this.PageSizeName;
  540. this.lbxPreview.ReadLayout(this.LayoutData);
  541. }
  542. }
  543. catch (Exception ex)
  544. {
  545. throw ex;
  546. }
  547. }
  548. /// <summary>
  549. /// 加载实例数据
  550. /// </summary>
  551. private void LoadInvoiceData()
  552. {
  553. try
  554. {
  555. //DataSet previewData = new DataSet();
  556. //if (this.DataSource == null)
  557. //{
  558. // previewData = GetPreviewData();
  559. //}
  560. //else
  561. //{
  562. // previewData = this.DataSource;
  563. //}
  564. //this.lbxPreview.DataSource = previewData;
  565. if (this.DataSource != null)
  566. {
  567. this.lbxPreview.LayoutMode = LayoutMode.Preview;
  568. this.lbxPreview.DataSource = this.DataSource;
  569. this.lbxPreview.DataMember = "Data";
  570. // 给列表数据赋值
  571. if (this.lbxPreview.OneGridItem != null)
  572. {
  573. this.lbxPreview.OneGridItem.GridDataMember = "DataDetail";
  574. }
  575. this.lbxPreview.GridDataSource = this.DataSource;
  576. }
  577. else
  578. {
  579. this.lbxPreview.LayoutMode = LayoutMode.Display;
  580. }
  581. }
  582. catch (Exception ex)
  583. {
  584. throw ex;
  585. }
  586. }
  587. /// <summary>
  588. /// 根据票据类型,取得资源文件中的样例数据
  589. /// </summary>
  590. /// <returns></returns>
  591. private DataSet GetPreviewData()
  592. {
  593. try
  594. {
  595. DataSet returnData = null;
  596. ServiceResultEntity result = this.GetInvoiceItemData(this.LayoutID);
  597. // 给数据表重命名
  598. if (result != null && result.Data != null && result.Data.Tables.Count == 2)
  599. {
  600. returnData = result.Data;
  601. returnData.Tables[0].TableName = "Data";
  602. returnData.Tables[1].TableName = "DataDetail";
  603. //// 追加条码列 周兴 先不要todo
  604. //string barcode = returnPreviewData.Tables[0].Rows[0]["InvoiceNo"].ToString();
  605. //returnPreviewData.Tables[0].Columns.Add("Barcode", typeof(Image));
  606. //returnPreviewData.Tables[0].Rows[0]["Barcode"] = Utility.GetCode39Image(barcode);
  607. //// 追加商品图片列
  608. //string samplePhotoFile = @"Dongke.IBOSS.PRD.Client.InvoiceManager.Resources.SamplePhoto.jpg";
  609. //Image imageSample = new Bitmap(asm.GetManifestResourceStream(samplePhotoFile));
  610. //returnPreviewData.Tables[1].Columns.Add("Photo", typeof(Image));
  611. //returnPreviewData.Tables[1].Columns.Add("Barcode", typeof(Image));
  612. //for (int i = 0; i < returnPreviewData.Tables[1].Rows.Count; i++)
  613. //{
  614. // returnPreviewData.Tables[1].Rows[i]["Photo"] = imageSample;
  615. // returnPreviewData.Tables[1].Rows[i]["Barcode"] = Utility.GetCode39Image(barcode);
  616. //}
  617. }
  618. else if (returnData.Tables.Count == 1)
  619. {
  620. returnData = result.Data;
  621. returnData.Tables[0].TableName = "Data";
  622. }
  623. return returnData;
  624. }
  625. catch (Exception ex)
  626. {
  627. throw ex;
  628. }
  629. }
  630. #endregion
  631. }
  632. }