Commit 4162a502 authored by 李佳's avatar 李佳

...

parent 5b76b879
......@@ -55,6 +55,7 @@
this.label1 = new System.Windows.Forms.Label();
this.lblStatus = new System.Windows.Forms.Label();
this.chkMacNumber = new System.Windows.Forms.CheckBox();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.gbxMachine.SuspendLayout();
this.SuspendLayout();
//
......@@ -63,6 +64,7 @@
this.gbxMachine.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gbxMachine.Controls.Add(this.linkLabel2);
this.gbxMachine.Controls.Add(this.label7);
this.gbxMachine.Controls.Add(this.linkLabel1);
this.gbxMachine.Controls.Add(this.textBox2);
......@@ -358,6 +360,18 @@
this.chkMacNumber.UseVisualStyleBackColor = true;
this.chkMacNumber.CheckedChanged += new System.EventHandler(this.chkMacNumber_CheckedChanged);
//
// linkLabel2
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linkLabel2.Location = new System.Drawing.Point(455, 41);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(67, 14);
this.linkLabel2.TabIndex = 89;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "导出文件";
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// AutoEncashView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -400,5 +414,6 @@
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.LinkLabel linkLabel2;
}
}
......@@ -9,6 +9,7 @@ using ChuPiao.AutoPrint.Services.AutoEncash;
using ChuPiao.Common.Enums;
using ChuPiao.Common.Models;
using ChuPiao.AutoPrint.Desktop.Properties;
using System.IO;
namespace ChuPiao.AutoPrint.Desktop.AutoEncash
{
......@@ -355,5 +356,46 @@ namespace ChuPiao.AutoPrint.Desktop.AutoEncash
}
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (this.lvwTicket.CheckedItems.Count == 0)
{
MessageBox.Show("请选择要导出的记录!");
return;
}
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择导出文件到哪个目录";
//dialog.RootFolder = Environment.SpecialFolder.Programs;
if (dialog.ShowDialog() == DialogResult.OK)
{
string prnPath = Path.Combine(dialog.SelectedPath, _service.LotMachine.MachineInfo.M_Number+"_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
if (!Directory.Exists(prnPath))
{
Directory.CreateDirectory(prnPath);
}
string ticketFilePath;
foreach (ListViewItem item in this.lvwTicket.CheckedItems)
{
L_LotTicketEntity entity = item.Tag as L_LotTicketEntity;
ticketFilePath = Path.Combine(prnPath, entity.L_TicketCode + ".prn");
try
{
File.WriteAllText(ticketFilePath, entity.L_PrnText);
LoggingService.Info(string.Concat("导出电子票文件:", ticketFilePath));
}
catch (Exception exception)
{
LoggingService.Warn(string.Concat(ticketFilePath, "导出电子票文件异常。错误信息:", exception.ToString()));
}
}
}
}
}
}
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment