shanji 2 years ago
parent
commit
36aed1b6dc
  1. 26
      BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
  2. 8
      BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml

26
BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs

@ -66,6 +66,10 @@ namespace BBWY.Client.ViewModels
public ICommand EditQuantityRatioCommand { get; set; }
public ICommand AddQuantityCommand { get; set; }
public ICommand SubtractQuantityCommand { get; set; }
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService, PurchaseService purchaseService, GlobalContext globalContext)
{
this.globalContext = globalContext;
@ -78,6 +82,8 @@ namespace BBWY.Client.ViewModels
AddProductSkuCommand = new RelayCommand(AddProductSku);
DeleteProductSkuWithSchemeCommand = new RelayCommand<ProductSkuWithScheme>(DeleteProductSkuWithScheme);
EditQuantityRatioCommand = new RelayCommand<object>(EditQuantityRatio);
AddQuantityCommand = new RelayCommand<PurchaseSchemeProductSku>(AddQuantity);
SubtractQuantityCommand = new RelayCommand<PurchaseSchemeProductSku>(SubtractQuantity);
this.delayTrigger = new DelayTrigger();
this.delayTrigger.OnExecute = OnDelayTriggerExecute;
}
@ -102,6 +108,15 @@ namespace BBWY.Client.ViewModels
return;
}
if (ProductSkuWithSchemeList.Count() == 0)
{
ProductAmount = 0;
FreightAmount = 0;
TotalAmount = 0;
IsLoading = false;
return;
}
IsLoading = true;
//IsLoading = true;
//Task.Factory.StartNew(() => purchaseOrderService.PreviewPurchaseOrder(new Consignee()
@ -309,5 +324,16 @@ namespace BBWY.Client.ViewModels
purchaseSchemeProductSku.ItemTotal = quantityRatio * skuQuantity;
}
}
private void AddQuantity(PurchaseSchemeProductSku purchaseSchemeProductSku)
{
purchaseSchemeProductSku.ItemTotal++;
}
private void SubtractQuantity(PurchaseSchemeProductSku purchaseSchemeProductSku)
{
if (purchaseSchemeProductSku.ItemTotal > 1)
purchaseSchemeProductSku.ItemTotal--;
}
}
}

8
BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml

@ -46,7 +46,7 @@
UseLayoutRounding="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="380"/>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="90"/>
@ -92,7 +92,7 @@
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=listbox_ProductSkuWithSchemeList}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="380"/>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
@ -229,7 +229,7 @@
BorderThickness="1"
Width="15"
Height="18"
Command="{Binding DataContext.SubtractQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}}}"
Command="{Binding DataContext.SubtractQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"
CommandParameter="{Binding }"/>
<c:BTextBox Text="{Binding ItemTotal}" Margin="5,0" VerticalAlignment="Center"
Width="40"
@ -239,7 +239,7 @@
BorderThickness="1"
Width="15"
Height="18"
Command="{Binding DataContext.AddQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}}}"
Command="{Binding DataContext.AddQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"
CommandParameter="{Binding }"/>
</StackPanel>

Loading…
Cancel
Save