Browse Source

订单同步

qianyi
shanji 3 years ago
parent
commit
d46ac09c4d
  1. 5
      BBWY.Client/APIServices/OrderService.cs
  2. 17
      BBWY.Client/ViewModels/Order/OrderListViewModel.cs
  3. 10
      BBWY.Client/Views/Order/OrderList.xaml

5
BBWY.Client/APIServices/OrderService.cs

@ -162,5 +162,10 @@ namespace BBWY.Client.APIServices
AppToken = globalContext.User.Shop.AppToken
}, null, HttpMethod.Post);
}
public ApiResponse<object> SyncOrder(long shopId, DateTime startTime, DateTime endTime)
{
return SendRequest<object>(globalContext.BBYWApiHost, "/Api/Order/SyncOrderByDate", new { shopId, startTime, endTime }, null, HttpMethod.Post);
}
}
}

17
BBWY.Client/ViewModels/Order/OrderListViewModel.cs

@ -76,6 +76,8 @@ namespace BBWY.Client.ViewModels
public ICommand SearchOrderCommand { get; set; }
public ICommand SyncOrderCommand { get; set; }
public ICommand CopyTextCommand { get; set; }
public ICommand CopyOrderWaybillCommand { get; set; }
@ -110,6 +112,7 @@ namespace BBWY.Client.ViewModels
Task.Factory.StartNew(() => LoadOrder(1)); //手动点击查询订单
Task.Factory.StartNew(() => LoadTodayAchievement(StartDate, EndDate));
});
SyncOrderCommand = new RelayCommand(SyncOrder);
CopyTextCommand = new RelayCommand<string>(s =>
{
try
@ -470,5 +473,19 @@ namespace BBWY.Client.ViewModels
//LoadOrder(PageIndex);
});
}
private void SyncOrder()
{
IsLoading = true;
Task.Factory.StartNew(() => orderService.SyncOrder(globalContext.User.Shop.ShopId, StartDate, EndDate)).ContinueWith(r =>
{
IsLoading = false;
var response = r.Result;
if (response.Success)
App.Current.Dispatcher.Invoke(() => MessageBox.Show("同步任务创建成功,该任务会执行一段时间,请稍后查询订单列表观察同步结果", "同步订单"));
else
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "同步订单"));
});
}
}
}

10
BBWY.Client/Views/Order/OrderList.xaml

@ -139,6 +139,16 @@
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchProductNo}" WaterRemark="精确匹配"/>
<TextBlock Text="客户姓名" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchContactName}" WaterRemark="精确匹配"/>
<c:BButton Content="同步" Width="50" Margin="5,0,0,0" Command="{Binding SyncOrderCommand}" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="10000">
<c:BButton.ToolTip>
<StackPanel>
<TextBlock Text="1.使用筛选条件中的开始时间和结束时间进行同步"/>
<TextBlock Text="2.从开始时间起每次同步3小时时长的订单直到到达结束时间"/>
<TextBlock Text="3.已存在未结束的同步任务将不会重复执行"/>
</StackPanel>
</c:BButton.ToolTip>
</c:BButton>
</StackPanel>
</Grid>

Loading…
Cancel
Save