Browse Source

合并

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
6bab143ab4
  1. 30
      BBWY.Client/APIServices/BatchPurchaseService.cs
  2. 10
      BBWY.Client/APIServices/PackTaskService.cs
  3. 2
      BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs
  4. 6
      BBWY.Client/Models/APIModel/Response/BatchPurchase/PurchaseOrderV2Response.cs
  5. 2
      BBWY.Client/Models/APIModel/Response/PackTask/PackTaskResultResponse.cs
  6. 554
      BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs
  7. 10
      BBWY.Client/Models/Enums.cs
  8. 7
      BBWY.Client/Models/PackTask/ConsumableModel.cs
  9. 11
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  10. 4
      BBWY.Client/ViewModels/BaseVM.cs
  11. 172
      BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs
  12. 45
      BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs
  13. 188
      BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs
  14. 18
      BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs
  15. 19
      BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs
  16. 26
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  17. 9
      BBWY.Client/ViewModels/ViewModelLocator.cs
  18. 270
      BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml
  19. 41
      BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml.cs
  20. 105
      BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
  21. 20
      BBWY.Client/Views/PackTask/CreatePackTask.xaml
  22. 38
      BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs
  23. 3
      BBWY.Client/Views/PackTask/SetBarCode.xaml
  24. 56
      BBWY.Client/Views/PackTask/SetBarCode.xaml.cs
  25. 15
      BBWY.Client/Views/PackTask/SetCerWindow.xaml
  26. 107
      BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs
  27. 7
      BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml
  28. 56
      BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs
  29. 16
      BBWY.Client/Views/PackTask/WareHouseListControl.xaml
  30. 23
      BBWY.Server.API/Controllers/BatchPurchaseController.cs
  31. 3
      BBWY.Server.API/Startup.cs
  32. 2
      BBWY.Server.Business/FreeSqlMultiDBManager.cs
  33. 21
      BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
  34. 5
      BBWY.Server.Model/Db/PurchaseOrder/PurchaseOrderV2.cs
  35. 79
      BBWY.Server.Model/Db/QK/FeesDetail.cs
  36. 192
      BBWY.Server.Model/Db/QK/PackTask.cs
  37. 28
      BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/UpdatePackStateRequest.cs
  38. 10
      BBWY.Server.Model/Dto/Response/PurchaseOrderV2/BatchPurchase/UpdatePackStateResponse.cs
  39. 26
      BBWY.Server.Model/Enums.cs

30
BBWY.Client/APIServices/BatchPurchaseService.cs

@ -171,6 +171,36 @@ namespace BBWY.Client.APIServices
}, null, HttpMethod.Post);
}
/// <summary>
/// 修改打包状态
/// </summary>
/// <param name="orderId"></param>
/// <param name="PackState"></param>
/// <returns></returns>
public ApiResponse<PayPurchaseOrderResponse> UpdatePackMoney(string orderId, decimal PackMoney)
{
return SendRequest<PayPurchaseOrderResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/UpdatePackMoney", new
{
orderId,
PackMoney
}, null, HttpMethod.Post);
}
/// <summary>
/// 修改采购单状态
/// </summary>
/// <param name="orderId"></param>
/// <param name="PackState"></param>
/// <returns></returns>
public ApiResponse<PayPurchaseOrderResponse> UpdatePurchaseOrderState(string orderId, PurchaseOrderState PurchaseOrderState)
{
return SendRequest<PayPurchaseOrderResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/UpdatePurchaseOrderState", new
{
orderId,
PurchaseOrderState
}, null, HttpMethod.Post);
}
}

10
BBWY.Client/APIServices/PackTaskService.cs

@ -136,13 +136,13 @@ namespace BBWY.Client.APIServices
, null, HttpMethod.Post);
}
public ApiResponse<object> UpdateTaskStatus(long id, int taskStatus)
public ApiResponse<object> UpdateTaskStatus(long id, int taskStatus,string orderId)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UpdatePackTaskStatus", new
{
id,
taskStatus
taskStatus,
orderId
}
, null, HttpMethod.Post);
}
@ -305,6 +305,10 @@ namespace BBWY.Client.APIServices
public decimal? ConsumableFees { get; set; }
public decimal? DiscountPrice { get; set; }
public string OrderId { get; set; }
public string SkuId { get; set; }
}
public class PersonTaskModel

2
BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs

@ -102,5 +102,7 @@ namespace BBWY.Client.Models.APIModel.Request
public int? CertificatePosition { get; set; }
public Worry IsWorry { get; set; }
public string OrderId { get; set; }
public Platform Platform { get; set; }
}
}

6
BBWY.Client/Models/APIModel/Response/BatchPurchase/PurchaseOrderV2Response.cs

@ -173,7 +173,13 @@ namespace BBWY.Client.Models
/// </summary>
public PurchaseOrderMode PurchaseOrderMode { get; set; }
/// <summary>
/// 打包状态(待发布 = 0, 打包中 = 1, 已完成 = 2)
/// </summary>
public PackState PackState { get; set; }
public IList<PurchaseOrderSkuResponse> ItemList { get; set; }
}
}

2
BBWY.Client/Models/APIModel/Response/PackTask/PackTaskResultResponse.cs

@ -169,7 +169,7 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask
/// 品牌
/// </summary>
public string Brand { get; set; }
public string OrderId { get; set; }
}
//public class FeesItemTypeDTO :NotifyObject

554
BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs

