Browse Source

代码更新

master
pengliangyang 1 year ago
parent
commit
41543ca25b
7 changed files with 93 additions and 56 deletions
  1. +34
    -34
      HKCardManager/Form1.Designer.cs
  2. +0
    -6
      HKCardManager/Form1.resx
  3. +25
    -0
      HKCardOUT/Bootstrapper.cs
  4. +15
    -8
      HKCardOUT/Logic/RemoteService.cs
  5. +9
    -5
      HKCardOUT/ViewModels/RootViewModel.cs
  6. +2
    -2
      HKControl/Main.cs
  7. +8
    -1
      HKControl/Siemens.cs

+ 34
- 34
HKCardManager/Form1.Designer.cs View File

@@ -28,8 +28,8 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.pictureBox11 = new System.Windows.Forms.PictureBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox();
@@ -50,6 +50,8 @@
this.button10 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.pictureBox13 = new System.Windows.Forms.PictureBox();
this.button14 = new System.Windows.Forms.Button();
this.pictureBox12 = new System.Windows.Forms.PictureBox(); this.pictureBox12 = new System.Windows.Forms.PictureBox();
this.button13 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button();
this.pictureBox6 = new System.Windows.Forms.PictureBox(); this.pictureBox6 = new System.Windows.Forms.PictureBox();
@@ -66,8 +68,6 @@
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.图标 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.图标 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.消息文本 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.消息文本 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.button14 = new System.Windows.Forms.Button();
this.pictureBox13 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
@@ -84,6 +84,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
@@ -94,7 +95,6 @@
this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout(); this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1 // splitContainer1
@@ -379,6 +379,30 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "卡片维护"; this.groupBox2.Text = "卡片维护";
// //
// pictureBox13
//
this.pictureBox13.BackColor = System.Drawing.Color.Transparent;
this.pictureBox13.Image = global::HKCardManager.Properties.Resources.shijianshezhi;
this.pictureBox13.Location = new System.Drawing.Point(20, 251);
this.pictureBox13.Name = "pictureBox13";
this.pictureBox13.Size = new System.Drawing.Size(20, 20);
this.pictureBox13.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox13.TabIndex = 12;
this.pictureBox13.TabStop = false;
//
// button14
//
this.button14.BackColor = System.Drawing.SystemColors.Control;
this.button14.Location = new System.Drawing.Point(9, 244);
this.button14.Name = "button14";
this.button14.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0);
this.button14.Size = new System.Drawing.Size(220, 36);
this.button14.TabIndex = 10;
this.button14.Text = "重置";
this.button14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button14.UseVisualStyleBackColor = false;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// pictureBox12 // pictureBox12
// //
this.pictureBox12.BackColor = System.Drawing.Color.Transparent; this.pictureBox12.BackColor = System.Drawing.Color.Transparent;
@@ -567,8 +591,8 @@
// //
// 图标 // 图标
// //
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter;
this.图标.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter;
this.图标.DefaultCellStyle = dataGridViewCellStyle1;
this.图标.HeaderText = "图标"; this.图标.HeaderText = "图标";
this.图标.Name = "图标"; this.图标.Name = "图标";
this.图标.ReadOnly = true; this.图标.ReadOnly = true;
@@ -577,36 +601,12 @@
// 消息文本 // 消息文本
// //
this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.消息文本.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.消息文本.DefaultCellStyle = dataGridViewCellStyle2;
this.消息文本.HeaderText = "消息文本"; this.消息文本.HeaderText = "消息文本";
this.消息文本.Name = "消息文本"; this.消息文本.Name = "消息文本";
this.消息文本.ReadOnly = true; this.消息文本.ReadOnly = true;
// //
// button14
//
this.button14.BackColor = System.Drawing.SystemColors.Control;
this.button14.Location = new System.Drawing.Point(9, 244);
this.button14.Name = "button14";
this.button14.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0);
this.button14.Size = new System.Drawing.Size(220, 36);
this.button14.TabIndex = 10;
this.button14.Text = "重置";
this.button14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button14.UseVisualStyleBackColor = false;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// pictureBox13
//
this.pictureBox13.BackColor = System.Drawing.Color.Transparent;
this.pictureBox13.Image = global::HKCardManager.Properties.Resources.shijianshezhi;
this.pictureBox13.Location = new System.Drawing.Point(20, 251);
this.pictureBox13.Name = "pictureBox13";
this.pictureBox13.Size = new System.Drawing.Size(20, 20);
this.pictureBox13.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox13.TabIndex = 12;
this.pictureBox13.TabStop = false;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@@ -632,6 +632,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
@@ -642,7 +643,6 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);


} }


