pry 2 vuotta sitten
vanhempi
commit
d26581c49d
12 muutettua tiedostoa jossa 65 lisäystä ja 40 poistoa
  1. +2
    -3
      HKCardOUT/Bootstrapper.cs
  2. +2
    -2
      HKCardOUT/HKCardOUT.csproj
  3. +2
    -3
      HKCardOUT/Helper/DataBus.cs
  4. +2
    -3
      HKCardOUT/Logic/Model/CardStutas.cs
  5. +19
    -1
      HKCardOUT/Logic/RemoteService.cs
  6. +17
    -8
      HKCardOUT/Logic/Service/HKCore.cs
  7. +1
    -1
      HKCardOUT/MqHandle.cs
  8. +6
    -6
      HKCardOUT/ViewModels/RootViewModel.cs
  9. +0
    -6
      HKCardOUT/options.json
  10. +4
    -0
      HKLib/Dto/CardStutasDto.cs
  11. +10
    -6
      HKLib/Interfaces/HKLibHelper.cs
  12. +0
    -1
      HKLib/RabbitMq/Config/MQFactory.cs

+ 2
- 3
HKCardOUT/Bootstrapper.cs Näytä tiedosto

@@ -65,12 +65,11 @@ namespace HKCardOUT
DataBus.COM = configer["COM"];
DataBus.StartDevice = configer["StartDevice"].AsBool();
DataBus.Cancel = configer["Cancel"].AsBool();
DataBus.AM = configer["AM"];
DataBus.PM = configer["PM"];
DataBus.Count = configer["Count"].AsInt();
DataBus.AT = configer["AT"];
HKLib.Configer.SaasRoute = DataBus.SaasRoute;
HKLib.Configer.MqAddress = configer["MQ"];
RemoteService.SyncTime();
RemoteService.GetCardStuatas();
DbContext.InitTable();
RemoteService.PullShopInfo();
base.Configure();


+ 2
- 2
HKCardOUT/HKCardOUT.csproj Näytä tiedosto

@@ -14,9 +14,9 @@
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
<PropertyGroup>
<!--<PropertyGroup>
<ApplicationManifest>App.manifest</ApplicationManifest>
</PropertyGroup>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;Core</DefineConstants>
</PropertyGroup>


+ 2
- 3
HKCardOUT/Helper/DataBus.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using HKCardOUT.Views;
using HKLib.Dto;
using Logic.RemoteModel;
using System;
using System.Collections.Generic;
@@ -31,10 +32,8 @@ namespace HKCardOUT.Helper
public static string StoreId { get; set; }
public static string COM { get; set; }
public static string SaasRoute { get; set; }
public static string AM { get; set; }
public static string PM { get; set; }
public static string AT { get; set; }
public static int Count { get; set; }
public static TimeSpilte Times { get; set; }
public static StoreInfoResponse StoreInfo { get; set; }
public static Dictionary<string, AdWindow> AdStatus { get; set; } = new Dictionary<string, AdWindow>();
}


+ 2
- 3
HKCardOUT/Logic/Model/CardStutas.cs Näytä tiedosto

@@ -1,10 +1,9 @@
using HKCardOUT.Logic;
using SqlSugar;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Logic.Model
namespace HKCardOUT.Logic.Model
{
[SugarTable("CardStutas")]
public class CardStutas: BaseEntity


+ 19
- 1
HKCardOUT/Logic/RemoteService.cs Näytä tiedosto

@@ -1,4 +1,6 @@
using HKCardOUT.Helper;
using HKCardOUT.Logic.Model;
using HKCardOUT.Logic.Service;
using Logic.RemoteModel;
using Newtonsoft.Json.Linq;
using System;
@@ -22,15 +24,31 @@ namespace HKCardOUT.Logic
/// 获取所有卡状态和卡号
/// </summary>
/// <param name="input"></param>
public static int CheckCardStuatas()
public static int GetCardStuatas()
{
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.CheckCardStatus;
t.ReqType = MultiType.GET;
}).Build().RunStringFirst().ToModel<JObject>()["data"]["cardState"];
HKCore.AddCard(new CardStutas
{
});
return data != null ? data.ToString().AsInt() : 0;
}
/// <summary>
/// 同步时间段
/// </summary>
public static void SyncTime()
{
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.CheckCardStatus;
t.ReqType = MultiType.GET;
}).Build().RunStringFirst().ToModel<JObject>()["data"];
}