@ -0,0 +1,554 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace BBWY.Client.Models
{
//public class ComboxItem
//{
// public int { get; set; }
//}
public class BatchPublishTask : NotifyObject
{
#region 属性
private ObservableCollection<ComboBoxItem> positionTypeList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{IsSelected = false,Content = "本地仓"}, new ComboBoxItem{IsSelected = false,Content = "齐越仓"}, new ComboBoxItem{IsSelected = false,Content = "京东仓"}
};
public ObservableCollection<ComboBoxItem> PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } }
private ObservableCollection<ComboBoxItem> packTypeList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{ Content="单件",IsSelected=false }, new ComboBoxItem{ Content="多件",IsSelected=false }
};
public ObservableCollection<ComboBoxItem> PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } }
private ObservableCollection<ComboBoxItem> basicPackList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{ Content="快递袋",IsSelected=false }, new ComboBoxItem{ Content="纸箱",IsSelected=false }, new ComboBoxItem{ Content="麻袋",IsSelected=false }
};
public ObservableCollection<ComboBoxItem> BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } }
private ObservableCollection<ComboBoxItem> isNeedBarCodeList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{IsSelected = false,Content = "需要"}, new ComboBoxItem{IsSelected = false,Content = "不需要"}};
public ObservableCollection<ComboBoxItem> IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } }
private ObservableCollection<ComboBoxItem> certificatePositionList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{ Content="无",IsSelected=false }, new ComboBoxItem{ Content="外部包装",IsSelected=false }, new ComboBoxItem{ Content="产品包装",IsSelected=false }
};
public ObservableCollection<ComboBoxItem> CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } }
private ObservableCollection<ComboBoxItem> availabilityList = new ObservableCollection<ComboBoxItem> {
new ComboBoxItem{ Content="已到货",IsSelected=false }, new ComboBoxItem{ Content="部分到货",IsSelected=false }, new ComboBoxItem{ Content="未到货",IsSelected=false }
};
public ObservableCollection<ComboBoxItem> AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } }
private int skuCount;
/// <summary>
/// Sku任务数
/// </summary>
public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } }
private string skuId;
/// <summary>
/// Sku
/// </summary>
public string SkuId { get => skuId; set { Set(ref skuId, value); } }
private string logo;
/// <summary>
/// 店铺Sku图链接
/// </summary>
public string Logo { get => logo; set { Set(ref logo, value); } }
private string skuName;
/// <summary>
/// 采购Sku名称
/// </summary>
public string SkuName { get => skuName; set { Set(ref skuName, value); } }
private string brand;
/// <summary>
/// 品牌
/// </summary>
public string Brand { get => brand; set { Set(ref brand, value); } }
private string productNo;
/// <summary>
/// 货号
/// </summary>
public string ProductNo { get => productNo; set { Set(ref productNo, value); } }
private string brandName;
/// <summary>
/// 品名(手写上传)
/// </summary>
public string BrandName { get => brandName; set { Set(ref brandName, value); } }
private int goodsNumber;
/// <summary>
/// 配件数
/// </summary>
public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } }
private Worry isWorry;
/// <summary>
/// 是否加急
/// </summary>
public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } }
private TaskState availability;
/// <summary>
/// 到货情况(待收货=0,部分收货=1,已到货=2)
/// </summary>
public TaskState Availability { get => availability; set { Set(ref availability, value); } }
private PackType packType;
/// <summary>
/// 打包类型(单件=0,多件=1)
/// </summary>
public PackType PackType { get => packType; set { Set(ref packType, value); } }
private BasicPack basicPack;
/// <summary>
/// 基础包装(快递袋=0,纸箱=1,麻袋=2)
/// </summary>
public BasicPack BasicPack { get => basicPack; set { Set(ref basicPack, value); } }
private PositionType positionType;
/// <summary>
/// 落仓(本地仓=0,齐越仓=1,京东仓=2)
/// </summary>
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
private string skuTitle;
/// <summary>
/// sku配件商品名称
/// </summary>
public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } }
private Need isNeedBarCode;
/// <summary>
/// 是否需要合格证
/// </summary>
public Need IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } }
private Need isNeedCertificateModel;
/// <summary>
/// 是否需要条形码
/// </summary>
public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } }
private BarCodeModel barCodeModel;
/// <summary>
/// 条形码
/// </summary>
public BarCodeModel BarCodeModel { get => barCodeModel; set { Set(ref barCodeModel, value); } }
private bool isSetBarCode;
/// <summary>
/// 设置显示(条形码)
/// </summary>
public bool IsSetBarCode
{
get => isSetBarCode;
set
{
Set(ref isSetBarCode, value);
IsNeedBarCode = IsSetBarCode ? Need. : Need.;
}
}
private bool isSetCertificate;
/// <summary>
/// 设置显示(合格证)
/// </summary>
public bool IsSetCertificate
{
get => isSetCertificate; set
{
Set(ref isSetCertificate, value);
IsNeedCertificateModel = IsSetCertificate ? Need. : Need.;
}
}
private string setSpuCerStatus;
public string SetSpuCerStatus { get => setSpuCerStatus; set { Set(ref setSpuCerStatus, value); } }
private bool isSetSpuCertificate = true;
/// <summary>
/// 设置spu显示(合格证)
/// </summary>
public bool IsSetSpuCertificate
{
get => isSetSpuCertificate; set
{
Set(ref isSetSpuCertificate, value);
SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板";
}
}
private string saveTask;
/// <summary>
/// 设置显示(合格证)
/// </summary>
public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } }
private string spuId;
/// <summary>
/// 合格证
/// </summary>
public string SpuId { get => spuId; set { Set(ref spuId, value); } }
private CertificateModel spuCertificateModel;
/// <summary>
/// spu合格证
/// </summary>
public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { Set(ref spuCertificateModel, value); } }
private CertificateModel certificateModel;
/// <summary>
/// 合格证
/// </summary>
public CertificateModel CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } }
/// <summary>
/// 合格证位置(外部包装=0,产品包装=1)
/// </summary>
private CertificatePosition certificatePosition;
/// <summary>
/// 合格证位置(外部包装=0,产品包装=1)
/// </summary>
public CertificatePosition CertificatePosition { get => certificatePosition; set { Set(ref certificatePosition, value); } }
/// <summary>
/// 注意事项(对接备注)
/// </summary>
private string markMessage;
/// <summary>
/// 注意事项(对接备注)
/// </summary>
public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } }
private ObservableCollection<IncreateModel> increateList;
/// <summary>
/// 增量耗材查询关键字
/// </summary>
public ObservableCollection<IncreateModel> IncreateList { get => increateList; set { Set(ref increateList, value); } }
#endregion
string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" };
public PackTaskService packTaskService;
public ProductService productService;
public BatchPublishTask()
{
IncreateList = new ObservableCollection<IncreateModel>();
foreach (var item in increates)
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = false
});
}
SetBarCodeCommand = new RelayCommand(SetBarCode);
SetCertificateCommand = new RelayCommand(SetCertificate);
LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer);
}
#region 方法
public ICommand SetBarCodeCommand { get; set; }
public ICommand SetCertificateCommand { get; set; }
public ICommand LookBarCommand { get; set; }
public ICommand LookCerCommand { get; set; }
private void SetBarCode()
{
if (string.IsNullOrEmpty(SkuId))
{
return;
}
if (BarCodeModel == null)
{
BarCodeModel = new BarCodeModel();
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow();
setBarCodeWindow.LoadData(BarCodeModel, packTaskService);
setBarCodeWindow.SaveResult = b =>
{
BarCodeModel = b;
IsSetBarCode = false;
IsNeedBarCode = Need.;
};
setBarCodeWindow.Show();
}
/// <summary>
/// 设置合格证
/// </summary>
private void SetCertificate()
{
if (string.IsNullOrEmpty(SkuId))
return;
SearSpuCer();
if (CertificateModel == null)
{
CertificateModel = new CertificateModel();
CertificateModel.ProductNo = ProductNo;
CertificateModel.Brand = Brand;
CertificateModel.SkuId = SkuId;
}
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
SetCerWindow setCerWindow = new SetCerWindow();
setCerWindow.LoadData(certificateModel, packTaskService, spuCertificateModel, IsSetSpuCertificate);
setCerWindow.SaveResult = s =>
{
CertificateModel = s;
IsSetCertificate = false;
IsNeedCertificateModel = Need.;
};
setCerWindow.Show();
}
/// <summary>
/// 查看合格证
/// </summary>
private void LookCer()
{
LookCerWindow lookCerWindow = new LookCerWindow(CertificateModel);
lookCerWindow.Show();
}
/// <summary>
/// 查看条形码
/// </summary>
private void LookBar()
{
LookBarCodeWindow look = new LookBarCodeWindow();
look.SetData(BarCodeModel);
look.Show();
}
/// <summary>
/// 搜索 skuId
/// </summary>
public void SearchSku(string skuid)
{
if (string.IsNullOrEmpty(skuid))
return;
ApiResponse<ProductListResponse> productApiResponse = null;
var skuResponse = productService.GetProductSkuList(string.Empty, skuid);
if (skuResponse.Success)
{
if (skuResponse.Data.Count == 0)
{
return;
}
Logo = skuResponse.Data[0].Logo.Replace("80x80", "200x200");
SkuName = skuResponse.Data[0].Title;
SpuId = skuResponse.Data[0].ProductId;
productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, 1);
if (productApiResponse.Success)
{
if (productApiResponse.Data.Count == 0)
{
return;
}
ProductNo = productApiResponse.Data.Items[0].ProductItemNum;
Brand = productApiResponse.Data.Items[0].BrandName;
}
var productSku = packTaskService.GetProductSku(skuid);
if (productSku == null || !productSku.Success)
{
return;
}
if (productSku.Data.PackConfig != null)
{
var config = productSku.Data.PackConfig;
SkuTitle = config.SkuGoodsTitle;
GoodsNumber = config.GoodsNumber;
PackType = (PackType)config.PackType;
BasicPack = (BasicPack)config.BasicPack;
Availability = (TaskState)config.Availability;
MarkMessage = config.MarkMessage;
CertificatePosition = config.CertificatePosition == null ? CertificatePosition. : (CertificatePosition)config.CertificatePosition.Value;
// Increment1 = config.Increment1;
string[] increateDatas = config.Increment1.Split(',');
bool isSelected = false;
foreach (var item in increates)
{
isSelected = false;
if (increateDatas.Contains(item))
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = isSelected
});
});
}
}
BrandName = productSku.Data.BrandName;
CertificateModel = productSku.Data.Certificate;
IsSetCertificate = false;
if (CertificateModel == null)
{
CertificateModel = new CertificateModel();
IsSetCertificate = true;
}
CertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = skuid;
BarCodeModel = productSku.Data.BarCodeModel;
IsSetBarCode = false;
if (BarCodeModel == null)
{
BarCodeModel = new BarCodeModel();
IsSetBarCode = true;
}
BarCodeModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.SkuId = skuid;
BarCodeModel.SkuName = SkuName;
}
else
{
App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku"));
return;
}
}
public void SearSpuCer()
{
if (string.IsNullOrEmpty(SpuId))
{
SearchSku(SkuId);
return;
}
SpuId = SpuId.Trim();//去掉空格 避免数据异常
var productSku = packTaskService.GetSpuCer(SpuId);
if (productSku == null || !productSku.Success)
{
IsSetSpuCertificate = true;
return;
}
SpuCertificateModel = productSku.Data;
IsSetSpuCertificate = false;
if (SpuCertificateModel == null)
{
SpuCertificateModel = new CertificateModel();
IsSetSpuCertificate = true;
SpuCertificateModel.Brand = Brand;
SpuCertificateModel.BrandName = BrandName;
SpuCertificateModel.ProductNo = ProductNo;
SpuCertificateModel.SpuId = SpuId;
}
}
public void InitData()
{
IncreateList = new ObservableCollection<IncreateModel>();
SpuId = string.Empty;
SaveTask = "发布";
Logo = string.Empty;
SkuId = "";
SkuCount = 0;
SkuName = string.Empty;
ProductNo = string.Empty;
Brand = string.Empty;
BrandName = string.Empty;
this.MarkMessage = "";
IsSetBarCode = true;
IsSetCertificate = true;
BarCodeModel = null;
CertificateModel = null;
SkuTitle = string.Empty;
GoodsNumber = 0;
foreach (var item in increates)
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = false
});
}
//SearchSku(SkuId);
}
#endregion
}
}

10
BBWY.Client/Models/Enums.cs

@ -384,4 +384,14 @@
= 0,
= 1
}
public enum Need
{
=0,
=1
}
public enum PackState
{
= 0, = 1, = 2
}
}

7
BBWY.Client/Models/PackTask/ConsumableModel.cs

@ -4,11 +4,13 @@ using BBWY.Client.ViewModels;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Resources;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media.TextFormatting;
@ -95,6 +97,11 @@ namespace BBWY.Client.Models.PackTask
public void DeletedConsumable(ObservableCollection<ConsumableModel> list)
{
MessageBoxResult result =System.Windows. MessageBox.Show("是否删除?", "提示",
MessageBoxButton.YesNo,
MessageBoxImage.Warning);
if (result != MessageBoxResult.Yes) return;
var res = consumableService.Deleted(Id);
if (res.Success)
{

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

@ -108,12 +108,14 @@ namespace BBWY.Client.Models
var serviceViewModel = viewModelLocator.PackServiceList;
serviceViewModel.TaskCount = SkuCount;
serviceViewModel.TaskId = TaskId;
serviceViewModel.OrderId= OrderId;
serviceViewModel.SkuId =SkuId ;
serviceViewModel.LoadPackDatas();
serviceViewModel.SetAllFees = new Action<FeesItemResponse, List<string>>((feesItem, packUsers) =>
{
FeesItemResponse = feesItem;
PackUser = string.Join("\r\n", packUsers);
FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees;
IsShowFees = feesItem.AllFees > 0 ? true : false;
});
service.Show();
@ -208,9 +210,12 @@ namespace BBWY.Client.Models
}
///修改完成
var model = packTaskService.UpdateTaskStatus(taskId, 1);
var model = packTaskService.UpdateTaskStatus(taskId, 1,"");
if (model != null && model.Success)
{
//var res = batchPurchaseService.UpdatePurchaseOrderState(id, Models.PurchaseOrderState.已完成 );
this.TaskStatus = TaskStateType.;
new TipsWindow("修改成功").Show();
}
@ -497,6 +502,8 @@ namespace BBWY.Client.Models
public FeesItemResponse FeesItemResponse { get => feesItemResponse; set { Set(ref feesItemResponse, value); } }
public IList<SkuMessage> ItemList { get; set; }
public string OrderId { get; set; }
}
public class SkuMessage : NotifyObject

4
BBWY.Client/ViewModels/BaseVM.cs

