Browse Source

1

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
51fedc3ade
  1. 15
      BBWY.Client/APIServices/BatchPurchaseService.cs
  2. 8
      BBWY.Client/BBWYAppSettings.json
  3. 1
      BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs
  4. 6
      BBWY.Client/Models/APIModel/Response/BatchPurchase/PurchaseOrderV2Response.cs
  5. 141
      BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs
  6. 4
      BBWY.Client/Models/Enums.cs
  7. 76
      BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs
  8. 9
      BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs
  9. 133
      BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs
  10. 4
      BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml
  11. 3
      BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
  12. 38
      BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs
  13. 3
      BBWY.Client/Views/PackTask/SetBarCode.xaml
  14. 56
      BBWY.Client/Views/PackTask/SetBarCode.xaml.cs
  15. 15
      BBWY.Client/Views/PackTask/SetCerWindow.xaml
  16. 107
      BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs
  17. 7
      BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml
  18. 56
      BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs
  19. 20
      BBWY.Server.API/Controllers/BatchPurchaseController.cs
  20. 16
      BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
  21. 5
      BBWY.Server.Model/Db/PurchaseOrder/PurchaseOrderV2.cs
  22. 13
      BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/UpdatePackStateRequest.cs
  23. 10
      BBWY.Server.Model/Dto/Response/PurchaseOrderV2/BatchPurchase/UpdatePackStateResponse.cs
  24. 6
      BBWY.Server.Model/Enums.cs

15
BBWY.Client/APIServices/BatchPurchaseService.cs

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

8
BBWY.Client/BBWYAppSettings.json

@ -1,9 +1,9 @@
{ {
//"BBWYApiHost": "http://localhost:5000", "BBWYApiHost": "http://localhost:5000",
"BBWYApiHost": "http://bbwytest.qiyue666.com", //"BBWYApiHost": "http://bbwytest.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com", "MDSApiHost": "http://mdsapi.qiyue666.com",
"JOSApiHost": "", "JOSApiHost": "",
"1688ApiHost": "", "1688ApiHost": "",
//"QKApiHost": "http://localhost:8080" "QKApiHost": "http://localhost:8080"
"QKApiHost": "http://qiku.qiyue666.com" // "QKApiHost": "http://qiku.qiyue666.com"
} }

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

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

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

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

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

@ -1,6 +1,9 @@
using BBWY.Client.APIServices; using BBWY.Client.APIServices;
using BBWY.Client.Models.PackTask; using BBWY.Client.Models.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models; using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@ -8,6 +11,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace BBWY.Client.Models namespace BBWY.Client.Models
{ {
@ -129,7 +134,8 @@ namespace BBWY.Client.Models
/// </summary> /// </summary>
public bool IsSetBarCode public bool IsSetBarCode
{ {
get => isSetBarCode; set get => isSetBarCode;
set
{ {
Set(ref isSetBarCode, value); Set(ref isSetBarCode, value);
@ -228,8 +234,106 @@ namespace BBWY.Client.Models
public ProductService productService; public ProductService productService;
public BatchPublishTask() 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 方法 #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> /// <summary>
/// 搜索 skuId /// 搜索 skuId
/// </summary> /// </summary>
@ -318,6 +422,7 @@ namespace BBWY.Client.Models
} }
CertificateModel.Brand = Brand; CertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName; CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo; CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = skuid; CertificateModel.SkuId = skuid;
@ -329,6 +434,7 @@ namespace BBWY.Client.Models
IsSetBarCode = true; IsSetBarCode = true;
} }
BarCodeModel.Brand = Brand; BarCodeModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName; BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo; BarCodeModel.ProductNo = ProductNo;
BarCodeModel.SkuId = skuid; BarCodeModel.SkuId = skuid;
@ -343,6 +449,39 @@ namespace BBWY.Client.Models
//查看有木有存在 //查看有木有存在
} }
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() public void InitData()
{ {

4
BBWY.Client/Models/Enums.cs

@ -390,4 +390,8 @@
=0, =0,
=1 =1
} }
public enum PackState
{
= 0, = 1, = 2
}
} }

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

