|
|
@ -7,6 +7,7 @@ using BBWY.Client.Views.PackTask; |
|
|
|
using BBWY.Common.Models; |
|
|
|
using BBWY.Common.Trigger; |
|
|
|
using GalaSoft.MvvmLight.Command; |
|
|
|
using GalaSoft.MvvmLight.Messaging; |
|
|
|
using NPOI.Util; |
|
|
|
using Org.BouncyCastle.Asn1.Crmf; |
|
|
|
using System; |
|
|
@ -14,14 +15,18 @@ using System.Collections.Generic; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Data; |
|
|
|
using System.Linq; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows.Controls; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Media.TextFormatting; |
|
|
|
using System.Windows.Navigation; |
|
|
|
|
|
|
|
namespace BBWY.Client.ViewModels.PackTask |
|
|
|
{ |
|
|
|
public class CreatePackTaskViewModel : BaseVM, IDenpendency |
|
|
|
public class CreatePackTaskViewModel : BaseVM |
|
|
|
{ |
|
|
|
private bool isLoading = false; |
|
|
|
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|
|
@ -341,11 +346,48 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void InitData() |
|
|
|
{ |
|
|
|
|
|
|
|
Logo = string.Empty; |
|
|
|
SearchSkuId = ""; |
|
|
|
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; |
|
|
|
string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; |
|
|
|
IncreateList = new ObservableCollection<IncreateModel>(); |
|
|
|
foreach (var item in increates) |
|
|
|
{ |
|
|
|
IncreateList.Add(new IncreateModel |
|
|
|
{ |
|
|
|
IncreateName = item, |
|
|
|
IsSelected = false |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public CreatePackTaskViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService) |
|
|
|
{ |
|
|
|
Messenger.Default.Register<bool>(this, "InitData", message => { |
|
|
|
|
|
|
|
InitData(); |
|
|
|
}); |
|
|
|
//RaisePropertyChanged(string.Empty);
|
|
|
|
//this.RaisePropertyChanged(nameof(CreatePackTaskViewModel));
|
|
|
|
|
|
|
|
this.productService = productService; |
|
|
|
this.packTaskService = packTaskService; |
|
|
|
|
|
|
|
|
|
|
|
AccepUserId = globalContext.User.Id.ToString(); |
|
|
|
|
|
|
|
IsSetBarCode = true; |
|
|
@ -367,7 +409,11 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
|
|
|
|
|
|
|
|
//查询sku
|
|
|
|
SearchSkuCommand = new RelayCommand(SearchSku); |
|
|
|
SearchSkuCommand = new RelayCommand(() => |
|
|
|
{ |
|
|
|
Task.Factory.StartNew(() => { SearchSku(); }); |
|
|
|
|
|
|
|
}); |
|
|
|
CreateTaskCommand = new RelayCommand<object>(CreateTask); |
|
|
|
this.globalContext = globalContext; |
|
|
|
SetBarCodeCommand = new RelayCommand(SetBarCode); |
|
|
@ -411,7 +457,7 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
if (!string.IsNullOrEmpty(key.Trim())) |
|
|
|
{ |
|
|
|
keyWordShopList = keyWordShopList.Where(s => s.IncreateName.Contains(key)).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
if (keyWordShopList.Count() > 0) |
|
|
|
{ |
|
|
@ -603,22 +649,22 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
/// <summary>
|
|
|
|
/// 发布任务
|
|
|
|
/// </summary>
|
|
|
|
public void CreateTask( object obj) |
|
|
|
public void CreateTask(object obj) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty( SkuId)) |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(SkuId)) |
|
|
|
{ |
|
|
|
new TipsWindow("请先搜索SkuId!").ShowDialog(); |
|
|
|
return; |
|
|
|
} |
|
|
|
string increateStr = ""; |
|
|
|
var increates =IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName); |
|
|
|
if (increates!=null&& increates.Count()>0) |
|
|
|
var increates = 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 |
|
|
|
{ |
|
|
@ -642,7 +688,7 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
}; |
|
|
|
if (IsNeedBarCode == "需要") |
|
|
|
{ |
|
|
|
if (BarCodeModel==null|| BarCodeModel.Id <= 0) |
|
|
|
if (BarCodeModel == null || BarCodeModel.Id <= 0) |
|
|
|
{ |
|
|
|
new TipsWindow("请设置条形码模板").ShowDialog(); |
|
|
|
return; |
|
|
@ -651,7 +697,7 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
} |
|
|
|
if (IsNeedCertificateModel == "需要") |
|
|
|
{ |
|
|
|
if (CertificateModel==null|| CertificateModel.Id <= 0) |
|
|
|
if (CertificateModel == null || CertificateModel.Id <= 0) |
|
|
|
{ |
|
|
|
new TipsWindow("请设置合格证模板").ShowDialog(); |
|
|
|
return; |
|
|
@ -679,6 +725,11 @@ namespace BBWY.Client.ViewModels.PackTask |
|
|
|
/// </summary>
|
|
|
|
public void SearchSku() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IsLoading = true; |
|
|
|
SkuId = searchSkuId; |
|
|
|
ApiResponse<ProductListResponse> productApiResponse = null; |
|
|
|