Browse Source

1

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
f5505856eb
  1. 5
      BBWY.Client/APIServices/QiKu/PackTaskService.cs
  2. 23
      BBWY.Client/APIServices/QiKu/SealBoxService.cs
  3. 12
      BBWY.Client/BBWY.Client.csproj
  4. 38
      BBWY.Client/Helpers/MyPrintHelper.cs
  5. 11
      BBWY.Client/Models/Enums.cs
  6. 5
      BBWY.Client/Models/FallWare/JDWareBoxModel.cs
  7. 7
      BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs
  8. 2
      BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs
  9. 77
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  10. 62
      BBWY.Client/Views/FallWare/PrintBoxWindow.xaml
  11. 120
      BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs
  12. 50
      BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml
  13. 74
      BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs
  14. 78
      BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml
  15. 88
      BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs
  16. 3
      BBWY.Client/Views/FallWare/WaitFallWareControl.xaml
  17. 58
      BBWY.Client/Views/FallWare/WareFallWareListControl.xaml
  18. 105
      BBWY.Client/Views/FallWare/WareFallWareListControl.xaml.cs
  19. 81
      BBWY.Client/Views/PackTask/TaskList.xaml
  20. 5
      BBWY.Client/Views/PackTask/TaskListControl.xaml
  21. 58
      BBWY.Client/Views/PackTask/WaitCompletedControl.xaml
  22. 101
      BBWY.Client/Views/PackTask/WaitCompletedControl.xaml.cs
  23. 63
      BBWY.Client/Views/PackTask/WaitPackageControl.xaml
  24. 195
      BBWY.Client/Views/PackTask/WaitPackageControl.xaml.cs
  25. 76
      BBWY.Client/Views/PackTask/WareHouseList.xaml
  26. 231
      BBWY.Client/Views/PackTask/WareHouseList.xaml.cs
  27. 68
      BBWY.Client/Views/PackTask/WareHouseListControl.xaml
  28. 193
      BBWY.Client/Views/PackTask/WareHouseListControl.xaml.cs
  29. 67
      BBWY.Client/Views/QualityTask/WaitQualityControl.xaml
  30. 195
      BBWY.Client/Views/QualityTask/WaitQualityControl.xaml.cs
  31. 23
      BBWY.Client/Views/TaskOverTime/WareTaskOverTimeControl.xaml

5
BBWY.Client/APIServices/QiKu/PackTaskService.cs

@ -293,7 +293,7 @@ namespace BBWY.Client.APIServices
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
public ApiResponse<SearchOverTimeTaskResponse> SearchOverTimeTaskList(string ShopId, DateTime? StartTime, DateTime? EndTime, OverTimeTaskType? OverTimeTaskType, int? PageIndex, int? PageSize=20)
public ApiResponse<SearchOverTimeTaskResponse> SearchOverTimeTaskList(string ShopId, DateTime? StartTime, DateTime? EndTime,OverTimeTaskState overTimeTaskState, OverTimeTaskType? OverTimeTaskType, int? PageIndex, int? PageSize=20)
{
return SendRequest<SearchOverTimeTaskResponse>(globalContext.QKApiHost, $"api/PackTask/SearchOverTimeTaskList", new {
ShopId,
@ -301,7 +301,8 @@ namespace BBWY.Client.APIServices
EndTime,
OverTimeTaskType,
PageIndex,
PageSize
PageSize,
overTimeTaskState
}, null, HttpMethod.Post);
}

23
BBWY.Client/APIServices/QiKu/SealBoxService.cs

@ -88,7 +88,7 @@ namespace BBWY.Client.APIServices
, null, HttpMethod.Post);
}
public ApiResponse<GetWareSealBoxResponse> GetWareSealBoxList(string ShopName, long? TaskId, string SkuId, int? PageIndex, int? PageSize)
public ApiResponse<GetWareSealBoxResponse> GetWareSealBoxList(string ShopName, long? TaskId, string SkuId,long? SealBoxId, int? PageIndex, int? PageSize)
{
return SendRequest<GetWareSealBoxResponse>(globalContext.QKApiHost, $"api/SealBox/GetWareSealBoxList",
new
@ -97,7 +97,8 @@ namespace BBWY.Client.APIServices
TaskId,
SkuId,
PageIndex,
PageSize
PageSize,
SealBoxId
}
, null, HttpMethod.Post);
}
@ -124,7 +125,7 @@ namespace BBWY.Client.APIServices
/// <param name="PageIndex"></param>
/// <param name="PageSize"></param>
/// <returns></returns>
public ApiResponse<SearchWaitFallWareResponse> SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, long? TaskId = null, string SkuId = null, int PageIndex = 1
public ApiResponse<SearchWaitFallWareResponse> SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, long? TaskId = null, string SkuId = null,long?sealBoxId=null, int PageIndex = 1
, int PageSize = 10)
{
return SendRequest<SearchWaitFallWareResponse>(globalContext.QKApiHost, $"api/SealBox/SearchWareFallWareConfigureList",
@ -135,7 +136,8 @@ namespace BBWY.Client.APIServices
SkuId,
PageIndex,
PageSize,
positionState
positionState,
sealBoxId
}
, null, HttpMethod.Post);
}
@ -169,7 +171,7 @@ namespace BBWY.Client.APIServices
public ApiResponse<bool> SetFallWareConfigure(long SealBoxId, string ProductTitle, string PurchaseOrder, string PrewOrder, string WaybillNo, string providerName = "", string wareName = "")
public ApiResponse<bool> SetFallWareConfigure(long SealBoxId, string ProductTitle, string PurchaseOrder, string PrewOrder, string WaybillNo, string providerName = "", string wareName = "",string WareCity="")
{
return SendRequest<bool>(globalContext.QKApiHost, $"api/SealBox/SetFallWareConfigure",
new
@ -180,7 +182,8 @@ namespace BBWY.Client.APIServices
PrewOrder,
WaybillNo,
providerName,
wareName
wareName,
WareCity
}
, null, HttpMethod.Post);
}
@ -264,13 +267,17 @@ namespace BBWY.Client.APIServices
null, null, HttpMethod.Post);
}
public ApiResponse<GetWareWaitCompletedResponse> GetWareWaitCompletedList(string shopId, int? PageIndex, int? PageSize)
public ApiResponse<GetWareWaitCompletedResponse> GetWareWaitCompletedList(string shopId, string ShopName , long? TaskId , string SkuId , long? sealBoxId , int? PageIndex, int? PageSize)
{
return SendRequest<GetWareWaitCompletedResponse>(globalContext.QKApiHost, $"api/SealBox/GetWareWaitCompletedList",
new {
shopId,
PageIndex,
PageSize
PageSize,
ShopName,
TaskId,
SkuId,
sealBoxId
}, null, HttpMethod.Post);
}