+ 0
- 6
HKCardManager/Form1.resx View File

@@ -63,10 +63,4 @@
<metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="图标.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

+ 25
- 0
HKCardOUT/Bootstrapper.cs View File

@@ -19,6 +19,8 @@ using HKLib.RabbitMQ.Subscriber;
using System.Linq; using System.Linq;
using BPA.Helper; using BPA.Helper;
using QuartzUtil.Job; using QuartzUtil.Job;
using System.Collections.Generic;
using DTO;


namespace HKCardOUT namespace HKCardOUT
{ {
@@ -133,6 +135,29 @@ namespace HKCardOUT
/// </summary> /// </summary>
protected override void OnLaunch() protected override void OnLaunch()
{ {
//List<SaleDto> dto = new List<SaleDto>();
//Guid.TryParse("3f8861ef-0ae0-469c-8c2d-7eec8df8a6d1", out Guid t);
//var GateId = DataBus.StoreInfo.Devices.FirstOrDefault(t => t.Address.AsInt() == 6)?.GateId;
//dto.Add(new SaleDto()
//{
// CardNum = "1590198442460844032",
// CreateAt = Convert.ToDateTime("2022-11-09 15:07:51.0397808"),
// Id = t,
// GateId = GateId,
// Type = -1

//});
//dto.Add(new SaleDto()
//{
// CardNum = "1590198442460844032",
// CreateAt = Convert.ToDateTime("2022-11-09 15:07:51.0397808"),
// Id = t,
// GateId = GateId,
// Type = -1

//});
//RemoteService.SyncSaleLogList(dto);

QuartzCoreFactory.QuartzCore().AddJob<CardJob>(new QuartzMap QuartzCoreFactory.QuartzCore().AddJob<CardJob>(new QuartzMap
{ {
JobDetail = "定时同步卡", JobDetail = "定时同步卡",


+ 15
- 8
HKCardOUT/Logic/RemoteService.cs View File

@@ -35,11 +35,12 @@ namespace HKCardOUT.Logic
{ {
try try
{ {
var res = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.CheckCardStatus;
t.ReqType = MultiType.GET;
}).Build().RunStringFirst();
var res = APIHelper.GetInstance.HttpGetRequest(ApiRoute.CheckCardStatus);
//var res = IHttpMultiClient.HttpMulti.AddNode(t =>
//{
// t.NodePath = ApiRoute.CheckCardStatus;
// t.ReqType = MultiType.GET;
//}).Build().RunStringFirst();
if (string.IsNullOrEmpty(res)) return 0; if (string.IsNullOrEmpty(res)) return 0;
var data = res.ToModel<JObject>()["data"]["data"].ToJson().ToModel<List<CardInfo>>(); var data = res.ToModel<JObject>()["data"]["data"].ToJson().ToModel<List<CardInfo>>();
var entity = data.Select(t => new CardStutas var entity = data.Select(t => new CardStutas
@@ -70,6 +71,8 @@ namespace HKCardOUT.Logic


var dtoTime = data.ToModel<JObject>()["data"]["data"].ToJson().ToModel<TimeSpilteDto>(); var dtoTime = data.ToModel<JObject>()["data"]["data"].ToJson().ToModel<TimeSpilteDto>();


HKLogImport.WriteInfo($"获取接口数据:{data}");

var time = GetNetWorkTime(); var time = GetNetWorkTime();
var tims = $"{time.Year}-{time.Month}-{time.Day}"; var tims = $"{time.Year}-{time.Month}-{time.Day}";
DataBus.Times = new TimeSpilte(); DataBus.Times = new TimeSpilte();
@@ -80,7 +83,7 @@ namespace HKCardOUT.Logic
DataBus.Times.ATStartTime = DateTime.Parse($"{tims} {dtoTime.ATStartTime}"); DataBus.Times.ATStartTime = DateTime.Parse($"{tims} {dtoTime.ATStartTime}");
DataBus.Times.ATEndTime = DateTime.Parse($"{tims} {dtoTime.ATEndTime}"); DataBus.Times.ATEndTime = DateTime.Parse($"{tims} {dtoTime.ATEndTime}");


HKLogImport.WriteInfo("同步时间:" + DataBus.Times);
HKLogImport.WriteInfo($"同步时间:早上用餐时间段{DataBus.Times.AMStartTime},{DataBus.Times.AMEndTime};中午用餐时间段{DataBus.Times.PMStartTime},{DataBus.Times.PMEndTime};晚上用餐时间段{DataBus.Times.ATStartTime},{DataBus.Times.ATEndTime}");


} }


@@ -123,6 +126,7 @@ namespace HKCardOUT.Logic
var Ids = dto.Select(t => t.Id).ToList(); var Ids = dto.Select(t => t.Id).ToList();
var check = DbContext.Context.Queryable<SaleLog>().Where(t => Ids.Contains(t.Id)).Any(t => t.IsSync); var check = DbContext.Context.Queryable<SaleLog>().Where(t => Ids.Contains(t.Id)).Any(t => t.IsSync);
if (check) return null; if (check) return null;
//var cc = APIHelper.GetInstance.PostRequest(ApiRoute.SyncSaleLogList, dto.ToJson());
var data = IHttpMultiClient.HttpMulti.AddHeader(t => var data = IHttpMultiClient.HttpMulti.AddHeader(t =>
{ {
t.HeaderKey = "TenantId"; t.HeaderKey = "TenantId";
@@ -133,8 +137,11 @@ namespace HKCardOUT.Logic
t.JsonParam = dto.ToJson(); t.JsonParam = dto.ToJson();
t.NodePath = ApiRoute.SyncSaleLogList; t.NodePath = ApiRoute.SyncSaleLogList;
}).Build().RunStringFirst(); }).Build().RunStringFirst();
HKLog.HKLogImport.WriteInfo($"批量同步同步消费记录调用:{data}");
return data.ToModel<JObject>()["data"].ToString().ToModel<JObject>()["failList"].ToJson().ToModel<List<FailDto>>();

HKLog.HKLogImport.WriteInfo($"推送数据:{dto.ToJson()}");
List<FailDto> result = data.ToModel<JObject>()["data"].ToString().ToModel<JObject>()["failList"].ToJson().ToModel<List<FailDto>>();
HKLog.HKLogImport.WriteInfo($"{result.Count}批量同步同步消费记录调用:{data}");
return result;
} }
} }
catch (Exception ex) catch (Exception ex)


+ 9
- 5
HKCardOUT/ViewModels/RootViewModel.cs View File

@@ -215,7 +215,7 @@ namespace HKCardOUT.ViewModels
Location = input.Address.AsInt().ToString(), Location = input.Address.AsInt().ToString(),
Date = DataBus.TodayTime Date = DataBus.TodayTime
}; };
HKLogImport.WriteInfo("读卡成功:" + mo.ToJson());
HKLogImport.WriteInfo("读卡成功:" + mo.ToJson()+ mo.Date);
if (Stacks.Count > 0) if (Stacks.Count > 0)
{ {
var check = Stacks.Where(t => t.CardNo == mo.CardNo).Where(t => t.Location == mo.Location).FirstOrDefault(); var check = Stacks.Where(t => t.CardNo == mo.CardNo).Where(t => t.Location == mo.Location).FirstOrDefault();
@@ -252,8 +252,7 @@ namespace HKCardOUT.ViewModels
Location = Info.Location, Location = Info.Location,
IsSync = false IsSync = false
}); });
}
if (Info.Date >= DataBus.Times.PMStartTime && Info.Date < DataBus.Times.PMEndTime)
}else if(Info.Date >= DataBus.Times.PMStartTime && Info.Date < DataBus.Times.PMEndTime)
{ {
Core.DeviceSalePM(new SaleLog Core.DeviceSalePM(new SaleLog
{ {
@@ -263,7 +262,7 @@ namespace HKCardOUT.ViewModels
}); });


} }
if (Info.Date >= DataBus.Times.ATStartTime && Info.Date < DataBus.Times.ATEndTime)
else if (Info.Date >= DataBus.Times.ATStartTime && Info.Date < DataBus.Times.ATEndTime)
{ {
Core.DeviceSaleAT(new SaleLog Core.DeviceSaleAT(new SaleLog
{ {
@@ -271,7 +270,12 @@ namespace HKCardOUT.ViewModels
Location = Info.Location, Location = Info.Location,
IsSync = false IsSync = false
}); });

}
else
{
HKLogImport.WriteInfo($"刷卡时间不处于用餐时间段:刷卡时间{Info.Date},用餐时间段:{ DataBus.Times.AMStartTime}--{ DataBus.Times.AMEndTime},{ DataBus.Times.PMStartTime}--{ DataBus.Times.PMEndTime},{ DataBus.Times.ATStartTime}--{ DataBus.Times.ATEndTime}");
HKLogImport.WriteInfo($"刷卡异常,重新同步用餐时间段");
RemoteService.SyncTime();
} }
} }
} }