/// <summary>
/// 同步消费记录
/// </summary>


+ 17
- 8
HKCardOUT/Logic/Service/HKCore.cs Näytä tiedosto

@@ -2,7 +2,6 @@
using HKCardOUT.Helper;
using HKCardOUT.Logic.Model;
using HKControl;
using Logic.Model;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -36,11 +35,15 @@ namespace HKCardOUT.Logic.Service
if (data.Stutas != 1) return false;
return true;
}
public static void AddCard(CardStutas input)
{
DbContext.Context.Insertable(input).CallEntityMethod(t => t.Create()).ExecuteCommand();
}

/// <summary>
/// 早上消费
/// </summary>
/// <param name="input"></param>
/// <param name="Old"></param>
/// <returns></returns>
public bool DeviceSaleAM(SaleLog input)
{
@@ -49,8 +52,10 @@ namespace HKCardOUT.Logic.Service
if(!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
if (Old == null) return false;
var AM = DataBus.AM.Split(",").Select(t => t.AsInt()).ToList();
var AMDay = Old.Where(t => t.CreateTime.Hour >= AM[0] && t.CreateTime.Hour < AM[1])
var AM = DataBus.Times.AM.Split(",");
var S = DateTime.Parse(AM[0]);
var E = DateTime.Parse(AM[1]);
var AMDay = Old.Where(t => t.CreateTime >=S && t.CreateTime < E)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
@@ -110,8 +115,10 @@ namespace HKCardOUT.Logic.Service
if (!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
if (Old == null) return false;
var PM = DataBus.PM.Split(",").Select(t => t.AsInt()).ToList();
var PMDay = Old.Where(t => t.CreateTime.Hour >= PM[0] && t.CreateTime.Hour < PM[1]).
var PM = DataBus.Times.PM.Split(",");
var S = DateTime.Parse(PM[0]);
var E = DateTime.Parse(PM[1]);
var PMDay = Old.Where(t => t.CreateTime >= S && t.CreateTime < E).
Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)
@@ -169,8 +176,10 @@ namespace HKCardOUT.Logic.Service
if (!GetCardStutas(input.CardNo)) return false;
var Old = Commom(input);
if (Old == null) return false;
var AT = DataBus.AT.Split(",").Select(t => t.AsInt()).ToList();
var ATDay = Old.Where(t => t.CreateTime.Hour >= AT[0] && t.CreateTime.Hour < AT[1])
var AT = DataBus.Times.AT.Split(",");
var S = DateTime.Parse(AT[0]);
var E = DateTime.Parse(AT[1]);
var ATDay = Old.Where(t => t.CreateTime >= S && t.CreateTime <E)
.Where(t => t.CreateTime.Year == DateTime.Now.Year)
.Where(t => t.CreateTime.Month == DateTime.Now.Month)
.Where(t => t.CreateTime.Day == DateTime.Now.Day)


+ 1
- 1
HKCardOUT/MqHandle.cs Näytä tiedosto

@@ -1,7 +1,7 @@
using HKCardOUT.Logic;
using HKCardOUT.Logic.Model;
using HKLib.Dto;
using HKLib.RabbitMQ.Config;
using Logic.Model;
using System;
using System.Collections.Generic;
using System.Text;


+ 6
- 6
HKCardOUT/ViewModels/RootViewModel.cs Näytä tiedosto

@@ -199,10 +199,10 @@ namespace HKCardOUT.ViewModels
lock (locker)
{
var Core = Container.Get<HKCore>();
var AM = DataBus.AM.Split(",").Select(t => t.AsInt()).ToList();
var PM = DataBus.PM.Split(",").Select(t => t.AsInt()).ToList();
var AT = DataBus.AT.Split(",").Select(t => t.AsInt()).ToList();
if (DateTime.Now.Hour >= AM[0] && DateTime.Now.Hour < AM[1])
var AM = DataBus.Times.AM.Split(",");
var PM = DataBus.Times.PM.Split(",");
var AT = DataBus.Times.AT.Split(",");
if (DateTime.Now >= DateTime.Parse(AM[0]) && DateTime.Now < DateTime.Parse(AM[1]))
{
Core.DeviceSaleAM(new SaleLog
{
@@ -211,7 +211,7 @@ namespace HKCardOUT.ViewModels
IsSync = false
});
}
if (DateTime.Now.Hour >= PM[0] && DateTime.Now.Hour < PM[1])
if (DateTime.Now >= DateTime.Parse(PM[0]) && DateTime.Now < DateTime.Parse(PM[1]))
{
Core.DeviceSalePM(new SaleLog
{
@@ -220,7 +220,7 @@ namespace HKCardOUT.ViewModels
IsSync = false
});
}
if (DateTime.Now.Hour >= AT[0] && DateTime.Now.Hour < AT[1])
if (DateTime.Now >= DateTime.Parse(AT[0]) && DateTime.Now < DateTime.Parse(AT[1]))
{
Core.DeviceSaleAT(new SaleLog
{


+ 0
- 6
HKCardOUT/options.json Näytä tiedosto

@@ -13,12 +13,6 @@
"ConnectionStrings": {
"Sqlite": "HKSQL.db3"
},
//早上
"AM": "6,9",
//中午
"PM": "11,14",
//下午
"AT": "17,20",
//每个时间段的刷卡次数
"Count": 1,
//取消单卡刷卡限制


+ 4
- 0
HKLib/Dto/CardStutasDto.cs Näytä tiedosto

@@ -14,5 +14,9 @@ namespace HKLib.Dto
/// 状态 0.禁用 1.正常 2.挂失 3.作废
/// </summary>
public int Stutas { get; set; }
/// <summary>
/// 手机号 名称
/// </summary>
public string keywrod { get; set; }
}
}

+ 10
- 6
HKLib/Interfaces/HKLibHelper.cs Näytä tiedosto

@@ -31,9 +31,10 @@ namespace HKLib.Interfaces
{
return IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = $"{Configer.SaasRoute}/{input}";
t.ReqType = MultiType.GET;
}).Build().RunStringFirst().ToModel<JObject>()["data"].ToString();
t.NodePath = $"{Configer.SaasRoute}/api/one-card/member-tag";
t.ReqType = MultiType.POST;
t.JsonParam = (new { Name = input }).ToJson();
}).Build().RunStringFirst().ToModel<JObject>()["data"]["id"].ToString();
}