@ -1,12 +1,16 @@
using BBWY.Client.APIServices; using BBWY.Client.APIServices;
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models; using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Net.Mail;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using System.Linq;
namespace BBWY.Client.ViewModels namespace BBWY.Client.ViewModels
{ {
@ -23,19 +27,84 @@ namespace BBWY.Client.ViewModels
public ICommand CreateTaskCommand { get; set; } public ICommand CreateTaskCommand { get; set; }
public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService) public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService, GlobalContext globalContext)
{ {
BatchPublishTasks = new ObservableCollection<BatchPublishTask>(); BatchPublishTasks = new ObservableCollection<BatchPublishTask>();
this.packTaskService = packTaskService; this.packTaskService = packTaskService;
this.productService = productService; this.productService = productService;
CreateTaskCommand = new RelayCommand(CreateTask); CreateTaskCommand = new RelayCommand<object>(CreateTask);
this.globalContext = globalContext;
} }
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
};
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);
private void CreateTask() if (!res.Success)
{ {
new TipsWindow(res.Msg);
return;
}
}
var win = obj as System.Windows.Window;
if (PublishTask != null) PublishTask();
win.Close();
} }
public Action PublishTask { get; set; }
Platform platform; string orderId; string PurchaserId; Platform platform; string orderId; string PurchaserId;
public void AddSkus(Platform platform, string orderId, string PurchaserId, List<PurchaseOrderSku> purchaseOrderSkus) public void AddSkus(Platform platform, string orderId, string PurchaserId, List<PurchaseOrderSku> purchaseOrderSkus)
{ {
@ -47,7 +116,6 @@ namespace BBWY.Client.ViewModels
foreach (var item in purchaseOrderSkus) foreach (var item in purchaseOrderSkus)
{ {
model = new BatchPublishTask(); model = new BatchPublishTask();
//model.InitData();
model.productService = productService; model.productService = productService;
model.packTaskService = packTaskService; model.packTaskService = packTaskService;
model.SkuId = item.SkuId; model.SkuId = item.SkuId;

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

@ -97,9 +97,14 @@ namespace BBWY.Client.ViewModels
ViewModelLocator viewModelLocator = new ViewModelLocator(); ViewModelLocator viewModelLocator = new ViewModelLocator();
BatchPublishTaskViewModel batch = viewModelLocator.BatchPublishTask; BatchPublishTaskViewModel batch = viewModelLocator.BatchPublishTask;
batch.AddSkus(PurchasePlatform, id, PurchaserId, itemList);
BatchPublishTaskWindow window = new BatchPublishTaskWindow(); BatchPublishTaskWindow window = new BatchPublishTaskWindow();
batch.PublishTask = () => {
//修改状态
batchPurchaseService.UpdatePackState(id, PackState.);
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex));
};
batch.AddSkus(PurchasePlatform, id, PurchaserId, itemList);
window.ShowDialog(); window.ShowDialog();

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

@ -222,18 +222,18 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary> /// </summary>
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
private string isNeedBarCode; private Need isNeedBarCode;
/// <summary> /// <summary>
/// 是否需要合格证 /// 是否需要合格证
/// </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>
/// 是否需要条形码 /// 是否需要条形码
/// </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); Set(ref isSetBarCode, value);
IsNeedBarCode = IsSetBarCode ? "不需要" : "需要"; IsNeedBarCode = IsSetBarCode ? Need. : Need.;
} }
} }
@ -269,7 +269,7 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
Set(ref isSetCertificate, value); Set(ref isSetCertificate, value);
IsNeedCertificateModel = IsSetCertificate ? "不需要" : "需要"; IsNeedCertificateModel = IsSetCertificate ? Need. : Need.;
} }
} }
private string setSpuCerStatus; private string setSpuCerStatus;
@ -427,8 +427,8 @@ namespace BBWY.Client.ViewModels.PackTask
PositionType = model.PositionType; PositionType = model.PositionType;
PackType = model.PackType; PackType = model.PackType;
BasicPack = model.BasicPack; BasicPack = model.BasicPack;
IsNeedBarCode = model.BarCodeModel != null ? "需要" : "不需要"; IsNeedBarCode = model.BarCodeModel == null ? Need. : Need.;
IsNeedCertificateModel = model.CertificateModel != null ? "需要" : "不需要"; IsNeedCertificateModel = model.CertificateModel == null ? Need. : Need.;
CertificatePosition = model.CertificatePosition; CertificatePosition = model.CertificatePosition;
TaskId = model.TaskId; TaskId = model.TaskId;
string[] increateDatas = model.Increment1.Split(','); string[] increateDatas = model.Increment1.Split(',');
@ -441,7 +441,8 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
isSelected = true; isSelected = true;
} }
App.Current.Dispatcher.Invoke(() => { App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel IncreateList.Add(new IncreateModel
{ {
IncreateName = item, IncreateName = item,
@ -545,6 +546,7 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel.Brand = Brand; SpuCertificateModel.Brand = Brand;
SpuCertificateModel.SkuId = SkuId; SpuCertificateModel.SkuId = SkuId;
} }
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName; SpuCertificateModel.BrandName = BrandName;
setSpuCerWindow = new SetSpuCerWindow(); setSpuCerWindow = new SetSpuCerWindow();
setSpuCerWindow.Show(); setSpuCerWindow.Show();
@ -678,31 +680,7 @@ namespace BBWY.Client.ViewModels.PackTask
//throw new NotImplementedException(); //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>
/// 保存合格证 /// 保存合格证
/// </summary> /// </summary>
@ -738,18 +716,20 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetCertificate = false; IsSetCertificate = false;
return; return;
} }
IsNeedCertificateModel = "需要"; IsNeedCertificateModel = Need.;
CertificateModel.Id = resData.Data; CertificateModel.Id = resData.Data;
IsSetCertificate = false; IsSetCertificate = false;
setCerWindow.Close(); setCerWindow.Close();
} }
SetBarCodeWindow setBarCodeWindow = null; SetCerWindow setCerWindow = null; SetSpuCerWindow setSpuCerWindow = null; SetBarCodeWindow setBarCodeWindow = null; SetCerWindow setCerWindow = null; SetSpuCerWindow setSpuCerWindow = null;
public BarcodeLabelModel LabelModel = BarcodeLabelModel.;
private void SetBarCode() private void SetBarCode()
{ {
if (string.IsNullOrEmpty(SearchSkuId)) if (string.IsNullOrEmpty(SkuId))
{ {
new TipsWindow("请先查询skuId").Show();
return; return;
} }
if (BarCodeModel == null) if (BarCodeModel == null)
@ -759,15 +739,54 @@ namespace BBWY.Client.ViewModels.PackTask
BarCodeModel.Brand = Brand; BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId; BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName; BarCodeModel.SkuName = SkuName;
} }
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName; BarCodeModel.BrandName = BrandName;
setBarCodeWindow = new SetBarCodeWindow();
SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow();
setBarCodeWindow.LoadData(BarCodeModel, packTaskService);
setBarCodeWindow.SaveResult = b =>
{
BarCodeModel = b;
IsSetBarCode = false;
IsNeedBarCode = Need.;
};
setBarCodeWindow.Show(); 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() private void SaveBarCode()
{ {
@ -785,12 +804,12 @@ namespace BBWY.Client.ViewModels.PackTask
//保存到服务器中 返回id //保存到服务器中 返回id
var resData = packTaskService.SaveBarCode(new BarCodeRequest var resData = packTaskService.SaveBarCode(new BarCodeRequest
{ {
Brand = Brand, Brand = BarCodeModel. Brand,
BrandName = BrandName, BrandName = BarCodeModel.BrandName,
ProductNo = ProductNo, ProductNo = BarCodeModel.ProductNo,
SkuId = SkuId, SkuId = BarCodeModel.SkuId,
SkuName = SkuName, SkuName = BarCodeModel.SkuName,
LabelModel = LabelModel LabelModel = BarCodeModel.LabelModel
}); });
if (resData == null || !resData.Success) if (resData == null || !resData.Success)
@ -800,7 +819,7 @@ namespace BBWY.Client.ViewModels.PackTask
} }
BarCodeModel.Id = resData.Data; BarCodeModel.Id = resData.Data;
IsNeedBarCode = "需要"; IsNeedBarCode = Need.;
IsSetBarCode = false; IsSetBarCode = false;
setBarCodeWindow.Close(); setBarCodeWindow.Close();
} }
@ -846,7 +865,7 @@ namespace BBWY.Client.ViewModels.PackTask
Increment2 = (int)Increment2, Increment2 = (int)Increment2,
CertificatePosition = (int)CertificatePosition, CertificatePosition = (int)CertificatePosition,
PackType = (int)PackType, PackType = (int)PackType,
MarkMessage = markMessage, MarkMessage = MarkMessage,
PositionType = (int)PositionType, PositionType = (int)PositionType,
GoodsNumber = GoodsNumber, GoodsNumber = GoodsNumber,
SkuGoodsTitle = SkuTitle, SkuGoodsTitle = SkuTitle,
@ -855,7 +874,7 @@ namespace BBWY.Client.ViewModels.PackTask
ShopId = globalContext.User.Shop.ShopId.ToString(), ShopId = globalContext.User.Shop.ShopId.ToString(),
IsWorry = IsWorry IsWorry = IsWorry
}; };
if (IsNeedBarCode == "需要") if (IsNeedBarCode == Need.)
{ {
if (BarCodeModel == null || BarCodeModel.Id <= 0) if (BarCodeModel == null || BarCodeModel.Id <= 0)
{ {
@ -864,7 +883,7 @@ namespace BBWY.Client.ViewModels.PackTask
} }
createTaskModel.BarCodeId = BarCodeModel.Id; createTaskModel.BarCodeId = BarCodeModel.Id;
} }
if (IsNeedCertificateModel == "需要") if (IsNeedCertificateModel == Need.)
{ {
if (CertificateModel == null || CertificateModel.Id <= 0) if (CertificateModel == null || CertificateModel.Id <= 0)
{ {
@ -940,16 +959,16 @@ namespace BBWY.Client.ViewModels.PackTask
return; return;
} }
if (productSku.Data.PackConfig!=null) if (productSku.Data.PackConfig != null)
{ {
var config = productSku.Data.PackConfig; var config = productSku.Data.PackConfig;
SkuTitle = config.SkuGoodsTitle; SkuTitle = config.SkuGoodsTitle;
GoodsNumber = config.GoodsNumber; GoodsNumber = config.GoodsNumber;
PackType = (PackType)config.PackType; PackType = (PackType)config.PackType;
BasicPack=(BasicPack)config.BasicPack; BasicPack = (BasicPack)config.BasicPack;
Availability =(TaskState)config.Availability; Availability = (TaskState)config.Availability;
MarkMessage = config.MarkMessage; MarkMessage = config.MarkMessage;
CertificatePosition = config.CertificatePosition==null? CertificatePosition .: (CertificatePosition)config.CertificatePosition.Value; CertificatePosition = config.CertificatePosition == null ? CertificatePosition. : (CertificatePosition)config.CertificatePosition.Value;
// Increment1 = config.Increment1; // Increment1 = config.Increment1;
string[] increateDatas = config.Increment1.Split(','); string[] increateDatas = config.Increment1.Split(',');
@ -961,7 +980,8 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
isSelected = true; isSelected = true;
} }
App.Current.Dispatcher.Invoke(() => { App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel IncreateList.Add(new IncreateModel
{ {
IncreateName = item, IncreateName = item,
@ -984,6 +1004,8 @@ namespace BBWY.Client.ViewModels.PackTask
} }
CertificateModel.Brand = Brand; CertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName; CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo; CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = SkuId; CertificateModel.SkuId = SkuId;
@ -995,8 +1017,10 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetBarCode = true; IsSetBarCode = true;
} }
BarCodeModel.Brand = Brand; BarCodeModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName; BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo; BarCodeModel.ProductNo = ProductNo;
BarCodeModel.SkuId = SkuId; BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName; BarCodeModel.SkuName = SkuName;
} }
@ -1035,6 +1059,7 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel = new CertificateModel(); SpuCertificateModel = new CertificateModel();
IsSetSpuCertificate = true; IsSetSpuCertificate = true;
SpuCertificateModel.Brand = Brand; SpuCertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName; SpuCertificateModel.BrandName = BrandName;
SpuCertificateModel.ProductNo = ProductNo; SpuCertificateModel.ProductNo = ProductNo;
SpuCertificateModel.SpuId = SpuId; SpuCertificateModel.SpuId = SpuId;

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

@ -17,7 +17,7 @@
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0" RightButtonGroupMargin="0,5,5,0"
Title="发布任务" Height="350" Width="1500"> Title="发布任务" Height="800" Width="1300">
<!-- DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" --> <!-- DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" -->
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -243,7 +243,7 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<Grid Grid.Row="1" Grid.Column="6" > <Grid Grid.Row="1" Grid.Column="6" >
<ComboBox VerticalContentAlignment="Center" Margin="5" Text="{Binding IsNeedCertificateModel}"> <ComboBox VerticalContentAlignment="Center" Margin="5" Text="{Binding IsNeedCertificateModel,Mode=TwoWay}">
<ComboBoxItem Content="需要" /> <ComboBoxItem Content="需要" />
<ComboBoxItem Content="不需要" IsSelected="True"/> <ComboBoxItem Content="不需要" IsSelected="True"/>
</ComboBox> </ComboBox>

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

@ -403,6 +403,7 @@
</c:BButton> </c:BButton>
</StackPanel> </StackPanel>
<Grid Visibility="{Binding PackState,Converter={StaticResource objConverter},ConverterParameter=待发布:Visible:Collapsed}">
<StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:Visible:Collapsed }" Orientation="Vertical" VerticalAlignment="Center"> <StackPanel Visibility="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:Visible:Collapsed }" Orientation="Vertical" VerticalAlignment="Center">
<c:BButton x:Name="createTask" Content="发布任务" Style="{StaticResource LinkButton}" <c:BButton x:Name="createTask" Content="发布任务" Style="{StaticResource LinkButton}"
Margin="5,0,0,10"> Margin="5,0,0,10">
@ -441,6 +442,8 @@
</b:Interaction.Triggers> </b:Interaction.Triggers>
</c:BButton> </c:BButton>
</StackPanel> </StackPanel>
</Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>

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