12
BBWY.Client/BBWY.Client.csproj

@ -84,6 +84,18 @@
<ItemGroup>
<Folder Include="Resources\LabelNames\" />
<Folder Include="Views\PackTask\Ware\01all\" />
<Folder Include="Views\PackTask\Ware\02NoArrival\" />
<Folder Include="Views\PackTask\Ware\03Acceptance\" />
<Folder Include="Views\PackTask\Ware\04Package\" />
<Folder Include="Views\PackTask\Ware\05SealBox\" />
<Folder Include="Views\PackTask\Ware\06Transport\" />
<Folder Include="Views\PackTask\Ware\07FallWare\" />
<Folder Include="Views\PackTask\Ware\08WaitComplete\" />
<Folder Include="Views\PackTask\Ware\09Completed\" />
<Folder Include="Views\PackTask\Ware\10StoreGetBySelf\" />
<Folder Include="Views\PackTask\Ware\11OverTime\" />
<Folder Include="Views\PackTask\Ware\12Cancel\" />
</ItemGroup>
</Project>

38
BBWY.Client/Helpers/MyPrintHelper.cs

@ -52,10 +52,7 @@ namespace BBWY.Client.Helpers
default:
break;
}
}
private static void SetBar(BarCodeModel barCode, ref PrintPageEventArgs args, Font font, int heightSpace)
{
@ -106,10 +103,6 @@ namespace BBWY.Client.Helpers
topHeigth += (50 + 5);
args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, topHeigth));
}
/// <summary>
/// 标准
/// </summary>
@ -159,7 +152,6 @@ namespace BBWY.Client.Helpers
args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, 130));
args.Graphics.DrawImage(img, 1, 68, 234, 60);
}
public static void PrintCertificate(ref PrintPageEventArgs args, CertificateModel certificate, Font font)
{
@ -194,7 +186,6 @@ namespace BBWY.Client.Helpers
}
private static void SetCerStander(ref PrintPageEventArgs args, CertificateModel certificate, Font font)
{
@ -579,7 +570,6 @@ namespace BBWY.Client.Helpers
}
public static void SaveImage(PrintPageEventArgs args)
{
args.Graphics.Save();
@ -593,9 +583,13 @@ namespace BBWY.Client.Helpers
}
/// <summary>
/// 字符串生成条形码 图片
/// </summary>
/// <param name="printStr"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static BitmapImage GetBarcodeImage(string printStr, int width, int height)
{
Bitmap image = new Bitmap(width, height);
@ -606,6 +600,24 @@ namespace BBWY.Client.Helpers
return bitmapToBitmapImage(image);
}
/// <summary>
/// 字符串生成条形码 图片
/// </summary>
/// <param name="printStr"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static BitmapImage GetBarcodeImageV2(string printStr, int width, int height)
{
Bitmap image = new Bitmap(width, height);
Graphics graphics2 = Graphics.FromImage(image);
Barcode barcode = new Barcode();
System.Drawing.Image img = barcode.Encode(TYPE.CODE128, printStr, width, height);
graphics2.DrawImage(img, 0, 0, width, height);
return bitmapToBitmapImage(image);
}
static BitmapImage bitmapToBitmapImage(Bitmap bitmap)
{
using (var stream = new MemoryStream())

11
BBWY.Client/Models/Enums.cs

@ -538,6 +538,17 @@
= 8,
= 11,
}
/// <summary>
/// 超时任务状态
/// </summary>
public enum OverTimeTaskState
{
= 0,
= 1,
=2
}
public enum TaskMessageType
{
ID = 0,

5
BBWY.Client/Models/FallWare/JDWareBoxModel.cs

@ -58,5 +58,10 @@ namespace BBWY.Client.Models.FallWare
/// 供应商
/// </summary>
public string ProviderName { get; set; }
/// <summary>
/// 仓库城市
/// </summary>
public string WareCity { get; set; }
}
}

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

@ -60,13 +60,6 @@ namespace BBWY.Client.ViewModels.PackTask
public int IncrementPartTaskCount { get => incrementPartTaskCount; set { Set(ref incrementPartTaskCount, value); } }
//public ObservableCollection<string> incrementPartCountList = new ObservableCollection<string>() {
//"0","1","2","3","4件以上"
//};
//public ObservableCollection<string> IncrementPartCountList { get => incrementPartCountList; set { Set(ref incrementPartCountList, value); } }
private int incrementPartCount;
/// <summary>
/// 配件数量

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

@ -942,7 +942,7 @@ namespace BBWY.Client.ViewModels.PackTask
Task.Factory.StartNew(() =>
{
WaitCompletedList = new ObservableCollection<WareWaitCompleted>();
var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), PageIndex, PageSize);
var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), null, taskId, SearchSkuId, null, PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var dataModel = datas.Data;

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

