From f82295d22af66e7581a2266d7025b9d9accf3ab2 Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Mon, 24 Apr 2023 19:23:57 +0800
Subject: [PATCH] 1

---
 BBWY.Client/Views/PackTask/CerControl.xaml    | 15 +++--------
 BBWY.Client/Views/PackTask/SetCerControl.xaml | 12 ++++-----
 .../Views/PackTask/SetCerControl.xaml.cs      | 26 +++++++++++++------
 BBWY.Client/Views/PackTask/SetCerWindow.xaml  | 12 ++++-----
 .../Views/PackTask/SetSpuCerWindow.xaml       | 11 ++++----
 .../PlatformSDK/LogisticsCompanyConverter.cs  |  4 +--
 6 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/BBWY.Client/Views/PackTask/CerControl.xaml b/BBWY.Client/Views/PackTask/CerControl.xaml
index 6c8c0df3..8da8a66b 100644
--- a/BBWY.Client/Views/PackTask/CerControl.xaml
+++ b/BBWY.Client/Views/PackTask/CerControl.xaml
@@ -5,18 +5,9 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:BBWY.Client.Views.PackTask"
              mc:Ignorable="d" 
-             d:DesignHeight="340" d:DesignWidth="382">
+             d:DesignHeight="300" d:DesignWidth="382">
     <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="40"/>
-            <RowDefinition/>
-        </Grid.RowDefinitions>
-        <Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"
-                Background="{StaticResource Border.Background}">
-            <TextBlock Text="查看合格证" HorizontalAlignment="Center" VerticalAlignment="Center"/>
-        </Border>
-
-        <UniformGrid Grid.Row="1">
+        <StackPanel Grid.Row="1" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,  AncestorType={x:Type local:SetCerControl}}}">
             <Border Name="no3c" Visibility="{Binding  CerData.LabelModel,Converter={StaticResource objConverter}, ConverterParameter=标准无3c:Visible:Collapsed}"  BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="1" VerticalAlignment="Top" HorizontalAlignment="Left">
                 <Grid>
                     <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12,0,0" />
@@ -106,7 +97,7 @@
                                  Height="44" Text="{Binding CerData.ProductAdress}"  Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,241,0,0"/>
                 </Grid>
             </Border>
-        </UniformGrid>
+        </StackPanel>
 
 
     </Grid>
diff --git a/BBWY.Client/Views/PackTask/SetCerControl.xaml b/BBWY.Client/Views/PackTask/SetCerControl.xaml
index f7a317ca..37bd4d01 100644
--- a/BBWY.Client/Views/PackTask/SetCerControl.xaml
+++ b/BBWY.Client/Views/PackTask/SetCerControl.xaml
@@ -8,7 +8,7 @@
              xmlns:cmodel="clr-namespace:BBWY.Client.Models"
              mc:Ignorable="d" 
              d:DesignHeight="700" d:DesignWidth="820">
-    <Grid>
+    <Grid DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,  AncestorType={x:Type local:SetCerControl}}}">
         <Grid.RowDefinitions>
             <RowDefinition/>
             <RowDefinition/>
@@ -19,7 +19,7 @@
         </Grid.ColumnDefinitions>
         <Grid >
             <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
-            <RadioButton GroupName="cer" IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准无3c}}"     Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准无3c}"  Content="标准" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
+            <RadioButton GroupName="cer"  IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准无3c}}"  Checked="RadioButton_Checked"    Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准无3c}"  Content="标准" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
             <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                 <Grid>
                     <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@@ -42,9 +42,9 @@
                 </Grid>
             </Border>
         </Grid>
-        <Grid Grid.Column="1" >
+        <Grid Grid.Column="1">
             <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"-->
-            <RadioButton GroupName="cer" IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准有3c}}"    Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准有3c}"  Content="带3c标" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
+            <RadioButton GroupName="cer" IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准有3c}}"  Checked="RadioButton_Checked"      Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准有3c}"  Content="带3c标" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
             <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                 <Grid >
                     <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@@ -59,7 +59,7 @@
                     <TextBlock Text="执行标准:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="9,166,0,0"  />
                     <c:BTextBox WaterRemark="如多个标准请使用逗号分隔"  Text="{Binding model.ExcuteStander,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="25" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,161,0,0"/>
                     <TextBlock Text="生产商:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="19,206,0,0" />
