|
@ -36,20 +36,7 @@ namespace BBWY.Client.ViewModels |
|
|
protected override void Load() |
|
|
protected override void Load() |
|
|
{ |
|
|
{ |
|
|
PurchaseSchemeList.Clear(); |
|
|
PurchaseSchemeList.Clear(); |
|
|
Task.Factory.StartNew(() => purchaseService.GetPurchaseSchemeList(new string[] { SkuId }, globalContext.User.Shop.ShopId)).ContinueWith(t => |
|
|
Task.Factory.StartNew(() => LoadPurchaseScheme(SkuId)); |
|
|
{ |
|
|
|
|
|
var r = t.Result; |
|
|
|
|
|
if (!r.Success) |
|
|
|
|
|
{ |
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "获取采购方案")); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var apiModel in r.Data) PurchaseSchemeList.Add(PurchaseScheme.Convert(apiModel)); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void Unload() |
|
|
protected override void Unload() |
|
@ -64,6 +51,21 @@ namespace BBWY.Client.ViewModels |
|
|
this.SkuName = skuName; |
|
|
this.SkuName = skuName; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void LoadPurchaseScheme(string skuId) |
|
|
|
|
|
{ |
|
|
|
|
|
var purchaseSchemeResponse = purchaseService.GetPurchaseSchemeList(new string[] { SkuId }, globalContext.User.Shop.ShopId); |
|
|
|
|
|
if (!purchaseSchemeResponse.Success) |
|
|
|
|
|
{ |
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(purchaseSchemeResponse.Msg, "获取采购方案")); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var apiModel in purchaseSchemeResponse.Data) PurchaseSchemeList.Add(PurchaseScheme.Convert(apiModel)); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void Delete(PurchaseScheme purchaseScheme) |
|
|
public void Delete(PurchaseScheme purchaseScheme) |
|
|
{ |
|
|
{ |
|
|
Task.Factory.StartNew(() => purchaseService.DeletePurchaseScheme(purchaseScheme.Id)).ContinueWith(r => |
|
|
Task.Factory.StartNew(() => purchaseService.DeletePurchaseScheme(purchaseScheme.Id)).ContinueWith(r => |
|
@ -85,6 +87,8 @@ namespace BBWY.Client.ViewModels |
|
|
bindingPurchaseProduct.SetData(skuList, purchaseScheme.PurchaserId, purchaseScheme.PurchaserName); |
|
|
bindingPurchaseProduct.SetData(skuList, purchaseScheme.PurchaserId, purchaseScheme.PurchaserName); |
|
|
var bindingView = new Views.Ware.BindingPurchaseProduct(); |
|
|
var bindingView = new Views.Ware.BindingPurchaseProduct(); |
|
|
var r = bindingView.ShowDialog(); |
|
|
var r = bindingView.ShowDialog(); |
|
|
|
|
|
if (r == true) |
|
|
|
|
|
Task.Factory.StartNew(() => LoadPurchaseScheme(SkuId)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|