@ -64,11 +64,27 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public ObservableCollection<OverTimeTaskType> OverTimeTaskTypeList { get => overTimeTaskTypeList; set { Set(ref overTimeTaskTypeList, value); } }
private OverTimeTaskType overTimeTaskState = OverTimeTaskType.;
private ObservableCollection<OverTimeTaskState> overTimeTaskStateList = new ObservableCollection<OverTimeTaskState> {
Models.OverTimeTaskState. , Models.OverTimeTaskState., OverTimeTaskState.
};
/// <summary>
///超时任务类型
/// </summary>
public ObservableCollection<OverTimeTaskState> OverTimeTaskStateList { get => overTimeTaskStateList; set { Set(ref overTimeTaskStateList, value); } }
private OverTimeTaskType overTimeTaskType = OverTimeTaskType.;
/// <summary>
/// 任务类型(超时)
/// </summary>
public OverTimeTaskType OverTimeTaskType { get => overTimeTaskType; set { Set(ref overTimeTaskType, value); } }
private OverTimeTaskState overTimeTaskState = OverTimeTaskState.;
/// <summary>
/// 任务类型(超时)
/// </summary>
public OverTimeTaskType OverTimeTaskState { get => overTimeTaskState; set { Set(ref overTimeTaskState, value); } }
public OverTimeTaskState OverTimeTaskState { get => overTimeTaskState; set { Set(ref overTimeTaskState, value); } }
@ -171,6 +187,18 @@ namespace BBWY.Client.ViewModels.PackTask
}
}
/// <summary>
/// 查询任务id
/// </summary>
private string searchSealBoxId;
public string SearchSealBoxId
{
get => searchSealBoxId; set
{
Set(ref searchSealBoxId, value);
}
}
/// <summary>
/// 查询Sku
/// </summary>
@ -496,16 +524,14 @@ namespace BBWY.Client.ViewModels.PackTask
PrewOrder = fallware.BoxConfigureData.PrewOrder,
ProductTitle = fallware.BoxConfigureData.ProductTitle,
PurchaseOrder = fallware.BoxConfigureData.PurchaseOrder,
WaybillNo = fallware.BoxConfigureData.WaybillNo
WaybillNo = fallware.BoxConfigureData.WaybillNo,
ProviderName = fallware.BoxConfigureData.ProviderName
};
if (fallware.WareType == WareType.)
{
PrintBoxWindow printBox = new PrintBoxWindow(model, fallware.WareType);
printBox.ShowDialog();
//加载模板数据
}
if (fallware.WareType == WareType.)
{
}
//打印
}
@ -527,14 +553,14 @@ namespace BBWY.Client.ViewModels.PackTask
};
if (fallware.WareType == WareType.)
{
SetJDWareBoxWindow window = new SetJDWareBoxWindow(model, sealBoxService, fallware.WareType, ReflashTask, false);
SetJDWareBoxWindow window = new SetJDWareBoxWindow(model);
window.Show();
//var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType, ReflashTask, false);
//w.ShowDialog();
}
if (fallware.WareType == WareType. || fallware.WareType == WareType.)
{
SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, sealBoxService, fallware.WareType, ReflashTask, false);
SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType);
window.Show();
}
@ -714,12 +740,26 @@ namespace BBWY.Client.ViewModels.PackTask
case Models.TaskState.:
case Models.TaskState.:
if (!model.OrderId.IsNullOrEmpty())
{
if (model.ExpressOrderList==null||model.ExpressOrderList.Count<=0)
{
System.Windows.MessageBox.Show("该任务采购单未进行发货,请联系业务进行发货后在确认收货", "提示");
return;
}
}
if (System.Windows.MessageBox.Show("是否确认收货?", "提示",
MessageBoxButton.YesNo,
MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
res = packTaskService.SetPackTaskState(taskId, Models.TaskState.);
if (res != null && res.Success)
{
//todo:手动发货上传B端数据
}
break;
case Models.TaskState.:
break;
@ -782,10 +822,17 @@ namespace BBWY.Client.ViewModels.PackTask
PageSize = 10;
IsStartThread = false;
long? taskId = null;
long? sealBoxId = null;
try
{
if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim()))
taskId = Convert.ToInt64(SearchTaskId);
var istrue = long.TryParse(SearchSealBoxId, out long sealboxid);
if (istrue)
{
sealBoxId = sealboxid;
}
}
catch
{
@ -800,7 +847,7 @@ namespace BBWY.Client.ViewModels.PackTask
Task.Factory.StartNew(() =>
{
WaitCompletedList = new ObservableCollection<WareWaitCompleted>();
var datas = sealBoxService.GetWareWaitCompletedList(null, PageIndex, PageSize);
var datas = sealBoxService.GetWareWaitCompletedList(null, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var dataModel = datas.Data;
@ -828,7 +875,7 @@ namespace BBWY.Client.ViewModels.PackTask
Task.Factory.StartNew(() =>
{
OverTimeTaskList = new ObservableCollection<OverTimeTaskResponse>();
var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState, PageIndex, PageSize);
var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState,OverTimeTaskType, PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var dataModel = datas.Data;
@ -923,7 +970,7 @@ namespace BBWY.Client.ViewModels.PackTask
WaitFallWareList = new ObservableCollection<WaitFallWareModel>();
var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, PageIndex, PageSize);
var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId,sealBoxId, PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var dataModel = datas.Data;
@ -1014,7 +1061,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
WaitSealBoxModels = new ObservableCollection<SealBoxModel>();
var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize);
var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var dataModel = datas.Data;

62
BBWY.Client/Views/FallWare/PrintBoxWindow.xaml

@ -0,0 +1,62 @@
<c:BWindow x:Class="BBWY.Client.Views.FallWare.PrintBoxWindow"
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.FallWare"
mc:Ignorable="d"
Style="{StaticResource bwstyle}"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
Height="219" Width="378"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0">
<!-- DataContext="{Binding CreateSetBarCodeView,Source={StaticResource Locator}}"-->
<Window.Resources>
<ResourceDictionary >
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"
Background="{StaticResource Border.Background}">
<TextBlock Text="打印箱唛" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Grid.Row="1" Orientation="Vertical" >
<StackPanel Orientation="Horizontal" Margin=" 0 50 0 0" HorizontalAlignment="Center">
<TextBlock Margin="0 0 5 0" VerticalAlignment="Center" Text="打印机:"/>
<Border BorderBrush="{StaticResource Border.Brush}" VerticalAlignment="Center" BorderThickness="1" Height="30">
<ComboBox x:Name="cbPrints" BorderThickness="0" Height="25" Width="200" VerticalAlignment="Center" HorizontalAlignment="Left" ItemsSource="{Binding PrintList}" Text="{Binding PrintName}" />
</Border>
</StackPanel>
<CheckBox Name="cbx_allsomebox" Content="打印所有同揽收单的箱唛" HorizontalAlignment="Left" Margin="66 10 0 0"/>
</StackPanel>
<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" Click="BButton_Click"
/>
</Grid>
</c:BWindow>

120
BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs

@ -0,0 +1,120 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Models.FallWare;
using BBWY.Controls;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing.Printing;
using System.IO;
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.FallWare
{
/// <summary>
/// PrintBoxWindow.xaml 的交互逻辑
/// </summary>
public partial class PrintBoxWindow : BWindow
{
public PrintBoxWindow(JDWareBoxModel model, WareType WareType)
{
JDWareBoxModel =model ; this.WareType = WareType;
InitializeComponent();
this.DataContext = this;
InitPrintList();
}
public void InitPrintList()
{
//TaskImage = MyPrintHelper.GetBarcodeImage(TaskId.ToString(), 300, 60);
//BarcodeImage = MyPrintHelper.GetBarcodeImage(SkuId, 300, 60);
PrintList = new ObservableCollection<string>();
var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据
int index = -1;
int selectIndex = 0;
foreach (string name in printingNames)
{
if (name == "Microsoft XPS Document Writer" || name == "Microsoft Print to PDF" || name == "Fax")
{
continue;
}
index++;
if (name.Contains("Deli"))
{
selectIndex = index;
}
PrintList.Add(name);
}
try
{
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "printName.init");
if (File.Exists(printNames))
{
PrintName = File.ReadAllText(printNames);
}
else
{
if (PrintList.Count > 0)
{
PrintName = PrintList[0].ToString();
}
}
}
catch (Exception)
{
}
}
public string PrintName { get; set; }
public int PrintCount { get; set; } = 1;
public JDWareBoxModel JDWareBoxModel { get; set; }
/// <summary>
/// 箱唛类型
/// </summary>
public WareType WareType { get; set; }
/// <summary>
/// 打印机列表
/// </summary>
public ObservableCollection<string> PrintList { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e)
{
if (WareType== WareType.)
{
SetJDWareBoxWindow jdWindow = new SetJDWareBoxWindow(JDWareBoxModel);
jdWindow.Show();
//jdWindow.WindowState = WindowState.Maximized;
jdWindow.PrintBox(PrintName);
}
if (WareType== WareType.|| WareType== WareType.)
{
SetCloudWareBoxWindow cloudWareWindow = new SetCloudWareBoxWindow(JDWareBoxModel, WareType);
cloudWareWindow.Visibility = Visibility.Hidden;
cloudWareWindow.Show();
cloudWareWindow.PrintBox(PrintName);
}
}
}
}

50
BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml

@ -16,7 +16,7 @@
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
Width="450" Height="330"
Width="450" Height="380"
RightButtonGroupMargin="0,5,5,0">
<!--CloseButtonColor="{StaticResource WindowButtonColor}" -->
<c:BWindow.Resources>
@ -45,12 +45,12 @@
Background="{StaticResource Border.Background}">
<TextBlock Text="{Binding WareType,Converter={StaticResource objConverter},ConverterParameter=云仓:云仓箱唛:聚水潭箱唛}" FontSize="16" HorizontalAlignment="Left" Margin="10 0 0 0" VerticalAlignment="Center"/>
</Border>
<Grid Grid.Row="1" Margin="1 0 1 1" Name="jd_box">
<Grid Grid.Row="1" Margin="2" Name="jd_box">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -59,28 +59,31 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" VerticalAlignment="Top" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="2" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="3" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="4" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="5" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="6" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="0" HorizontalAlignment="Left" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="0" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="3" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="2" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Height="1" Background="Black" Grid.Row="0" VerticalAlignment="Top" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="0" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="2" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="3" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="4" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="5" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="6" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Width="1" Background="Black" Grid.Column="0" HorizontalAlignment="Left" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="0" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="3" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Width="1" Background="Black" Grid.Column="2" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="店铺名称"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.ShopName}" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding WareType,Converter={StaticResource taskStateToBoolean},ConverterParameter=云仓:CLPS采购单号:采购单号}" Grid.Row="1"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.PurchaseOrder ,Mode=TwoWay}" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Margin="2">
<Image Stretch="Fill" Source="{Binding PurchaseOrderImage}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.PurchaseOrder ,Mode=TwoWay}" />
</StackPanel>
<TextBlock Style="{StaticResource middleTextBlock}" Text="目的城市-仓库" Grid.Row="2"/>
@ -89,7 +92,8 @@
<TextBlock Style="{StaticResource middleTextBlock}" Text="箱数" Grid.Row="3"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="3" Grid.Column="1" >
<TextBlock Style="{StaticResource middleTextBlock}" Text="1/"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding PrintCount,Mode=TwoWay}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="/"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.BoxCount,Mode=TwoWay}" />