@ -22,11 +22,11 @@ namespace BBWY.Client.ViewModels
LoadCommand = new RelayCommand(Load);
UnloadCommand = new RelayCommand(Unload);
CopyTextCommand = new RelayCommand<string>(s =>
CopyTextCommand = new RelayCommand<object>(s =>
{
try
{
Clipboard.SetText(s);
Clipboard.SetText(s.ToString());
}
catch (Exception ex)
{

172
BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs

@ -0,0 +1,172 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Linq;
using System.Windows;
using GalaSoft.MvvmLight.Messaging;
namespace BBWY.Client.ViewModels
{
public class BatchPublishTaskViewModel : BaseVM, IDenpendency
{
PackTaskService packTaskService;
ProductService productService;
private bool isLoading = false;
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
private ObservableCollection<BatchPublishTask> batchPublishTasks;
public ObservableCollection<BatchPublishTask> BatchPublishTasks { get => batchPublishTasks; set { Set(ref batchPublishTasks, value); } }
// public ObservableCollection<BatchPublishTask> BatchPublishTasks;
public ICommand OpenSkuDetailCommand { get; set; }
public ICommand CreateTaskCommand { get; set; }
public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService, GlobalContext globalContext)
{
BatchPublishTasks = new ObservableCollection<BatchPublishTask>();
this.packTaskService = packTaskService;
this.productService = productService;
CreateTaskCommand = new RelayCommand<object>(CreateTask);
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
this.globalContext = globalContext;
}
private void OpenSkuDetail(object param)
{
var paramList = (object[])param;
// var orderId = paramList[0].ToString();
var skuId = paramList[0].ToString();
var url = $"https://item.jd.com/{skuId}.html";
try
{
System.Diagnostics.Process.Start("explorer.exe", url);
}
catch (Exception ex)
{
Clipboard.SetText(url);
MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
}
}
GlobalContext globalContext;
private void CreateTask(object obj)
{
foreach (var task in BatchPublishTasks)
{
string increateStr = "";
var increates = task.IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName);
if (increates != null && increates.Count() > 0)
{
increateStr = string.Join(",", increates);
}
var createTaskModel = new Models.APIModel.Request.CreateTaskRequest
{
ProductNo = task.ProductNo,
Logo = task.Logo,
SkuName = task.SkuName,
BrandName = task.BrandName,
Availability = (int)task.Availability,
BasicPack = (int)task.BasicPack,
SkuId = task.SkuId,
CreateTime = DateTime.Now,
Increment1 = increateStr,
CertificatePosition = (int)task.CertificatePosition,
PackType = (int)task.PackType,
MarkMessage = task.MarkMessage,
PositionType = (int)task.PositionType,
GoodsNumber = task.GoodsNumber,
SkuGoodsTitle = task.SkuTitle,
SkuCount = task.SkuCount,
UserId = globalContext.User.Id.ToString(),
ShopId = PurchaserId,
IsWorry = task.IsWorry,
OrderId = orderId,
Platform =platform
};
if (task.IsNeedBarCode == Need.)
{
if (task.BarCodeModel == null || task.BarCodeModel.Id <= 0)
{
new TipsWindow("请设置条形码模板").Show();
return;
}
createTaskModel.BarCodeId = task.BarCodeModel.Id;
}
if (task.IsNeedCertificateModel == Need.)
{
if (task.CertificateModel == null || task.CertificateModel.Id <= 0)
{
new TipsWindow("请设置合格证模板").Show();
return;
}
createTaskModel.CertificateId = task.CertificateModel.Id;//
}
ApiResponse<object> res = null;
res = packTaskService.CreateTask(createTaskModel);
if (!res.Success)
{
new TipsWindow(res.Msg);
return;
}
}
//var win = obj as System.Windows.Window;
Messenger.Default.Send(true, "CloseBatchPublishTaskWindow");
//win.Close();
if (PublishTask != null) PublishTask();
}
public Action PublishTask { get; set; }
Platform platform; string orderId; string PurchaserId;
public void AddSkus(Platform platform, string orderId, string PurchaserId, List<PurchaseOrderSku> purchaseOrderSkus)
{
BatchPublishTasks = new ObservableCollection<BatchPublishTask>();
this.platform = platform; this.orderId = orderId;
this.PurchaserId = PurchaserId;
BatchPublishTask model = null;
IsLoading = true;
foreach (var item in purchaseOrderSkus)
{
model = new BatchPublishTask();
model.productService = productService;
model.packTaskService = packTaskService;
model.SkuId = item.SkuId;
model.SkuCount = item.Quantity.Value;
model.Logo = item.Logo.Replace("80x80", "200x200");
model.SpuId = item.ProductId;
model.SkuName = item.SkuTitle;
model.SearchSku(item.SkuId);
App.Current.Dispatcher.Invoke(() =>
{
BatchPublishTasks.Add(model);
});
}
IsLoading = false;
}
}
}

45
BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs

@ -1,5 +1,6 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.ViewModels;
using BBWY.Client.Views.BatchPurchase;
using BBWY.Common.Extensions;
using BBWY.Common.Models;
@ -11,6 +12,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
namespace BBWY.Client.ViewModels
@ -44,6 +46,8 @@ namespace BBWY.Client.ViewModels
public ICommand CancelPurchaseOrderCommand { get; set; }
public ICommand CreateQTTaskCommand { get; set; }
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } }
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } }
public string SearchPurchaseOrderId { get => searchPurchaseOrderId; set { Set(ref searchPurchaseOrderId, value); } }
@ -72,6 +76,8 @@ namespace BBWY.Client.ViewModels
PayPurchaseOrderCommand = new RelayCommand<object>(PayPurchaseOrder);
CancelPurchaseOrderCommand = new RelayCommand<object>(CancelPurchaseOrder);
CreateQTTaskCommand = new RelayCommand<object>(CreateQTTask);
PageSize = 10;
this.globalContext = globalContext;
EndDate = DateTime.Now.Date;
@ -80,7 +86,41 @@ namespace BBWY.Client.ViewModels
InitQueryPurchaseOrder();
}
private void CreateQTTask(object obj)
{
var parameters = (object[])obj;
var PurchasePlatform = (Platform)parameters[0];//采购平台
var id = parameters[1].ToString();//订单id
var itemList = (List<PurchaseOrderSku>)parameters[2];//skuid 数量
var PurchaserId = (string)parameters[3];//采购商id
ViewModelLocator viewModelLocator = new ViewModelLocator();
BatchPublishTaskViewModel batch = viewModelLocator.BatchPublishTask;
batch.PublishTask = () => {
//修改状态
var res = batchPurchaseService.UpdatePurchaseOrderState(id, Models.PurchaseOrderState.);
if (res.Success)
{
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex));
}
};
batch.AddSkus(PurchasePlatform, id, PurchaserId, itemList);
BatchPublishTaskWindow window = new BatchPublishTaskWindow();
window.Show();
}
private void CancelPurchaseOrder(object obj)
{
@ -104,6 +144,8 @@ namespace BBWY.Client.ViewModels
}
if (res.Data != null)
MessageBox.Show(res.Data.Msg);
else
MessageBox.Show(res.Msg);
}
private void PayPurchaseOrder(object obj)
@ -125,6 +167,9 @@ namespace BBWY.Client.ViewModels
}
if (res.Data != null)
MessageBox.Show(res.Data.Msg);
else
MessageBox.Show(res.Msg);
}

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

