Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage
This commit is contained in:
commit
4e0e102381
3 files changed
+48
-42
No files matched your search
@@ -69,6 +69,36 @@ namespace formula_manage.UserClass
|
|||||||
return new Tuple<bool, string>(flag, msg);
|
return new Tuple<bool, string>(flag, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frxPath">模板</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Tuple<bool, string> Design(string frxPath)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
string msg = "";
|
||||||
|
FastReport.Report report = new FastReport.Report();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
report.Load(frxPath);
|
||||||
|
report.DoublePass = true;
|
||||||
|
|
||||||
|
report.Design();
|
||||||
|
flag = true;
|
||||||
|
msg = "Designer Open";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
msg = ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
report.Dispose();
|
||||||
|
}
|
||||||
|
return new Tuple<bool, string>(flag, msg);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设计
|
/// 设计
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -76,7 +106,7 @@ namespace formula_manage.UserClass
|
|||||||
/// <param name="dicParam">字典参数</param>
|
/// <param name="dicParam">字典参数</param>
|
||||||
/// <param name="dsDataSource">数据源</param>
|
/// <param name="dsDataSource">数据源</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Tuple<bool, string> Design(string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource)
|
public static Tuple<bool, string> Designs(string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource)
|
||||||
{
|
{
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
string msg = "";
|
string msg = "";
|
||||||
@@ -103,7 +133,7 @@ namespace formula_manage.UserClass
|
|||||||
|
|
||||||
report.Design();
|
report.Design();
|
||||||
flag = true;
|
flag = true;
|
||||||
msg = "设计器打开成功";
|
msg = "Designer Open";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
Title="打印设置" Height="500" Width="500" MaxWidth="500">
|
Title="打印设置" Height="500" Width="500" MaxWidth="500">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,35,0,0" TextWrapping="Wrap" Text="打印模板:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,35,0,0" TextWrapping="Wrap" Text="打印模板:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
<TextBox x:Name="Print_path" HorizontalAlignment="Left" Height="20" Margin="90,35,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="285"/>
|
<TextBox x:Name="Print_path" HorizontalAlignment="Left" Height="20" Margin="90,35,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="285" MaxLines="1"/>
|
||||||
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,35,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click"/>
|
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,35,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click"/>
|
||||||
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,70,0,0" Content="默认打印机:" VerticalAlignment="Top" Width="90"
|
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,70,0,0" Content="默认打印机:" VerticalAlignment="Top" Width="90"
|
||||||
x:Name="TEXT_Print" Checked="Print_Checked" Unchecked="Print_Checked"/>
|
x:Name="TEXT_Print" Checked="Print_Checked" Unchecked="Print_Checked"/>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,105,0,0" TextWrapping="Wrap" Text="发布至其它目标打印机" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,105,0,0" TextWrapping="Wrap" Text="发布至其它目标打印机" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,135,0,0" TextWrapping="Wrap" Text="打印模板:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,135,0,0" TextWrapping="Wrap" Text="打印模板:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
<TextBox x:Name="Print_path2" HorizontalAlignment="Left" Height="20" Margin="90,135,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="285"/>
|
<TextBox x:Name="Print_path2" HorizontalAlignment="Left" Height="20" Margin="90,135,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="285" MaxLines="1"/>
|
||||||
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,135,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click1"/>
|
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,135,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click1"/>
|
||||||
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,170,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
|
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,170,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
|
||||||
x:Name="TEXT_Print2" Checked="Print_Checked2" Unchecked="Print_Checked2"/>
|
x:Name="TEXT_Print2" Checked="Print_Checked2" Unchecked="Print_Checked2"/>
|
||||||
|
|||||||
+14
-38
@@ -126,24 +126,30 @@ namespace formula_manage.Windows
|
|||||||
System.Windows.MessageBox.Show("模板不能为空");
|
System.Windows.MessageBox.Show("模板不能为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var data = this.CreateBillData();
|
|
||||||
if (!data.Item1)
|
|
||||||
|
var tuple = PrintHelper.Design(Print_path.Text);
|
||||||
|
if (!tuple.Item1)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("模拟数据生成错误");
|
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Button_Click_12(object sender, RoutedEventArgs e) //编辑模板
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Print_path2.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("模板不能为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tuple = PrintHelper.Design(Print_path.Text, data.Item2, data.Item3);
|
|
||||||
|
var tuple = PrintHelper.Design(Print_path2.Text);
|
||||||
if (!tuple.Item1)
|
if (!tuple.Item1)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click_12(object sender, RoutedEventArgs e) //编辑模板
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
private void Button_Click_2(object sender, RoutedEventArgs e) //预览模板
|
private void Button_Click_2(object sender, RoutedEventArgs e) //预览模板
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -153,36 +159,6 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<bool, Dictionary<string, object>, DataSet> CreateBillData()
|
|
||||||
{
|
|
||||||
//注意事项
|
|
||||||
//小票动态数据会变化,小票的长度也会动态改变
|
|
||||||
//这里主要演示下 动态数据源 为了动态拉伸,除了传入数据源,在模板上面code部分需要加代码
|
|
||||||
Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
||||||
dic.Add("billNo", "2018111100002222");
|
|
||||||
dic.Add("optorName", "管理员");
|
|
||||||
|
|
||||||
//组装dataset数据源
|
|
||||||
DataTable dtDetail = new DataTable("dtDetail");
|
|
||||||
dtDetail.Columns.Add("GOODSCODE");
|
|
||||||
dtDetail.Columns.Add("GOODSNAME");
|
|
||||||
dtDetail.Columns.Add("GOODSPRICE");
|
|
||||||
dtDetail.Columns.Add("GOODSCOUNT");
|
|
||||||
dtDetail.Columns.Add("PAYSUM");
|
|
||||||
|
|
||||||
//加10种商品
|
|
||||||
for (int i = 1; i <= 10; i++)
|
|
||||||
{
|
|
||||||
dtDetail.Rows.Add("10000" + 1, "测试商品" + i, 10.00m, 5, 50.00m);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DataSet dsFrx = new DataSet();
|
|
||||||
dsFrx.Tables.Add(dtDetail);
|
|
||||||
|
|
||||||
return new Tuple<bool, Dictionary<string, object>, DataSet>(true, dic, dsFrx);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Print_Checked(object sender, RoutedEventArgs e) //打印机是否生效
|
private void Print_Checked(object sender, RoutedEventArgs e) //打印机是否生效
|
||||||
{
|
{
|
||||||
Printer = TEXT_Print.IsChecked.GetValueOrDefault(); //打印机是否生效
|
Printer = TEXT_Print.IsChecked.GetValueOrDefault(); //打印机是否生效
|
||||||
|
|||||||
Reference in new issue
Block a user