shanji 3 years ago
parent
commit
7bb5b84ed9
  1. 39
      BBWY.Client/ViewModels/Setting/ShopSettingViewModel.cs
  2. 5
      BBWY.Client/Views/Setting/ShopSetting.xaml
  3. 6
      BBWY.Server.Business/EarlyWarning/JD/JDStockNumWarningBusiness.cs

39
BBWY.Client/ViewModels/Setting/ShopSettingViewModel.cs

@ -24,7 +24,7 @@ namespace BBWY.Client.ViewModels
private int skuSafeTurnoverDays; private int skuSafeTurnoverDays;
private string dingDingWebHook; private string dingDingWebHook;
private string dingDingKey; private string dingDingKey;
private int selectedSkuSafeTurnoverDay; private KVModel selectedSkuSafeTurnoverDay;
public ICommand SaveCommand { get; set; } public ICommand SaveCommand { get; set; }
@ -39,12 +39,12 @@ namespace BBWY.Client.ViewModels
public int PanelIndex { get => panelIndex; set { Set(ref panelIndex, value); } } public int PanelIndex { get => panelIndex; set { Set(ref panelIndex, value); } }
public IList<int> SafeDayList { get; set; } public IList<KVModel> SafeDayList { get; set; }
public int SkuSafeTurnoverDays { get => skuSafeTurnoverDays; set { Set(ref skuSafeTurnoverDays, value); } } public int SkuSafeTurnoverDays { get => skuSafeTurnoverDays; set { Set(ref skuSafeTurnoverDays, value); } }
public string DingDingWebHook { get => dingDingWebHook; set { Set(ref dingDingWebHook, value); } } public string DingDingWebHook { get => dingDingWebHook; set { Set(ref dingDingWebHook, value); } }
public string DingDingKey { get => dingDingKey; set { Set(ref dingDingKey, value); } } public string DingDingKey { get => dingDingKey; set { Set(ref dingDingKey, value); } }
public int SelectedSkuSafeTurnoverDay { get => selectedSkuSafeTurnoverDay; set { Set(ref selectedSkuSafeTurnoverDay, value); } } public KVModel SelectedSkuSafeTurnoverDay { get => selectedSkuSafeTurnoverDay; set { Set(ref selectedSkuSafeTurnoverDay, value); } }
public ShopSettingViewModel(GlobalContext globalContext, ShopService shopService) public ShopSettingViewModel(GlobalContext globalContext, ShopService shopService)
{ {
@ -56,7 +56,29 @@ namespace BBWY.Client.ViewModels
{ {
PanelIndex = i; PanelIndex = i;
}); });
SafeDayList = new List<int>() { 0, 14, 21, 28 }; SafeDayList = new List<KVModel>()
{
new KVModel()
{
Key="不提醒",
Value="0"
},
new KVModel()
{
Key="14",
Value="14"
},
new KVModel()
{
Key="21",
Value="21"
},
new KVModel()
{
Key="28",
Value="28"
}
};
} }
protected override void Load() protected override void Load()
@ -76,7 +98,7 @@ namespace BBWY.Client.ViewModels
globalContext.User.Shop.PurchaseAccountList[0].Clone() as PurchaseAccount; globalContext.User.Shop.PurchaseAccountList[0].Clone() as PurchaseAccount;
DingDingKey = globalContext.User.Shop.DingDingKey; DingDingKey = globalContext.User.Shop.DingDingKey;
DingDingWebHook = globalContext.User.Shop.DingDingWebHook; DingDingWebHook = globalContext.User.Shop.DingDingWebHook;
SelectedSkuSafeTurnoverDay = globalContext.User.Shop.SkuSafeTurnoverDays; SelectedSkuSafeTurnoverDay = SafeDayList.FirstOrDefault(s => s.Value == globalContext.User.Shop.SkuSafeTurnoverDays.ToString());
} }
protected override void Unload() protected override void Unload()
@ -86,7 +108,7 @@ namespace BBWY.Client.ViewModels
this.ManagePwd = string.Empty; this.ManagePwd = string.Empty;
this.isValidated = false; this.isValidated = false;
this.DingDingKey = this.DingDingWebHook = string.Empty; this.DingDingKey = this.DingDingWebHook = string.Empty;
SelectedSkuSafeTurnoverDay = 0; SelectedSkuSafeTurnoverDay = SafeDayList[0];
} }
private void Save() private void Save()
@ -118,7 +140,7 @@ namespace BBWY.Client.ViewModels
PurchaseAccount, PurchaseAccount,
DingDingWebHook, DingDingWebHook,
DingDingKey, DingDingKey,
SelectedSkuSafeTurnoverDay)).ContinueWith(r => int.Parse(SelectedSkuSafeTurnoverDay.Value))).ContinueWith(r =>
{ {
IsLoading = false; IsLoading = false;
var response = r.Result; var response = r.Result;
@ -135,6 +157,9 @@ namespace BBWY.Client.ViewModels
globalContext.User.Shop.PurchaseAccountList.Add(PurchaseAccount); globalContext.User.Shop.PurchaseAccountList.Add(PurchaseAccount);
globalContext.User.Shop.PlatformCommissionRatio = p; globalContext.User.Shop.PlatformCommissionRatio = p;
globalContext.User.Shop.ManagePwd = this.ManagePwd; globalContext.User.Shop.ManagePwd = this.ManagePwd;
globalContext.User.Shop.DingDingKey = this.DingDingKey;
globalContext.User.Shop.DingDingWebHook = this.DingDingWebHook;
globalContext.User.Shop.SkuSafeTurnoverDays = int.Parse(SelectedSkuSafeTurnoverDay.Value);
}); });
} }
} }

5
BBWY.Client/Views/Setting/ShopSetting.xaml

@ -155,7 +155,10 @@
<TextBlock Text="策略设置" Style="{StaticResource textblockPropertyStyle}" Grid.Row="4"/> <TextBlock Text="策略设置" Style="{StaticResource textblockPropertyStyle}" Grid.Row="4"/>
<TextBlock Text="安全周转天数" Style="{StaticResource textblockPropertyStyle}" Grid.Row="5"/> <TextBlock Text="安全周转天数" Style="{StaticResource textblockPropertyStyle}" Grid.Row="5"/>
<ComboBox ItemsSource="{Binding SafeDayList}" SelectedItem="{Binding SelectedSkuSafeTurnoverDay,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" Height="30" Width="100" <ComboBox ItemsSource="{Binding SafeDayList}"
SelectedItem="{Binding SelectedSkuSafeTurnoverDay,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Key"
Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" Height="30" Width="100"
VerticalContentAlignment="Center"/> VerticalContentAlignment="Center"/>
<Grid Grid.ColumnSpan="2" Grid.Row="6" Margin="4.5,0"> <Grid Grid.ColumnSpan="2" Grid.Row="6" Margin="4.5,0">

6
BBWY.Server.Business/EarlyWarning/JD/JDStockNumWarningBusiness.cs

@ -181,6 +181,10 @@ namespace BBWY.Server.Business
} }
} }
#region 预警检查结果日志
//nLogManager.GetLogger($"库存预警-{shop.ShopName}").Info("");
#endregion
if (isWarning) if (isWarning)
{ {
isSendDingTalk = true; isSendDingTalk = true;
@ -224,7 +228,7 @@ namespace BBWY.Server.Business
} }
catch (Exception ex) catch (Exception ex)
{ {
nLogManager.Default().Error(ex, "查询sku库存失败"); nLogManager.GetLogger($"库存预警-{shop.ShopName}").Error(ex, "查询sku库存失败");
} }
} }

Loading…
Cancel
Save