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. 125
      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. 54
      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. 14
      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);
}
/// <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://bbwytest.qiyue666.com",
"BBWYApiHost": "http://localhost:5000",
//"BBWYApiHost": "http://bbwytest.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com",
"JOSApiHost": "",
"1688ApiHost": "",
//"QKApiHost": "http://localhost:8080"
"QKApiHost": "http://qiku.qiyue666.com"
"QKApiHost": "http://localhost:8080"
// "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 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>
public PurchaseOrderMode PurchaseOrderMode { get; set; }
/// <summary>
/// 打包状态(待发布 = 0, 打包中 = 1, 已完成 = 2)
/// </summary>
public PackState PackState { 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.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;
@ -8,6 +11,8 @@ 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
{
@ -129,7 +134,8 @@ namespace BBWY.Client.Models
/// </summary>
public bool IsSetBarCode
{
get => isSetBarCode; set
get => isSetBarCode;
set
{
Set(ref isSetBarCode, value);
@ -228,8 +234,106 @@ namespace BBWY.Client.Models
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>
@ -318,6 +422,7 @@ namespace BBWY.Client.Models
}
CertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = skuid;
@ -329,6 +434,7 @@ namespace BBWY.Client.Models
IsSetBarCode = true;
}
BarCodeModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo;
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()
{

4
BBWY.Client/Models/Enums.cs

@ -390,4 +390,8 @@
=0,
=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.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;
namespace BBWY.Client.ViewModels
{
@ -23,19 +27,84 @@ namespace BBWY.Client.ViewModels
public ICommand CreateTaskCommand { get; set; }
public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService)
public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService, GlobalContext globalContext)
{
BatchPublishTasks = new ObservableCollection<BatchPublishTask>();
this.packTaskService = packTaskService;
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;
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)
{
model = new BatchPublishTask();
//model.InitData();
model.productService = productService;
model.packTaskService = packTaskService;
model.SkuId = item.SkuId;

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

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

125
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;
@ -427,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(',');
@ -441,7 +441,8 @@ namespace BBWY.Client.ViewModels.PackTask
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() => {
App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
@ -545,6 +546,7 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel.Brand = Brand;
SpuCertificateModel.SkuId = SkuId;
}
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName;
setSpuCerWindow = new SetSpuCerWindow();
setSpuCerWindow.Show();
@ -678,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>
@ -738,18 +716,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)
@ -759,15 +739,54 @@ namespace BBWY.Client.ViewModels.PackTask
BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
if (!string.IsNullOrEmpty(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();
}
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()
{
@ -785,12 +804,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)
@ -800,7 +819,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
BarCodeModel.Id = resData.Data;
IsNeedBarCode = "需要";
IsNeedBarCode = Need.;
IsSetBarCode = false;
setBarCodeWindow.Close();
}
@ -846,7 +865,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,
@ -855,7 +874,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)
{
@ -864,7 +883,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
createTaskModel.BarCodeId = BarCodeModel.Id;
}
if (IsNeedCertificateModel == "需要")
if (IsNeedCertificateModel == Need.)
{
if (CertificateModel == null || CertificateModel.Id <= 0)
{
@ -961,7 +980,8 @@ namespace BBWY.Client.ViewModels.PackTask
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() => {
App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
@ -984,6 +1004,8 @@ namespace BBWY.Client.ViewModels.PackTask
}
CertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
CertificateModel.BrandName = BrandName;
CertificateModel.ProductNo = ProductNo;
CertificateModel.SkuId = SkuId;
@ -995,8 +1017,10 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetBarCode = true;
}
BarCodeModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
@ -1035,6 +1059,7 @@ namespace BBWY.Client.ViewModels.PackTask
SpuCertificateModel = new CertificateModel();
IsSetSpuCertificate = true;
SpuCertificateModel.Brand = Brand;
if (!string.IsNullOrEmpty(BrandName))
SpuCertificateModel.BrandName = BrandName;
SpuCertificateModel.ProductNo = ProductNo;
SpuCertificateModel.SpuId = SpuId;

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

@ -17,7 +17,7 @@
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"
Title="发布任务" Height="350" Width="1500">
Title="发布任务" Height="800" Width="1300">
<!-- DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" -->
<Window.Resources>
<ResourceDictionary>
@ -243,7 +243,7 @@
</ComboBox>
</Grid>
<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="不需要" IsSelected="True"/>
</ComboBox>

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

@ -403,6 +403,7 @@
</c:BButton>
</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">
<c:BButton x:Name="createTask" Content="发布任务" Style="{StaticResource LinkButton}"
Margin="5,0,0,10">
@ -441,6 +442,8 @@
</b:Interaction.Triggers>
</c:BButton>
</StackPanel>
</Grid>
</StackPanel>
</Grid>

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>

54
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;
@ -24,5 +26,55 @@ namespace BBWY.Client.Views.PackTask
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();
}
}
}

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

@ -59,16 +59,36 @@ 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 UpdatePackState([FromBody] UpdatePackStateRequest request)
{
return batchPurchaseBusiness.UpdatePackState(request);
}
}
}

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

@ -403,7 +403,9 @@ namespace BBWY.Server.Business
.ExecuteAffrows();
}
return new PayPurchaseOrderResponse() { Success= payOrderResponse.Success,
return new PayPurchaseOrderResponse()
{
Success = payOrderResponse.Success,
Msg = payOrderResponse.Msg
};
}
@ -428,5 +430,15 @@ namespace BBWY.Server.Business
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>
[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; }
}
}

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
}
public enum PackState
{
=0,=1,=2
}
}
}

Loading…
Cancel
Save