-                    <c:BTextBox Text="{Binding ProductShop,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="25" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,201,0,0"/>
+                    <c:BTextBox Text="{Binding model.ProductShop,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="25" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,201,0,0"/>
                     <TextBlock Text="地址:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="33,242,0,0" />
                     <TextBox TextWrapping ="Wrap" AcceptsReturn="True" Text="{Binding model.ProductAdress,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="44"  Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,241,0,0"/>
                     <TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />
@@ -74,7 +74,7 @@
 
         <Grid  Grid.Row="1">
             <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
-            <RadioButton GroupName="cer" IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.无型号}}"     Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.无型号}"  Content="无型号" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
+            <RadioButton GroupName="cer"  IsChecked="{Binding model.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.无型号}}"  Checked="RadioButton_Checked"   Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.无型号}"  Content="无型号" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
             <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                 <Grid>
                     <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
diff --git a/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs b/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs
index cf49f2e6..de951363 100644
--- a/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs
+++ b/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs
@@ -14,20 +14,21 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using WebSocketSharp;
 
 namespace BBWY.Client.Views.PackTask
 {
     /// <summary>
     /// SetCerControl.xaml 的交互逻辑
     /// </summary>
-    public partial class SetCerControl : UserControl,INotifyPropertyChanged
+    public partial class SetCerControl : UserControl, INotifyPropertyChanged
     {
         public SetCerControl()
         {
             InitializeComponent();
         }
 
-      
+
 
         //CertificateModel
 
@@ -63,7 +64,7 @@ namespace BBWY.Client.Views.PackTask
         {
 
 
-        
+
             var control = d as SetCerControl;
 
             var newValue = e.NewValue as CertificateModel;
@@ -75,12 +76,21 @@ namespace BBWY.Client.Views.PackTask
                 //control.OnPropertyChanged(e);
 
             }
-            
-           
+
+
         }
-       
 
-        
+        private void RadioButton_Checked(object sender, RoutedEventArgs e)
+        {
+            var rabtn = sender as RadioButton;
+            if (rabtn != null && rabtn.CommandParameter != null) {
+               var labModel = Enum.Parse<CertificateLabelModel>(rabtn.CommandParameter.ToString()) ;
+                model.LabelModel = labModel ;
+                model.IsLogo = labModel == CertificateLabelModel.标准有3c ? 1 : 0; 
+            }
+         
+            var data = e.Source as string ;
+        }
     }
-    
+
 }
diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml b/BBWY.Client/Views/PackTask/SetCerWindow.xaml
index d4b5c868..986b6a00 100644
--- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml
+++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml
@@ -41,7 +41,7 @@
                 <c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="导入spu模板" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"  
               Command="{Binding InseartCerCommand}"     />
             </StackPanel>
-            <Grid Grid.Row="1">
+            <!--<Grid Grid.Row="1">
                 <Grid.RowDefinitions>
                     <RowDefinition/>
                     <RowDefinition/>
@@ -51,7 +51,7 @@
                     <ColumnDefinition/>
                 </Grid.ColumnDefinitions>
                 <Grid >
-                    <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
+                    IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"
                     <RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准无3c}}"     Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准无3c}"  Content="标准" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                     <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                         <Grid>
@@ -76,7 +76,7 @@
                     </Border>
                 </Grid>
                 <Grid    Grid.Column="1">
-                    <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"-->
+                    IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"
                     <RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准有3c}}"    Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准有3c}"  Content="带3c标" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                     <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                         <Grid >
@@ -106,7 +106,7 @@
                 </Grid>
 
                 <Grid   Grid.Row="1">
-                    <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
+                    IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"
                     <RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.无型号}}"     Command="{Binding CerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.无型号}"  Content="无型号" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                     <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                         <Grid>
@@ -128,8 +128,8 @@
                         </Grid>
                     </Border>
                 </Grid>