/// <summary>
@@ -43,8 +44,8 @@ namespace HKLib.Interfaces
{
return IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = $"{Configer.SaasRoute}";
t.ReqType = MultiType.POST;
t.NodePath = $"{Configer.SaasRoute}/api/one-card/member-tag";
t.ReqType = MultiType.PUT;
t.JsonParam = (new { Name = input, Id = Sid }).ToJson();
}).Build().RunStringFirst().ToModel<JObject>()["isSuccess"].ToString().AsBool();
}
@@ -53,13 +54,14 @@ namespace HKLib.Interfaces
/// 根据用户命获取下拉用户列表
/// </summary>
/// <param name="keyword"></param>
public static void GetUserList(string keyword)
public static string GetUserList(string keyword)
{
IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = $"{Configer.SaasRoute}/{keyword}";
t.ReqType = MultiType.GET;
}).Build().RunStringFirst();
return "";
}
/// <summary>
/// 添加用户
@@ -80,6 +82,8 @@ namespace HKLib.Interfaces
/// <param name="input"></param>
public static void CardStutasChange(CardStutasDto input)
{
input.CardNo = GetUserList(input.keywrod);

IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = $"{Configer.SaasRoute}";


+ 0
- 1
HKLib/RabbitMq/Config/MQFactory.cs Näytä tiedosto

@@ -1,6 +1,5 @@
using EasyNetQ;
using EasyNetQ.Topology;
using HKLib.DataBus.数据缓存;
using System;
using System.Collections.Generic;
using System.Configuration;


Ladataan…
Peruuta
Tallenna