+ 2
- 2
HKControl/Main.cs View File

@@ -45,7 +45,7 @@ namespace HKControl
return DataModels[3].LeftWindowData.IsSwipe; return DataModels[3].LeftWindowData.IsSwipe;
case 6: case 6:
if (!DataModels.ContainsKey(3)) return false; if (!DataModels.ContainsKey(3)) return false;
return DataModels[3].LeftWindowData.IsSwipe;
return DataModels[3].RightWindowData.IsSwipe;
default: default:
break; break;
} }
@@ -102,7 +102,7 @@ namespace HKControl
case 5: case 5:
return DataModels[3].LeftWindowData.Complete; return DataModels[3].LeftWindowData.Complete;
case 6: case 6:
return DataModels[3].LeftWindowData.Complete;
return DataModels[3].RightWindowData.Complete;
default: default:
break; break;
} }


+ 8
- 1
HKControl/Siemens.cs View File

@@ -18,6 +18,8 @@ namespace HKControl
private int Myport; private int Myport;
private bool IsStartConnect = false; private bool IsStartConnect = false;


private bool IsError = false;

/// <summary> /// <summary>
/// 打开连接 /// 打开连接
/// </summary> /// </summary>
@@ -45,12 +47,17 @@ namespace HKControl
IsStartConnect = false; IsStartConnect = false;
ConnectOk?.Invoke(); ConnectOk?.Invoke();
HKLog.HKLogImport.WriteInfo($"设备{ip}连接成功"); HKLog.HKLogImport.WriteInfo($"设备{ip}连接成功");
IsError = false;
//Debug.WriteLine($"设备{ip}连接成功"); //Debug.WriteLine($"设备{ip}连接成功");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
HKLog.HKLogImport.WriteInfo($"设备连接出错:{ip}");
if (!IsError)
{
HKLog.HKLogImport.WriteInfo($"设备连接出错:{ip}");
IsError = true;
}
Thread.Sleep(3000); Thread.Sleep(3000);
Connect(cpuType, ip, port); Connect(cpuType, ip, port);
//Debug.WriteLine(ex.ToString()); //Debug.WriteLine(ex.ToString());


Loading…
Cancel
Save