@ -222,18 +222,18 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
private string isNeedBarCode;
private Need isNeedBarCode;
/// <summary>
/// 是否需要合格证
/// </summary>
public string IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } }
public Need IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } }
private string isNeedCertificateModel;
private Need isNeedCertificateModel;
/// <summary>
/// 是否需要条形码
/// </summary>
public string IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } }
public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } }
@ -255,7 +255,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
Set(ref isSetBarCode, value);
IsNeedBarCode = IsSetBarCode ? "不需要" : "需要";
IsNeedBarCode = IsSetBarCode ? Need. : Need.;
}
}
@ -269,7 +269,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
Set(ref isSetCertificate, value);
IsNeedCertificateModel = IsSetCertificate ? "不需要" : "需要";
IsNeedCertificateModel = IsSetCertificate ? Need. : Need.;
}
}
private string setSpuCerStatus;
@ -302,7 +302,7 @@ namespace BBWY.Client.ViewModels.PackTask
private string spuId;
/// <summary>
/// 合格证
/// spu
/// </summary>
public string SpuId { get => spuId; set { Set(ref spuId, value); } }
@ -338,41 +338,10 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } }
/// <summary>
/// 服务收费 (单个任务id 消耗的总费用)
/// </summary>
private decimal feesMoney;
/// <summary>
/// 服务收费 (单个任务id 消耗的总费用)
/// </summary>
public decimal FeesMoney { get => feesMoney; set { Set(ref feesMoney, value); } }
/// <summary>
/// 打包员
/// </summary>
private string packUser;
/// <summary>
/// 打包员
/// </summary>
public string PackUser { get => packUser; set { Set(ref packUser, value); } }
private string printName;
/// <summary>
/// 选中的打印机名称
/// </summary>
public string PrintName { get => printName; set { Set(ref printName, value); } }
private List<string> printNames;
/// <summary>
/// 选中的打印机名称
/// </summary>
public List<string> PrintNames { get => printNames; set { Set(ref printNames, value); } }
private int printNums;
/// <summary>
/// 打印数
/// </summary>
public int PrintNums { get => printNums; set { Set(ref printNums, value); } }
private readonly PackTaskService packTaskService;
@ -458,8 +427,8 @@ namespace BBWY.Client.ViewModels.PackTask
PositionType = model.PositionType;
PackType = model.PackType;
BasicPack = model.BasicPack;
IsNeedBarCode = model.BarCodeModel != null ? "需要" : "不需要";
IsNeedCertificateModel = model.CertificateModel != null ? "需要" : "不需要";
IsNeedBarCode = model.BarCodeModel == null ? Need. : Need.;
IsNeedCertificateModel = model.CertificateModel == null ? Need. : Need.;
CertificatePosition = model.CertificatePosition;
TaskId = model.TaskId;
string[] increateDatas = model.Increment1.Split(',');
@ -472,7 +441,8 @@ namespace BBWY.Client.ViewModels.PackTask
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() => {
App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
@ -535,7 +505,7 @@ namespace BBWY.Client.ViewModels.PackTask
LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer);
PrintNames = new List<string>();
delayTrigger = new DelayTrigger(500);
delayTrigger.OnExecute = OnSearchIncreateKeyWordChanged;
BarLabelCheck(BarcodeLabelModel.);//默认精简模式
@ -562,7 +532,7 @@ namespace BBWY.Client.ViewModels.PackTask
ProductNo = SpuCertificateModel.ProductNo,
Shader = SpuCertificateModel.Shader,
ProductShop = SpuCertificateModel.ProductShop,
ApplyAge = SpuCertificateModel.ApplyAge,
ApplyAge = SpuCertificateModel.ApplyAge,
};
}
@ -576,7 +546,8 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel.Brand = Brand;
SpuCertificateModel.SkuId = SkuId;
}
SpuCertificateModel.BrandName = BrandName;
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName;
setSpuCerWindow = new SetSpuCerWindow();
setSpuCerWindow.Show();
}
@ -709,31 +680,7 @@ namespace BBWY.Client.ViewModels.PackTask
//throw new NotImplementedException();
}
/// <summary>
/// 设置合格证
/// </summary>
private void SetCertificate()
{
if (string.IsNullOrEmpty(SearchSkuId))
{
new TipsWindow("请先查询skuId").Show();
return;
}
SearSpuCer();
if (CertificateModel == null)
{
CertificateModel = new CertificateModel();
CertificateModel.ProductNo = ProductNo;
CertificateModel.Brand = Brand;
CertificateModel.SkuId = SkuId;
}
CertificateModel.BrandName = BrandName;
setCerWindow = new SetCerWindow();
setCerWindow.Show();
//throw new NotImplementedException();
}
/// <summary>
/// 保存合格证
/// </summary>
@ -768,18 +715,20 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetCertificate = false;
return;
}
IsNeedCertificateModel = "需要";
IsNeedCertificateModel = Need.;
CertificateModel.Id = resData.Data;
IsSetCertificate = false;
setCerWindow.Close();
}
SetBarCodeWindow setBarCodeWindow = null; SetCerWindow setCerWindow = null; SetSpuCerWindow setSpuCerWindow = null;
public BarcodeLabelModel LabelModel = BarcodeLabelModel.;
private void SetBarCode()
{
if (string.IsNullOrEmpty(SearchSkuId))
if (string.IsNullOrEmpty(SkuId))
{
new TipsWindow("请先查询skuId").Show();
return;
}
if (BarCodeModel == null)
@ -789,15 +738,54 @@ namespace BBWY.Client.ViewModels.PackTask
BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
BarCodeModel.BrandName = BrandName;
setBarCodeWindow = new SetBarCodeWindow();
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow();
setBarCodeWindow.LoadData(BarCodeModel, packTaskService);
setBarCodeWindow.SaveResult = b =>
{
BarCodeModel = b;
IsSetBarCode = false;
IsNeedBarCode = Need.;
};
setBarCodeWindow.Show();
}
public BarcodeLabelModel LabelModel = BarcodeLabelModel.;
/// <summary>
/// 设置合格证
/// </summary>
private void SetCertificate()
{
if (string.IsNullOrEmpty(SkuId))
return;
SearSpuCer();
if (CertificateModel == null)
{
CertificateModel = new CertificateModel();
CertificateModel.ProductNo = ProductNo;
CertificateModel.Brand = Brand;
CertificateModel.SkuId = SkuId;
}
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
SetCerWindow setCerWindow = new SetCerWindow();
setCerWindow.LoadData(certificateModel, packTaskService, spuCertificateModel, IsSetSpuCertificate);
setCerWindow.SaveResult = s =>
{
CertificateModel = s;
IsSetCertificate = false;
IsNeedCertificateModel = Need.;
};
setCerWindow.Show();
}
private void SaveBarCode()
{
@ -815,12 +803,12 @@ namespace BBWY.Client.ViewModels.PackTask
//保存到服务器中 返回id
var resData = packTaskService.SaveBarCode(new BarCodeRequest
{
Brand = Brand,
BrandName = BrandName,
ProductNo = ProductNo,
SkuId = SkuId,
SkuName = SkuName,
LabelModel = LabelModel
Brand = BarCodeModel. Brand,
BrandName = BarCodeModel.BrandName,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName,
LabelModel = BarCodeModel.LabelModel
});
if (resData == null || !resData.Success)
@ -830,7 +818,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
BarCodeModel.Id = resData.Data;
IsNeedBarCode = "需要";
IsNeedBarCode = Need.;
IsSetBarCode = false;
setBarCodeWindow.Close();
}
@ -876,7 +864,7 @@ namespace BBWY.Client.ViewModels.PackTask
Increment2 = (int)Increment2,
CertificatePosition = (int)CertificatePosition,
PackType = (int)PackType,
MarkMessage = markMessage,
MarkMessage = MarkMessage,
PositionType = (int)PositionType,
GoodsNumber = GoodsNumber,
SkuGoodsTitle = SkuTitle,
@ -885,7 +873,7 @@ namespace BBWY.Client.ViewModels.PackTask
ShopId = globalContext.User.Shop.ShopId.ToString(),
IsWorry = IsWorry
};
if (IsNeedBarCode == "需要")
if (IsNeedBarCode == Need.)
{
if (BarCodeModel == null || BarCodeModel.Id <= 0)
{
@ -894,7 +882,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
createTaskModel.BarCodeId = BarCodeModel.Id;
}
if (IsNeedCertificateModel == "需要")
if (IsNeedCertificateModel == Need.)
{
if (CertificateModel == null || CertificateModel.Id <= 0)
{
@ -970,16 +958,16 @@ namespace BBWY.Client.ViewModels.PackTask
return;
}
if (productSku.Data.PackConfig!=null)
if (productSku.Data.PackConfig != null)
{
var config = productSku.Data.PackConfig;
SkuTitle = config.SkuGoodsTitle;
GoodsNumber = config.GoodsNumber;
PackType = (PackType)config.PackType;
BasicPack=(BasicPack)config.BasicPack;
Availability =(TaskState)config.Availability;
BasicPack = (BasicPack)config.BasicPack;
Availability = (TaskState)config.Availability;
MarkMessage = config.MarkMessage;
CertificatePosition = config.CertificatePosition==null? CertificatePosition .: (CertificatePosition)config.CertificatePosition.Value;
CertificatePosition = config.CertificatePosition == null ? CertificatePosition. : (CertificatePosition)config.CertificatePosition.Value;
// Increment1 = config.Increment1;
string[] increateDatas = config.Increment1.Split(',');
@ -991,12 +979,13 @@ namespace BBWY.Client.ViewModels.PackTask
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() => {
IncreateList.Add(new IncreateModel
App.Current.Dispatcher.Invoke(() =>
{
IncreateName = item,
IsSelected = isSelected
});
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = isSelected
});
});
}
@ -1014,7 +1003,9 @@ namespace BBWY.Client.ViewModels.PackTask
}
CertificateModel.Brand = Brand;
CertificateModel.BrandName = BrandName;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = SkuId;
BarCodeModel = productSku.Data.BarCodeModel;
@ -1025,8 +1016,10 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetBarCode = true;
}
BarCodeModel.Brand = Brand;
BarCodeModel.BrandName = BrandName;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
@ -1065,7 +1058,8 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel = new CertificateModel();
IsSetSpuCertificate = true;
SpuCertificateModel.Brand = Brand;
SpuCertificateModel.BrandName = BrandName;
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName;
SpuCertificateModel.ProductNo = ProductNo;
SpuCertificateModel.SpuId = SpuId;

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

@ -44,7 +44,7 @@ namespace BBWY.Client.ViewModels.PackTask
readonly PackTaskService packTaskService;
readonly ConsumableService consumableService;
readonly PackDetailService packDetailService;
readonly BatchPurchaseService batchPurchaseService;
private ObservableCollection<PackItemModel> increateList = new ObservableCollection<PackItemModel>();
public ObservableCollection<PackItemModel> IncreateList { get => increateList; set { Set(ref increateList, value); } } //
@ -75,7 +75,7 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public List<PackItemModel> LoadList = new List<PackItemModel>();
public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, PackServiceService packServiceService, PackDetailService packDetailService)//, long taskId
public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, PackServiceService packServiceService, PackDetailService packDetailService, BatchPurchaseService batchPurchaseService)//, long taskId
{
//TaskId = taskId;
this.consumableService = consumableService;
@ -159,6 +159,7 @@ namespace BBWY.Client.ViewModels.PackTask
AddConsumableCommand = new RelayCommand(AddConsumable);
UpLoadPackCommand = new RelayCommand<object>(UpLoadPack);
SetAllCountCommand = new RelayCommand<object>(SetAllCount);
this.batchPurchaseService = batchPurchaseService;
@ -284,7 +285,8 @@ namespace BBWY.Client.ViewModels.PackTask
private int taskCount;
public int TaskCount { get => taskCount; set { Set(ref taskCount, value); } } //
public string OrderId { get; set; }
public string SkuId { get; set; }
/// <summary>
/// 上传数据 (判断是否超量) 统一上传
/// </summary>
@ -328,7 +330,7 @@ namespace BBWY.Client.ViewModels.PackTask
decimal AllFees = 0;
decimal price = 0;
decimal IncreateFees = 0,PackFees=0,ConsumableFees=0,DiscountPrice=0;
decimal IncreateFees = 0, PackFees = 0, ConsumableFees = 0, DiscountPrice = 0;
foreach (var item in IncreateList)//增值服务上传
{
if (item.SelectId <= 0 || string.IsNullOrEmpty(item.SelectUserId) || item.ItemCount <= 0)
@ -528,13 +530,14 @@ namespace BBWY.Client.ViewModels.PackTask
}
uploadService.AddPackServices = addDatas;
uploadService.DeletedPackServices = del;
uploadService.AllFees = Convert.ToDecimal((AllFees).ToString("0.00")); ;
uploadService.SkuId = SkuId;
uploadService.OrderId= OrderId;
uploadService.AllFees = Convert.ToDecimal(AllFees.ToString("0.00"));
uploadService.SingleFees = singleFees;
uploadService.IncreaseFees = Convert.ToDecimal((IncreateFees).ToString("0.00"));
uploadService.PackFees = Convert.ToDecimal((PackFees).ToString("0.00"));
uploadService.ConsumableFees = Convert.ToDecimal((ConsumableFees).ToString("0.00"));
uploadService. DiscountPrice = Convert.ToDecimal( (AllFees * upDisCount).ToString("0.00"));
uploadService.DiscountPrice = Convert.ToDecimal((AllFees * upDisCount).ToString("0.00"));
var res = packDetailService.UploadService(uploadService);
if (res != null && res.Success)
{
@ -550,7 +553,6 @@ namespace BBWY.Client.ViewModels.PackTask
SetAllFees(feesItem, packUsers);
win.Close();
}
}
/// <summary>
/// 更新 打包员 和费用数据

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

