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.
92 lines
2.9 KiB
92 lines
2.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Text;
|
|
using System.Linq;
|
|
|
|
namespace BBWY.Client.Models
|
|
{
|
|
/// <summary>
|
|
/// 采购商品
|
|
/// </summary>
|
|
public class PurchaseSchemeProduct : NotifyObject
|
|
{
|
|
|
|
private string purchaseUrl;
|
|
private string purchaseProductId;
|
|
private bool isEditing;
|
|
private string searchPurchaseSkuName;
|
|
|
|
public long SkuPurchaseSchemeId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 采购商品和采购方案的关系Id
|
|
/// </summary>
|
|
public long Id { get; set; }
|
|
|
|
public string ProductId { get; set; }
|
|
|
|
public string SkuId { get; set; }
|
|
|
|
public string PurchaseUrl { get => purchaseUrl; set { Set(ref purchaseUrl, value); } }
|
|
public string PurchaseProductId { get => purchaseProductId; set => purchaseProductId = value; }
|
|
|
|
public bool IsEditing
|
|
{
|
|
get => isEditing;
|
|
set
|
|
{
|
|
SearchPurchaseSkuName = string.Empty;
|
|
Set(ref isEditing, value);
|
|
}
|
|
}
|
|
|
|
public IList<PurchaseSchemeProductSku> SkuList { get; set; }
|
|
|
|
public IList<PurchaseSchemeProductSku> SearchSkuList { get; set; }
|
|
|
|
public IList<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; }
|
|
|
|
public List<string> SelectedSkuIdList { get; set; }
|
|
|
|
public int PurchaseSkuCount
|
|
{
|
|
get { return SelectedSkuIdList.Count(); }
|
|
}
|
|
|
|
public string SearchPurchaseSkuName
|
|
{
|
|
get => searchPurchaseSkuName;
|
|
set { Set(ref searchPurchaseSkuName, value); }
|
|
}
|
|
|
|
public PurchaseSchemeProduct()
|
|
{
|
|
SkuList = new ObservableCollection<PurchaseSchemeProductSku>();
|
|
SearchSkuList = new ObservableCollection<PurchaseSchemeProductSku>();
|
|
PurchaseSchemeProductSkuList = new ObservableCollection<PurchaseSchemeProductSku>();
|
|
SelectedSkuIdList = new List<string>();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="apiModel"></param>
|
|
/// <param name="convertSelectedSku">是否转换方案中已选的sku</param>
|
|
/// <returns></returns>
|
|
public static PurchaseSchemeProduct Convert(PurchaseSchemeProductResponse apiModel)
|
|
{
|
|
var model = new PurchaseSchemeProduct()
|
|
{
|
|
Id = apiModel.Id,
|
|
ProductId = apiModel.ProductId,
|
|
SkuId = apiModel.SkuId,
|
|
PurchaseProductId = apiModel.PurchaseProductId,
|
|
PurchaseUrl = apiModel.PurchaseUrl,
|
|
SkuPurchaseSchemeId = apiModel.SkuPurchaseSchemeId
|
|
};
|
|
model.SelectedSkuIdList.AddRange(apiModel.PurchaseSchemeProductSkuList.Select(s => s.PurchaseSkuId));
|
|
return model;
|
|
}
|
|
}
|
|
}
|
|
|