74
BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs

@ -14,6 +14,10 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WebSocketSharp;
using BBWY.Client.Helpers;
using System.Printing;
using System.Reflection;
using System.IO;
namespace BBWY.Client.Views.FallWare
{
@ -22,51 +26,71 @@ namespace BBWY.Client.Views.FallWare
/// </summary>
public partial class SetCloudWareBoxWindow : BWindow
{
public SetCloudWareBoxWindow(JDWareBoxModel model, SealBoxService sealBoxService, WareType wareType, Action reflashWindow, bool isEnabled = true)
public SetCloudWareBoxWindow(JDWareBoxModel model, WareType wareType)
{
if (SealBoxService == null) this.SealBoxService = sealBoxService;
WareType = wareType;
ReflashWindow = reflashWindow;
WareType = wareType;
JDWareBoxModel = model;
InitializeComponent();
PurchaseOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50);
this.DataContext = this;
if (!isEnabled)
{
//this.jd_box.IsEnabled = isEnabled;
//this.btn_save.Visibility = Visibility.Collapsed;
}
}
public JDWareBoxModel JDWareBoxModel { get; set; }
private SealBoxService SealBoxService { get; set; }
private Action ReflashWindow { get; set; }
/// <summary>
/// 采购单号条形码
/// </summary>
public BitmapImage PurchaseOrderImage { get; set; }
public WareType WareType { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e)
public int PrintCount { get; set; } = 1;
public void PrintBox(string printName)
{
if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty())
var localPrintServer = new LocalPrintServer();
if (string.IsNullOrEmpty(printName))
{
MessageBox.Show("采购单号不能为空");
return;
}
if (JDWareBoxModel.PrewOrder.IsNullOrEmpty() && WareType == WareType.)
var printQueue = localPrintServer.GetPrintQueue(printName);
if (printQueue.IsInError)
{
MessageBox.Show("预约单号不能为空");
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
var res = SealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle, JDWareBoxModel.PurchaseOrder, JDWareBoxModel.PrewOrder, JDWareBoxModel.WaybillNo);
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
PrintDialog printDialog = new PrintDialog();
if (res != null && res.Success)
printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向
for (int i = 1; i <= JDWareBoxModel.BoxCount; i++)
{
if (ReflashWindow != null) ReflashWindow();
this.Close();
PrintCount = i;
//设置纸张大小
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;
this.Width = pageWidth;
this.FontSize = 30;
this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight)));
//794 429 Width="478" Height="440"
//this.jd_box.Arrange(new Rect(new Point((pageWidth - jd_box.DesiredSize.Width) / 2, (pageHeight - jd_box.DesiredSize.Height) / 2), new Size(jd_box.DesiredSize.Width, jd_box.DesiredSize.Height)));
printDialog.PrintVisual(this.jd_box, "打印任务");
return;
}
if (res != null) MessageBox.Show(res.Msg);
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();
}
}
}

78
BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml

@ -10,13 +10,13 @@
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:hc="https://handyorg.github.io/handycontrol"
WindowStartupLocation="CenterScreen"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
Width="450" Height="500"
Width="480" Height="480"
RightButtonGroupMargin="0,5,5,0">
<!--CloseButtonColor="{StaticResource WindowButtonColor}" -->
<c:BWindow.Resources>
@ -45,15 +45,16 @@
Background="{StaticResource Border.Background}">
<TextBlock Text="京仓箱唛" FontSize="16" HorizontalAlignment="Left" Margin="10 0 0 0" VerticalAlignment="Center"/>
</Border>
<Grid Grid.Row="1" Margin="1 0 1 1" Name="jd_box">
<Grid Grid.Row="1" Name="jd_box" >
<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*" />
<RowDefinition Height="0"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@ -61,53 +62,60 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" VerticalAlignment="Top" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="2" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="3" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="4" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="5" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="6" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="0" HorizontalAlignment="Left" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="0" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="3" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="2" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Height="1" Background="Black" Grid.Row="0" VerticalAlignment="Top" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="0" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="2" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="3" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="4" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="5" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Height="1" Background="Black" Grid.Row="6" VerticalAlignment="Bottom" Grid.ColumnSpan="4"/>
<Border Width="1" Background="Black" Grid.Column="0" HorizontalAlignment="Left" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="0" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="3" HorizontalAlignment="Right" Grid.RowSpan="7"/>
<Border Width="1" Background="Black" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<Border Width="1" Background="Black" Grid.Column="2" Grid.Row="6" HorizontalAlignment="Right" Grid.RowSpan="1"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="供应商名称"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding ProviderName}" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.ProviderName,Mode=TwoWay}" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="采购单号" Grid.Row="1"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding PurchaseOrder ,Mode=TwoWay}" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Margin="2">
<Image Stretch="Fill" Source="{Binding PurchaseOrderImage}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.PurchaseOrder ,Mode=TwoWay}" />
</StackPanel>
<TextBlock Style="{StaticResource middleTextBlock}" Text="预约单号" Grid.Row="2"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding PrewOrder,Mode=TwoWay}" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Margin="2">
<Image Stretch="Fill" Source="{Binding PrewOrderImage}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.PrewOrder,Mode=TwoWay}" />
</StackPanel>
<!--<TextBlock Style="{StaticResource middleTextBlock}" Text="运单号" Grid.Row="3"/>
<TextBox Style="{StaticResource middleTextBox}" Text="{Binding WaybillNo,Mode=TwoWay}" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3"/>-->
<TextBox Style="{StaticResource middleTextBox}" Text="{Binding JDWareBoxModel.WaybillNo,Mode=TwoWay}" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3"/>-->
<TextBlock Style="{StaticResource middleTextBlock}" Text="目的城市-仓库" Grid.Row="4"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding WareName}" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.WareName}" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="商品名称" Grid.Row="5"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding ProductTitle,Mode=TwoWay}" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.ProductTitle,Mode=TwoWay}" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="箱数" Grid.Row="6"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="6" Grid.Column="1" >
<TextBlock Style="{StaticResource middleTextBlock}" Text="1/"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding BoxCount,Mode=TwoWay}" />
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding PrintCount}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="/"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.BoxCount,Mode=TwoWay}" />
</StackPanel>
<TextBlock Style="{StaticResource middleTextBlock}" Text="商品数量" Grid.Row="6" Grid.Column="2"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding ProductCount}" Grid.Row="6" Grid.Column="3" />
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding JDWareBoxModel.ProductCount}" Grid.Row="6" Grid.Column="3" />
</Grid>
<!--<c:BButton Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="105" VerticalAlignment="Center" Height="40" Click="BButton_Click"
Name="btn_save" />-->
</Grid>
</Grid>
</c:BWindow>

88
BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs

@ -1,10 +1,18 @@
using BBWY.Client.APIServices;
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Client.Models.FallWare;
using BBWY.Controls;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing.Printing;
using System.IO;
using System.Printing;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@ -22,54 +30,82 @@ namespace BBWY.Client.Views.FallWare
/// </summary>
public partial class SetJDWareBoxWindow : BWindow
{
public SetJDWareBoxWindow(JDWareBoxModel model, SealBoxService sealBoxService,WareType wareType, Action reflashWindow,bool isEnabled = true)
public SetJDWareBoxWindow(JDWareBoxModel model)
{
if (SealBoxService == null) this.SealBoxService = sealBoxService;
WareType = wareType;
ReflashWindow = reflashWindow;
JDWareBoxModel = model;
InitializeComponent();
this.DataContext = JDWareBoxModel;
if (!isEnabled)
{
//this.jd_box.IsEnabled = isEnabled;
//this.btn_save.Visibility = Visibility.Collapsed;
PurchaseOrderImage= MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50);
PrewOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PrewOrder, 350, 50);
this.DataContext =this;
}
public JDWareBoxModel JDWareBoxModel { get; set; }
/// <summary>
/// 采购单号条形码
/// </summary>
public BitmapImage PurchaseOrderImage { get; set; }
}
public JDWareBoxModel JDWareBoxModel { get; set; }
private SealBoxService SealBoxService { get; set; }
/// <summary>
/// 预约单号条形码
/// </summary>
public BitmapImage PrewOrderImage { get; set; }
public int PrintCount { get; set; } = 1;
private Action ReflashWindow { get; set; }
private WareType WareType { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e)
public void PrintBox(string printName)
{
if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty())
var localPrintServer = new LocalPrintServer();
if (string.IsNullOrEmpty(printName))
{
MessageBox.Show("采购单号不能为空");
return;
}
if (JDWareBoxModel.PrewOrder.IsNullOrEmpty()&& WareType== WareType.)
var printQueue = localPrintServer.GetPrintQueue(printName);
if (printQueue.IsInError)
{
MessageBox.Show("预约单号不能为空");
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
var res = SealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle,JDWareBoxModel.PurchaseOrder,JDWareBoxModel.PrewOrder,JDWareBoxModel.WaybillNo);
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
PrintDialog printDialog = new PrintDialog();
printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向
if (res!=null&&res.Success)
for (int i = 1; i <= JDWareBoxModel.BoxCount; i++)
{
if (ReflashWindow != null) ReflashWindow();
this.Close();
PrintCount = i;
//设置纸张大小
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;
this.Width = pageWidth;
this.FontSize = 30;
this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight)));
//794 429 Width="478" Height="440"
//this.jd_box.Arrange(new Rect(new Point((pageWidth - jd_box.DesiredSize.Width) / 2, (pageHeight - jd_box.DesiredSize.Height) / 2), new Size(jd_box.DesiredSize.Width, jd_box.DesiredSize.Height)));
printDialog.PrintVisual(this.jd_box, "打印任务");
return;
}
if (res != null) MessageBox.Show(res.Msg);
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();
}
}
}

3
BBWY.Client/Views/FallWare/WaitFallWareControl.xaml

@ -255,10 +255,9 @@
Command="{Binding DataContext.LookBoxConfigureCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"
/>
<c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" VerticalAlignment="Center" Content="打印"
<c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" VerticalAlignment="Center" Content="打印" Margin="10 0 0 0 "
Command="{Binding DataContext.PrintBoxConfigureCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"
Visibility="Collapsed"
/>
</StackPanel>
<TextBlock Style="{StaticResource middleTextBlock}" Text="未配置"

58
BBWY.Client/Views/FallWare/WareFallWareListControl.xaml