@ -72,16 +72,16 @@ namespace BBWY.Client.ViewModels.PackTask
public ICommand BatchCheckedCommand { get; set; }
public ICommand CopyTextCommand { get; set; }
public PackTaskTotalViewModel(PackTaskService packTaskService)
{
this.packTaskService = packTaskService;
EndDate = DateTime.Now;
StartDate = DateTime.Now.Date;
SearchTaskTotalCommand = new RelayCommand(SearchTaskTotal);
StartDate = DateTime.Now;
EndDate = DateTime.Now;
SetSearchDateCommand = new RelayCommand<int>(d =>
{
@ -97,19 +97,6 @@ namespace BBWY.Client.ViewModels.PackTask
});
BatchCheckedCommand = new RelayCommand(BatchCheck);
CopyTextCommand = new RelayCommand<object>((obj) =>
{
try
{
Clipboard.SetText(obj.ToString());
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
Console.ResetColor();
}
});
BatchSettleCommand = new RelayCommand(BatchSettle);
SettleCommand = new RelayCommand<long>(SettleTask);
ExportCommand = new RelayCommand(Export);

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

@ -146,7 +146,7 @@ namespace BBWY.Client.ViewModels.PackTask
private readonly WorkProcessService workProcessService;
private readonly PackTaskService packTaskService;
private readonly IncreateServiceService increateServiceService;
public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService)
public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService)
{
this.packTaskService = packTaskService;
this.consumableService = consumableService;
@ -181,13 +181,14 @@ namespace BBWY.Client.ViewModels.PackTask
StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date;
IsLoading = false;
SetTaskStatusCommand = new RelayCommand<object>(SetTaskStatus);
//加载数据
SetTaskState(Models.TaskState.);
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
this.productService = productService;
this.batchPurchaseService = batchPurchaseService;
}
@ -199,6 +200,7 @@ namespace BBWY.Client.ViewModels.PackTask
#region 事件绑定
public ICommand SetTaskStatusCommand { get; set; }
/// <summary>
/// 打开图片链接
/// </summary>
@ -229,6 +231,21 @@ namespace BBWY.Client.ViewModels.PackTask
public ICommand TaskPageIndexChangedCommand { get; set; }
BatchPurchaseService batchPurchaseService;
public void SetTaskStatus(object obj )
{
var objList = (object[])obj;
long taskId = (long)objList[0];
string orderId=(string)objList[1];
///修改完成
var model = packTaskService.UpdateTaskStatus(taskId, 1,orderId);
if (model != null && model.Success&&!string.IsNullOrEmpty(orderId))
SearchTaskList();
}
public void SetTaskState(TaskState? taskState)
{
IsWorry = null;
@ -306,7 +323,10 @@ namespace BBWY.Client.ViewModels.PackTask
SkuTitle = item.SkuGoodsTitle,
TaskId = item.TaskId,
TaskStatus = (TaskStateType)item.TaskStatus,
EndTime = item.CreateTime
EndTime = item.CreateTime,
OrderId= item.OrderId,
SkuId = item.SkuId,
};

9
BBWY.Client/ViewModels/ViewModelLocator.cs

@ -277,5 +277,14 @@ namespace BBWY.Client.ViewModels
return s.ServiceProvider.GetRequiredService<BatchPurchaseAddProductSkuViewModel>();
}
}
public BatchPublishTaskViewModel BatchPublishTask
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<BatchPublishTaskViewModel>();
}
}
}
}

270
BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml

@ -0,0 +1,270 @@
<c:BWindow x:Class="BBWY.Client.Views.BatchPurchase.BatchPublishTaskWindow"
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.BatchPurchase"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
DataContext="{Binding BatchPublishTask,Source={StaticResource Locator}}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"
Title="发布任务" Height="800" Width="1300">
<!-- DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" -->
<Window.Resources>
<ResourceDictionary>
<ObjectDataProvider x:Key="storageTypeProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="cmodel:StorageType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ctr:OrderStorageTypeOptionConverter x:Key="ostConverter"/>
<ctr:ProfitRatioConverter x:Key="profitRatioConverter"/>
<ctr:WaybillNoConverter x:Key="waybillConverter"/>
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
<ctr:SaleGrossProfitConverter x:Key="sgpcConverter"/>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
<Grid Background="{StaticResource Border.Background}">
<TextBlock Text="发布任务" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
<ListBox x:Name="listbox_order"
Grid.Row="1"
ItemsSource="{Binding BatchPublishTasks,Mode=TwoWay}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,1"
Foreground="{StaticResource Text.Color}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=listbox_order,Converter={StaticResource widthConverter},ConverterParameter=-0}"
MinHeight="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Width="1" HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Grid.Column="1"/>
<StackPanel Orientation="Vertical" Grid.Column="0">
<c:BAsyncImage UrlSource="{Binding Logo}"
Width="150" DecodePixelWidth="150"
VerticalAlignment="Top" Margin="25 13 25 13"
Cursor="Hand">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.OpenSkuDetailCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="SkuId"/>
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BAsyncImage>
<TextBlock Margin="25 0 0 10">
<Run Text="SKU名称:"/>
<Run Text="{Binding SkuName}"/>
</TextBlock >
<TextBlock Margin="25 0 0 10">
<Run Text="货号:"/>
<Run Text="{Binding ProductNo}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="25 0 0 10" Height="30">
<TextBlock Text="品名:" VerticalAlignment="Center"/>
<c:BTextBox Text="{Binding BrandName}" Height="30" Width="120" WaterRemark="请输入品名"/>
</StackPanel>
<StackPanel Margin="25 0 0 10" Orientation="Horizontal">
<TextBlock Text="条形码:"/>
<c:BButton Content="设置" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding SetBarCodeCommand}"
Visibility="{Binding IsSetBarCode, Converter={StaticResource objConverter}, ConverterParameter=true:Visible:Collapsed }"
/>
<StackPanel Visibility="{Binding IsSetBarCode, Converter={StaticResource objConverter}, ConverterParameter=false:Visible:Collapsed }" Orientation="Horizontal" HorizontalAlignment="Center" >
<c:BButton Content="查看" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding LookBarCommand}"/>
<c:BButton Content="修改" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding SetBarCodeCommand}"/>
</StackPanel >
</StackPanel>
<StackPanel Margin="25 0 0 5" Orientation="Horizontal">
<TextBlock Text="合格证:"/>
<c:BButton Content="设置" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding SetCertificateCommand}"
Visibility="{Binding IsSetCertificate, Converter={StaticResource objConverter}, ConverterParameter=true:Visible:Collapsed }"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
Visibility="{Binding IsSetCertificate, Converter={StaticResource objConverter}, ConverterParameter=false:Visible:Collapsed }">
<c:BButton Content="查看" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding LookCerCommand}"/>
<c:BButton Content="修改" Style="{StaticResource LinkButton}" Width="35" Height="15" Command="{Binding SetCertificateCommand}"/>
</StackPanel >
</StackPanel>
</StackPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid >
<TextBlock Text="任务信息" FontWeight="Bold" Margin="19 23" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<StackPanel Height="25" VerticalAlignment="Center" Margin="19 64" Orientation="Horizontal" HorizontalAlignment="Left" >
<TextBlock Text="数量:" VerticalAlignment="Center"/>
<c:BTextBox WaterRemark="打包数量" Height="25" Width="90" Text="{Binding SkuCount}" />
<TextBlock Margin="30 0 0 0" Text="到货情况:" VerticalAlignment="Center"/>
<ComboBox VerticalContentAlignment="Center" ItemsSource="{Binding AvailabilityList}" Text="{Binding Availability}" >
</ComboBox>
<TextBlock Margin="30 0 0 0" Text="加急:" VerticalAlignment="Center"/>
<ComboBox VerticalContentAlignment="Center" Text="{Binding IsWorry}" >
<ComboBoxItem Content="否" IsSelected="True" />
<ComboBoxItem Content="是"/>
</ComboBox>
</StackPanel>
<c:BTextBox HorizontalAlignment="Left" Text="{Binding MarkMessage}" VerticalAlignment="Top" Height="100" Width="350"
WaterRemark="备注信息" Margin="400 64 0 0 " AcceptsReturn="True" TextWrapping="Wrap">
</c:BTextBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Height="25"
Margin="19 118 0 0">
<TextBlock Text="落仓去向:" VerticalAlignment="Center"/>
<ComboBox VerticalContentAlignment="Center" ItemsSource="{Binding PositionTypeList}" Text="{Binding PositionType}" >
</ComboBox>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<TextBlock Text="打包配置" FontWeight="Bold" Margin="19 23" />
<Grid Height="70" Margin="19 64">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="77"/>
<ColumnDefinition Width="77"/>
<ColumnDefinition MinWidth="77"/>
<ColumnDefinition Width="77"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="77"/>
<ColumnDefinition Width="77"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.ColumnSpan="8" VerticalAlignment="Top" Height="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.Row="0" Grid.ColumnSpan="8" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.Row="1" Grid.ColumnSpan="8" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="0" HorizontalAlignment="Left" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="0" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="1" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="3" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="4" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="5" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="6" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Grid.RowSpan="2" Grid.Column="7" HorizontalAlignment="Right" Width="1" Background="{StaticResource Border.Brush}"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="0" Text="组合类型"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="1" Text="配件数量"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="2" Text="SKU配件商品"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="3" Text="基础包装"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="4" Text="增量耗材"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="5" Text="条码标签"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="6" Text="合格证"/>
<TextBlock Grid.Row="0" Style="{StaticResource middleTextBlock}" Grid.Column="7" Text="合格证位置"/>
<Grid Grid.Row="1" Grid.Column="0" >
<ComboBox VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding PackTypeList}" Text="{Binding PackType}" >
</ComboBox>
</Grid>
<c:BTextBox BorderBrush="Transparent" Grid.Row="1" Grid.Column="1" Height="30" Margin="5" Text="{Binding GoodsNumber,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<c:BTextBox BorderBrush="Transparent" Grid.Row="1" Grid.Column="2" Height="30" Margin="5" Text="{Binding SkuTitle,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Grid Grid.Row="1" Grid.Column="3" >
<ComboBox BorderBrush="Transparent" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding BasicPackList}" Text="{Binding BasicPack}" >
</ComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="4">
<Grid.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>
</Grid.Resources>
<hc:CheckComboBox IsTextSearchEnabled="True" ItemsSource="{Binding IncreateList}"
ShowClearButton="True"
MinWidth="90"
Height="25"
Margin="5,0,5,0">
<hc:CheckComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5,2.5">
<CheckBox Content="{Binding IncreateName}" IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</DataTemplate>
</hc:CheckComboBox.ItemTemplate>
<hc:CheckComboBox.ItemContainerStyle>
<Style TargetType="{x:Type hc:CheckComboBoxItem}" BasedOn="{StaticResource NoBgListBoxItemStyle}">
<Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Style>
</hc:CheckComboBox.ItemContainerStyle>
</hc:CheckComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="5" >
<ComboBox VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding IsNeedBarCodeList}" Text="{Binding IsNeedBarCode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
</ComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="6" >
<ComboBox VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding IsNeedBarCodeList}" Text="{Binding IsNeedCertificateModel,Mode=TwoWay}">
</ComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="7" >
<ComboBox VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding CertificatePositionList}" Text="{Binding CertificatePosition}">
</ComboBox>
</Grid>
</Grid>
</Grid>
</Grid>
<Border Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid Grid.Row="2">
<Button Content="发布" Width="100" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,2,5,2"
Command="{Binding CreateTaskCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type c:BWindow}}}"
Background="{StaticResource Button.Background}" BorderThickness="0" Foreground="White"/>
</Grid>
</Grid>
</c:BWindow>

