Browse Source

合并

qianyi
连坤 林 2 years ago
parent
commit
480170d6c8
  1. 16
      BBWY.Client/Models/Enums.cs
  2. 45
      BBWY.Client/Models/PackTask/PackItemModel.cs
  3. 37
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  4. 4
      BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs
  5. 40
      BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs
  6. 4
      BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml
  7. 6
      BBWY.Client/Views/PackTask/PrintWindow.xaml
  8. 22
      BBWY.Client/Views/PackTask/PrintWindow.xaml.cs
  9. 1
      BBWY.Client/Views/PackTask/ServiceWindow.xaml
  10. 9
      BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs
  11. 4
      BBWY.Client/Views/PackTask/SetCerWindow.xaml

16
BBWY.Client/Models/Enums.cs

@ -291,14 +291,14 @@
No3C = 0, No3C = 0,
Is3C = 1 Is3C = 1
} }
/// <summary> ///// <summary>
/// 合格证是否3c ///// 合格证是否3c
/// </summary> ///// </summary>
public enum CerHave3C //public enum CerHave3C
{ //{
No3C = 0, // No3C = 0,
Is3C = 1 // Is3C = 1
} //}
/// <summary> /// <summary>
/// 加急 /// 加急
/// </summary> /// </summary>

45
BBWY.Client/Models/PackTask/PackItemModel.cs

@ -34,10 +34,31 @@ namespace BBWY.Client.Models.PackTask
public int ItemCount { get => itemCount; set { Set(ref itemCount, value); } } public int ItemCount { get => itemCount; set { Set(ref itemCount, value); } }
public ObservableCollection<IncreateServiceModel> IncreateServiceList { get; set; }
public ObservableCollection<PackUser> MemberList { get; set; }
public ObservableCollection<ConsumableModel> ConsumableList { get; set; } private ObservableCollection<IncreateServiceModel> increateServiceList;
public ObservableCollection<WorkProcessModel> PackServiceList { get; set; } public ObservableCollection<IncreateServiceModel> IncreateServiceList
{
get => increateServiceList; set
{
Set(ref increateServiceList, value);
}
}
private ObservableCollection<PackUser> memberList;
public ObservableCollection<PackUser> MemberList
{
get => memberList; set
{
Set(ref memberList, value);
}
}
private ObservableCollection<ConsumableModel> consumableList;
public ObservableCollection<ConsumableModel> ConsumableList
{ get => consumableList; set { Set(ref consumableList, value); } }
private ObservableCollection<WorkProcessModel> packServiceList;
public ObservableCollection<WorkProcessModel> PackServiceList { get => packServiceList; set { Set(ref packServiceList, value); } }
/// <summary> /// <summary>
/// 设置列表的 是否编辑属性 /// 设置列表的 是否编辑属性
/// </summary> /// </summary>
@ -45,27 +66,15 @@ namespace BBWY.Client.Models.PackTask
public ICommand DeleteServiceCommand { get; set; } public ICommand DeleteServiceCommand { get; set; }
public PackItemModel(ObservableCollection<IncreateServiceModel> IncreateServiceList=null, public PackItemModel()
ObservableCollection<PackUser> MemberList=null,
ObservableCollection<ConsumableModel> ConsumableList=null,
ObservableCollection<WorkProcessModel> PackServiceList=null
)
{ {
DeleteServiceCommand = new RelayCommand<object>(DeleteService); DeleteServiceCommand = new RelayCommand<object>(DeleteService);
this. IncreateServiceList = IncreateServiceList;
this.PackServiceList = PackServiceList;
this.MemberList = MemberList;
this.ConsumableList = ConsumableList;
} }
private void DeleteService(object obj) private void DeleteService(object obj)
{ {
ObservableCollection<PackItemModel> list= obj as ObservableCollection<PackItemModel>; ObservableCollection<PackItemModel> list = obj as ObservableCollection<PackItemModel>;
list.Remove(this); list.Remove(this);
} }
} }
} }

37
BBWY.Client/Models/PackTask/PackTaskModel.cs