@ -62,12 +62,65 @@
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="50,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="54"/>
<RowDefinition Height="40"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" Grid.Row="0" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="封箱ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSealBoxId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
</StackPanel>
<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}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="30" Grid.Row="1">
</StackPanel>
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="搜索" Width="94" Height="30" HorizontalAlignment="Left" Margin="0,0,0,0"
Command="{Binding SearchTaskCommand}"
Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</Grid>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<RadioButton Content="已配置" Height="35" Width="130" Tag="{Binding FallWareConfiguredCount,Mode=TwoWay}" IsChecked="{Binding SealBoxConfigureType,Converter={StaticResource objConverter},ConverterParameter=已配置:True:False}"
Command="{Binding SetSealBoxConfigureTypeCommand}" CommandParameter="{x:Static cmodel:SealBoxConfigureType.已配置}"
/>
@ -75,7 +128,7 @@
Command="{Binding SetSealBoxConfigureTypeCommand}" CommandParameter="{x:Static cmodel:SealBoxConfigureType.待配置}"
/>
</StackPanel>
<Grid Grid.Row="1"
<Grid Grid.Row="2"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待落仓:Visible:Collapsed}"
>
@ -83,7 +136,7 @@
</Grid>
<Grid Grid.Row="1"
<Grid Grid.Row="2"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱:Visible:Collapsed}"
>
@ -96,4 +149,5 @@
</Grid>
</Grid>
</Grid>
</UserControl>

105
BBWY.Client/Views/FallWare/WareFallWareListControl.xaml.cs

@ -1,5 +1,10 @@
using System;
using BBWY.Client.Helpers;
using BBWY.Client.ViewModels;
using BBWY.Common.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -10,6 +15,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.FallWare
{
@ -21,6 +27,103 @@ namespace BBWY.Client.Views.FallWare
public WareFallWareListControl()
{
InitializeComponent();
this.Loaded += Load;
}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
}
public string QKApiHost { get; set; }
List<string> shops = new List<string>();
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

81
BBWY.Client/Views/PackTask/TaskList.xaml

@ -66,44 +66,16 @@
</Page.Resources>
<Grid>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
<Grid Margin="5,0">
<Grid Margin="5,5 5 5">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="40"/>
<RowDefinition Height="50"/>
<RowDefinition Height="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱|待落仓|待出库:0:40}"/>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
<!---->
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<!--<TextBlock Text="提交时间:" VerticalAlignment="Center" Margin="11,0,0,0"/>
<DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>
<DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>-->
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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}"/>
</StackPanel>
<Grid Grid.Column="1" >
<Button Content="搜索" Width="80" VerticalAlignment="Stretch" Margin="30,0,0,0"
Command="{Binding SearchTaskCommand}" Grid.Column="1"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</Grid>
<StackPanel Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Left" Orientation="Horizontal">
<StackPanel Grid.RowSpan="1" HorizontalAlignment="Left" Orientation="Horizontal" >
<RadioButton Height="35" Width="126" VerticalAlignment="Center" x:Name="qb" Content="全部" Command="{Binding SetTaskStateCommand}"
@ -154,19 +126,50 @@
/>
<Button Content="发布任务" Height="35" Width="120" Margin="30 0 0 0"
Command="{Binding CreateTaskCommand}" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"
/>
</StackPanel>
<Border Grid.Row="2" Margin="0,5,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0"
<Grid Background="{StaticResource Border.Background}" Grid.Row="1" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<!--<TextBlock Text="提交时间:" VerticalAlignment="Center" Margin="11,0,0,0"/>
<DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>
<DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>-->
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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}"/>
<Grid Grid.Column="1" HorizontalAlignment="Left">
<Button Content="搜索" Width="100" Height="30" VerticalAlignment="Center" Margin="66,0,0,0"
Command="{Binding SearchTaskCommand}" Grid.Column="1"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</StackPanel>
</Grid>
<Grid Grid.Row="2" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Button Content="发布任务" Height="35" Width="120" Margin="0 0 0 0" HorizontalAlignment="Left"
Command="{Binding CreateTaskCommand}" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱|待落仓:Collapsed:Visible}"
/>
</Grid>
<Border Grid.Row="3" Margin="0,5,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0"
/>
<Border Grid.Row="3" Margin="0,0,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0"
<Border Grid.Row="4" Margin="0,0,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0"
/>
<Grid Grid.Row="2" Margin="0,5,0,0">
<Grid Grid.Row="3" Margin="0,5,0,0">
<local:TaskListControl x:Name="listbox_task"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱|待落仓|待验收|待打包|待出库:Collapsed:Visible}"
@ -187,7 +190,7 @@
<c:PageControl PageIndex="{Binding PageIndex}"
PageSize="{Binding PageSize}"
RecordCount="{Binding OrderCount}"
Grid.Row="3"
Grid.Row="4"
HorizontalAlignment="Left" Width="450">
<b:Interaction.Triggers>
<b:EventTrigger EventName="OnPageIndexChanged">

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

@ -115,11 +115,6 @@
<TextBlock VerticalAlignment="Center" Text="部门:" Margin="14,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding DepartmentName}" Margin="5,0,0,0" />
<!--<TextBlock VerticalAlignment="Center" Text="店铺:" Margin="14,0,0,0" />
<c:BButton Content="{Binding ShopName}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding ShopName}"
Margin=" 5,0,0,0"/>-->
<TextBlock VerticalAlignment="Center" Text="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel>

58
BBWY.Client/Views/PackTask/WaitCompletedControl.xaml

@ -24,14 +24,65 @@
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
<ctr:SaleGrossProfitConverter x:Key="sgpcConverter"/>
</UserControl.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="50,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="54"/>
<RowDefinition Height="45"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" Grid.Row="0" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0"
<StackPanel Orientation="Horizontal" >
<TextBlock Text="封箱ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSealBoxId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
</StackPanel>
<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}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="30" Grid.Row="1">
</StackPanel>
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="搜索" Width="94" Height="30" HorizontalAlignment="Left" Margin="0,0,0,0"
Command="{Binding SearchTaskCommand}"
Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</Grid>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0" Grid.Row="1" Margin="0 10 0 0"
Background="#F2F2F2">
<Grid>
<Grid.ColumnDefinitions>
@ -68,7 +119,7 @@
</Grid>
</Border>
<ListBox x:Name="listbox_order"
Grid.Row="7"
Grid.Row="2"
ItemsSource="{Binding WaitCompletedList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
@ -298,4 +349,5 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>

101
BBWY.Client/Views/PackTask/WaitCompletedControl.xaml.cs

@ -1,5 +1,7 @@
using System;
using BBWY.Client.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -21,6 +23,103 @@ namespace BBWY.Client.Views.PackTask
public WaitCompletedControl()
{
InitializeComponent();
this.Loaded += Load;
}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
}
public string QKApiHost { get; set; }
List<string> shops = new List<string>();
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

63
BBWY.Client/Views/PackTask/WaitPackageControl.xaml

