Browse Source

1

AddValidOverTime
506583276@qq.com 3 years ago
parent
commit
8d6aa6c830
  1. 54
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  2. 32
      BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs
  3. 53
      BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs
  4. 24
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  5. 13
      BBWY.Client/Views/PackTask/PackTaskTotal.xaml
  6. 117
      BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs
  7. 2
      BBWY.Client/Views/PackTask/TaskListControl.xaml
  8. 2
      BBWY.Client/Views/PackTask/WareHouseList.xaml
  9. 51
      BBWY.Client/Views/PackTask/WareHouseList.xaml.cs

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

@ -27,10 +27,8 @@ namespace BBWY.Client.Models
private long id;
public long Id { get => id; set { Set(ref id, value); } }
private readonly PackTaskService packTaskService;
readonly WorkProcessService workProcessService;
readonly IncreateServiceService increateServiceService;
public ICommand SetTaskStatusCommand { get; set; }
public ICommand PrintBarcodeCommand { get; set; }
public ICommand PrintCerCommand { get; set; }
@ -38,31 +36,17 @@ namespace BBWY.Client.Models
public ICommand LookBarCommand { get; set; }
public ICommand SetServiceCommand { get; set; }
public ConsumableService consumableService;
/// <summary>
/// 修改任务
/// </summary>
public ICommand UpdateTaskCommand { get; set; }
/// <summary>
/// 删除任务
/// </summary>
public ICommand DeletedTaskCommand { get; set; }
public Action ReflashTask { get; set; }
private void DeletedTask()
{
MessageBoxResult result = MessageBox.Show("确定删除?", "提示",
MessageBoxButton.YesNo,
MessageBoxImage.Warning);
if (result != MessageBoxResult.Yes) return;
packTaskService.DeletedTask(TaskId);
if (ReflashTask != null)
ReflashTask();//刷新界面
}
private void UpdateTask()
{
@ -83,21 +67,14 @@ namespace BBWY.Client.Models
public PackTaskModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService)
public PackTaskModel()
{
SetTaskStatusCommand = new RelayCommand<long>(SetTaskStatus);
PrintBarcodeCommand = new RelayCommand(PrintBarcode);
PrintCerCommand = new RelayCommand(PrintCer);
LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer);
SetServiceCommand = new RelayCommand(SetService);
UpdateTaskCommand = new RelayCommand(UpdateTask);
DeletedTaskCommand = new RelayCommand(DeletedTask);
this.packTaskService = packTaskService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
}
private void SetService()
@ -200,26 +177,7 @@ namespace BBWY.Client.Models
//printWindow.Datas = LoadBarLabelModels();
printWindow.Show();
}
public void SetTaskStatus(long taskId)
{
if (this.TaskStatus == TaskStateType.)
{
return;
}
///修改完成
var model = packTaskService.UpdateTaskStatus(taskId, 1,"");
if (model != null && model.Success)
{
//var res = batchPurchaseService.UpdatePurchaseOrderState(id, Models.PurchaseOrderState.已完成 );
this.TaskStatus = TaskStateType.;
new TipsWindow("修改成功").Show();
}
}
/*
public Dictionary<string, string> LoadBarLabelModels()
{

32
BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs

@ -5,6 +5,7 @@ using BBWY.Client.Models;
using BBWY.Client.Models.PackTask;
using BBWY.Client.Views.Order;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Extensions;
using BBWY.Common.Models;
using BBWY.Controls;
using GalaSoft.MvvmLight.Command;
@ -72,16 +73,19 @@ namespace BBWY.Client.ViewModels.PackTask
public ICommand BatchCheckedCommand { get; set; }
//public IList<Department> departmentList;
//ShopService shopService;
public PackTaskTotalViewModel(PackTaskService packTaskService)
{
this.packTaskService = packTaskService;
SearchTaskTotalCommand = new RelayCommand(SearchTaskTotal);
//this.shopService = shopService;
SearchTaskTotalCommand = new RelayCommand(() =>
{
SearchTask(1);
});
StartDate = DateTime.Now;
EndDate = DateTime.Now;
EndDate = DateTime.Now;
SetSearchDateCommand = new RelayCommand<int>(d =>
{
@ -102,6 +106,24 @@ namespace BBWY.Client.ViewModels.PackTask
ExportCommand = new RelayCommand(Export);
SearchTaskTotal();
//LoadShopList();
}
private void LoadShopList()
{
//departmentList=new List<Department>();
//var response = shopService.GetDepartmentList();
//if (!response.Success)
// throw new Exception(response.Msg);
//departmentList = response.Data.Map<IList<Department>>();
//var shopList = new List<Shop>();
//foreach (var d in departmentList)
// shopList.AddRange(d.ShopList);
}
private void Export()

53
BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs

@ -127,6 +127,11 @@ namespace BBWY.Client.ViewModels.PackTask
public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService)
{
this.globalContext = globalContext;
this.productService = productService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
this.packTaskService = packTaskService;
//TaskState = BBWY.Client.Models. TaskState.全部;
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
@ -144,35 +149,28 @@ namespace BBWY.Client.ViewModels.PackTask
});
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
CopyTextCommand = new RelayCommand<object>(s =>
{
try
{
Clipboard.SetText(s.ToString());
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
Console.ResetColor();
}
});
DeletedTaskCommand = new RelayCommand<object>(DeletedTask);
StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date;
IsLoading = false;
//加载数据
SetTaskState(Models.TaskState.);
this.globalContext = globalContext;
this.productService = productService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
}
private void DeletedTask(object obj)
{
MessageBoxResult result = MessageBox.Show("确定删除?", "提示",
MessageBoxButton.YesNo,
MessageBoxImage.Warning);
long taskId = (long)obj;
if (result != MessageBoxResult.Yes) return;
packTaskService.DeletedTask(taskId);
Task.Factory.StartNew(() => SearchTaskList());
}
private void IsLoadCount()
@ -227,11 +225,11 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public ICommand OpenSkuDetailCommand { get; set; }
/// <summary>
/// 复制
/// 删除任务
/// </summary>
public ICommand CopyTextCommand { get; set; }
public ICommand DeletedTaskCommand { get; set; }
public void SetTaskState(TaskState? taskState)
{
@ -293,7 +291,7 @@ namespace BBWY.Client.ViewModels.PackTask
foreach (var item in dataModel.Items)
{
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
var data = new PackTaskModel()
{
Brand = item.Brand,
SkuId = item.SkuId,
@ -322,10 +320,7 @@ namespace BBWY.Client.ViewModels.PackTask
TaskId = item.TaskId,
TaskStatus = (TaskStateType)item.TaskStatus,
EndTime = item.CreateTime,
IsWorry = (Worry)item.IsWorry
IsWorry = (Worry)item.IsWorry,
};
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
{

24
BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs

@ -190,14 +190,6 @@ namespace BBWY.Client.ViewModels.PackTask
this.productService = productService;
this.batchPurchaseService = batchPurchaseService;
}
#region 事件绑定
public ICommand SetTaskStatusCommand { get; set; }
@ -241,7 +233,7 @@ namespace BBWY.Client.ViewModels.PackTask
string orderId=(string)objList[1];
///修改完成
var model = packTaskService.UpdateTaskStatus(taskId, 1,orderId);
if (model != null && model.Success&&!string.IsNullOrEmpty(orderId))
if (model != null && model.Success)
SearchTaskList();
}
@ -297,7 +289,7 @@ namespace BBWY.Client.ViewModels.PackTask
OrderCount = dataModel.TotalCount;
foreach (var item in dataModel.Items)
{
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
var data = new PackTaskModel()
{
AcceptName = item.UserName,
Availability = (TaskState)item.Availability,
@ -326,9 +318,8 @@ namespace BBWY.Client.ViewModels.PackTask
EndTime = item.CreateTime,
OrderId= item.OrderId,
SkuId = item.SkuId,
SkuName = item.SkuName,
};
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
{
@ -420,14 +411,5 @@ namespace BBWY.Client.ViewModels.PackTask
#endregion
}
}

13
BBWY.Client/Views/PackTask/PackTaskTotal.xaml

@ -24,6 +24,12 @@
</Page.Resources>
<Grid>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
<StackPanel Background="Black" Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="572,13,0,0" Width="140">
<c:BTextBox x:Name="tbDepartment" Width="140" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxDepartment" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid Margin="5,0">
<Grid.RowDefinitions>
<RowDefinition Height="90"/>
@ -31,7 +37,6 @@
<RowDefinition/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Height="75" Panel.ZIndex="999">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@ -52,11 +57,11 @@
<DatePicker SelectedDate="{Binding StartDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/>
<DatePicker SelectedDate="{Binding EndDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/>
<TextBlock Text="任务ID:" Width="40" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId}" WaterRemark="精确匹配"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId}" />
<TextBlock Text="部门:" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="精确匹配" Text="{Binding SearchDepartment}"/>
<c:BTextBox Margin="5,0,0,0" Width="140" />
<TextBlock Text="店铺:" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchShopName}" WaterRemark="精确匹配"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchShopName}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,5" Height="30">
<c:BButton Content="今天" Width="50" Height="25" Margin="5,0,0,0"

117
BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs

@ -1,5 +1,14 @@
using System;
using BBWY.Client.APIServices;
using BBWY.Client.Helpers;
using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Common.Models;
using HandyControl.Controls;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -21,6 +30,112 @@ namespace BBWY.Client.Views.PackTask
public PackTaskTotal()
{
InitializeComponent();
this.Loaded += Load;
}
public ShopService shopService;
private void Load(object sender, RoutedEventArgs e)
{
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true);
var Configuration = builder.Build();
QKApiHost = Configuration.GetSection("QKApiHost").Value;
HttpClientHelper helper = new HttpClientHelper(QKApiHost);
string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据
var data = helper.Get(url);
var res = JsonConvert.DeserializeObject<ApiResponse<UserDepartment[]>>(data);
//创建一个ListBoxIem
if (res.Success)
{
if (res.Data != null && res.Data.Length > 0)
{
foreach (var department in res.Data)
{
if (!departments.Contains(department.DePartmentName))
{
departments.Add(department.DePartmentName);
}
}
}
}
}
public string QKApiHost { get; set; }
public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e)
{
try
{
var list = (ListBox)sender;
if (list.Items.Count <= 0)
{
return;
}
var value = (ListBoxItem)list.SelectedValue;
var content = (Label)value.Content;
tbDepartment.Text = content.Content.ToString();
tipBoxDepartment.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
List<string> departments = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (System.Windows.Controls.TextBox)sender;
//创建一个ListBox
if (tipBoxDepartment != null && tipBoxDepartment.Items.Count > 0)
{
tipBoxDepartment.Items.Clear();
}
if (departments.Count <= 0)
return;
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxDepartment.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in departments)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxDepartment.Items.Add(item);
}
}
tipBoxDepartment.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
}
}

2
BBWY.Client/Views/PackTask/TaskListControl.xaml

@ -120,7 +120,7 @@
<StackPanel Grid.Column="11" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" >
<c:BButton Command="{Binding UpdateTaskCommand}"
Style="{StaticResource LinkButton}" Content="修改" />
<c:BButton Command="{Binding DeletedTaskCommand}"
<c:BButton Command="{Binding DataContext.DeletedTaskCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" CommandParameter="{Binding TaskId}"
Margin="5,0,0,0" Style="{StaticResource LinkButton}" Content="删除" />
</StackPanel>

2
BBWY.Client/Views/PackTask/WareHouseList.xaml

@ -59,8 +59,6 @@
<TextBlock Text="SKU:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="" Text="{Binding SearchSkuId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="部门:" VerticalAlignment="Center" Margin="16,0,0,0"/>
</StackPanel>
<Grid Grid.Column="1" >

51
BBWY.Client/Views/PackTask/WareHouseList.xaml.cs

@ -32,14 +32,39 @@ namespace BBWY.Client.Views.PackTask
public WareHouseList()
{
InitializeComponent();
var applicationPath = System.IO. Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
this.Loaded += Load;
}
private void Load(object sender, RoutedEventArgs e)
{
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true);
var Configuration = builder.Build();
var Configuration = builder.Build();
QKApiHost = Configuration.GetSection("QKApiHost").Value;
HttpClientHelper helper = new HttpClientHelper(QKApiHost);
string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据
var data = helper.Get(url);
var res = JsonConvert.DeserializeObject<ApiResponse<UserDepartment[]>>(data);
//创建一个ListBoxIem
if (res.Success)
{
if (res.Data != null && res.Data.Count() > 0)
{
foreach (var department in res.Data)
{
if (!departments.Contains(department.DePartmentName))
{
departments.Add(department.DePartmentName);
}
}
}
}
}
string QKApiHost = "";
public string QKApiHost {get;set;}
public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e)
{
try
@ -57,12 +82,12 @@ namespace BBWY.Client.Views.PackTask
catch (Exception)
{
}
}
List<string> departments = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
@ -78,7 +103,7 @@ namespace BBWY.Client.Views.PackTask
}
if (departments.Count<=0)
if (departments.Count <= 0)
{
HttpClientHelper helper = new HttpClientHelper(QKApiHost);
@ -98,8 +123,6 @@ namespace BBWY.Client.Views.PackTask
departments.Add(department.DePartmentName);
}
}
}
}
@ -120,7 +143,7 @@ namespace BBWY.Client.Views.PackTask
item.Content = lb;
tipBox.Items.Add(item);
}
}
tipBox.Visibility = Visibility.Visible;
@ -128,9 +151,9 @@ namespace BBWY.Client.Views.PackTask
catch (Exception)
{
}
}
}
}

Loading…
Cancel
Save