@ -27,7 +27,8 @@ namespace BBWY.Client.Models
public long Id { get => id; set { Set(ref id, value); } } public long Id { get => id; set { Set(ref id, value); } }
private readonly PackTaskService packTaskService; private readonly PackTaskService packTaskService;
WorkProcessService workProcessService; readonly WorkProcessService workProcessService;
readonly IncreateServiceService increateServiceService;
public ICommand SetTaskStatusCommand { get; set; } public ICommand SetTaskStatusCommand { get; set; }
public ICommand PrintBarcodeCommand { get; set; } public ICommand PrintBarcodeCommand { get; set; }
@ -35,7 +36,7 @@ namespace BBWY.Client.Models
public ICommand LookCerCommand { get; set; } public ICommand LookCerCommand { get; set; }
public ICommand LookBarCommand { get; set; } public ICommand LookBarCommand { get; set; }
public ICommand SetServiceCommand { get; set; } public ICommand SetServiceCommand { get; set; }
IncreateServiceService increateServiceService;
public ConsumableService consumableService; public ConsumableService consumableService;
/// <summary> /// <summary>
@ -64,7 +65,7 @@ namespace BBWY.Client.Models
private void UpdateTask() private void UpdateTask()
{ {
CreatePackTask create = new CreatePackTask();
ViewModelLocator viewModel = new ViewModelLocator(); ViewModelLocator viewModel = new ViewModelLocator();
var createViewModel = viewModel.CreateTaskView; var createViewModel = viewModel.CreateTaskView;
@ -72,13 +73,7 @@ namespace BBWY.Client.Models
{ {
createViewModel.ReflashWindow = ReflashTask; createViewModel.ReflashWindow = ReflashTask;
} }
create.SendData(this);//初始化数据
CreatePackTask create = new CreatePackTask();
//ViewModelLocator viewModel = new ViewModelLocator();
//var createViewModel = viewModel.CreateTaskView;
//if (ReflashTask != null)
// createViewModel.ReflashWindow = ReflashTask;
create.SendData(this);
create.ShowDialog(); create.ShowDialog();
@ -105,15 +100,19 @@ namespace BBWY.Client.Models
private void SetService() private void SetService()
{ {
ServiceWindow service = new ServiceWindow();
//加载数据 //加载数据
ViewModelLocator viewModelLocator = new ViewModelLocator();
ServiceWindow service = new ServiceWindow(packTaskService, TaskId, SkuCount, consumableService, workProcessService, increateServiceService);//设置 var serviceViewModel = viewModelLocator.PackServiceList;
service.model.SetAllFees = new Action<FeesItemResponse, List<string>>((feesItem, packUsers) => serviceViewModel.TaskCount = SkuCount;
{ serviceViewModel.TaskId = TaskId;
FeesItemResponse = feesItem; serviceViewModel.LoadPackDatas();
PackUser = string.Join("\r\n", packUsers); serviceViewModel.SetAllFees = new Action<FeesItemResponse, List<string>>((feesItem, packUsers) =>
IsShowFees = feesItem.AllFees > 0 ? true : false; {
}); FeesItemResponse = feesItem;
PackUser = string.Join("\r\n", packUsers);
IsShowFees = feesItem.AllFees > 0 ? true : false;
});
service.Show(); service.Show();
} }
@ -288,7 +287,7 @@ namespace BBWY.Client.Models
private long taskId; private long taskId;
/// <summary> /// <summary>
/// 绑定数据 /// 任务id
/// </summary> /// </summary>
public long TaskId { get => taskId; set { Set(ref taskId, value); } } public long TaskId { get => taskId; set { Set(ref taskId, value); } }

4
BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs

@ -487,7 +487,7 @@ namespace BBWY.Client.ViewModels.PackTask
SaveCerCommand = new RelayCommand(SaveCer); SaveCerCommand = new RelayCommand(SaveCer);
BarLabelCheckCommand = new RelayCommand<BarcodeLabelModel>(BarLabelCheck); BarLabelCheckCommand = new RelayCommand<BarcodeLabelModel>(BarLabelCheck);
CerLabelCheckCommand = new RelayCommand<CerHave3C>(CerLabelCheck); CerLabelCheckCommand = new RelayCommand<CertificateLabelModel>(CerLabelCheck);
LookBarCommand = new RelayCommand(LookBar); LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer); LookCerCommand = new RelayCommand(LookCer);
@ -558,7 +558,7 @@ namespace BBWY.Client.ViewModels.PackTask
look.Show(); look.Show();
} }
private void CerLabelCheck(CerHave3C cer) private void CerLabelCheck(CertificateLabelModel cer)
{ {
CertificateModel.IsLogo = (int)cer; CertificateModel.IsLogo = (int)cer;
} }