41
BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml.cs

@ -0,0 +1,41 @@
using BBWY.Client.Models;
using BBWY.Controls;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
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.BatchPurchase
{
/// <summary>
/// BatchPublishTaskWindow.xaml 的交互逻辑
/// </summary>
public partial class BatchPublishTaskWindow : BWindow
{
public BatchPublishTaskWindow()
{
InitializeComponent();
Messenger.Default.Register<bool>(this, "CloseBatchPublishTaskWindow", CloseWindow);
}
private void CloseWindow(bool obj)
{
Messenger.Default.Unregister(this);
if (obj)
{
this.Close();
}
}
}
}

105
BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml

@ -103,7 +103,7 @@
<Button Content="搜索" Width="50" VerticalAlignment="Stretch" Margin="5,0,0,0" Command="{Binding SearchPurchaseOrderCommand}"
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/>
<Button Content="导出" Command="{Binding ExportCommand}" Width="50" Grid.Column="1"
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#1CC2A2" BorderThickness="0" Foreground="White"/>
Visibility="{Binding Visibility,ElementName=listbox_purchaseOrder}" Background="#1CC2A2" BorderThickness="0" Foreground="White"/>
<!--<Button Content="同步" Command="{Binding SyncOrderCommand}" Width="50" Grid.Column="1" Grid.Row="1"
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#02A7F0" BorderThickness="0" Foreground="White"/>-->
</Grid>
@ -371,39 +371,82 @@
TextWrapping="Wrap"/>
<Border Width="1" Grid.Column="5" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/>
<StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:Visible:Collapsed}" Orientation="Vertical" Grid.Column="6" VerticalAlignment="Center">
<c:BButton x:Name="payOrder" Content="支付货款" Style="{StaticResource LinkButton}"
<StackPanel Grid.Column="6" VerticalAlignment="Center">
<StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:Visible:Collapsed }" Orientation="Vertical" VerticalAlignment="Center">
<c:BButton x:Name="payOrder" Content="支付货款" Style="{StaticResource LinkButton}"
Margin="5,0,0,10">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.PayPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
<!-- Command ="{Binding DataContext.CancelPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}"
CommandParameter="{Binding Id}" -->
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.PayPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
<c:BButton x:Name="cancelOrder" Content="取消" Style="{StaticResource LinkButton}"
Margin="5,0,0,0">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command ="{Binding DataContext.CancelPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" >
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command ="{Binding DataContext.CancelPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" >
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
</StackPanel>
<Grid >
<StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:Visible:Collapsed }" Orientation="Vertical" VerticalAlignment="Center">
<c:BButton x:Name="createTask" Content="发布任务" Style="{StaticResource LinkButton}"
Margin="5,0,0,10">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.CreateQTTaskCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
<Binding Path="ItemList"/>
<Binding Path="PurchaserId"/>
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
</StackPanel>
<StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:Visible:Collapsed }" Orientation="Vertical" VerticalAlignment="Center">
<c:BButton x:Name="createTask1" Content="发布任务" Style="{StaticResource LinkButton}"
Margin="5,0,0,10">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.CreateQTTaskCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="PurchasePlatform" />
<Binding Path="Id" />
<Binding Path="ItemList"/>
<Binding Path="PurchaserId"/>
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
</StackPanel>
</Grid>
</StackPanel>
</Grid>

20
BBWY.Client/Views/PackTask/CreatePackTask.xaml

@ -17,9 +17,9 @@
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"
Title="发布任务" Height="350" Width="1500">
Title="发布任务" HorizontalAlignment="Center" Height="350" Width="1500">
<!-- DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" -->
<Window.Resources>
<Window.Resources>
<ResourceDictionary>
<ObjectDataProvider x:Key="storageTypeProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
@ -37,17 +37,21 @@
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="43*"/>
<ColumnDefinition Width="1457*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="150"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
<Grid Background="{StaticResource Border.Background}">
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999" Grid.ColumnSpan="2"/>
<Grid Background="{StaticResource Border.Background}" Grid.ColumnSpan="2">
<TextBlock Text="发布任务" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
<Grid Grid.Row="1">
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="350"/>
<ColumnDefinition Width="350"/>
@ -113,7 +117,7 @@
</Grid>
<Grid Margin="10" Grid.Column="1" Background="{StaticResource Border.Background}">
<Button Content="设置条形码" Width="100" Height="30" VerticalAlignment="Center" Command="{Binding SetBarCodeCommand}"
<Button Content="设置条形码" Width="100" Height="30" VerticalAlignment="Center" Command="{Binding SetBarCodeCommand}"
Visibility="{Binding IsSetBarCode, Converter={StaticResource objConverter}, ConverterParameter=true:Visible:Collapsed }"
Background="{StaticResource Button.Background}" BorderThickness="0" Foreground="White"/>
<StackPanel Visibility="{Binding IsSetBarCode, Converter={StaticResource objConverter}, ConverterParameter=false:Visible:Collapsed }" Orientation="Horizontal" HorizontalAlignment="Center" >
@ -140,7 +144,7 @@
</Grid>
</Grid>
<Grid Margin="10" Grid.Row="2">
<Grid Margin="10,10,10,10" Grid.Row="2" Grid.ColumnSpan="2">
<Grid >
<Grid.Resources>
@ -329,7 +333,7 @@
</Grid>
<Grid Grid.Row="3">
<Grid Grid.Row="3" Grid.ColumnSpan="2">
<Button Content="{Binding SaveTask,Mode=TwoWay}" Width="100" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,2,5,2"
Command="{Binding CreateTaskCommand}"

38
BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs

@ -25,27 +25,27 @@ namespace BBWY.Client.Views.PackTask
{
InitializeComponent();
CertificateModel data = new CertificateModel
{
Brand = certificate.Brand,
BrandName = certificate.BrandName,
ExcuteStander = certificate.ExcuteStander,
FactoryNumber = certificate.FactoryNumber,
IsLogo = certificate.IsLogo,
LabelModel = certificate.LabelModel,
ProductAdress = certificate.ProductAdress,
Id = certificate.Id,
ProductDate = certificate.ProductDate,
ProductNo = certificate.ProductNo,
ProductShop = certificate.ProductShop,
Shader = certificate.Shader,
SkuId = certificate.SkuId,
Reseller = certificate.Reseller,
ApplyAge = certificate.ApplyAge,
//CertificateModel data = new CertificateModel
//{
// Brand = certificate.Brand,
// BrandName = certificate.BrandName,
// ExcuteStander = certificate.ExcuteStander,
// FactoryNumber = certificate.FactoryNumber,
// IsLogo = certificate.IsLogo,
// LabelModel = certificate.LabelModel,
// ProductAdress = certificate.ProductAdress,
// Id = certificate.Id,
// ProductDate = certificate.ProductDate,
// ProductNo = certificate.ProductNo,
// ProductShop = certificate.ProductShop,
// Shader = certificate.Shader,
// SkuId = certificate.SkuId,
// Reseller = certificate.Reseller,
// ApplyAge = certificate.ApplyAge,
};
//};
this.DataContext = data;
this.DataContext = certificate;
}
}
}

3
BBWY.Client/Views/PackTask/SetBarCode.xaml

@ -12,7 +12,6 @@
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
@ -138,6 +137,6 @@
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveBarCodeCommand}" />
Command="{Binding SaveBarCodeCommand}" Click="BButton_Click" />
</Grid>
</c:BWindow>

56
BBWY.Client/Views/PackTask/SetBarCode.xaml.cs

@ -1,4 +1,6 @@
using BBWY.Client.Models;
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
using BBWY.Controls;
using System;
using System.Collections.Generic;
@ -19,10 +21,60 @@ namespace BBWY.Client.Views.PackTask
/// </summary>
public partial class SetBarCodeWindow : BWindow
{
public SetBarCodeWindow( )
public SetBarCodeWindow()
{
InitializeComponent();
}
public void LoadData(BarCodeModel barCodeModel,PackTaskService PackTaskService)
{
BarCodeModel = barCodeModel; packTaskService = PackTaskService;
this.DataContext = this;
}
public BarCodeModel BarCodeModel { get; set; }
public PackTaskService packTaskService { get; set; }
public Action<BarCodeModel> SaveResult { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e)
{
if (BarCodeModel.LabelModel == BarcodeLabelModel.)//标准版 判断数据是否异常
{
if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写")
{
TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型");
tips.Show();
return;
}
}
//保存到服务器中 返回id
var resData = packTaskService.SaveBarCode(new BarCodeRequest
{
Brand = BarCodeModel.Brand,
BrandName = BarCodeModel.BrandName,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName,
LabelModel = BarCodeModel.LabelModel
});
if (resData == null || !resData.Success)
{
//IsSetBarCode = false;
return;
}
BarCodeModel.Id = resData.Data;
if (SaveResult != null)
SaveResult(BarCodeModel);
// IsNeedBarCode = "需要";
//IsSetBarCode = false;
// setBarCodeWindow.Close();
this.Close();
}
}
}

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

