Browse Source

Merge branch 'master' of http://code.qiyue666.com/pengcong001/bbwy

AddValidOverTime
shanji 2 years ago
parent
commit
be62806b23
  1. 5
      BBWY.Client/APIServices/QiKu/PackDetailService.cs
  2. 14
      BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs
  3. 4
      BBWY.Client/BBWYAppSettings.json
  4. 2
      BBWY.Client/GlobalContext.cs
  5. 33
      BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs
  6. 34
      BBWY.Client/Models/APIModel/Response/PackTask/SetPackDetailV2Response.cs
  7. 54
      BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs
  8. 44
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  9. 70
      BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs
  10. 28
      BBWY.Client/Views/PackTask/PackDetailWindow.xaml
  11. 58
      BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs
  12. 49
      BBWY.Client/Views/PackTask/WareHouseListControl.xaml
  13. 56
      BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml
  14. 131
      BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs
  15. 97
      BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml
  16. 230
      BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml.cs
  17. 46
      BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml
  18. 62
      BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml.cs
  19. 4
      BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml
  20. 9
      BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs

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

@ -1,4 +1,5 @@
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Client.Models.APIModel;
using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models.APIModel.Response.PackTask;
using BBWY.Common.Http; using BBWY.Common.Http;
using BBWY.Common.Models; using BBWY.Common.Models;
@ -35,9 +36,9 @@ namespace BBWY.Client.APIServices
/// </summary> /// </summary>
/// <param name="consumable"></param> /// <param name="consumable"></param>
/// <returns></returns> /// <returns></returns>
public ApiResponse<object> SetPackDetail(SetPackDetailRequest consumable) public ApiResponse<SetPackDetailV2Response> SetPackDetailV2(SetPackDetailRequest consumable)
{ {
return SendRequest<object>(globalContext.QKApiHost, "api/PackDetail/SetPackDetail", return SendRequest<SetPackDetailV2Response>(globalContext.QKApiHost, "api/PackDetail/SetPackDetailV2",
consumable consumable
, null, HttpMethod.Post); , null, HttpMethod.Post);
} }

14
BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs

@ -58,5 +58,19 @@ namespace BBWY.Client.APIServices.QiKu
} }
, null, HttpMethod.Post); , null, HttpMethod.Post);
} }
public ApiResponse<object> SaveTaskShelves(long TaskId, string ShelvesNumber, int? FloorNumber, string RemarkMsg)
{
return SendRequest<object>(globalContext.QKApiHost, $"api/PackTaskAbort/SaveTaskShelves",
new
{
TaskId,
ShelvesNumber,
FloorNumber,
UserName = globalContext.User.Name,
RemarkMsg
}
, null, HttpMethod.Post);
}
} }
} }

4
BBWY.Client/BBWYAppSettings.json

@ -4,6 +4,6 @@
"MDSApiHost": "http://mdsapi.qiyue666.com", "MDSApiHost": "http://mdsapi.qiyue666.com",
"JOSApiHost": "", "JOSApiHost": "",
"1688ApiHost": "", "1688ApiHost": "",
"QKApiHost": "http://localhost:8080" //"QKApiHost": "http://localhost:8080"
// "QKApiHost": "http://qiku.qiyue666.com" "QKApiHost": "http://qiku.qiyue666.com"
} }

2
BBWY.Client/GlobalContext.cs

@ -13,7 +13,7 @@ namespace BBWY.Client
{ {
ShopServiceGroupList = new List<string>(); ShopServiceGroupList = new List<string>();
ShopServiceGroupLowerList = new List<string>(); ShopServiceGroupLowerList = new List<string>();
ClientVersion = "10210"; ClientVersion = "10211";
} }

33
BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs

@ -142,15 +142,6 @@ namespace BBWY.Client.Models.APIModel
public string OrderId { get; set; } public string OrderId { get; set; }
///// <summary>
/////分箱情况
///// </summary>
//public WareHourseDTO[] WareHourses { get; set; }
/// <summary>
/// 地托编号
/// </summary>
public int? FloorDragNumber { get; set; }
/// <summary> /// <summary>
/// 质检超时时间 /// 质检超时时间
/// </summary> /// </summary>
@ -161,8 +152,6 @@ namespace BBWY.Client.Models.APIModel
/// </summary> /// </summary>
public DateTime? PackCompletionOverTime { get; set; } public DateTime? PackCompletionOverTime { get; set; }
/// <summary> /// <summary>
/// 质检超时备注信息 /// 质检超时备注信息
/// </summary> /// </summary>
@ -201,7 +190,6 @@ namespace BBWY.Client.Models.APIModel
/// </summary> /// </summary>
public DateTime? SendToSetSkuConfigureTime { get; set; } public DateTime? SendToSetSkuConfigureTime { get; set; }
/// <summary> /// <summary>
/// 物流状态 /// 物流状态
/// </summary> /// </summary>
@ -211,6 +199,27 @@ namespace BBWY.Client.Models.APIModel
/// 消息列表 /// 消息列表
/// </summary> /// </summary>
public List<MarkMessageModel> MarkMessageModelList { get; set; } public List<MarkMessageModel> MarkMessageModelList { get; set; }
/// <summary>
/// 异常类型
/// </summary>
public string TaskExceptionType { get; set; }
/// <summary>
/// 货架编号
/// </summary>
public string ShelvesNumber { get; set; }
/// <summary>
/// 货架层数
/// </summary>
public int? FloorNumber { get; set; }
/// <summary>
/// 挂起异常备注
/// </summary>
public string AbortRemark { get; set; }
public DateTime? TaskAbortTime { get; set; } public DateTime? TaskAbortTime { get; set; }
} }
public class ExpressOrderResponse public class ExpressOrderResponse

34
BBWY.Client/Models/APIModel/Response/PackTask/SetPackDetailV2Response.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Client.Models.APIModel
{
public class SetPackDetailV2Response
{
/// <summary>
/// 套餐任务量
/// </summary>
public int ProcessTaskCount { get; set; }
/// <summary>
/// 打包完成时间(超时时间)
/// </summary>
public DateTime? PackCompletionOverTime { get; set; }
/// <summary>
/// 包装收益
/// </summary>
public decimal PackerFees { get; set; }
/// <summary>
/// 工序套餐名称
/// </summary>
public string ProcessComboName { get; set; }
/// <summary>
/// 耗材名称列表
/// </summary>
public List<string> ConsumableNameList { get; set; }
}
}

54
BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs

@ -24,6 +24,7 @@ using BBWY.Client.Models.APIModel;
using Org.BouncyCastle.Bcpg; using Org.BouncyCastle.Bcpg;
using System.Threading; using System.Threading;
using Org.BouncyCastle.Ocsp; using Org.BouncyCastle.Ocsp;
using BBWY.Client.Views.PackagingTask;
namespace BBWY.Client.ViewModels.PackTask namespace BBWY.Client.ViewModels.PackTask
{ {
@ -446,6 +447,15 @@ namespace BBWY.Client.ViewModels.PackTask
public string PackUserName { get => packUserName; set { Set(ref packUserName, value); } } public string PackUserName { get => packUserName; set { Set(ref packUserName, value); } }
private string processComboName;
/// <summary>
/// 工序套餐名称
/// </summary>
public string ProcessComboName { get => processComboName; set { Set(ref processComboName, value); } }
private decimal? packerFee; private decimal? packerFee;
/// <summary> /// <summary>
/// 包装员费用 /// 包装员费用
@ -755,7 +765,7 @@ namespace BBWY.Client.ViewModels.PackTask
var resData = packDetailRes.Data; var resData = packDetailRes.Data;
PackProcessType = resData.PackProcessType; PackProcessType = resData.PackProcessType;
switch (PackProcessType) switch (PackProcessType)
@ -839,7 +849,7 @@ namespace BBWY.Client.ViewModels.PackTask
}); });
}); });
} }
} }
@ -945,6 +955,22 @@ namespace BBWY.Client.ViewModels.PackTask
/// 计费模式 /// 计费模式
/// </summary> /// </summary>
public FeesMode FeesMode { get; set; } public FeesMode FeesMode { get; set; }
public DateTime? packCompletionOverTime;
/// <summary>
/// 打包完成时间(超时时间)
/// </summary>
public DateTime? PackCompletionOverTime { get => packCompletionOverTime; set { Set(ref packCompletionOverTime, value); } } //
public List<string> consumableNameList;
/// <summary>
/// 耗材名称列表
/// </summary>
public List<string> ConsumableNameList { get => consumableNameList; set { Set(ref consumableNameList, value); } } //
/// <summary> /// <summary>
/// 上传数据 (判断是否超量) 统一上传 /// 上传数据 (判断是否超量) 统一上传
/// </summary> /// </summary>
@ -955,8 +981,6 @@ namespace BBWY.Client.ViewModels.PackTask
System.Windows.MessageBox.Show("信息不完整,打包人设置有误"); System.Windows.MessageBox.Show("信息不完整,打包人设置有误");
return; return;
} }
if (PackUserModelList != null && PackUserModelList.Count > 0) if (PackUserModelList != null && PackUserModelList.Count > 0)
{ {
if (PackUserModelList.Any(p => p.SelectUserId.IsNullOrEmpty() || p.TaskCount <= 0)) if (PackUserModelList.Any(p => p.SelectUserId.IsNullOrEmpty() || p.TaskCount <= 0))
@ -979,8 +1003,6 @@ namespace BBWY.Client.ViewModels.PackTask
} }
} }
if (ConsumableServiceList != null && ConsumableServiceList.Count > 0) if (ConsumableServiceList != null && ConsumableServiceList.Count > 0)
{ {
if (ConsumableServiceList.Any(p => p.SelectId == null || p.TaskCount <= 0)) if (ConsumableServiceList.Any(p => p.SelectId == null || p.TaskCount <= 0))
@ -1004,7 +1026,6 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
FeesMode = FeesMode.; FeesMode = FeesMode.;
} }
SetPackDetailRequest setPackDetailRequest = new SetPackDetailRequest() SetPackDetailRequest setPackDetailRequest = new SetPackDetailRequest()
{ {
DirectionalSingleFees = CustomProcessSinglePrice, DirectionalSingleFees = CustomProcessSinglePrice,
@ -1013,7 +1034,7 @@ namespace BBWY.Client.ViewModels.PackTask
ConsumableFees = ConsumableFees, ConsumableFees = ConsumableFees,
TaskId = TaskId, TaskId = TaskId,
PackUserList = PackUserModelList?.Select(p => new PackUserModelRequest { TaskCount = p.TaskCount, UserId = p.SelectUserId }).ToList(), PackUserList = PackUserModelList?.Select(p => new PackUserModelRequest { TaskCount = p.TaskCount, UserId = p.SelectUserId }).ToList(),
ConsumableList = ConsumableServiceList?.Select(c => new ConsumableRequest { ConsumableId = c.SelectId.Value, TaskCount = c.TaskCount, ConsumableTypeName = c.ConsumableType, ConsumablePrice = c.ConsumablePrice,IsSaveConfig=c.IsHideDelete }).ToList(), ConsumableList = ConsumableServiceList?.Select(c => new ConsumableRequest { ConsumableId = c.SelectId.Value, TaskCount = c.TaskCount, ConsumableTypeName = c.ConsumableType, ConsumablePrice = c.ConsumablePrice, IsSaveConfig = c.IsHideDelete }).ToList(),
DiscountFactory = DiscountFactory, DiscountFactory = DiscountFactory,
PackDiscountPrice = PackDiscountFees, PackDiscountPrice = PackDiscountFees,
PackPrice = PackFees, PackPrice = PackFees,
@ -1026,7 +1047,7 @@ namespace BBWY.Client.ViewModels.PackTask
}; };
var res = packDetailService.SetPackDetail(setPackDetailRequest); var res = packDetailService.SetPackDetailV2(setPackDetailRequest);
if (res == null) if (res == null)
{ {
@ -1039,9 +1060,22 @@ namespace BBWY.Client.ViewModels.PackTask
return; return;
} }
var names = PackUserModelList.Select(c => c.MemberList.SingleOrDefault(s => s.Id == c.SelectUserId)?.UserName);
PackUserName = string.Join(",",names);
ProcessTaskCount = res.Data.ProcessTaskCount;
PackerFee = res.Data.PackerFees;
ProcessComboName = res.Data.ProcessComboName;
ConsumableNameList = res.Data.ConsumableNameList;
PackCompletionOverTime = res.Data.PackCompletionOverTime;
// new TipsWindow("上传成功!").Show(); // new TipsWindow("上传成功!").Show();
var win = obj as System.Windows.Window; var win = obj as PackDetailWindow;
PrintPackDetailWindow print = new PrintPackDetailWindow(win);
print.ShowDialog();
if (ReflashWindow != null) if (ReflashWindow != null)
ReflashWindow(); ReflashWindow();
win.Close(); win.Close();

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

@ -38,6 +38,7 @@ using BBWY.Client.Views.SplitTask;
using BBWY.Client.Extensions; using BBWY.Client.Extensions;
using BBWY.Client.Views.PackTaskAbort; using BBWY.Client.Views.PackTaskAbort;
using System.Windows.Controls; using System.Windows.Controls;
using BBWY.Client.Views.SomeArrival;
namespace BBWY.Client.ViewModels.PackTask namespace BBWY.Client.ViewModels.PackTask
{ {
@ -805,6 +806,12 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary> /// </summary>
public ICommand PrintShelvesNumberCommand { get; set; } public ICommand PrintShelvesNumberCommand { get; set; }
/// <summary>
/// 打印部分到货任务信息
/// </summary>
public ICommand PrintShelvesCommand { get; set; }
public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService, PackagingTaskService packagingTaskService, PackTaskAbortService packTaskAbortService) public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService, PackagingTaskService packagingTaskService, PackTaskAbortService packTaskAbortService)
{ {
@ -947,6 +954,8 @@ namespace BBWY.Client.ViewModels.PackTask
PrintShelvesNumberCommand = new RelayCommand<PackTaskModel>(PrintShelvesNumber); PrintShelvesNumberCommand = new RelayCommand<PackTaskModel>(PrintShelvesNumber);
PrintShelvesCommand = new RelayCommand<PackTaskModel>(PrintShelves);
LoadSplitDatas(); LoadSplitDatas();
} }
@ -963,7 +972,11 @@ namespace BBWY.Client.ViewModels.PackTask
} }
} }
} }
private void PrintShelves(PackTaskModel model)
{
PrintSomeArrivalWindow window = new PrintSomeArrivalWindow(packTaskAbortService, model, ReflashTask, ShelvesNumberList, FloorNumberList);
window.ShowDialog();
}
private void PrintShelvesNumber(PackTaskModel model) private void PrintShelvesNumber(PackTaskModel model)
@ -1262,20 +1275,21 @@ namespace BBWY.Client.ViewModels.PackTask
if (isqualityBrand) if (isqualityBrand)
{ {
QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data);
service.ShowDialog();
if (IsNeedCer == Need.)
{ //if (IsNeedCer == Need.需要 || !packTaskRes.Data.SkuPurchaseSchemeId.IsNullOrEmpty())//查看配件配件
QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); //{
service.ShowDialog(); // QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data);
} // service.ShowDialog();
else //}
{ //else
BatchPrintWindow window = new BatchPrintWindow(markType, IsNeedCer, model.TaskId, model.BrandName, model.SkuCount, model.CertificateModel, model.BarCodeModel, qualityTaskService, //{
ReflashTask // BatchPrintWindow window = new BatchPrintWindow(markType, IsNeedCer, model.TaskId, model.BrandName, model.SkuCount, model.CertificateModel, model.BarCodeModel, qualityTaskService,
); // ReflashTask
window.ShowDialog(); // );
} // window.ShowDialog();
//}

70
BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs

@ -512,9 +512,9 @@ namespace BBWY.Client.ViewModels
var request = new Models.APIModel.Request.QualityTaskRequest var request = new Models.APIModel.Request.QualityTaskRequest
{ {
//BasicPack = BasicPack, //BasicPack = BasicPack,
// ArrivalQuantity = SkuCount, // ArrivalQuantity = SkuCount,
// GoodProductQuantity = SkuCount, // GoodProductQuantity = SkuCount,
// Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), // Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)),
BrandName = BrandName, BrandName = BrandName,
//CertificatePosition = CertificatePosition, //CertificatePosition = CertificatePosition,
//OrderId = OrderId, //OrderId = OrderId,
@ -535,50 +535,36 @@ namespace BBWY.Client.ViewModels
} }
request.BarcodeId = BarCodeModel.Id; request.BarcodeId = BarCodeModel.Id;
} }
if (IsNeedPrintCer == Need.) IsNeedPrintCer = Need.;
if (PurchaseSkuList != null && PurchaseSkuList.Count > 0 && purchaseSkuList.Any(p => p.IsNeedCer)) if (PurchaseSkuList != null && PurchaseSkuList.Count > 0 && purchaseSkuList.Any(p => p.IsNeedCer))
{
if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0)
{ {
//if () MessageBox.Show("存在未确认的合格证,请先完成确认!");
//{ return;
// MessageBox.Show("无可用的合格证打印!");
// return;
//}
if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0)
{
MessageBox.Show("存在未确认的合格证,请先完成确认!");
return;
}
if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null))
{
MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存");
return;
}
if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0)
{
MessageBox.Show("无可选的合格证打印!");
return;
}
request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id));
} }
try if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null))
{
var competeRes = qualityTaskService.CompeteQualityTask(request);
if (competeRes == null)
{ {
MessageBox.Show("网络异常"); MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存");
return; return;
} }
if (!competeRes.Success) if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0)
{ {
MessageBox.Show(competeRes.Msg); MessageBox.Show("无可选的合格证打印!");
return; return;
} }
BatchPrintWindow batchPrint = new BatchPrintWindow(BrandMarkType, IsNeedPrintCer, TaskId,BrandName, SkuCount, request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id));
IsNeedPrintCer = Need.;
}
try
{
BatchPrintWindow batchPrint = new BatchPrintWindow(BrandMarkType, IsNeedPrintCer, TaskId, BrandName, SkuCount,
PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO != null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO != null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray()
, BarCodeModel, qualityTaskService,()=> { , BarCodeModel, qualityTaskService, () =>
{
ReflashWindow?.Invoke(); ReflashWindow?.Invoke();
var window = obj as BWindow; var window = obj as BWindow;
@ -590,8 +576,8 @@ namespace BBWY.Client.ViewModels
batchPrint.ShowDialog(); batchPrint.ShowDialog();
} }
catch (Exception ex) catch (Exception ex)
@ -840,6 +826,12 @@ namespace BBWY.Client.ViewModels
})); }));
//PurchaseSkuList.Add(item); //PurchaseSkuList.Add(item);
} }
//if (cer == Need.不需要 && PurchaseSkuList != null)
// foreach (var item in PurchaseSkuList)
// {
// item.IsNeedCer = false;
// }
} }
if (BarCodeModel == null) if (BarCodeModel == null)
{ {

28
BBWY.Client/Views/PackTask/PackDetailWindow.xaml

@ -69,7 +69,6 @@
</Setter> </Setter>
</Style> </Style>
</Window.Resources> </Window.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/> <ColumnDefinition Width="500"/>
@ -81,7 +80,7 @@
<RowDefinition Height="40"/> <RowDefinition Height="40"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" <Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" Grid.ColumnSpan="2"
Background="{StaticResource Button.Background}"> Background="{StaticResource Button.Background}">
<TextBlock Text="包装任务配置" HorizontalAlignment="Left" Foreground="White" Margin="20 0 0 0" VerticalAlignment="Center"/> <TextBlock Text="包装任务配置" HorizontalAlignment="Left" Foreground="White" Margin="20 0 0 0" VerticalAlignment="Center"/>
</Border> </Border>
@ -508,7 +507,7 @@
<TextBlock Text="其他设置" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" /> <TextBlock Text="其他设置" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" />
<Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/> <Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/>
</Grid> </Grid>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="20 10 20 10"> <!--<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="20 10 20 10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="45"/> <ColumnDefinition Width="45"/>
<ColumnDefinition/> <ColumnDefinition/>
@ -522,7 +521,7 @@
<c:BButton Grid.Column="2" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <c:BButton Grid.Column="2" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Click="BButton_Click" Click="BButton_Click"
/> />
</Grid> </Grid>-->
</StackPanel> </StackPanel>
</ScrollViewer.Content> </ScrollViewer.Content>
</ScrollViewer> </ScrollViewer>
@ -589,7 +588,7 @@
<TextBlock TextWrapping="Wrap"> <TextBlock TextWrapping="Wrap">
<Run Text="任务量:"/> <Run Text="任务量:"/>
<Run Text="{Binding PackTaskModel.FeesItemResponse.ProcessComboTaskCount}"/> <Run Text="{Binding ProcessTaskCount}"/>
</TextBlock> </TextBlock>
<TextBlock TextWrapping="Wrap" Grid.Column="1"> <TextBlock TextWrapping="Wrap" Grid.Column="1">
<Run Text="配件数量:"/> <Run Text="配件数量:"/>
@ -615,7 +614,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Margin="0 0 0 0" FontSize="15" FontWeight="Bold"> <TextBlock Margin="0 0 0 0" FontSize="15" FontWeight="Bold">
<Run Text="包装员:"/> <Run Text="包装员:"/>
<Run Text="{Binding PackTaskModel.PackUser}"/> <Run Text="{Binding PackUserName}"/>
</TextBlock> </TextBlock>
<TextBlock Margin="0 0 0 0" Style="{StaticResource middleTextBlock}" Grid.Column="1" FontWeight="Bold"> <TextBlock Margin="0 0 0 0" Style="{StaticResource middleTextBlock}" Grid.Column="1" FontWeight="Bold">
<Run Text="包装收益:"/> <Run Text="包装收益:"/>
@ -624,22 +623,22 @@
</Grid> </Grid>
<TextBlock Margin="0 0 0 0" FontSize="13" FontWeight="Bold"> <TextBlock Margin="0 0 0 0" FontSize="13" FontWeight="Bold">
<Run Text="截止时间:"/> <Run Text="截止时间:"/>
<Run Text="{Binding PackTaskModel.PackCompletionOverTime,StringFormat='d号 HH:mm'}"/> <Run Text="{Binding PackCompletionOverTime,StringFormat='d号 HH:mm'}"/>
</TextBlock> </TextBlock>
<TextBlock Margin="0 5 0 5"> <TextBlock Margin="0 5 0 5">
<Run Text="工序套餐:"/> <Run Text="工序套餐:"/>
<Run Text="{Binding PackTaskModel.FeesItemResponse.ProcessComboName}"/> <Run Text="{Binding ProcessComboName}"/>
</TextBlock> </TextBlock>
<ListBox <ListBox
ItemsSource="{Binding PackTaskModel.FeesItemResponse.ConsumableList}" ItemsSource="{Binding ConsumableNameList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}" BorderBrush="{StaticResource Border.Brush}"
BorderThickness="0" BorderThickness="0"
Foreground="{StaticResource Text.Color}"> >
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Height="40"> <Grid Height="20">
<TextBlock Text="{Binding ItemName}"/> <TextBlock Text="{Binding }"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
@ -668,9 +667,10 @@
</StackPanel> </StackPanel>
<c:BButton Grid.Row="2" Content="确定" Margin="0 0 20 0" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <c:BButton Grid.Row="2" Content="确定" Margin="0 0 20 0" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding UpLoadPackCommand}" Click="BButton_Click_1"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
/> />
<!-- Command="{Binding UpLoadPackCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"-->
</Grid> </Grid>

58
BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs

@ -2,6 +2,7 @@
using BBWY.Client.Helpers; using BBWY.Client.Helpers;
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Client.ViewModels.PackTask; using BBWY.Client.ViewModels.PackTask;
using BBWY.Client.Views.PackagingTask;
using BBWY.Controls; using BBWY.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -40,7 +41,7 @@ namespace BBWY.Client.Views.PackTask
var serviceViewModel = this.DataContext as PackDetailViewModel; var serviceViewModel = this.DataContext as PackDetailViewModel;
if (model.Brand.IsNullOrEmpty()) if (model.Brand.IsNullOrEmpty())
{ {
if (model.BarCodeModel!=null&&!model.BarCodeModel.Brand.IsNullOrEmpty()) if (model.BarCodeModel != null && !model.BarCodeModel.Brand.IsNullOrEmpty())
model.Brand = model.BarCodeModel.Brand; model.Brand = model.BarCodeModel.Brand;
else if (model.CertificateModel != null && model.CertificateModel.Any(c => c.Brand != null)) else if (model.CertificateModel != null && model.CertificateModel.Any(c => c.Brand != null))
model.Brand = model.CertificateModel.FirstOrDefault(c => c.Brand != null)?.Brand; model.Brand = model.CertificateModel.FirstOrDefault(c => c.Brand != null)?.Brand;
@ -65,8 +66,14 @@ namespace BBWY.Client.Views.PackTask
serviceViewModel.OrderId = model.OrderId; serviceViewModel.OrderId = model.OrderId;
serviceViewModel.SkuId = model.SkuId; serviceViewModel.SkuId = model.SkuId;
serviceViewModel.PackUserName = model.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ","); serviceViewModel.PackUserName = model.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ",");
serviceViewModel.ProcessComboName = model.FeesItemResponse?.ProcessComboName;
serviceViewModel.PackCompletionOverTime = model.PackCompletionOverTime;
serviceViewModel.ConsumableNameList = model.FeesItemResponse?.ConsumableList?.Select(c =>
{
return $"{c.ItemName}";
})?.ToList();
serviceViewModel.PackerFee = model.FeesItemResponse?.PackFees*(model.FeesItemResponse?.PackerDiscount??0.85m) ; serviceViewModel.PackerFee = model.FeesItemResponse?.PackFees * (model.FeesItemResponse?.PackerDiscount ?? 0.85m);
serviceViewModel.LoadPackDatas(); serviceViewModel.LoadPackDatas();
if (reflashWindow != null) if (reflashWindow != null)
serviceViewModel.ReflashWindow = reflashWindow; serviceViewModel.ReflashWindow = reflashWindow;
@ -94,24 +101,27 @@ namespace BBWY.Client.Views.PackTask
// MessageBox.Show("页面加载中,请重试!"); // MessageBox.Show("页面加载中,请重试!");
// return; // return;
//} //}
string printName = cbPrintName.Text.Trim(); //string printName = cbPrintName.Text.Trim();
PrintBox(printName); //PrintBox(printName);
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); //string printNames = System.IO.Path.Combine(applicationPath, "printName.init");
try //try
{ //{
if (File.Exists(printNames)) // if (File.Exists(printNames))
{ // {
File.Delete(printNames); // File.Delete(printNames);
} // }
} //}
catch //catch
{ //{
} //}
File.WriteAllText(printNames, cbPrintName.Text); //File.WriteAllText(printNames, cbPrintName.Text);
//var serviceViewModel = this.DataContext as PackDetailViewModel;
//serviceViewModel?.ReflashWindow?.Invoke();
return; return;
} }
@ -229,5 +239,19 @@ namespace BBWY.Client.Views.PackTask
} }
} }
private void BButton_Click_1(object sender, RoutedEventArgs e)
{
var serviceViewModel = this.DataContext as PackDetailViewModel;
serviceViewModel.UpLoadPackCommand.Execute(this);
}
} }
} }

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

@ -185,7 +185,8 @@
<TextBlock Text="数量" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="数量" Grid.Column="1" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="组合类型" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="组合类型" Grid.Column="2" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="SKU配件商品" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="SKU配件商品" Grid.Column="3" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="包装需求" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="包装需求" Grid.Column="4" Style="{StaticResource middleTextBlock}" Visibility="{Binding TaskState, Converter={StaticResource objConverter},ConverterParameter=部分到货:Collapsed:Visible}" />
<TextBlock Text="摆放货架" Grid.Column="4" Style="{StaticResource middleTextBlock}" Visibility="{Binding TaskState, Converter={StaticResource objConverter},ConverterParameter=部分到货:Visible:Collapsed}" />
<TextBlock Text="物流信息" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="物流信息" Grid.Column="5" Style="{StaticResource middleTextBlock}"/>
<!--<TextBlock Text="注意事项/对接备注" Grid.Column="6" Style="{StaticResource middleTextBlock}"/>--> <!--<TextBlock Text="注意事项/对接备注" Grid.Column="6" Style="{StaticResource middleTextBlock}"/>-->
<TextBlock Text="费用" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> <TextBlock Text="费用" Grid.Column="7" Style="{StaticResource middleTextBlock}"/>
@ -408,7 +409,7 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Column="4" > <Grid Grid.Column="4" Visibility="{Binding DataContext.TaskState,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}, Converter={StaticResource objConverter},ConverterParameter=部分到货:Collapsed:Visible}">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Left"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Left">
<StackPanel Margin="10,5" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" > <StackPanel Margin="10,5" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock Text="基础包装:"/> <TextBlock Text="基础包装:"/>
@ -423,6 +424,37 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Column="4" Visibility="{Binding DataContext.TaskState,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}, Converter={StaticResource objConverter},ConverterParameter=部分到货:Visible:Collapsed}" >
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding ShelvesNumber, Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding ShelvesNumber}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="号货架,"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding FloorNumber}"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="层"/>
</StackPanel>
<!--<StackPanel Orientation="Horizontal" Margin="0 10 0 0 ">
<c:BButton Content="修改" Style="{StaticResource LinkButton}"
CommandParameter="{Binding}"
Command="{Binding DataContext.UpdateShelvesNumberCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
/>
<c:BButton Content="打印" Style="{StaticResource LinkButton}" Margin="10 0 0 0 "
CommandParameter="{Binding}"
Command="{Binding DataContext.PrintShelvesNumberCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
/>
</StackPanel>-->
</StackPanel>
</Grid>
<Grid Grid.Column="5"> <Grid Grid.Column="5">
<ListBox x:Name="listbox_expressorder" ItemsSource="{Binding ExpressOrderList}" <ListBox x:Name="listbox_expressorder" ItemsSource="{Binding ExpressOrderList}"
Style="{StaticResource NoScrollViewListBoxStyle}" BorderThickness="0" Style="{StaticResource NoScrollViewListBoxStyle}" BorderThickness="0"
@ -563,11 +595,16 @@ Command="{Binding SetServiceCommand}"
CommandParameter="{Binding}" CommandParameter="{Binding}"
Command="{Binding DataContext.UpdateTaskStateCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" Command="{Binding DataContext.UpdateTaskStateCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
> />
</c:BButton>
</Grid> </Grid>
<c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" Margin="0 10 0 10" VerticalAlignment="Center" Content="打印标签"
Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=部分到货:Visible:Collapsed}"
CommandParameter="{Binding}"
Command="{Binding DataContext.PrintShelvesCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
/>
<c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" Margin="0 5 0 5 " VerticalAlignment="Center" Content="{Binding ShowSendMsg,Converter={StaticResource objConverter},ConverterParameter=False:任务备注:取消备注}" <c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" Margin="0 5 0 5 " VerticalAlignment="Center" Content="{Binding ShowSendMsg,Converter={StaticResource objConverter},ConverterParameter=False:任务备注:取消备注}"
CommandParameter="{Binding TaskId}" CommandParameter="{Binding TaskId}"

56
BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml

@ -0,0 +1,56 @@
<c:BWindow x:Class="BBWY.Client.Views.PackagingTask.PrintPackDetailWindow"
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.PackagingTask"
mc:Ignorable="d"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
Height="219" Width="378"
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" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10">
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" 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>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="62 0 0 0">
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="份数:"/>
<c:BTextBox Text="{Binding PrintCount}" Height="30" Width="200" />
</StackPanel>
</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>

131
BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs

@ -0,0 +1,131 @@
using BBWY.Client.Models;
using BBWY.Client.Views.PackTask;
using BBWY.Client.Views.SplitTask;
using BBWY.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.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;
using WebSocketSharp;
namespace BBWY.Client.Views.PackagingTask
{
/// <summary>
/// PrintPackDetailWindow.xaml 的交互逻辑
/// </summary>
public partial class PrintPackDetailWindow : BWindow
{
public PrintPackDetailWindow(PackDetailWindow printWindow)
{
InitializeComponent();
InitPrintList();
this.DataContext = this;
this.printWindow = printWindow;
}
private PackTaskModel model;
PackDetailWindow printWindow;
/// <summary>
/// 打印机列表
/// </summary>
public ObservableCollection<string> PrintList { get; set; }
public string PrintName { get; set; }
public int PrintCount { get => printCount; set { Set(ref printCount, value); } }
private int printCount = 1;
public void InitPrintList()
{
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)
{
}
}
private void BButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (PrintName.IsNullOrEmpty())
{
MessageBox.Show("请选择打印设备");
return;
}
if (string.IsNullOrEmpty(PrintName))
{
return;
}
var localPrintServer = new LocalPrintServer();
var printQueue = localPrintServer.GetPrintQueue(PrintName);
if (printQueue.IsInError)
{
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
for (int i = 0; i < PrintCount; i++)
{
printWindow.PrintBox(PrintName);
}
this.Close();
}
}
}

97
BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml

@ -0,0 +1,97 @@
<c:BWindow x:Class="BBWY.Client.Views.SomeArrival.PrintSomeArrivalWindow"
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.SomeArrival"
mc:Ignorable="d"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
Height="330" 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 Height="80"/>
<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 Orientation="Vertical" Grid.Row="2" HorizontalAlignment="Left" Margin="50 0 0 10">
<StackPanel Orientation="Horizontal" Margin="0 10 0 10">
<TextBlock Text="摆放货架:" Style="{StaticResource middleTextBlock}" />
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" CornerRadius="1" Height="30">
<StackPanel Orientation="Horizontal">
<Label Content="货架编号" BorderThickness="0 0 0 0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="70"/>
<Border Width="1" Background="{StaticResource Border.Brush}" HorizontalAlignment="Left"/>
<ComboBox Height="30" HorizontalAlignment="Stretch" ItemsSource="{Binding ShelvesNumberList}" Text="{Binding ShelvesNumber}" BorderThickness="0" Margin="1" />
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" CornerRadius="1" Height="30" Margin="10 0 0 0">
<StackPanel Orientation="Horizontal">
<Label Content="货架层数" BorderThickness="0 0 0 0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="70"/>
<Border Width="1" Background="{StaticResource Border.Brush}" HorizontalAlignment="Left"/>
<ComboBox Height="30" HorizontalAlignment="Stretch" ItemsSource="{Binding FloorNumberList}" Text="{Binding FloorNumber}" BorderThickness="0" Margin="1" />
</StackPanel>
</Border>
</StackPanel>
<c:BTextBox Text="{Binding RemarkMsg}" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" WaterRemark="备注消息" VerticalAlignment="Top" MinHeight="100" TextWrapping="Wrap" AcceptsReturn="True" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10">
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" 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>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="62 0 0 0">
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="份数:"/>
<c:BTextBox Text="{Binding PrintCount}" Height="30" Width="200" />
</StackPanel>
</StackPanel>
<Border Grid.Row="3" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="3" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click"
/>
</Grid>
</c:BWindow>

230
BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml.cs

@ -0,0 +1,230 @@
using BBWY.Client.APIServices.QiKu;
using BBWY.Client.Extensions;
using BBWY.Client.Models;
using BBWY.Client.Views.SplitTask;
using BBWY.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.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;
using WebSocketSharp;
namespace BBWY.Client.Views.SomeArrival
{
/// <summary>
/// PrintSomeArrivalWindow.xaml 的交互逻辑
/// </summary>
public partial class PrintSomeArrivalWindow : BWindow
{
public PrintSomeArrivalWindow(PackTaskAbortService packTaskAbortService, PackTaskModel model, Action reFlashWindow, List<string> shelvesNumberList, List<int> floorNumberList)
{
InitializeComponent();
InitPrintList();
this.DataContext = this;
this.model = model;
this.packTaskAbortService = packTaskAbortService;
if (!model.ShelvesNumber.IsNullOrEmpty())
ShelvesNumber = model.ShelvesNumber;
if (model.FloorNumber != null) FloorNumber = model.FloorNumber;
if (model.AbortRemark != null) RemarkMsg = model.AbortRemark;
FloorNumberList = floorNumberList;
ShelvesNumberList = shelvesNumberList;
ReFlashWindow = reFlashWindow;
}
private string remarkMsg;
/// <summary>
/// 货架
/// </summary>
public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } }
Action ReFlashWindow;
PackTaskAbortService packTaskAbortService;
private List<int> floorNumberList = new List<int> { 1, 2, 3, 4 };
/// <summary>
/// 层数列表
/// </summary>
public List<int> FloorNumberList { get => floorNumberList; set { Set(ref floorNumberList, value); } }
private int? floorNumber;
/// <summary>
///层数
/// </summary>
public int? FloorNumber { get => floorNumber; set { Set(ref floorNumber, value); } }
private List<string> shelvesNumberList;
/// <summary>
/// 货架列表
/// </summary>
public List<string> ShelvesNumberList { get => shelvesNumberList; set { Set(ref shelvesNumberList, value); } }
private string shelvesNumber;
/// <summary>
/// 货架
/// </summary>
public string ShelvesNumber { get => shelvesNumber; set { Set(ref shelvesNumber, value); } }
private PackTaskModel model;
/// <summary>
/// 打印机列表
/// </summary>
public ObservableCollection<string> PrintList { get; set; }
public string PrintName { get; set; }
public int PrintCount { get => printCount; set { Set(ref printCount, value); } }
private int printCount = 1;
public void InitPrintList()
{
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 void PrintBox()
{
}
private void BButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (PrintName.IsNullOrEmpty())
{
MessageBox.Show("请选择打印设备");
return;
}
if (string.IsNullOrEmpty(PrintName))
{
return;
}
var localPrintServer = new LocalPrintServer();
var printQueue = localPrintServer.GetPrintQueue(PrintName);
if (printQueue.IsInError)
{
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
if (ShelvesNumber.IsNullOrEmpty() || FloorNumber==null )
{
MessageBox.Show("请输入摆放货架位置");
return;
}
var res = packTaskAbortService.SaveTaskShelves(model.TaskId, ShelvesNumber, FloorNumber,remarkMsg);
if (res==null||!res.Success)
{
MessageBox.Show(res.Msg ?? "未知错误!");
return;
}
model.ShelvesNumber = ShelvesNumber;
model.FloorNumber = FloorNumber;
model.AbortRemark = RemarkMsg;
SomeArrivalWindow window = new SomeArrivalWindow(model);
//window.ShowDialog();
for (int i = 0; i < PrintCount; i++)
{
window.Print(PrintName);
}
this.Close();
ReFlashWindow?.Invoke();
try
{
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "printName.init");
try
{
if (File.Exists(printNames))
{
File.Delete(printNames);
}
}
catch
{
}
File.WriteAllText(printNames, PrintName);
}
catch (Exception)
{
}
}
}
}

46
BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml

@ -0,0 +1,46 @@
<c:BWindow x:Class="BBWY.Client.Views.SomeArrival.SomeArrivalWindow"
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.SomeArrival"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
mc:Ignorable="d"
CloseButtonVisibility="Visible"
WindowStartupLocation="CenterScreen"
CloseButtonColor="White"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"
Title="ExceptionTaskWindow" Height="567" Width="388">
<Grid Visibility="Visible" >
<Grid x:Name="print_box" Height="492" Width="272">
<StackPanel Margin="10 10 10 10" Width="252" HorizontalAlignment="Center" Orientation="Vertical">
<TextBlock FontSize="28" FontWeight="Bold">
<Run Text="任务ID:"/>
</TextBlock>
<TextBlock FontSize="60" FontWeight="Bold">
<Run Text="{Binding Model.TaskIdRemark}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0 10 0 10">
<TextBlock Style="{StaticResource middleTextBlock}" Text="摆放货号: " FontSize="20" />
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding Model.ShelvesNumber}" FontSize="20"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="号货架,第" FontSize="20"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding Model.FloorNumber}" FontSize="20"/>
<TextBlock Style="{StaticResource middleTextBlock}" Text="层" FontSize="20"/>
</StackPanel>
<TextBlock TextWrapping="Wrap" >
<Run Text="备注信息:"/>
<Run Text="{Binding Model.AbortRemark}"/>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</c:BWindow>

62
BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml.cs

@ -0,0 +1,62 @@
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Printing;
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.SomeArrival
{
/// <summary>
/// SomeArrivalWindow.xaml 的交互逻辑
/// </summary>
public partial class SomeArrivalWindow : BWindow
{
public SomeArrivalWindow(PackTaskModel model)
{
InitializeComponent();
this.DataContext = this;
Model = model;
}
private PackTaskModel model;
public PackTaskModel Model { get => model; set { Set(ref model, value); } }
public string taskIdRemark;
public string TaskIdRemark { get => taskIdRemark; set { Set(ref taskIdRemark, value); } }
public string remarkMsg;
public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } }
public string exceptType;
public string ExceptType { get => exceptType; set { Set(ref exceptType, value); } }
public void Print(string printName)
{
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
PrintDialog printDialog = new PrintDialog();
//Height="492" Width="272" 567 388
printDialog.PrintTicket.PageOrientation = PageOrientation.ReversePortrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 //设置纸张大小
var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth);
var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight);
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight);
print_box.Height = pageHeight;
print_box.Width = pageWidth;
this.print_box.Arrange(new Rect(new System.Windows.Point(0, 0), new System.Windows.Size(pageWidth, pageHeight)));
this.UpdateLayout(); //刷新界面
printDialog.PrintVisual(this.print_box, "打印任务");
this.Close();
}
}
}

4
BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml

@ -37,7 +37,6 @@ Style="{StaticResource bwstyle}"
Background="{StaticResource Border.Background}"> Background="{StaticResource Border.Background}">
<TextBlock Text="打印异常任务" HorizontalAlignment="Center" VerticalAlignment="Center"/> <TextBlock Text="打印异常任务" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border> </Border>
<StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center"> <StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10">
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="打印机:"/> <TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="打印机:"/>
@ -58,9 +57,6 @@ Style="{StaticResource bwstyle}"
</StackPanel> </StackPanel>
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> <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" <c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click"
/> />

9
BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs

@ -1,6 +1,7 @@
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel;
using BBWY.Client.Views.FallWare; using BBWY.Client.Views.FallWare;
using BBWY.Client.Views.PackTask;
using BBWY.Controls; using BBWY.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -116,8 +117,12 @@ namespace BBWY.Client.Views.SplitTask
} }
ExceptionTaskWindow window = new ExceptionTaskWindow(model); ExceptionTaskWindow window = new ExceptionTaskWindow(model);
//window.ShowDialog(); for (int i = 0; i < PrintCount; i++)
window.Print(PrintName); {
window.Print(PrintName);
}
this.Close(); this.Close();

Loading…
Cancel
Save