@ -26,12 +26,66 @@
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
<ctr:SaleGrossProfitConverter x:Key="sgpcConverter"/>
</UserControl.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="460,15,0,0">
<c:BTextBox x:Name="tb" Width="150" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBox" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="660,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="54"/>
<RowDefinition Height="45"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" Grid.Row="0" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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,2,0"/>
<c:BTextBox Visibility="Hidden" Width="150" Height="30" TextChanged="tb_TextChanged" ></c:BTextBox>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="物流单号:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchWayBillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="精准搜索"/>
<TextBlock Text="物流公司名称:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="模糊搜索"/>
<Button Content="搜索" Width="94" Height="30" VerticalAlignment="Stretch" Margin="10,0,0,0"
Command="{Binding SearchTaskCommand}"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</StackPanel>
</Grid>
<Border Height="1" Grid.Row="1" Margin="0 10 0 0" Background="{StaticResource Border.Brush}" VerticalAlignment="Top"/>
<Grid Grid.Row="1" Margin="0 10 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="80"/>
@ -154,7 +208,9 @@
<!--<StackPanel Grid.Column="9" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=未到货|部分到货|待验收:Visible:Collapsed}"
>
--><!-- --><!--
-->
<!-- -->
<!--
<c:BButton Command="{Binding UpdateTaskCommand}" Style="{StaticResource LinkButton}" Content="修改" />
<c:BButton Command="{Binding DataContext.DeletedTaskCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" CommandParameter="{Binding}"
Margin="5,0,0,0" Style="{StaticResource LinkButton}" Content="取消"/>
@ -538,4 +594,5 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>

195
BBWY.Client/Views/PackTask/WaitPackageControl.xaml.cs

@ -1,5 +1,11 @@
using System;
using BBWY.Client.Helpers;
using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Common.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -10,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.PackTask
{
@ -21,6 +28,192 @@ namespace BBWY.Client.Views.PackTask
public WaitPackageControl()
{
InitializeComponent();
this.Loaded += Load;
}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
departments = globalContext.User.DepartmentList.Select(s => s.Name).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
}
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;
tb.Text = content.Content.ToString();
tipBox.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
List<string> departments = new List<string>();
List<string> shops = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
{
if (tipBox != null)
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBox != null && tipBox.Items.Count > 0)
{
tipBox.Items.Clear();
}
if (departments.Count <= 0)
{
if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com";
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);
}
}
}
}
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBox.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;
tipBox.Items.Add(item);
}
}
tipBox.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

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

@ -68,80 +68,18 @@
</Page.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="460,15,0,0">
<c:BTextBox x:Name="tb" Width="150" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBox" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="660,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
<Grid Margin="5,0">
<Grid Margin="5,5">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="40"/>
<RowDefinition Height="35"/>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
<!---->
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<!--<TextBlock Text="提交时间:" VerticalAlignment="Center" Margin="11,0,0,0"/>
<DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>
<DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>-->
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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,2,0"/>
<c:BTextBox Visibility="Hidden" Width="150" Height="30" TextChanged="tb_TextChanged" ></c:BTextBox>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="物流单号:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchWayBillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="精准搜索"/>
<TextBlock Text="物流公司名称:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="模糊搜索"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="30" Grid.Row="1">
</StackPanel>
<Grid Grid.Column="1" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="搜索" Width="60" VerticalAlignment="Stretch" Margin="5,0,0,0"
Command="{Binding SearchTaskCommand}"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</Grid>
<StackPanel Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Left" Orientation="Horizontal">
<StackPanel Grid.RowSpan="1" HorizontalAlignment="Left" Orientation="Horizontal">
<RadioButton Height="35" Width="126" VerticalAlignment="Center" x:Name="qb" Content="全部" Command="{Binding SetTaskStateCommand}"
IsChecked="{Binding TaskState,Mode=TwoWay,Converter={StaticResource taskStateToBoolean},ConverterParameter=#null:True:False}"
/>
@ -200,10 +138,10 @@
</StackPanel>
<Border Grid.Row="2" Margin="0,5,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0" />
<Border Grid.Row="3" Margin="0,0,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0" />
<Grid Grid.Row="2" Margin="0,5,0,0">
<Border Grid.Row="2" Margin="0,0,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0" />
<Grid Grid.Row="1" Margin="0,5,0,0">
<fallware:WareFallWareListControl Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待落仓:Visible:Collapsed}" />
<local:WareHouseListControl Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱|待落仓|待验收|待打包|待转运|已超时|待出库:Collapsed:Visible}" />
<fallware:WareFallWareListControl Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待封箱:Visible:Collapsed}" />
@ -217,7 +155,7 @@
<c:PageControl PageIndex="{Binding PageIndex,Mode=TwoWay}"
PageSize="{Binding PageSize,Mode=TwoWay}"
RecordCount="{Binding OrderCount,Mode=TwoWay}"
Grid.Row="3"
Grid.Row="2"
HorizontalAlignment="Left" Width="450">
<b:Interaction.Triggers>
<b:EventTrigger EventName="OnPageIndexChanged">

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

@ -34,238 +34,7 @@ namespace BBWY.Client.Views.PackTask
public WareHouseList()
{
InitializeComponent();
this.Loaded += Load;
}
//private void WareHouseList_Unloaded(object sender, RoutedEventArgs e)
//{
// Messenger.Default.Unregister("AcceptGlobalContext");
//}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
departments=globalContext.User.DepartmentList.Select(s=>s.Name).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
//try
//{
// 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;
// if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com";
// 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);
// }
// }
// }
// }
//}
//catch (Exception)
//{
//}
}
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;
tb.Text = content.Content.ToString();
tipBox.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
List<string> departments = new List<string>();
List<string> shops = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
{
if (tipBox != null)
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBox != null && tipBox.Items.Count > 0)
{
tipBox.Items.Clear();
}
if (departments.Count <= 0)
{
if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com";
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);
}
}
}
}
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBox.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;
tipBox.Items.Add(item);
}
}
tipBox.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

68
BBWY.Client/Views/PackTask/WareHouseListControl.xaml

@ -24,12 +24,69 @@
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
<ctr:SaleGrossProfitConverter x:Key="sgpcConverter"/>
</UserControl.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="460,15,0,0">
<c:BTextBox x:Name="tb" Width="150" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBox" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="660,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="54"/>
<RowDefinition Height="45"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" Grid.Row="0" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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,2,0"/>
<c:BTextBox Visibility="Hidden" Width="150" Height="30" TextChanged="tb_TextChanged" ></c:BTextBox>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="物流单号:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchWayBillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="精准搜索"/>
<TextBlock Text="物流公司名称:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="模糊搜索"/>
<Button Content="搜索" Width="94" Height="30" VerticalAlignment="Stretch" Margin="10,0,0,0"
Command="{Binding SearchTaskCommand}"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</StackPanel>
</Grid>
<Border Height="1" Grid.Row="1" Margin="0 10 0 0" Background="{StaticResource Border.Brush}" VerticalAlignment="Top"/>
<Grid Grid.Row="1" Margin="0 10 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="90"/>
@ -72,7 +129,7 @@
</Grid>
<!--ItemsSource="{Binding OrderList}"-->
<ListBox x:Name="listbox_order"
Grid.Row="7"
Grid.Row="2"
ItemsSource="{Binding PackTaskList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
@ -355,7 +412,8 @@
Width="14" Margin="0,0,0,0" Fill="{StaticResource Text.Pink}"
ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="20000"
><!--Visibility="{Binding FeesItemResponse,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible }"-->
>
<!--Visibility="{Binding FeesItemResponse,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible }"-->
<Path.ToolTip>
<ToolTip Style="{StaticResource OrderCouponToolipStyle}">
@ -442,4 +500,6 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>