-            </Grid>
-            <!--<local:SetCerControl Grid.Row="1" CertificateModel="{Binding CertificateModel,Mode=TwoWay,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}"/>-->
+            </Grid>-->
+            <local:SetCerControl Grid.Row="1" model="{Binding CertificateModel,Mode=TwoWay,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}"/>
         </Grid>
         <Border Grid.Row="2"  Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
         <c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"  
diff --git a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml
index 3584c751..c994728b 100644
--- a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml
+++ b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml
@@ -29,8 +29,9 @@
                 Background="{StaticResource Border.Background}">
             <TextBlock Text="设置SPU合格证模板" HorizontalAlignment="Center" VerticalAlignment="Center"/>
         </Border>
+        <local:SetCerControl Grid.Row="1" model="{Binding SpuCertificateModel,Mode=TwoWay,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}"/>
 
-        <Grid Grid.Row="1">
+        <!--<Grid Grid.Row="1">
             <Grid.RowDefinitions>
                 <RowDefinition/>
                 <RowDefinition/>
@@ -40,7 +41,7 @@
                 <ColumnDefinition/>
             </Grid.ColumnDefinitions>
             <Grid >
-                <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
+                IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"
                 <RadioButton GroupName="cer" IsChecked="{Binding SpuCertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准无3c}}"     Command="{Binding SpuCerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准无3c}"  Content="标准" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                 <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                     <Grid>
@@ -65,7 +66,7 @@
                 </Border>
             </Grid>
             <Grid    Grid.Column="1">
-                <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"-->
+                IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"
                 <RadioButton GroupName="cer" IsChecked="{Binding SpuCertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.标准有3c}}"    Command="{Binding SpuCerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.标准有3c}"  Content="带3c标" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                 <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                     <Grid >
@@ -95,7 +96,7 @@
             </Grid>
 
             <Grid   Grid.Row="1">
-                <!--IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
+                IsChecked="{Binding IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"
                 <RadioButton GroupName="cer" IsChecked="{Binding SpuCertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.无型号}}"     Command="{Binding SpuCerLabelCheckCommand}"  CommandParameter="{x:Static cmodel:CertificateLabelModel.无型号}"  Content="无型号" Margin="10,0,0,0" Height="30" VerticalAlignment="Top"/>
                 <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,30,13,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                     <Grid>
@@ -117,7 +118,7 @@
                     </Grid>
                 </Border>
             </Grid>
-        </Grid>
+        </Grid>-->
         <Border Grid.Row="2"  Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
         <c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"  
               Command="{Binding SaveSpuCerCommand}"     />
diff --git a/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs b/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs
index db1d21fd..da918a0e 100644
--- a/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs
+++ b/BBWY.Server.Business/PlatformSDK/LogisticsCompanyConverter.cs
@@ -17,10 +17,10 @@ namespace BBWY.Server.Business
             converterDictionary = new Dictionary<string, IList<LogisticsCompanyRelationship>>();
             converterDictionary.Add($"{Enums.Platform.阿里巴巴}_{Enums.Platform.京东}", new List<LogisticsCompanyRelationship>()
             {
-                new LogisticsCompanyRelationship(){SourceName="中通快递(ZTO)",TargetName="中通速递"},
+                //new LogisticsCompanyRelationship(){SourceName="中通快递(ZTO)",TargetName="中通速递"},
                 new LogisticsCompanyRelationship(){SourceName="圆通速递(YTO)",TargetName="圆通快递"},
                 new LogisticsCompanyRelationship(){SourceName="邮政国内小包",TargetName="邮政快递包裹"},
-                new LogisticsCompanyRelationship(){SourceName="韵达快递",TargetName="韵达快递"},
+               // new LogisticsCompanyRelationship(){SourceName="韵达快递",TargetName="韵达快递"},
                 new LogisticsCompanyRelationship(){SourceName="申通快递(STO)",TargetName="申通快递",SecondTargetName="厂家自送"},
                 new LogisticsCompanyRelationship(){SourceName="顺丰速运",TargetName="顺丰快递"},
                 new LogisticsCompanyRelationship(){SourceName="百世快递",TargetName="厂家自送"},