Browse Source

测试OK

Lishi
xxe 2 years ago
parent
commit
e0f7cd2d42
5 changed files with 23 additions and 6 deletions
  1. +13
    -1
      HKCardIN/ViewModels/RootViewModel.cs
  2. +1
    -1
      HKCardOUT/Helper/HKHelpers.cs
  3. +6
    -2
      HKCardOUT/Logic/Service/HKCore.cs
  4. +2
    -1
      HKCardOUT/ViewModels/RootViewModel.cs
  5. +1
    -1
      HKCardOUT/Views/RootView.xaml

+ 13
- 1
HKCardIN/ViewModels/RootViewModel.cs View File

@@ -4,6 +4,7 @@ using HKCardIN.Logic.Model;
using Stylet; using Stylet;
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;


namespace HKCardIN.ViewModels namespace HKCardIN.ViewModels
@@ -16,7 +17,6 @@ namespace HKCardIN.ViewModels
{ {
CodeVisible = Visibility.Collapsed; CodeVisible = Visibility.Collapsed;
ContentVisible = Visibility.Visible; ContentVisible = Visibility.Visible;
MainThread();
} }


#region 属性 #region 属性
@@ -93,13 +93,25 @@ namespace HKCardIN.ViewModels
} }


if (BaseLogic.GetInstance().PushMoneyToServer(CardNo, ShowMoney)) if (BaseLogic.GetInstance().PushMoneyToServer(CardNo, ShowMoney))
{
HandyControl.Controls.Growl.SuccessGlobal($"【{CardNo}】充值成功"); HandyControl.Controls.Growl.SuccessGlobal($"【{CardNo}】充值成功");
Task.Run(() =>
{
Thread.Sleep(5 * 1000);
Info = null;
});
}
else else
HandyControl.Controls.Growl.InfoGlobal($"【{CardNo}】充值失败"); HandyControl.Controls.Growl.InfoGlobal($"【{CardNo}】充值失败");
} }
#endregion #endregion


#region 方法 #region 方法
protected override void OnViewLoaded()
{
MainThread();
//Info = BaseLogic.GetInstance().PullUserAndCardInfo("1569245210230263808");
}
private void MainThread() private void MainThread()
{ {
ThreadManage.GetInstance().StartLong(new Action(() => ThreadManage.GetInstance().StartLong(new Action(() =>


HKCardOUT/Helper/HKHelper.cs → HKCardOUT/Helper/HKHelpers.cs View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;


namespace HKCardOUT.Helper namespace HKCardOUT.Helper
{ {
public class HKHelper: Singleton<HKHelper>
public class HKHelpers: Singleton<HKHelpers>
{ {
/// <summary> /// <summary>
/// 判断网络状况的方法,返回值true为连接,false为未连接 /// 判断网络状况的方法,返回值true为连接,false为未连接

+ 6
- 2
HKCardOUT/Logic/Service/HKCore.cs View File

@@ -28,10 +28,12 @@ namespace HKCardOUT.Logic.Service
//10秒防止重复刷卡 //10秒防止重复刷卡
if (Old.CreateTime.Subtract(DateTime.Now).TotalSeconds > 10d) if (Old.CreateTime.Subtract(DateTime.Now).TotalSeconds > 10d)
{ {
if (DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteCommand() > 0)
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
if (entity.Id!=Guid.Empty)
{ {
var res = RemoteService.SyncSaleLog(input.CardNo, input.Money); var res = RemoteService.SyncSaleLog(input.CardNo, input.Money);
Main.GetInstance.Start(input.Location.AsInt()); Main.GetInstance.Start(input.Location.AsInt());
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand();
return res; return res;
} }
} }
@@ -39,10 +41,12 @@ namespace HKCardOUT.Logic.Service
} }
else else
{ {
if (DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteCommand() > 0)
var entity = DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteReturnEntity();
if (entity.Id!=Guid.Empty)
{ {
var res = RemoteService.SyncSaleLog(input.CardNo, input.Money); var res = RemoteService.SyncSaleLog(input.CardNo, input.Money);
Main.GetInstance.Start(input.Location.AsInt()); Main.GetInstance.Start(input.Location.AsInt());
DbContext.Context.Updateable<SaleLog>().SetColumns(t => t.IsSync == true).Where(t => t.Id == entity.Id).ExecuteCommand();
return res; return res;
} }
return false; return false;


+ 2
- 1
HKCardOUT/ViewModels/RootViewModel.cs View File

@@ -1,5 +1,6 @@
using DTO; using DTO;
using HKCardOUT.Helper; using HKCardOUT.Helper;
using HKCardOUT.Logic;
using HKCardOUT.Logic.Model; using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service; using HKCardOUT.Logic.Service;
using Stylet; using Stylet;
@@ -63,7 +64,7 @@ namespace HKCardOUT.ViewModels
try try
{ {
//1.检测网络上下线 //1.检测网络上下线
bool network = HKHelper.GetInstance().GetNetworkState();
bool network = HKHelpers.GetInstance().GetNetworkState();
if (network != DataBus.NetWordState) if (network != DataBus.NetWordState)
{ {
if (network) HandyControl.Controls.Growl.InfoGlobal("网络连接成功"); if (network) HandyControl.Controls.Growl.InfoGlobal("网络连接成功");


+ 1
- 1
HKCardOUT/Views/RootView.xaml View File

@@ -105,7 +105,7 @@
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn <DataGridTextColumn
Width="260"
Width="300"
Binding="{Binding CardNo}" Binding="{Binding CardNo}"
ElementStyle="{StaticResource CenterAlignmentStyle}" ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="卡号" Header="卡号"


Loading…
Cancel
Save