193
BBWY.Client/Views/PackTask/WareHouseListControl.xaml.cs

@ -1,6 +1,12 @@
using BBWY.Client.ViewModels.PackTask;
using BBWY.Client.Helpers;
using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Client.ViewModels.PackTask;
using BBWY.Common.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -11,6 +17,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.PackTask
{
@ -23,8 +30,192 @@ namespace BBWY.Client.Views.PackTask
public WareHouseListControl()
{
InitializeComponent();
this.Loaded += Load;
}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
departments = globalContext.User.DepartmentList.Select(s => s.Name).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
}
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;
tb.Text = content.Content.ToString();
tipBox.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
List<string> departments = new List<string>();
List<string> shops = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
{
if (tipBox != null)
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBox != null && tipBox.Items.Count > 0)
{
tipBox.Items.Clear();
}
if (departments.Count <= 0)
{
if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com";
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);
}
}
}
}
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBox.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;
tipBox.Items.Add(item);
}
}
tipBox.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

67
BBWY.Client/Views/QualityTask/WaitQualityControl.xaml

@ -24,12 +24,69 @@
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
<ctr:SaleGrossProfitConverter x:Key="sgpcConverter"/>
</UserControl.Resources>
<Grid>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="460,15,0,0">
<c:BTextBox x:Name="tb" Width="150" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBox" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="660,15,0,0"
>
<c:BTextBox x:Name="tbShop" Width="150" Height="30" TextChanged="tbShop_TextChanged" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="54"/>
<RowDefinition Height="45"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Border.Background}" Grid.Row="0" HorizontalAlignment="Stretch" Panel.ZIndex="999" Margin="0,5,0,0" >
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Height="30" >
<StackPanel.Resources>
<Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</StackPanel.Resources>
<TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/>
<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,2,0"/>
<c:BTextBox Visibility="Hidden" Width="150" Height="30" TextChanged="tb_TextChanged" ></c:BTextBox>
<TextBlock x:Name="textblock_shop" Text="店铺:" VerticalAlignment="Center" Margin="16,0,0,0"/>
<c:BTextBox Name="btbShopName" Width="150" Visibility="Hidden" Margin="5,0,0,0" Text="{Binding SearchShopName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="店铺名称"/>
<TextBlock Text="物流单号:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchWayBillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="精准搜索"/>
<TextBlock Text="物流公司名称:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="模糊搜索"/>
<Button Content="搜索" Width="94" Height="30" VerticalAlignment="Stretch" Margin="10,0,0,0"
Command="{Binding SearchTaskCommand}"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
</StackPanel>
</Grid>
<Border Height="1" Grid.Row="1" Margin="0 10 0 0" Background="{StaticResource Border.Brush}" VerticalAlignment="Top"/>
<Grid Grid.Row="1" Margin="0 10 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="80"/>
@ -74,7 +131,7 @@
</Grid>
<!--ItemsSource="{Binding OrderList}"-->
<ListBox x:Name="listbox_order"
Grid.Row="7"
Grid.Row="2"
ItemsSource="{Binding PackTaskList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
@ -545,4 +602,8 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>

195
BBWY.Client/Views/QualityTask/WaitQualityControl.xaml.cs

@ -1,5 +1,11 @@
using System;
using BBWY.Client.Helpers;
using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Common.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -10,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.QualityTask
{
@ -21,6 +28,192 @@ namespace BBWY.Client.Views.QualityTask
public WaitQualityControl()
{
InitializeComponent();
this.Loaded += Load;
}
GlobalContext globalContext;
public void LoadShops(GlobalContext globalContext)
{
this.globalContext = globalContext;
shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList();
departments = globalContext.User.DepartmentList.Select(s => s.Name).ToList();
}
private void Load(object sender, RoutedEventArgs e)
{
try
{
var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main;
LoadShops(model.GlobalContext);
}
catch
{
}
}
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;
tb.Text = content.Content.ToString();
tipBox.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
List<string> departments = new List<string>();
List<string> shops = new List<string>();
private void tb_TextChanged(object sender, TextChangedEventArgs e)
{
if (tipBox != null)
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBox != null && tipBox.Items.Count > 0)
{
tipBox.Items.Clear();
}
if (departments.Count <= 0)
{
if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com";
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);
}
}
}
}
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBox.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;
tipBox.Items.Add(item);
}
}
tipBox.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (shops.Count <= 0)
{
if (globalContext != null)
LoadShops(globalContext);
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
foreach (var department in shops)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(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;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
}
}

23
BBWY.Client/Views/TaskOverTime/WareTaskOverTimeControl.xaml

@ -32,20 +32,29 @@
<DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>
<DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/>
<TextBlock Text="任务类型:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="30" CornerRadius="0">
<ComboBox BorderThickness="0" Width="140" Height="30" ItemsSource="{Binding OverTimeTaskTypeList}" Text="{Binding OverTimeTaskState,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ComboBox.Resources>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ComboBox.Resources>
</StackPanel.Resources>
<TextBlock Text="任务类型:" VerticalAlignment="Center" Margin="20,0,0,0"/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="30" CornerRadius="0">
<ComboBox BorderThickness="0" Width="140" Height="30" ItemsSource="{Binding OverTimeTaskTypeList}" Text="{Binding OverTimeTaskType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</ComboBox>
</Border>
<TextBlock Text="任务状态:" VerticalAlignment="Center" Margin="20,0,0,0"/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="30" CornerRadius="0">
<ComboBox BorderThickness="0" Width="140" Height="30" ItemsSource="{Binding OverTimeTaskStateList}" Text="{Binding OverTimeTaskState,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Border>
</StackPanel>
<Grid >
<c:BButton Content="搜索" Width="100" VerticalAlignment="Stretch" Margin="30,0,0,0"
@ -56,7 +65,7 @@
</Grid>
<Border Grid.Row="1" Margin="0,50, 0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0 1 0 0" >
<Border Grid.Row="1" Margin="0,30, 0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0 1 0 0" >
<Grid >
<Grid.RowDefinitions>

Loading…
Cancel
Save