40
BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs

@ -62,9 +62,9 @@ namespace BBWY.Client.ViewModels.PackTask
readonly WorkProcessService workProcessService; readonly WorkProcessService workProcessService;
readonly IncreateServiceService increateService; readonly IncreateServiceService increateService;
public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateService, long taskId) public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateService)//, long taskId
{ {
TaskId = taskId; //TaskId = taskId;
this.consumableService = consumableService; this.consumableService = consumableService;
this.packTaskService = packTaskService; this.packTaskService = packTaskService;
this.workProcessService = workProcessService; this.workProcessService = workProcessService;
@ -156,14 +156,14 @@ namespace BBWY.Client.ViewModels.PackTask
//加载数据 //加载数据
LoadPackDatas(); //LoadPackDatas();
} }
/// <summary> /// <summary>
/// 加载任务数据 /// 加载任务数据
/// </summary> /// </summary>
private void LoadPackDatas() public void LoadPackDatas()
{ {
Task task = Task.Factory.StartNew(() => Task task = Task.Factory.StartNew(() =>
{ {
@ -177,8 +177,10 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
App.Current.Dispatcher.Invoke(() => App.Current.Dispatcher.Invoke(() =>
{ {
IncreateList.Add(new PackItemModel(IncreateServiceList, MemberList) IncreateList.Add(new PackItemModel()
{ {
MemberList = MemberList,
IncreateServiceList = IncreateServiceList,
ItemCount = item.ItemCount, ItemCount = item.ItemCount,
ItemName = item.ItemName, ItemName = item.ItemName,
SelectId = item.SelectId, SelectId = item.SelectId,
@ -196,8 +198,10 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
App.Current.Dispatcher.Invoke(() => App.Current.Dispatcher.Invoke(() =>
{ {
PackList.Add(new PackItemModel(null, MemberList, null, PackServiceList) PackList.Add(new PackItemModel()
{ {
PackServiceList= PackServiceList,
MemberList =MemberList,
ItemCount = item.ItemCount, ItemCount = item.ItemCount,
ItemName = item.ItemName, ItemName = item.ItemName,
SelectId = item.SelectId, SelectId = item.SelectId,
@ -215,13 +219,14 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
App.Current.Dispatcher.Invoke(() => App.Current.Dispatcher.Invoke(() =>
{ {
ConsumableServiceList.Add(new PackItemModel(null, MemberList, ConsumableList) ConsumableServiceList.Add(new PackItemModel()
{ {
MemberList = MemberList,
ConsumableList = ConsumableList,
ItemCount = item.ItemCount, ItemCount = item.ItemCount,
ItemName = item.ItemName, ItemName = item.ItemName,
SelectId = item.SelectId, SelectId = item.SelectId,
// SelectUserId = item.SelectUserId,
//MemberName = item.MemberName
}); });
}); });
@ -583,25 +588,30 @@ namespace BBWY.Client.ViewModels.PackTask
private void AddPackService() private void AddPackService()
{ {
PackList.Add(new PackItemModel(null, MemberList, null, PackServiceList) PackList.Add(new PackItemModel()
{ {
ItemCount = TaskCount ItemCount = TaskCount,
MemberList = MemberList,
PackServiceList = PackServiceList
}); });
} }
private void AddIncreateService() private void AddIncreateService()
{ {
IncreateList.Add(new PackItemModel(IncreateServiceList, MemberList) IncreateList.Add(new PackItemModel()
{ {
ItemCount = TaskCount ItemCount = TaskCount,
IncreateServiceList = IncreateServiceList,
MemberList = MemberList,
}); });
} }
private void AddConsumable() private void AddConsumable()
{ {
ConsumableServiceList.Add(new PackItemModel(null, null, ConsumableList) ConsumableServiceList.Add(new PackItemModel()
{ {
ItemCount = TaskCount ItemCount = TaskCount,
ConsumableList = ConsumableList
}); });
} }
} }

4
BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" xmlns:local="clr-namespace:BBWY.Client.Views.PackTask"
mc:Ignorable="d" mc:Ignorable="d"
Style="{StaticResource bwstyle}" Style="{StaticResource bwstyle}"
Height="240" Width="320" Height="245" Width="320"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:cmodel="clr-namespace:BBWY.Client.Models"
@ -48,7 +48,7 @@
</StackPanel> </StackPanel>
</Border> </Border>
<Border Name="biaozhun" Visibility="Collapsed" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="5"> <Border Name="biaozhun" Visibility="Collapsed" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="1">
<StackPanel Orientation="Vertical" > <StackPanel Orientation="Vertical" >
<TextBlock Margin="10,10,10,0" FontSize="15" FontWeight="Black" > <TextBlock Margin="10,10,10,0" FontSize="15" FontWeight="Black" >

6
BBWY.Client/Views/PackTask/PrintWindow.xaml

@ -16,8 +16,10 @@
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"> RightButtonGroupMargin="0,5,5,0"
ResizeMode="NoResize"
>
<!-- DataContext="{Binding CreateSetBarCodeView,Source={StaticResource Locator}}"-->
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="39"/> <RowDefinition Height="39"/>

22
BBWY.Client/Views/PackTask/PrintWindow.xaml.cs

@ -142,16 +142,14 @@ namespace BBWY.Client.Views.PackTask
public BarCodeModel BarCodeModel { get; set; } public BarCodeModel BarCodeModel { get; set; }
// public string LabelName { get; set; }
//public Dictionary<string, string> Datas { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e) private void BButton_Click(object sender, RoutedEventArgs e)
{ {
Task.Factory.StartNew(() => {
try try
{ {
//string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); //string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//string path = appPath + $"/Resources/LabelNames/{LabelName}.btw"; //string path = appPath + $"/Resources/LabelNames/{LabelName}.btw";
int printCount = Convert.ToInt32(tbCount.Text);//份数 int printCount = Convert.ToInt32(tbCount.Text);//份数
@ -163,19 +161,15 @@ namespace BBWY.Client.Views.PackTask
document.PrinterSettings.Copies = (short)printCount;//打印份数 document.PrinterSettings.Copies = (short)printCount;//打印份数
document.Print(); document.Print();
// Task.Factory.StartNew(() => {
// PrintBarCode(path, printCount, printName);
//});
} }
catch (Exception ex) catch (Exception ex)
{ {
new TipsWindow("打印失败").ShowDialog(); App.Current.Dispatcher.Invoke(() => {
} new TipsWindow("打印失败").ShowDialog();
});
}
});
} }

1
BBWY.Client/Views/PackTask/ServiceWindow.xaml

@ -14,6 +14,7 @@
CloseButtonVisibility="Visible" CloseButtonVisibility="Visible"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
DataContext="{Binding PackServiceList,Source={StaticResource Locator}}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"> RightButtonGroupMargin="0,5,5,0">

9
BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs

@ -22,7 +22,7 @@ namespace BBWY.Client.Views.PackTask
/// </summary> /// </summary>
public partial class ServiceWindow : BWindow public partial class ServiceWindow : BWindow
{ {
/*
public PackServiceViewModel model { get; set; } public PackServiceViewModel model { get; set; }
public PackTaskService packTaskService; public PackTaskService packTaskService;
public ConsumableService consumableService; public ConsumableService consumableService;
@ -40,8 +40,11 @@ namespace BBWY.Client.Views.PackTask
model.TaskCount = taskCount; model.TaskCount = taskCount;
this.DataContext = model; this.DataContext = model;
} }
*/
public ServiceWindow()
{
InitializeComponent();
}
} }
} }

4
BBWY.Client/Views/PackTask/SetCerWindow.xaml

@ -38,7 +38,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid > <Grid >
<!--IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"--> <!--IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}"-->
<RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.No3C}}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.No3C}" Content="标准" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/> <RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.No3C}}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CertificateLabelModel.No3C}" Content="标准" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left"> <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid> <Grid>
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" /> <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@ -64,7 +64,7 @@
</Grid> </Grid>
<Grid Grid.Column="1" > <Grid Grid.Column="1" >
<!--IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"--> <!--IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}"-->
<RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.Is3C}}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.Is3C}" Content="带3c标" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/> <RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.LabelModel,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:CertificateLabelModel.Is3C}}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CertificateLabelModel.Is3C}" Content="带3c标" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left"> <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid > <Grid >
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" /> <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />

Loading…
Cancel
Save