@ -12,7 +12,6 @@
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
@ -36,10 +35,10 @@
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="{Binding SetSpuCerStatus}" HorizontalAlignment="Right" Width="100" Margin="20,0,20,0" VerticalAlignment="Stretch"
Command="{Binding SetSpuCerCommand}" />
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="导入spu模板" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding InseartCerCommand}" />
<c:BButton Name="SetSpuCer" Background="{StaticResource Button.Background}" Grid.Row="2" Content="{Binding SetSpuCerStatus}" HorizontalAlignment="Right" Width="100" Margin="20,0,20,0" VerticalAlignment="Stretch"
Command="{Binding SetSpuCerCommand}" Click="SetSpuCer_Click" />
<c:BButton Name="InseartCer" Background="{StaticResource Button.Background}" Grid.Row="2" Content="导入spu模板" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding InseartCerCommand}" Click="InseartCer_Click" />
</StackPanel>
<!--<Grid Grid.Row="1">
<Grid.RowDefinitions>
@ -129,10 +128,10 @@
</Border>
</Grid>
</Grid>-->
<local:SetCerControl Grid.Row="1" model="{Binding CertificateModel,Mode=TwoWay,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}"/>
<local:SetCerControl Grid.Row="1" model="{Binding CertificateModel}"/>
</Grid>
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveCerCommand}" />
<c:BButton x:Name="save_btn" Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveCerCommand}" Click="save_btn_Click" />
</Grid>
</c:BWindow>

107
BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs

@ -1,5 +1,9 @@
using BBWY.Client.Models;
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
using BBWY.Controls;
using NPOI.Util;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
@ -24,5 +28,106 @@ namespace BBWY.Client.Views.PackTask
{
InitializeComponent();
}
public void LoadData(CertificateModel CertificateModel, PackTaskService packTaskService, CertificateModel SpuCertificateModel,bool IsSetSpuCertificate)
{
this.CertificateModel = CertificateModel.Copy();
this.SpuCertificateModel = SpuCertificateModel.Copy();
this.packTaskService = packTaskService;
this.IsSetSpuCertificate = IsSetSpuCertificate;
SetSpuCer.Content = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板";
this.DataContext = this;
}
public bool IsSetSpuCertificate { get; set; }
public PackTaskService packTaskService { get; set; }
public CertificateModel CertificateModel { get; set; }
public CertificateModel SpuCertificateModel { get; set; }
public Action<CertificateModel> SaveResult { get; set; }
private void save_btn_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(CertificateModel.ExcuteStander)
|| string.IsNullOrEmpty(CertificateModel.Shader) || string.IsNullOrEmpty(CertificateModel.BrandName)
|| string.IsNullOrEmpty(CertificateModel.Brand) || string.IsNullOrEmpty(CertificateModel.ProductShop)
|| string.IsNullOrEmpty(CertificateModel.ProductAdress))
{
new TipsWindow("参数出错!请重新填写!").Show();
return;
}
var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries);
var resData = packTaskService.SaveCer(new CerRequest
{
Brand = CertificateModel.Brand,
BrandName = CertificateModel.BrandName,
ProductNo = CertificateModel.ProductNo,
SkuId = CertificateModel.SkuId,
ExcuteStander = CertificateModel.ExcuteStander,
LabelModel = (int)CertificateModel.LabelModel,
FactoryNumber = CertificateModel.FactoryNumber,
IsLogo = CertificateModel.IsLogo,
ProductAdress = CertificateModel.ProductAdress,
ProductShop = CertificateModel.ProductShop,
Shader = CertificateModel.Shader,
ApplyAge = CertificateModel.ApplyAge,
});
if (resData == null || !resData.Success)
{
// IsSetCertificate = false;
return;
}
// IsNeedCertificateModel = "需要";
CertificateModel.Id = resData.Data;
if (SaveResult != null) SaveResult(CertificateModel);
this.Close();
//IsSetCertificate = false;
//setCerWindow.Close();
}
private void SetSpuCer_Click(object sender, RoutedEventArgs e)
{
if (SpuCertificateModel == null)
{
SpuCertificateModel = new CertificateModel();
SpuCertificateModel.ProductNo = CertificateModel.ProductNo;
SpuCertificateModel.Brand = CertificateModel.Brand;
SpuCertificateModel.SkuId = CertificateModel.SkuId;
}
SetSpuCerWindow setSpuCerWindow = new SetSpuCerWindow();
setSpuCerWindow.LoadData(SpuCertificateModel, packTaskService);
setSpuCerWindow.SaveResult = s =>
{
SpuCertificateModel = s;
SetSpuCer.Content = "修改spu模板";//"设置spu模板" : "修改spu模板";
IsSetSpuCertificate = false;
};
setSpuCerWindow.Show();
}
private void InseartCer_Click(object sender, RoutedEventArgs e)
{
if (IsSetSpuCertificate)
{
new TipsWindow("无可用模板").Show();
return;
}
CertificateModel.Brand = SpuCertificateModel.Brand;
CertificateModel.BrandName = SpuCertificateModel.BrandName;
CertificateModel.ExcuteStander = SpuCertificateModel.ExcuteStander;
CertificateModel.FactoryNumber = SpuCertificateModel.FactoryNumber;
CertificateModel.IsLogo = SpuCertificateModel.IsLogo;
CertificateModel.LabelModel = SpuCertificateModel.LabelModel;
CertificateModel.ProductAdress = SpuCertificateModel.ProductAdress;
CertificateModel.ProductNo = SpuCertificateModel.ProductNo;
CertificateModel.Shader = SpuCertificateModel.Shader;
CertificateModel.ProductShop = SpuCertificateModel.ProductShop;
CertificateModel.ApplyAge = SpuCertificateModel.ApplyAge;
}
}
}

7
BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml

@ -12,7 +12,6 @@
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
@ -29,7 +28,7 @@
Background="{StaticResource Border.Background}">
<TextBlock Text="设置SPU合格证模板" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<local:SetCerControl Grid.Row="1" model="{Binding SpuCertificateModel,Mode=TwoWay,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}"/>
<local:SetCerControl Grid.Row="1" model="{Binding SpuCertificateModel}"/>
<!--<Grid Grid.Row="1">
<Grid.RowDefinitions>
@ -120,7 +119,7 @@
</Grid>
</Grid>-->
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveSpuCerCommand}" />
<c:BButton Name="save_spuCer" Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Click="save_spuCer_Click" />
</Grid>
</c:BWindow>

56
BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs

@ -1,4 +1,8 @@
using BBWY.Controls;
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
using BBWY.Controls;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Text;
@ -22,5 +26,55 @@ namespace BBWY.Client.Views.PackTask
{
InitializeComponent();
}
private PackTaskService packTaskService { get; set; }
public CertificateModel SpuCertificateModel { get; set; }
public void LoadData(CertificateModel SpuCertificateModel, PackTaskService packTaskService)
{
this.SpuCertificateModel = SpuCertificateModel.Copy();
this.packTaskService = packTaskService;
this.DataContext=this;
}
public Action<CertificateModel> SaveResult { get; set; }
private void save_spuCer_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(SpuCertificateModel.ExcuteStander)
|| string.IsNullOrEmpty(SpuCertificateModel.BrandName)
|| string.IsNullOrEmpty(SpuCertificateModel.Brand) || string.IsNullOrEmpty(SpuCertificateModel.ProductShop)
|| string.IsNullOrEmpty(SpuCertificateModel.ProductAdress))
{
new TipsWindow("参数出错!请重新填写!").Show();
return;
}
var resData = packTaskService.SaveSpuCer(new CerRequest
{
Brand = SpuCertificateModel.Brand,
BrandName = SpuCertificateModel.BrandName,
ProductNo = SpuCertificateModel.ProductNo,
SpuId = SpuCertificateModel.SpuId,
ExcuteStander = SpuCertificateModel.ExcuteStander,
LabelModel = (int)SpuCertificateModel.LabelModel,
FactoryNumber = SpuCertificateModel.FactoryNumber,
IsLogo = SpuCertificateModel.IsLogo,
ProductAdress = SpuCertificateModel.ProductAdress,
ProductShop = SpuCertificateModel.ProductShop,
Shader = SpuCertificateModel.Shader,
SkuId = SpuCertificateModel.SkuId,
ApplyAge = SpuCertificateModel.ApplyAge,
});
if (resData == null || !resData.Success)
{
return;
}
if (SaveResult != null) SaveResult(SpuCertificateModel);
this.Close();
}
}
}

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

@ -122,8 +122,20 @@
<TextBlock VerticalAlignment="Center" Text="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel>
<c:BButton Grid.Column="11" Command="{Binding SetTaskStatusCommand}" CommandParameter="{Binding TaskId}"
HorizontalAlignment="Stretch" VerticalAlignment="Center" Content="完成" />
<c:BButton Grid.Column="11" HorizontalAlignment="Stretch" VerticalAlignment="Center" Content="完成" >
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.SetTaskStatusCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="TaskId" />
<Binding Path="OrderId"/>
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger>
</b:Interaction.Triggers>
</c:BButton>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>

23
BBWY.Server.API/Controllers/BatchPurchaseController.cs

@ -59,16 +59,39 @@ namespace BBWY.Server.API.Controllers
return batchPurchaseBusiness.GetPurchaseOrderList(request);
}
/// <summary>
/// 支付订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public PayPurchaseOrderResponse PayPurchaseOrder([FromBody] PayPurchaseOrderRequest request)
{
return batchPurchaseBusiness.PayPurchaseOrder(request);
}
/// <summary>
/// 取消订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public CancelPurchaseOrderResponse CancelPurchaseOrder([FromBody] CancelPurchaseOrderRequest request)
{
return batchPurchaseBusiness.CancelPurchaseOrder(request);
}
/// <summary>
/// 修改采购单状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public UpdatePackStateResponse UpdatePurchaseOrderState([FromBody] UpdatePurchaseOrderStateRequest request)
{
return batchPurchaseBusiness.UpdatePurchaseOrderState(request);
}
}
}

