40 changed files with 1934 additions and 573 deletions
@ -0,0 +1,138 @@ |
|||
<UserControl x:Class="BBWY.Client.Views.PackTask.FeesExcelV2Control" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" |
|||
mc:Ignorable="d" Background="White" |
|||
d:DesignHeight="120" d:DesignWidth="1800"> |
|||
<Grid x:Name ="gd"/> |
|||
|
|||
|
|||
|
|||
<!--<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
|||
<Grid.ColumnDefinitions > |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="*"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30" /> |
|||
<RowDefinition Height="30" /> |
|||
<RowDefinition Height="30" /> |
|||
<RowDefinition Height="30" /> |
|||
</Grid.RowDefinitions> |
|||
<Border Background="#F2F2F2" Grid.RowSpan="3" Grid.ColumnSpan="13"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1,0,0,0"/> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Column="1" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1,0,0,0"/> |
|||
<Border Width="1" HorizontalAlignment="Right" BorderBrush="#D7D7D7" Grid.Column="12" Grid.Row="0" Grid.RowSpan="4" BorderThickness="0,0,1,0"/> |
|||
<Border Height="1" VerticalAlignment="Top" BorderBrush="#D7D7D7" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="13" BorderThickness="0,1,0,0"/> |
|||
<Border Height="1" VerticalAlignment="Top" BorderBrush="#D7D7D7" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="7" BorderThickness="0,1,0,0"/> |
|||
<Border Height="1" VerticalAlignment="Bottom" BorderBrush="#D7D7D7" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="13" BorderThickness="0,1,0,0"/> |
|||
<Border Height="1" VerticalAlignment="Bottom" BorderBrush="#D7D7D7" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="13" BorderThickness="0,1,0,0"/> |
|||
|
|||
<TextBlock Text="任务ID" TextAlignment="Center" Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
|
|||
<TextBlock Text="包装服务" Grid.Column="1" Grid.ColumnSpan="4" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Column="4" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1,0,0,0"/> |
|||
|
|||
<TextBlock Text="打包耗材" Grid.Column="5" Grid.ColumnSpan="3" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Column="12" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1,0,0,0"/> |
|||
|
|||
|
|||
<TextBlock MinWidth="101" TextAlignment="Center" Text="结算金额" Grid.Column="8" Grid.RowSpan="3" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="13739" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="149.82" Grid.Row="3" Grid.Column="8" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
|
|||
<Grid Grid.Column="1" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
|
|||
<TextBlock Text="工序类型" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="简工序" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<Border Height="1" VerticalAlignment="Bottom" BorderBrush="#D7D7D7" Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="0,1,0,0"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Row="0" Grid.RowSpan="3" BorderThickness="1,0,0,0"/> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" BorderThickness="1,0,0,0"/> |
|||
</Grid> |
|||
<Grid Grid.Column="2" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="工序套餐" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="紧贴标" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
|
|||
|
|||
|
|||
|
|||
<Border Height="1" VerticalAlignment="Bottom" BorderBrush="#D7D7D7" Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="0,1,0,0"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.Row="0" Grid.RowSpan="2" BorderThickness="1,0,0,0"/> |
|||
|
|||
</Grid> |
|||
<TextBlock Text="0.42*33" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<Grid Grid.Column="3" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="2*"/> |
|||
<RowDefinition Height="*"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="折扣系数" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="0.74" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
</Grid> |
|||
|
|||
|
|||
|
|||
<Grid Grid.Column="4" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="2*"/> |
|||
<RowDefinition Height="*"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="小计" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="30.00" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
</Grid> |
|||
<Grid Grid.Column="5" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="2*"/> |
|||
<RowDefinition Height="*"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="8号箱子" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="0.49*33" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
</Grid> |
|||
<Grid Grid.Column="6" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="2*"/> |
|||
<RowDefinition Height="*"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="气泡纸" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="0.49*33" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
</Grid> |
|||
<Grid Grid.Column="7" Grid.Row="1" Grid.RowSpan="3" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="2*"/> |
|||
<RowDefinition Height="*"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width="1" HorizontalAlignment="Left" BorderBrush="#D7D7D7" Grid.RowSpan="2" BorderThickness="0,0,1,0"/> |
|||
<TextBlock Text="小计" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
<TextBlock Text="16.17" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
|||
</Grid> |
|||
|
|||
</Grid>--> |
|||
</UserControl> |
@ -0,0 +1,355 @@ |
|||
using BBWY.Client.Models.APIModel.Response.PackTask; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Markup; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.PackTask |
|||
{ |
|||
/// <summary>
|
|||
/// FeesExcelV2Control.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class FeesExcelV2Control : UserControl |
|||
{ |
|||
public FeesExcelV2Control() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
public FeesItemResponse FeesItem |
|||
{ |
|||
get |
|||
{ |
|||
return (FeesItemResponse)GetValue(FeesItemProperty); |
|||
|
|||
} |
|||
set |
|||
{ |
|||
SetValue(FeesItemProperty, value); |
|||
} |
|||
} |
|||
public static readonly DependencyProperty FeesItemProperty = |
|||
DependencyProperty.Register("FeesItem", typeof(FeesItemResponse), typeof(FeesExcelV2Control), new PropertyMetadata(ChangedProperty)); |
|||
|
|||
|
|||
private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
var control = d as FeesExcelV2Control; |
|||
var newValue = e.NewValue as FeesItemResponse; |
|||
control.FeesItem = newValue; |
|||
|
|||
|
|||
control.LoadData(); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string xaml = @" <Grid xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"">
|
|||
<Grid.ColumnDefinitions > |
|||
<ColumnDefinition /> |
|||
[:Columns:] |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
</Grid.RowDefinitions> |
|||
<Border Background=""#F2F2F2"" Grid.RowSpan=""3"" Grid.ColumnSpan=""[:ColumnCount:]""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Column=""1"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""1,0,0,0""/> |
|||
|
|||
|
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Right"" BorderBrush=""#D7D7D7"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Top"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""0"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Top"" BorderBrush=""#D7D7D7"" Grid.Column=""1"" Grid.Row=""1"" Grid.ColumnSpan=""[:ColumnCount-2:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""2"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""3"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<TextBlock MinWidth=""84"" Text=""任务ID"" TextAlignment=""Center"" Grid.Column=""0"" Grid.RowSpan=""3"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
[:Header:] |
|||
<TextBlock MinWidth=""101"" TextAlignment=""Center"" Text=""结算金额"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" Grid.RowSpan=""3"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:TaskId:]"" Grid.Row=""3"" Grid.Column=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:AllFees:]"" Grid.Row=""3"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
[:ListData:] |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string processComboStr1 = @"<Grid Grid.Column=""1"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
<TextBlock Text=""工序类型"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessTypeName:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""3"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.Column=""1"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
</Grid> |
|||
<Grid Grid.Column=""2"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""工序套餐"" Grid.Row=""0"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessComboName:]"" Grid.Row=""1"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
|
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
|
|||
</Grid> |
|||
<TextBlock Text=""[:ProcessComboPrice:]"" Grid.Row=""3"" Grid.Column=""1"" Grid.ColumnSpan=""2"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/>";
|
|||
|
|||
|
|||
|
|||
|
|||
string processComboStr = @" <Grid Grid.Column=""1"" MinWidth=""168"" Grid.Row=""1"" Grid.RowSpan=""3"" Grid.ColumnSpan=""2"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
<TextBlock Text="" 工序类型 "" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessTypeName:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
<TextBlock Text="" 工序套餐 "" Grid.Row=""0"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessComboName:]"" Grid.Row=""1"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
<TextBlock Text=""[:ProcessComboPrice:]"" Grid.Row=""3"" Grid.ColumnSpan=""2"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""3"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.Column=""1"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
string discountFactorStr = @" <Grid Grid.Column=""3"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""折扣系数"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:DiscountFactor:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
string processFeesStr = @"
|
|||
|
|||
|
|||
<Grid Grid.Column=""4"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""小计"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:PackFees:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string columnStr = "<ColumnDefinition Width=\"[:Width:]\"/>"; |
|||
|
|||
string workProcess = "<TextBlock Text=\"包装服务\" Grid.Column=\"1\" Grid.ColumnSpan=\"[:ProcessCount:]\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\"/>\r\n <Border Width=\"1\" HorizontalAlignment=\"Left\" BorderBrush=\"#D7D7D7\" Grid.Column=\"[:1+ProcessCount:]\" Grid.Row=\"0\" Grid.RowSpan=\"4\" BorderThickness=\"1,0,0,0\"/>\r\n "; |
|||
|
|||
string consumableService = "<TextBlock Text=\"包装耗材\" Grid.Column=\"[:1+ProcessCount:]\" Grid.ColumnSpan=\"[:ConsumableCount:]\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\"/>\r\n <Border Width=\"1\" HorizontalAlignment=\"Left\" BorderBrush=\"#D7D7D7\" Grid.Column=\"[:1+ProcessCount:+ConsumableCount]\" Grid.Row=\"0\" Grid.RowSpan=\"4\" BorderThickness=\"1,0,0,0\"/>\r\n "; |
|||
|
|||
|
|||
string incrementConsumableStr = @" <Grid Grid.Column=""[:index:]"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""[:ServiceName:]"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ServiceCount:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
string totalIncrementConsumableStr = @" <Grid Grid.Column=""[:index:]"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""小计"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:Price:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
private void LoadData() |
|||
{ |
|||
|
|||
if (FeesItem == null || FeesItem.ProcessComboTaskCount <= 0) |
|||
{ |
|||
return; |
|||
} |
|||
try |
|||
{ |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Clear(); |
|||
}); |
|||
|
|||
|
|||
|
|||
var consumableList = FeesItem.ConsumableList; |
|||
|
|||
var processCount = 4; |
|||
var consumableCount = consumableList.Count(); |
|||
|
|||
if (consumableCount > 0) |
|||
{ |
|||
consumableCount++; |
|||
} |
|||
columnStr = columnStr.Replace("[:Width:]", "*"); |
|||
var columnCount = consumableCount + processCount + 2; |
|||
StringBuilder columns = new StringBuilder(); |
|||
for (int i = 1; i < columnCount; i++) |
|||
{ |
|||
columns.AppendLine(columnStr); |
|||
} |
|||
StringBuilder serviceData = new StringBuilder(); |
|||
|
|||
int allCount = consumableCount + processCount; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
serviceData.AppendLine(processComboStr.Replace("[:ProcessTypeName:]",$" {FeesItem.ProcessTypeName} " ) |
|||
.Replace("[:ProcessComboName:]",$" {FeesItem.ProcessComboName} " ) |
|||
.Replace("[:ProcessComboPrice:]", $"{FeesItem.ProcessComboPrice}*{FeesItem.ProcessComboTaskCount}") |
|||
); |
|||
|
|||
serviceData.AppendLine(discountFactorStr.Replace("[:DiscountFactor:]", FeesItem.DiscountFoctor?.ToString())); |
|||
serviceData.AppendLine(processFeesStr.Replace("[:PackFees:]", FeesItem.PackFees.ToString("0.00"))); |
|||
|
|||
int rowIndex = 4; |
|||
|
|||
if (consumableList.Count > 0) |
|||
{ |
|||
foreach (var item in consumableList) |
|||
{ |
|||
rowIndex++; |
|||
serviceData.AppendLine(incrementConsumableStr.Replace("[:index:]", $"{rowIndex}") |
|||
.Replace("[:ServiceName:]", $"{item.ItemName}") |
|||
.Replace("[:ServiceCount:]", $"{item.ItemPrice}*{item.ItemCount}")); |
|||
} |
|||
rowIndex++; |
|||
serviceData.AppendLine(totalIncrementConsumableStr.Replace("[:index:]", $"{rowIndex}") |
|||
.Replace("[:Price:]", $"{FeesItem.ConsumableFees}") |
|||
); |
|||
} |
|||
|
|||
|
|||
StringBuilder header = new StringBuilder(); |
|||
|
|||
if (processCount > 0) |
|||
{ |
|||
header.AppendLine(workProcess); |
|||
} |
|||
if (consumableCount > 0) |
|||
{ |
|||
header.AppendLine(consumableService); |
|||
} |
|||
decimal allFees = 0; |
|||
decimal discount = 0; |
|||
decimal discountFees = 0; |
|||
discount = FeesItem.disCount; |
|||
|
|||
allFees = FeesItem.AllFees; |
|||
|
|||
discountFees = allFees * discount; |
|||
string discountStr = "原价"; |
|||
|
|||
if (discount > 1) |
|||
discountStr = $"{discount.ToString("0.0")}倍"; |
|||
if (discount < 1) |
|||
discountStr = $"{(discount * 10).ToString("0.0")}折"; |
|||
var newGrid = xaml.Replace("[:Header:]", header.ToString()) |
|||
.Replace("[:Columns:]", columns.ToString()) |
|||
.Replace("[:ColumnCount:]", $"{columnCount}") |
|||
.Replace("[:ColumnCount-2:]", $"{columnCount - 2}") |
|||
.Replace("[:1+ProcessCount:]", $"{1 + processCount}") |
|||
.Replace("[:1+ProcessCount:+ConsumableCount]", $"{1 + processCount + consumableCount}") |
|||
.Replace("[:2+ProcessCount:+ConsumableCount]", $"{2 + processCount + consumableCount}") |
|||
.Replace("[:3+ProcessCount:+ConsumableCount]", $"{3 + processCount + consumableCount}") |
|||
.Replace("[:ProcessCount:]", $"{processCount}") |
|||
.Replace("[:ConsumableCount:]", $"{consumableCount}") |
|||
.Replace("[:TaskId:]", $"{FeesItem.TaskId}") |
|||
.Replace("[:ListData:]", serviceData.ToString()) |
|||
.Replace("[:AllFees:]", $"{FeesItem.AllFees.ToString("0.00")}"); |
|||
//.Replace("[:Discount:]", $"{FeesItem.DiscountFoctor}")
|
|||
//.Replace("[:DiscountFees:]", $"{discountFees.ToString(" 0.00")}");
|
|||
|
|||
|
|||
//
|
|||
newGrid = newGrid.Replace(@"[:Visity:]", ""); |
|||
|
|||
|
|||
|
|||
|
|||
var grid = XamlReader.Parse(newGrid) as Grid; |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Add(grid); |
|||
}); |
|||
|
|||
} |
|||
catch |
|||
{ |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
<UserControl x:Class="BBWY.Client.Views.PackTask.MinFeesExcelV2Control" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" |
|||
mc:Ignorable="d" |
|||
d:DesignHeight="450" d:DesignWidth="800"> |
|||
<Grid x:Name ="gd"/> |
|||
</UserControl> |
@ -0,0 +1,347 @@ |
|||
using BBWY.Client.Models.APIModel.Response.PackTask; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Markup; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.PackTask |
|||
{ |
|||
/// <summary>
|
|||
/// MinFeesExcelV2Control.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class MinFeesExcelV2Control : UserControl |
|||
{ |
|||
public MinFeesExcelV2Control() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
public FeesItemResponse FeesItem |
|||
{ |
|||
get |
|||
{ |
|||
return (FeesItemResponse)GetValue(FeesItemProperty); |
|||
|
|||
} |
|||
set |
|||
{ |
|||
SetValue(FeesItemProperty, value); |
|||
} |
|||
} |
|||
public static readonly DependencyProperty FeesItemProperty = |
|||
DependencyProperty.Register("FeesItem", typeof(FeesItemResponse), typeof(MinFeesExcelV2Control), new PropertyMetadata(ChangedProperty)); |
|||
|
|||
|
|||
private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
var control = d as MinFeesExcelV2Control; |
|||
var newValue = e.NewValue as FeesItemResponse; |
|||
control.FeesItem = newValue; |
|||
|
|||
|
|||
control.LoadData(); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string xaml = @" <Grid xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"">
|
|||
<Grid.ColumnDefinitions > |
|||
<ColumnDefinition Width=""0"" /> |
|||
[:Columns:] |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
<RowDefinition Height=""30"" /> |
|||
</Grid.RowDefinitions> |
|||
<Border Background=""#F2F2F2"" Grid.RowSpan=""3"" Grid.ColumnSpan=""[:ColumnCount:]""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Column=""1"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""1,0,0,0""/> |
|||
|
|||
|
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Right"" BorderBrush=""#D7D7D7"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" Grid.Row=""0"" Grid.RowSpan=""4"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Top"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""0"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Top"" BorderBrush=""#D7D7D7"" Grid.Column=""1"" Grid.Row=""1"" Grid.ColumnSpan=""[:ColumnCount-2:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""2"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Column=""0"" Grid.Row=""3"" Grid.ColumnSpan=""[:ColumnCount:]"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
[:Header:] |
|||
<TextBlock MinWidth=""101"" TextAlignment=""Center"" Text=""结算金额"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" Grid.RowSpan=""3"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:TaskId:]"" Grid.Row=""3"" Grid.Column=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:AllFees:]"" Grid.Row=""3"" Grid.Column=""[:1+ProcessCount:+ConsumableCount]"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
[:ListData:] |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string processComboStr1 = @"<Grid Grid.Column=""1"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
<TextBlock Text=""工序类型"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessTypeName:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""3"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.Column=""1"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
</Grid> |
|||
<Grid Grid.Column=""2"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""工序套餐"" Grid.Row=""0"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessComboName:]"" Grid.Row=""1"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
|
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
|
|||
</Grid> |
|||
<TextBlock Text=""[:ProcessComboPrice:]"" Grid.Row=""3"" Grid.Column=""1"" Grid.ColumnSpan=""2"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/>";
|
|||
|
|||
|
|||
|
|||
|
|||
string processComboStr = @" <Grid Grid.Column=""1"" MinWidth=""168"" Grid.Row=""1"" Grid.RowSpan=""3"" Grid.ColumnSpan=""2"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
|
|||
<TextBlock Text="" 工序类型 "" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessTypeName:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
<TextBlock Text="" 工序套餐 "" Grid.Row=""0"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ProcessComboName:]"" Grid.Row=""1"" Grid.Column=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
|
|||
<TextBlock Text=""[:ProcessComboPrice:]"" Grid.Row=""3"" Grid.ColumnSpan=""2"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.ColumnSpan=""2"" BorderThickness=""0,1,0,0""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.RowSpan=""3"" BorderThickness=""1,0,0,0""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.Row=""0"" Grid.Column=""1"" Grid.RowSpan=""2"" BorderThickness=""1,0,0,0""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
string discountFactorStr = @" <Grid Grid.Column=""3"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""折扣系数"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:DiscountFactor:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
string processFeesStr = @"
|
|||
|
|||
|
|||
<Grid Grid.Column=""4"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" > |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""小计"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:PackFees:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
string columnStr = "<ColumnDefinition Width=\"[:Width:]\"/>"; |
|||
|
|||
string workProcess = "<TextBlock Text=\"包装服务\" Grid.Column=\"1\" Grid.ColumnSpan=\"[:ProcessCount:]\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\"/>\r\n <Border Width=\"1\" HorizontalAlignment=\"Left\" BorderBrush=\"#D7D7D7\" Grid.Column=\"[:1+ProcessCount:]\" Grid.Row=\"0\" Grid.RowSpan=\"4\" BorderThickness=\"1,0,0,0\"/>\r\n "; |
|||
|
|||
string consumableService = "<TextBlock Text=\"包装耗材\" Grid.Column=\"[:1+ProcessCount:]\" Grid.ColumnSpan=\"[:ConsumableCount:]\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\"/>\r\n <Border Width=\"1\" HorizontalAlignment=\"Left\" BorderBrush=\"#D7D7D7\" Grid.Column=\"[:1+ProcessCount:+ConsumableCount]\" Grid.Row=\"0\" Grid.RowSpan=\"4\" BorderThickness=\"1,0,0,0\"/>\r\n "; |
|||
|
|||
|
|||
string incrementConsumableStr = @" <Grid Grid.Column=""[:index:]"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""[:ServiceName:]"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:ServiceCount:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
string totalIncrementConsumableStr = @" <Grid Grid.Column=""[:index:]"" MinWidth=""84"" Grid.Row=""1"" Grid.RowSpan=""3"" >
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""2*""/> |
|||
<RowDefinition Height=""*""/> |
|||
</Grid.RowDefinitions> |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" BorderBrush=""#D7D7D7"" Grid.RowSpan=""2"" BorderThickness=""0,0,1,0""/> |
|||
<TextBlock Text=""小计"" Grid.Row=""0"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
<TextBlock Text=""[:Price:]"" Grid.Row=""1"" VerticalAlignment=""Center"" HorizontalAlignment=""Center""/> |
|||
</Grid>";
|
|||
|
|||
|
|||
|
|||
private void LoadData() |
|||
{ |
|||
|
|||
if (FeesItem == null || FeesItem.ProcessComboTaskCount <= 0) |
|||
{ |
|||
return; |
|||
} |
|||
try |
|||
{ |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Clear(); |
|||
}); |
|||
|
|||
|
|||
|
|||
var consumableList = FeesItem.ConsumableList; |
|||
|
|||
var processCount = 3; |
|||
var consumableCount = consumableList.Count(); |
|||
|
|||
columnStr = columnStr.Replace("[:Width:]", "auto"); |
|||
var columnCount = consumableCount + processCount + 2; |
|||
StringBuilder columns = new StringBuilder(); |
|||
for (int i = 1; i < columnCount; i++) |
|||
{ |
|||
columns.AppendLine(columnStr); |
|||
} |
|||
StringBuilder serviceData = new StringBuilder(); |
|||
|
|||
int allCount = consumableCount + processCount; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
serviceData.AppendLine(processComboStr.Replace("[:ProcessTypeName:]", $" {FeesItem.ProcessTypeName} ") |
|||
.Replace("[:ProcessComboName:]", $" {FeesItem.ProcessComboName} ") |
|||
.Replace("[:ProcessComboPrice:]", $"{FeesItem.ProcessComboPrice}*{FeesItem.ProcessComboTaskCount}") |
|||
); |
|||
|
|||
serviceData.AppendLine(discountFactorStr.Replace("[:DiscountFactor:]", FeesItem.DiscountFoctor?.ToString())); |
|||
//serviceData.AppendLine(processFeesStr.Replace("[:PackFees:]", FeesItem.PackFees.ToString("0.00")));
|
|||
|
|||
int rowIndex = 3; |
|||
|
|||
if (consumableList.Count > 0) |
|||
{ |
|||
foreach (var item in consumableList) |
|||
{ |
|||
rowIndex++; |
|||
serviceData.AppendLine(incrementConsumableStr.Replace("[:index:]", $"{rowIndex}") |
|||
.Replace("[:ServiceName:]", $"{item.ItemName}") |
|||
).Replace("[:ServiceCount:]", $"");//
|
|||
} |
|||
rowIndex++; |
|||
//serviceData.AppendLine(totalIncrementConsumableStr.Replace("[:index:]", $"{rowIndex}")
|
|||
// .Replace("[:Price:]", $"{FeesItem.ConsumableFees}")
|
|||
// );
|
|||
} |
|||
|
|||
|
|||
StringBuilder header = new StringBuilder(); |
|||
|
|||
if (processCount > 0) |
|||
{ |
|||
header.AppendLine(workProcess); |
|||
} |
|||
if (consumableCount > 0) |
|||
{ |
|||
header.AppendLine(consumableService); |
|||
} |
|||
decimal allFees = 0; |
|||
decimal discount = 0; |
|||
decimal discountFees = 0; |
|||
discount = FeesItem.disCount; |
|||
|
|||
allFees = FeesItem.AllFees; |
|||
|
|||
discountFees = allFees * discount; |
|||
string discountStr = "原价"; |
|||
|
|||
if (discount > 1) |
|||
discountStr = $"{discount.ToString("0.0")}倍"; |
|||
if (discount < 1) |
|||
discountStr = $"{(discount * 10).ToString("0.0")}折"; |
|||
var newGrid = xaml.Replace("[:Header:]", header.ToString()) |
|||
.Replace("[:Columns:]", columns.ToString()) |
|||
.Replace("[:ColumnCount:]", $"{columnCount}") |
|||
.Replace("[:ColumnCount-2:]", $"{columnCount - 2}") |
|||
.Replace("[:1+ProcessCount:]", $"{1 + processCount}") |
|||
.Replace("[:1+ProcessCount:+ConsumableCount]", $"{1 + processCount + consumableCount}") |
|||
.Replace("[:2+ProcessCount:+ConsumableCount]", $"{2 + processCount + consumableCount}") |
|||
.Replace("[:3+ProcessCount:+ConsumableCount]", $"{3 + processCount + consumableCount}") |
|||
.Replace("[:ProcessCount:]", $"{processCount}") |
|||
.Replace("[:ConsumableCount:]", $"{consumableCount}") |
|||
.Replace("[:TaskId:]", $"") |
|||
.Replace("[:ListData:]", serviceData.ToString()) |
|||
.Replace("[:AllFees:]", $"{FeesItem.PackFees.ToString("0.00")}");//打包费用
|
|||
|
|||
newGrid = newGrid.Replace(@"[:Visity:]", ""); |
|||
|
|||
|
|||
|
|||
|
|||
var grid = XamlReader.Parse(newGrid) as Grid; |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Add(grid); |
|||
}); |
|||
|
|||
} |
|||
catch |
|||
{ |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
<Window x:Class="BBWY.Client.Views.PackTask.PrintPackTaskDetail" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" |
|||
mc:Ignorable="d" |
|||
Title="PrintPackTaskDetail" Height="492" Width="272"> |
|||
<Grid x:Name="print_box"> |
|||
<Grid Margin="10"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="110"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Image Width="110" Stretch="Fill" Source="{Binding PurchaseOrderImage}"/> |
|||
<StackPanel VerticalAlignment="Top" Grid.Column="1"> |
|||
<TextBlock Text="云仓" HorizontalAlignment="Center" FontWeight="Bold" FontSize="30"/> |
|||
<Image Height="40" Stretch="Fill" /> |
|||
<TextBlock Style="{StaticResource middleTextBlock}" Text="10001"/> |
|||
</StackPanel> |
|||
</Grid> |
|||
<StackPanel Orientation="Vertical" Grid.Row="1"> |
|||
<TextBlock Margin="0 5 0 5"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="{Binding PackTaskModel.ItemList[0].SkuName}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="品名:"/> |
|||
<Run Text="{Binding PackTaskModel.ItemList[0].BrandName}"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="0 5 0 5"> |
|||
<Run Text="SKU数量:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="0 5 0 5"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
<Image Margin="10 10 10 0" Stretch="Fill" Source="/resources/images/barcode.png"/> |
|||
<TextBlock Margin="0 0 0 5" Style="{StaticResource middleTextBlock}" > |
|||
<Run Text="POP"/> |
|||
<Run Text="123456789789"/> |
|||
</TextBlock> |
|||
<Border Height="2" BorderThickness="1" BorderBrush="Black"/> |
|||
<TextBlock Margin="0 5 0 5"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="0 5 0 5"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="1234567"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid> |
|||
</Grid> |
|||
</Window> |
@ -0,0 +1,81 @@ |
|||
using BBWY.Client.Helpers; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Client.Models.FallWare; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Printing; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.PackTask |
|||
{ |
|||
/// <summary>
|
|||
/// PrintPackTaskDetail.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class PrintPackTaskDetail : Window |
|||
{ |
|||
public PrintPackTaskDetail(PackTaskModel model) |
|||
{ |
|||
InitializeComponent(); |
|||
PackTaskModel = model; |
|||
|
|||
this.DataContext = this; |
|||
|
|||
this.UpdateLayout();//刷新UI
|
|||
} |
|||
public PackTaskModel PackTaskModel { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
public void PrintBox(string printName) |
|||
{ |
|||
|
|||
var localPrintServer = new LocalPrintServer(); |
|||
if (string.IsNullOrEmpty(printName)) |
|||
{ |
|||
return; |
|||
} |
|||
var printQueue = localPrintServer.GetPrintQueue(printName); |
|||
if (printQueue.IsInError) |
|||
{ |
|||
System.Windows.MessageBox.Show("打印机处于错误状态"); |
|||
return; |
|||
} |
|||
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
|
|||
PrintDialog printDialog = new PrintDialog(); |
|||
|
|||
printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向
|
|||
//设置纸张大小
|
|||
var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); |
|||
var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); |
|||
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); |
|||
this.Height = pageHeight + 39;//833
|
|||
this.Width = pageWidth;//1123
|
|||
this.FontSize = 30; |
|||
// box_margin.Margin = new Thickness(50, 50, 50, 50);
|
|||
//box_margin.Margin = new Thickness(10);
|
|||
//this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight)));
|
|||
|
|||
this.UpdateLayout(); //刷新界面
|
|||
printDialog.PrintVisual(this.print_box, "打印任务"); |
|||
|
|||
//var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
|||
//string printNames = System.IO.Path.Combine(applicationPath, "printName.init");
|
|||
//if (File.Exists(printNames))
|
|||
//{
|
|||
// File.Delete(printNames);
|
|||
//}
|
|||
//System.IO.File.WriteAllText(printNames, printName);
|
|||
this.Close(); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue