步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

920 lines
32 KiB

2 years ago
using BBWY.Client.APIServices;
using BBWY.Client.Models.PackTask;
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.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;
using BBWY.Client.Models.QualityTask;
using BBWY.Client.Views.QualityTask;
2 years ago
using BBWY.Client.Models.APIModel.Response.PackPurchaseTask;
using NPOI.Util.ArrayExtensions;
2 years ago
using System.Threading.Tasks;
using Org.BouncyCastle.Asn1.Crmf;
using System.Runtime.InteropServices.WindowsRuntime;
using NPOI.Util;
using BBWY.Controls;
using WebSocketSharp;
2 years ago
namespace BBWY.Client.ViewModels
{
2 years ago
public class QualityViewModel : BaseVM
2 years ago
{
#region 属性
2 years ago
public int goodProductQuantity;
public int arrivalQuantity;
/// <summary>
/// 到货数量
/// </summary>
public int ArrivalQuantity { get => arrivalQuantity; set { Set(ref arrivalQuantity, value); } }
/// <summary>
/// 良品数量
/// </summary>
public int GoodProductQuantity { get => goodProductQuantity; set { Set(ref goodProductQuantity, value); } }
/// <summary>
/// 预计完成时间
/// </summary>
public DateTime? PreCompeteTime { get; set; }
2 years ago
private ObservableCollection<PurchaseSku> purchaseSkuList;
public ObservableCollection<PurchaseSku> PurchaseSkuList { get => purchaseSkuList; set { Set(ref purchaseSkuList, value); } }
private string searchSkuId;
public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } }
// public long TaskId { get; set; }
//private bool isSelected;
//public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } }
private ObservableCollection<string> worryList = new ObservableCollection<string> {
"否","是"
};
public ObservableCollection<string> WorryList { get => worryList; set { Set(ref worryList, value); } }
private ObservableCollection<string> positionTypeList = new ObservableCollection<string> {
2 years ago
"商家仓","云仓", "京仓","聚水潭齐越仓"};
2 years ago
public ObservableCollection<string> PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } }
private ObservableCollection<string> packTypeList = new ObservableCollection<string> {
"单件","多件"
};
public ObservableCollection<string> PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } }
private ObservableCollection<string> basicPackList = new ObservableCollection<string> {
"快递袋","纸箱","麻袋"
};
public ObservableCollection<string> BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } }
private ObservableCollection<string> isNeedBarCodeList = new ObservableCollection<string> {
"需要", "不需要" };
public ObservableCollection<string> IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } }
private ObservableCollection<string> isNeedCerList = new ObservableCollection<string> {
"需要", "不需要" };
public ObservableCollection<string> IsNeedCerList { get => isNeedCerList; set { Set(ref isNeedCerList, value); } }
private ObservableCollection<string> certificatePositionList = new ObservableCollection<string> {
"无","外部包装","产品包装"
};
public ObservableCollection<string> CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } }
private ObservableCollection<string> availabilityList = new ObservableCollection<string> {
"已到货","部分到货","未到货"
};
public ObservableCollection<string> AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } }
2 years ago
2 years ago
private int floorDragNumber;
public int FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } }
private ObservableCollection<int> floorDragNumberList = new ObservableCollection<int>
{
};
public ObservableCollection<int> FloorDragNumberList { get => floorDragNumberList; set { Set(ref floorDragNumberList, value); } }
2 years ago
private ObservableCollection<string> preCompeteTimeDayList = new ObservableCollection<string>
{
};
2 years ago
public ObservableCollection<string> PreCompeteTimeDayList { get => preCompeteTimeDayList; set { Set(ref preCompeteTimeDayList, value); } }
2 years ago
private ObservableCollection<string> preCompeteTimeHourList = new ObservableCollection<string> {
2 years ago
"12点前","18点前","22点前"
2 years ago
};
2 years ago
public ObservableCollection<string> PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } }
2 years ago
//
public string preCompeteTimeDay;
public string PreCompeteTimeDay { get => preCompeteTimeDay; set { Set(ref preCompeteTimeDay, value); } }
2 years ago
public string preCompeteTimeHour;
public string PreCompeteTimeHour { get => preCompeteTimeHour; set { Set(ref preCompeteTimeHour, value); } }
2 years ago
private ObservableCollection<WareHourseDTO> wareHourseList = new ObservableCollection<WareHourseDTO> { };
public ObservableCollection<WareHourseDTO> WareHourseList { get => wareHourseList; set { Set(ref wareHourseList, value); } }
2 years ago
private int wareHourseCount;
public int WareHourseCount { get => wareHourseCount; set { Set(ref wareHourseCount, value); } }
2 years ago
2 years ago
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); } }
2 years ago
public string orderId;
public string OrderId { get => orderId; set { Set(ref orderId, value); } }
2 years ago
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); } }
2 years ago
private Availability availability;
2 years ago
/// <summary>
/// 到货情况(待收货=0,部分收货=1,已到货=2)
/// </summary>
2 years ago
public Availability Availability { get => availability; set { Set(ref availability, value); } }
2 years ago
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>
2 years ago
/// 落仓(商家仓=0,云仓=1,京仓=2,聚水潭齐越仓=3)
2 years ago
/// </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); } }
string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" };
PackPurchaseTaskService packPurchaseTaskService;
2 years ago
PackTaskService packTaskService;
2 years ago
ProductService productService;
GlobalContext globalContext;
private bool isLoading = false;
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
2 years ago
PurchaseService purchaseService;
public string OriginShopName { get; set; }
public string SkuPurchaseSchemeId { get; set; }
public Platform Platform { get; set; }
public string ShopId { get; set; }
public long TaskId { get; set; }
public string UserName { get; set; }
public ICommand SetBarCodeCommand { get; set; }
public ICommand SetCertificateCommand { get; set; }
public ICommand LookBarCommand { get; set; }
public ICommand LookCerCommand { get; set; }
public ICommand OpenSkuDetailCommand { get; set; }
public ICommand CompeteQualityTaskCommand { get; set; }
public ICommand SearchSkuCommand { get; set; }
2 years ago
#endregion
2 years ago
public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService)
2 years ago
{
this.packPurchaseTaskService = packPurchaseTaskService;
this.productService = productService;
this.globalContext = globalContext;
2 years ago
2 years ago
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
SetBarCodeCommand = new RelayCommand(SetBarCode);
SetCertificateCommand = new RelayCommand<PurchaseSku>(SetCertificate);
LookBarCommand = new RelayCommand(LookBar);
2 years ago
LookCerCommand = new RelayCommand<CertificateModel>(LookCer);
2 years ago
CompeteQualityTaskCommand = new RelayCommand<object>(CompeteQualityTask);
2 years ago
IncreateList = new ObservableCollection<IncreateModel>();
foreach (var item in increates)
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = false
});
}
this.purchaseService = purchaseService;
2 years ago
this.packTaskService = packTaskService;
2 years ago
}
2 years ago
2 years ago
#region 方法
2 years ago
private void CompeteQualityTask(object obj)
{
2 years ago
if (FloorDragNumber <= 0)
{
MessageBox.Show($"请选择摆放地拖编号");
return;
}
2 years ago
if (GoodProductQuantity > ArrivalQuantity)
{
MessageBox.Show($"良品数量:{GoodProductQuantity}不能大于到货数量:{ArrivalQuantity}");
return;
}
if (ArrivalQuantity == 0)
{
MessageBox.Show($"到货数量不能:{ArrivalQuantity}!");
return;
}
var request = new Models.APIModel.Request.QualityTaskRequest
{
BasicPack = BasicPack,
ArrivalQuantity = ArrivalQuantity,
GoodProductQuantity = GoodProductQuantity,
Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)),
BrandName = BrandName,
CertificatePosition = CertificatePosition,
MarkMessage = MarkMessage,
OrderId = OrderId,
PackType = PackType,
GoodsNumber = GoodsNumber,
SkuGoodsTitle = SkuTitle,
SkuId = SkuId,
IsNeedBar = IsNeedBarCode == Need.,
IsNeedCer = IsNeedCertificateModel == Need.,
2 years ago
TaskId = TaskId,
FloorDragNumber = FloorDragNumber
2 years ago
};
if (IsNeedBarCode == Need.)
{
if (BarCodeModel == null || BarCodeModel.Id <= 0)
2 years ago
{
MessageBox.Show("条形码不能为空");
return;
}
request.BarcodeId = BarCodeModel.Id;
}
if(PurchaseSkuList != null && PurchaseSkuList.Count > 0&&purchaseSkuList.Any(p=> p.IsNeedCer)) //(IsNeedCertificateModel == Need.需要)
2 years ago
{
//if ()
//{
// MessageBox.Show("无可用的合格证打印!");
// return;
//}
2 years ago
if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0)
{
MessageBox.Show("存在未确认的合格证,请先完成确认!");
return;
}
2 years ago
if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null))
{
MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存");
return;
}
2 years ago
if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0)
{
MessageBox.Show("无可选的合格证打印!");
return;
}
request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id));
}
int hour = Convert.ToInt32(PreCompeteTimeHour.Replace("点前", ""));
2 years ago
2 years ago
DateTime date = DateTime.Now;
switch (preCompeteTimeDay)
{
case "今天":
date = DateTime.Now;
break;
case "明天":
date = DateTime.Now.AddDays(1);
break;
case "后天":
date = DateTime.Now.AddDays(2);
break;
default:
break;
}
//date = Convert.ToDateTime(PreCompeteTimeDay);
var competeTime = date.Date.AddHours(hour);
if (competeTime < DateTime.Now)
2 years ago
{
MessageBox.Show($"预计完成时间不能小于当前时间,请重新选择预计完成时间");
return;
}
var now = DateTime.Now;
if (now.Hour < 12)
{
if (competeTime > now.AddDays(1).Date.AddHours(12))
2 years ago
{
MessageBox.Show($"预计完成时间不能超过明天12点,请重新选择预计完成时间");
return;
}
}
else if (now.Hour < 18)
{
if (competeTime > now.AddDays(1).Date.AddHours(18))
{
MessageBox.Show($"预计完成时间不能超过明天18点,请重新选择预计完成时间");
return;
}
}
else if (now.Hour < 22)
{
if (competeTime > now.AddDays(1).Date.AddHours(22))
{
MessageBox.Show($"预计完成时间不能超过明天22点,请重新选择预计完成时间");
return;
}
}
else
{
if (competeTime > now.AddDays(2).Date.AddHours(12))
{
MessageBox.Show($"预计完成时间不能超过后天12点,请重新选择预计完成时间");
return;
}
}
request.PreCompeteTime = competeTime;
2 years ago
try
{
var competeRes = packPurchaseTaskService.CompeteQualityTask(request);
if (competeRes == null)
{
MessageBox.Show("网络异常");
return;
}
if (!competeRes.Success)
{
MessageBox.Show(competeRes.Msg);
return;
}
BatchPrintWindow batchPrint = new BatchPrintWindow();
batchPrint.SetData(GoodProductQuantity,
PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray()
, BarCodeModel);
batchPrint.ShowDialog();
if (ReflashWindow != null) ReflashWindow();
var window = obj as BWindow;
App.Current.Dispatcher.Invoke(new Action(() =>
{
2 years ago
window.Close();
}));
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.Message);
}
2 years ago
2 years ago
}
2 years ago
private void SetBarCode()
{
if (string.IsNullOrEmpty(SkuId))
{
return;
}
if (BarCodeModel == null)
{
2 years ago
var resCode = packPurchaseTaskService.SearchBarCode(SkuId);
if (resCode == null)
2 years ago
{
BarCodeModel = new BarCodeModel();
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
else
{
BarCodeModel = resCode.Data;
}
2 years ago
2 years ago
}
if (!string.IsNullOrEmpty(BrandName))
BarCodeModel.BrandName = BrandName;
SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow();
2 years ago
setBarCodeWindow.LoadData(BarCodeModel, packTaskService);
2 years ago
setBarCodeWindow.SaveResult = b =>
{
BarCodeModel = b;
IsSetBarCode = false;
IsNeedBarCode = Need.;
};
setBarCodeWindow.Show();
}
/// <summary>
/// 设置合格证
/// </summary>
private void SetCertificate(PurchaseSku model)
{
if (model.CerDTO == null)
{
model.CerDTO = new CertificateModel
{
ProductNo = ProductNo,
Brand = Brand,
SkuId = SkuId,
PurchaseSkuId = model.PurchaseSkuId
};
}
if (!string.IsNullOrEmpty(BrandName))
model.CerDTO.BrandName = BrandName;
QualitySetCerWindow setCerWindow = new QualitySetCerWindow();
setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate, saveType);
2 years ago
setCerWindow.SaveResult = (s, PackCerState) =>
{
2 years ago
if (string.IsNullOrEmpty(s.PurchaseSkuId))
{
var sku = PurchaseSkuList.SingleOrDefault(p => p.CerDTO.GoodsNumber == s.GoodsNumber);
sku.CerDTO = s;
sku.IsSetCertificate = false;
sku.IsNeedCer = PackCerState == PackCerState.;
IsNeedCertificateModel = Need.;
return;
}
var skus = PurchaseSkuList.SingleOrDefault(p =>p.CerDTO!=null&& p.CerDTO.PurchaseSkuId == s.PurchaseSkuId);
2 years ago
skus.CerDTO = s;
skus.IsSetCertificate = false;
skus.IsNeedCer = PackCerState == PackCerState.;
IsNeedCertificateModel = Need.;
};
setCerWindow.Show();
}
/// <summary>
/// 查看合格证
/// </summary>
2 years ago
private void LookCer(CertificateModel certificate)
2 years ago
{
2 years ago
QualityLookCerWindow lookCerWindow = new QualityLookCerWindow(certificate);
2 years ago
lookCerWindow.Show();
}
/// <summary>
/// 查看条形码
/// </summary>
private void LookBar()
{
LookBarCodeWindow look = new LookBarCodeWindow();
look.SetData(BarCodeModel);
look.Show();
}
SaveType? saveType;
2 years ago
/// <summary>
/// 搜索 skuId(todo:)
/// </summary>
2 years ago
public void SearchSku(PackTaskModel model)
2 years ago
{
2 years ago
2 years ago
InitData();
2 years ago
TaskId = model.TaskId;
2 years ago
OrderId = model.OrderId;
2 years ago
SkuId = model.SkuId;
SkuName = model.ItemList[0].SkuName;
2 years ago
Logo = model.ItemList[0].Logo.Replace("80x80", "200x200");
2 years ago
BrandName = model.ItemList[0].BrandName;
SkuCount = model.SkuCount;
2 years ago
brand = model.Brand;
2 years ago
ProductNo = model.ProductNo;
MarkMessage = model.MarkMessage;
PackType = model.PackType;
GoodsNumber = model.GoodsNumber;
SkuTitle = model.SkuTitle;
BasicPack = model.BasicPack;
2 years ago
CertificatePosition = model.CertificatePosition;
2 years ago
2 years ago
ArrivalQuantity = 0;
GoodProductQuantity = 0;
2 years ago
IncreateList = new ObservableCollection<IncreateModel>();
2 years ago
string[] increateDatas = model.Increment1?.Split(',');
bool isSelected = false;
2 years ago
2 years ago
foreach (var item in increates)
{
isSelected = false;
if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item))
{
isSelected = true;
}
App.Current.Dispatcher.Invoke(() =>
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = isSelected
});
});
}
var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId);
if (packTaskRes==null)
{
MessageBox.Show("网络异常!");
return;
}
if (!packTaskRes.Success || packTaskRes.Data==null)
{
MessageBox.Show(packTaskRes.Msg);
return;
}
SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId;
saveType = packTaskRes.Data.SaveType;
if (saveType == null)
{
saveType = OrderId.IsNullOrEmpty() ? SaveType.C端 : SaveType.B端;
}
2 years ago
if (packTaskRes == null || !packTaskRes.Success) return;
BarCodeModel = packTaskRes.Data.BarCodeDTO;
IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need. : Need.;
IsSetBarCode = packTaskRes.Data.BarCodeDTO == null ? true : false;
2 years ago
IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need. : Need.;
if (packTaskRes.Data.WareHourses != null)
packTaskRes.Data.WareHourses.ToList().ForEach(w =>
{
WareHourseList.Add(w);
});
2 years ago
WareHourseCount = WareHourseList.Count();
2 years ago
if (packTaskRes.Data.PurchaseSkus != null)
{
2 years ago
2 years ago
int goodsIndex = 0;
2 years ago
foreach (var item in packTaskRes.Data.PurchaseSkus)
{
2 years ago
goodsIndex++;
if (item.CerDTO != null) item.CerDTO.GoodsNumberIndex = goodsIndex;
2 years ago
item.IsSetCertificate = true;
2 years ago
if (string.IsNullOrEmpty(item.PurchaseProductId))
{
2 years ago
PurchaseSkuList.Add(item); continue;
2 years ago
}
var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId);
2 years ago
if (list == null && !list.Success)
2 years ago
{
PurchaseSkuList.Add(item); continue;
}
2 years ago
PurchaseSkuItemBasicInfoResponse skuItem = null;
if (list.Data != null) skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId);
2 years ago
App.Current.Dispatcher.Invoke(new Action(() =>
{
PurchaseSkuList.Add(new PurchaseSku
2 years ago
{
2 years ago
Logo = skuItem?.Logo,
Title = skuItem?.Title,
2 years ago
IsNeedCer = item.IsNeedCer,
PurchaseSkuId = item.PurchaseSkuId,
CerDTO = item.CerDTO,
2 years ago
IsSetCertificate = item.IsNeedCer,
2 years ago
});
}));
//PurchaseSkuList.Add(item);
2 years ago
}
}
2 years ago
2 years ago
2 years ago
}
public Action ReflashWindow { get; set; }
public void InitData()
{
2 years ago
FloorDragNumber = 0;
2 years ago
PurchaseSkuList = new ObservableCollection<PurchaseSku>();
WareHourseList = new ObservableCollection<WareHourseDTO>();
2 years ago
PreCompeteTimeDayList = new ObservableCollection<string>();
2 years ago
FloorDragNumberList = new ObservableCollection<int>();
2 years ago
2 years ago
for (int i = 0; i < 30; i++)
2 years ago
{
2 years ago
App.Current.Dispatcher.Invoke((Action)(() =>
{
FloorDragNumberList.Add(i + 1);
}));
2 years ago
}
2 years ago
var nowTime = DateTime.Now;
var hour = nowTime.Hour;
if (hour < 12)
2 years ago
{
PreCompeteTimeDayList.Add("今天");
PreCompeteTimeDayList.Add("明天");
PreCompeteTimeDay = "今天";
PreCompeteTimeHour = "12点前";
}
else if (hour < 18)
2 years ago
{
PreCompeteTimeDayList.Add("今天");
PreCompeteTimeDayList.Add("明天");
PreCompeteTimeDay = "今天";
PreCompeteTimeHour = "18点前";
}
else if (hour < 22)
{
PreCompeteTimeDayList.Add("今天");
PreCompeteTimeDayList.Add("明天");
2 years ago
PreCompeteTimeDay = "今天";
2 years ago
PreCompeteTimeHour = "22点前";
}
else
{
PreCompeteTimeDayList.Add("今天");
PreCompeteTimeDayList.Add("明天");
PreCompeteTimeDayList.Add("后天");
PreCompeteTimeDay = "明天";
PreCompeteTimeHour = "12点前";
}
2 years ago
2 years ago
IsSetBarCode = true;
SkuTitle = "";
BrandName = "";
GoodsNumber = 0;
PackType = PackType.;
BasicPack = BasicPack.;
CertificatePosition = CertificatePosition.;
IsNeedBarCode = Need.;
IsNeedCertificateModel = Need.;
}
2 years ago
2 years ago
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调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
}
}
2 years ago
2 years ago
#endregion
}
}