3
BBWY.Server.API/Startup.cs

@ -47,11 +47,12 @@ namespace BBWY.Server.API
var fsql2 = new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.MySql, Configuration.GetConnectionString("MDSDB")).Build();
var fsql3 = new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.MySql, Configuration.GetConnectionString("JDXX")).Build();
services.AddSingleton(new FreeSqlMultiDBManager()
{
BBWYfsql = fsql,
MDSfsql = fsql2,
JDXXfsql = fsql3
JDXXfsql = fsql3,
});
services.AddSingleton<NLogManager>();
services.AddSingleton(typeof(NLog.ILogger), NLog.LogManager.GetCurrentClassLogger());

2
BBWY.Server.Business/FreeSqlMultiDBManager.cs

@ -10,5 +10,7 @@ namespace BBWY.Server.Business
public IFreeSql MDSfsql { get; set; }
public IFreeSql JDXXfsql { get; set; }
}
}

21
BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs

@ -1,6 +1,7 @@
using BBWY.Common.Models;
using BBWY.Server.Model;
using BBWY.Server.Model.Db;
using BBWY.Server.Model.Db.QK;
using BBWY.Server.Model.Dto;
using FreeSql;
using Newtonsoft.Json;
@ -9,6 +10,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;
namespace BBWY.Server.Business
@ -18,6 +20,8 @@ namespace BBWY.Server.Business
private ProductBusiness productBusiness;
private IEnumerable<PlatformSDKBusiness> platformSDKBusinessList;
public BatchPurchaseBusiness(IFreeSql fsql,
NLogManager nLogManager,
IIdGenerator idGenerator,
@ -26,6 +30,7 @@ namespace BBWY.Server.Business
{
this.productBusiness = productBusiness;
this.platformSDKBusinessList = platformSDKBusinessList;
}
/// <summary>
@ -426,8 +431,11 @@ namespace BBWY.Server.Business
var purchaseOrderIdList = purchaseOrderList.Select(p => p.Id).ToList();
var purchaseOrderSkuList = fsql.Select<PurchaseOrderSku>().Where(posku => purchaseOrderIdList.Contains(posku.PurchaseOrderId)).ToList<PurchaseOrderSkuResponse>();
foreach (var purchaseOrder in purchaseOrderList)
purchaseOrder.ItemList = purchaseOrderSkuList.Where(posku => posku.PurchaseOrderId == purchaseOrder.Id).ToList();
return new PurchaseOrderV2ListResponse() { Count = total, ItemList = purchaseOrderList };
}
@ -472,5 +480,18 @@ namespace BBWY.Server.Business
Msg = payOrderResponse.Msg
};
}
public UpdatePackStateResponse UpdatePurchaseOrderState(UpdatePurchaseOrderStateRequest request)
{
var order = fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne();
fsql.Update<PurchaseOrderV2>(order)
.Set(a => a.OrderState, request.PurchaseOrderState)
.ExecuteAffrows();
return new UpdatePackStateResponse();
}
}
}

5
BBWY.Server.Model/Db/PurchaseOrder/PurchaseOrderV2.cs

@ -203,6 +203,11 @@ namespace BBWY.Server.Model.Db
/// </summary>
[Column(MapType = typeof(int))]
public Enums.PurchaseOrderMode PurchaseOrderMode { get; set; }
/// <summary>
/// 打包状态 (待发布=0,打包中=1,已完成=2)
/// </summary>
[Column(MapType = typeof(int))]
public Enums.PackState PackState { get; set; }
}
}

79
BBWY.Server.Model/Db/QK/FeesDetail.cs

@ -0,0 +1,79 @@
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Server.Model.Db.QK
{
/// <summary>
/// 收费明细表
/// </summary>
[Table(Name = "feesdetail", DisableSyncStructure = true)]
public class FeesDetail
{
[Column(IsPrimary =true)]
public long Id { get; set; }
/// <summary>
/// 任务id
/// </summary>
public long TaskId { get; set; }
/// <summary>
/// 耗材ids
/// </summary>
public string ConsumableIds { get; set; }
/// <summary>
/// 耗材数量
/// </summary>
public string ConsumableNos { get; set; }
/// <summary>
/// 工序ids
/// </summary>
public string WorkProcessIds { get; set; }
/// <summary>
/// 工序数量
/// </summary>
public string WorkProcessNos { get; set; }
/// <summary>
/// 增值服务ids
/// </summary>
public string IncreateServiceIds { get; set; }
/// <summary>
/// 增值服务数量
/// </summary>
public string IncreateServiceNos { get; set; }
/// <summary>
/// 任务单件费用
/// </summary>
public decimal SingleFees { get; set; }
/// <summary>
/// 任务总费用
/// </summary>
public decimal AllFees { get; set; }
/// <summary>
/// 任务打折
/// </summary>
public decimal? Discount { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 打包服务项目
/// </summary>
public string PackServiceIds { get; set; }
/// <summary>
/// 服务数量
/// </summary>
public string PackServiceNos { get; set; }
public decimal? IncreaseFees { get; set; }
public decimal? PackFees { get; set; }
public decimal? ConsumableFees { get; set; }
public decimal? DiscountPrice { get; set; }
}
}

192
BBWY.Server.Model/Db/QK/PackTask.cs

@ -0,0 +1,192 @@
using FreeSql;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;
using BBWY.Server.Model;
namespace BBWY.Server.Model.Db.QK
{
/// <summary>
/// 打包任务
/// </summary>
[Table(Name = "packtask", DisableSyncStructure = true)]
public class PackTask
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsNullable = false)]
public long Id { get; set; }
/// <summary>
/// 需求方创建日期
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 任务状态(未完成=0,已完成=1,)
/// </summary>
public int TaskStatus { get; set; }
/// <summary>
/// 项目完成时间
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// 需求方团队id
/// </summary>
public string DepartmentId { get; set; }
/// <summary>
/// 需求方店铺id
/// </summary>
public string ShopId { get; set; }
/// <summary>
/// 货号品名(手写上传)
/// </summary>
public string BrandName { get; set; }
/// <summary>
/// 对接人
/// </summary>
public string UserId { get; set; }
/// <summary>
/// skuid
/// </summary>
public string SkuId { get; set; }
/// <summary>
/// sku数量
/// </summary>
public int SkuCount { get; set; }
/// <summary>
/// 打包类型(单件=0,多件=1)
/// </summary>
public int PackType { get; set; }
/// <summary>
/// 落仓(本地仓=0,齐越仓=1,京东仓=2)
/// </summary>
public int PositionType { get; set; }
/// <summary>
/// 基础包装(快递袋=0,纸箱=1,麻袋=2)
/// </summary>
public int BasicPack { get; set; }
/// <summary>
/// 增量1()
/// </summary>
public string Increment1 { get; set; }
/// <summary>
/// 增量2()
/// </summary>
public int? Increment2 { get; set; }
/// <summary>
/// 工序道数
/// </summary>
public int? ProcessCount { get; set; }
/// <summary>
/// 条形码id
/// </summary>
public long? BarcodeId { get; set; }
/// <summary>
/// 合格证
/// </summary>
public long? CertificateId { get; set; }
/// <summary>
/// 合格证位置(外部包装=0,产品包装=1)
/// </summary>
public int? CertificatePosition { get; set; }
/// <summary>
/// 箱子耗材(自带=0,4-13号纸箱=1-10,)
/// </summary>
public int? BoxConsumables { get; set; }
/// <summary>
/// sku配件名称
/// </summary>
public string SkuGoodsTitle { get; set; }
/// <summary>
/// 配件数
/// </summary>
public int GoodsNumber { get; set; }
/// <summary>
/// 气泡纸耗材(长=0,宽=1)
/// </summary>
public int? AirConsumables { get; set; }
/// <summary>
/// 注意事项(对接备注)
/// </summary>
public string MarkMessage { get; set; }
/// <summary>
/// 到货情况(待收货=2,部分收货=1,已到货=0)
/// </summary>
public int Availability { get; set; }
/// <summary>
/// 是否加急
/// </summary>
public int IsWorry { get; set; }
/// <summary>
/// 是否删除
/// </summary>
public Enums.IsDeleted IsDeleted { get; set; }
/// <summary>
/// 是否结清
/// </summary>
public Enums.Settle IsSettle { get; set; }
/// <summary>
/// 拳探订单id
/// </summary>
public string OrderId { get; set; }
/// <summary>
/// 店铺归属
/// </summary>
public string OriginShopId { get; set; }
/// <summary>
/// 账单归属(0=店铺,1=拳探)
/// </summary>
public Enums.BillOrigin BillOrigin { get; set; }
}
public class OrderTaskFees
{
public string OrderId { get; set; }
public string SkuId { get; set; }
public Decimal? DiscountPrice { get; set; }
}
}

28
BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/UpdatePackStateRequest.cs

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using BBWY.Server.Model;
namespace BBWY.Server.Model.Dto
{
public class UpdatePackStateRequest
{
public string OrderId { get; set; }
public Enums.PackState PackState { get ;set ;}
}
public class UpdatePurchaseOrderStateRequest
{
public string OrderId { get; set; }
public Enums.PurchaseOrderState PurchaseOrderState { get; set; }
}
public class UpdatePackMoneyRequest
{
public string SkuId { get; set; }
public string OrderId { get; set; }
//设置sku 耗材费
public decimal PackMoney { get; set; }
}
}

10
BBWY.Server.Model/Dto/Response/PurchaseOrderV2/BatchPurchase/UpdatePackStateResponse.cs

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Server.Model.Dto
{
public class UpdatePackStateResponse
{
}
}

26
BBWY.Server.Model/Enums.cs

@ -319,5 +319,31 @@
{
= 0, = 1, = 2, = 3, = 4, = 5, = 6, = 7
}
public enum PackState
{
=0,=1,=2
}
public enum IsDeleted
{
= 0,
= 1
}
public enum Settle
{
= 0,
= 1
}
public enum BillOrigin
{
= 0,
= 1
}
}
}

Loading…
Cancel
Save