@ -25,27 +25,27 @@ namespace BBWY.Client.Views.PackTask
{ {
InitializeComponent(); InitializeComponent();
CertificateModel data = new CertificateModel //CertificateModel data = new CertificateModel
{ //{
Brand = certificate.Brand, // Brand = certificate.Brand,
BrandName = certificate.BrandName, // BrandName = certificate.BrandName,
ExcuteStander = certificate.ExcuteStander, // ExcuteStander = certificate.ExcuteStander,
FactoryNumber = certificate.FactoryNumber, // FactoryNumber = certificate.FactoryNumber,
IsLogo = certificate.IsLogo, // IsLogo = certificate.IsLogo,
LabelModel = certificate.LabelModel, // LabelModel = certificate.LabelModel,
ProductAdress = certificate.ProductAdress, // ProductAdress = certificate.ProductAdress,
Id = certificate.Id, // Id = certificate.Id,
ProductDate = certificate.ProductDate, // ProductDate = certificate.ProductDate,
ProductNo = certificate.ProductNo, // ProductNo = certificate.ProductNo,
ProductShop = certificate.ProductShop, // ProductShop = certificate.ProductShop,
Shader = certificate.Shader, // Shader = certificate.Shader,
SkuId = certificate.SkuId, // SkuId = certificate.SkuId,
Reseller = certificate.Reseller, // Reseller = certificate.Reseller,
ApplyAge = certificate.ApplyAge, // 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:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible" CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
@ -138,6 +137,6 @@
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> <Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <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> </Grid>
</c:BWindow> </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 BBWY.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -19,10 +21,60 @@ namespace BBWY.Client.Views.PackTask
/// </summary> /// </summary>
public partial class SetBarCodeWindow : BWindow public partial class SetBarCodeWindow : BWindow
{ {
public SetBarCodeWindow( ) public SetBarCodeWindow()
{ {
InitializeComponent(); 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:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible" CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
@ -36,10 +35,10 @@
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"> <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" <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}" /> Command="{Binding SetSpuCerCommand}" Click="SetSpuCer_Click" />
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="导入spu模板" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <c:BButton Name="InseartCer" Background="{StaticResource Button.Background}" Grid.Row="2" Content="导入spu模板" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding InseartCerCommand}" /> Command="{Binding InseartCerCommand}" Click="InseartCer_Click" />
</StackPanel> </StackPanel>
<!--<Grid Grid.Row="1"> <!--<Grid Grid.Row="1">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -129,10 +128,10 @@
</Border> </Border>
</Grid> </Grid>
</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> </Grid>
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> <Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <c:BButton x:Name="save_btn" Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveCerCommand}" /> Command="{Binding SaveCerCommand}" Click="save_btn_Click" />
</Grid> </Grid>
</c:BWindow> </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 BBWY.Controls;
using NPOI.Util;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Ocsp; using Org.BouncyCastle.Ocsp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -24,5 +28,106 @@ namespace BBWY.Client.Views.PackTask
{ {
InitializeComponent(); 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:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}"
CloseButtonVisibility="Visible" CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
@ -29,7 +28,7 @@
Background="{StaticResource Border.Background}"> Background="{StaticResource Border.Background}">
<TextBlock Text="设置SPU合格证模板" HorizontalAlignment="Center" VerticalAlignment="Center"/> <TextBlock Text="设置SPU合格证模板" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border> </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 Grid.Row="1">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -120,7 +119,7 @@
</Grid> </Grid>
</Grid>--> </Grid>-->
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> <Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" <c:BButton Name="save_spuCer" Background="{StaticResource Button.Background}" Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding SaveSpuCerCommand}" /> Click="save_spuCer_Click" />
</Grid> </Grid>
</c:BWindow> </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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -22,5 +26,55 @@ namespace BBWY.Client.Views.PackTask
{ {
InitializeComponent(); 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();
}
} }
} }

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

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

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

@ -403,7 +403,9 @@ namespace BBWY.Server.Business
.ExecuteAffrows(); .ExecuteAffrows();
} }
return new PayPurchaseOrderResponse() { Success= payOrderResponse.Success, return new PayPurchaseOrderResponse()
{
Success = payOrderResponse.Success,
Msg = payOrderResponse.Msg Msg = payOrderResponse.Msg
}; };
} }
@ -415,7 +417,7 @@ namespace BBWY.Server.Business
if (payOrderResponse.Success) if (payOrderResponse.Success)
{ {
var order =fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne(); var order = fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne();
fsql.Update<PurchaseOrderV2>(order) fsql.Update<PurchaseOrderV2>(order)
.Set(a => a.OrderState, Enums.PurchaseOrderState.) .Set(a => a.OrderState, Enums.PurchaseOrderState.)
.ExecuteAffrows(); .ExecuteAffrows();
@ -428,5 +430,15 @@ namespace BBWY.Server.Business
Msg = payOrderResponse.Msg Msg = payOrderResponse.Msg
}; };
} }
public UpdatePackStateResponse UpdatePackState(UpdatePackStateRequest request)
{
var order = fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne();
fsql.Update<PurchaseOrderV2>(order)
.Set(a => a.PackState, request.PackState)
.ExecuteAffrows();
return new UpdatePackStateResponse();
}
} }
} }

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

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

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

@ -0,0 +1,13 @@
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 ;}
}
}

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
{
}
}

6
BBWY.Server.Model/Enums.cs

@ -319,5 +319,11 @@
{ {
= 0, = 1, = 2, = 3, = 4, = 5, = 6, = 7 = 0, = 1, = 2, = 3, = 4, = 5, = 6, = 7
} }
public enum PackState
{
=0,=1,=2
}
} }
} }

Loading…
Cancel
Save