diff --git a/HKCardManager/Form1.Designer.cs b/HKCardManager/Form1.Designer.cs index b5984ea..91f4bbd 100644 --- a/HKCardManager/Form1.Designer.cs +++ b/HKCardManager/Form1.Designer.cs @@ -28,8 +28,8 @@ /// 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.groupBox5 = new System.Windows.Forms.GroupBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox(); @@ -50,6 +50,8 @@ this.button10 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); 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.button13 = new System.Windows.Forms.Button(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); @@ -66,8 +68,6 @@ this.dataGridView1 = new System.Windows.Forms.DataGridView(); 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(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -84,6 +84,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit(); this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); @@ -94,7 +95,6 @@ this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -379,6 +379,30 @@ this.groupBox2.TabStop = false; 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 // 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.图标.Name = "图标"; this.图标.ReadOnly = true; @@ -577,36 +601,12 @@ // 消息文本 // 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.消息文本.Name = "消息文本"; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -632,6 +632,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit(); this.groupBox2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); @@ -642,7 +643,6 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).EndInit(); this.ResumeLayout(false); } diff --git a/HKCardManager/Form1.resx b/HKCardManager/Form1.resx index 9876a5b..1338f61 100644 --- a/HKCardManager/Form1.resx +++ b/HKCardManager/Form1.resx @@ -63,10 +63,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs index 1a0f61c..d64f03d 100644 --- a/HKCardOUT/Bootstrapper.cs +++ b/HKCardOUT/Bootstrapper.cs @@ -19,6 +19,8 @@ using HKLib.RabbitMQ.Subscriber; using System.Linq; using BPA.Helper; using QuartzUtil.Job; +using System.Collections.Generic; +using DTO; namespace HKCardOUT { @@ -133,6 +135,29 @@ namespace HKCardOUT /// protected override void OnLaunch() { + //List dto = new List(); + //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(new QuartzMap { JobDetail = "定时同步卡", diff --git a/HKCardOUT/Logic/RemoteService.cs b/HKCardOUT/Logic/RemoteService.cs index 75b8368..b7f6aa3 100644 --- a/HKCardOUT/Logic/RemoteService.cs +++ b/HKCardOUT/Logic/RemoteService.cs @@ -35,11 +35,12 @@ namespace HKCardOUT.Logic { 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; var data = res.ToModel()["data"]["data"].ToJson().ToModel>(); var entity = data.Select(t => new CardStutas @@ -70,6 +71,8 @@ namespace HKCardOUT.Logic var dtoTime = data.ToModel()["data"]["data"].ToJson().ToModel(); + HKLogImport.WriteInfo($"获取接口数据:{data}"); + var time = GetNetWorkTime(); var tims = $"{time.Year}-{time.Month}-{time.Day}"; DataBus.Times = new TimeSpilte(); @@ -80,7 +83,7 @@ namespace HKCardOUT.Logic DataBus.Times.ATStartTime = DateTime.Parse($"{tims} {dtoTime.ATStartTime}"); 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 check = DbContext.Context.Queryable().Where(t => Ids.Contains(t.Id)).Any(t => t.IsSync); if (check) return null; + //var cc = APIHelper.GetInstance.PostRequest(ApiRoute.SyncSaleLogList, dto.ToJson()); var data = IHttpMultiClient.HttpMulti.AddHeader(t => { t.HeaderKey = "TenantId"; @@ -133,8 +137,11 @@ namespace HKCardOUT.Logic t.JsonParam = dto.ToJson(); t.NodePath = ApiRoute.SyncSaleLogList; }).Build().RunStringFirst(); - HKLog.HKLogImport.WriteInfo($"批量同步同步消费记录调用:{data}"); - return data.ToModel()["data"].ToString().ToModel()["failList"].ToJson().ToModel>(); + + HKLog.HKLogImport.WriteInfo($"推送数据:{dto.ToJson()}"); + List result = data.ToModel()["data"].ToString().ToModel()["failList"].ToJson().ToModel>(); + HKLog.HKLogImport.WriteInfo($"{result.Count}批量同步同步消费记录调用:{data}"); + return result; } } catch (Exception ex) diff --git a/HKCardOUT/ViewModels/RootViewModel.cs b/HKCardOUT/ViewModels/RootViewModel.cs index 41e08fa..963cda1 100644 --- a/HKCardOUT/ViewModels/RootViewModel.cs +++ b/HKCardOUT/ViewModels/RootViewModel.cs @@ -215,7 +215,7 @@ namespace HKCardOUT.ViewModels Location = input.Address.AsInt().ToString(), Date = DataBus.TodayTime }; - HKLogImport.WriteInfo("读卡成功:" + mo.ToJson()); + HKLogImport.WriteInfo("读卡成功:" + mo.ToJson()+ mo.Date); if (Stacks.Count > 0) { 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, 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 { @@ -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 { @@ -271,7 +270,12 @@ namespace HKCardOUT.ViewModels Location = Info.Location, 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(); } } } diff --git a/HKControl/Main.cs b/HKControl/Main.cs index 4f26135..d3191ae 100644 --- a/HKControl/Main.cs +++ b/HKControl/Main.cs @@ -45,7 +45,7 @@ namespace HKControl return DataModels[3].LeftWindowData.IsSwipe; case 6: if (!DataModels.ContainsKey(3)) return false; - return DataModels[3].LeftWindowData.IsSwipe; + return DataModels[3].RightWindowData.IsSwipe; default: break; } @@ -102,7 +102,7 @@ namespace HKControl case 5: return DataModels[3].LeftWindowData.Complete; case 6: - return DataModels[3].LeftWindowData.Complete; + return DataModels[3].RightWindowData.Complete; default: break; } diff --git a/HKControl/Siemens.cs b/HKControl/Siemens.cs index 753c5df..d2679c7 100644 --- a/HKControl/Siemens.cs +++ b/HKControl/Siemens.cs @@ -18,6 +18,8 @@ namespace HKControl private int Myport; private bool IsStartConnect = false; + private bool IsError = false; + /// /// 打开连接 /// @@ -45,12 +47,17 @@ namespace HKControl IsStartConnect = false; ConnectOk?.Invoke(); HKLog.HKLogImport.WriteInfo($"设备{ip}连接成功"); + IsError = false; //Debug.WriteLine($"设备{ip}连接成功"); } } catch (Exception ex) { - HKLog.HKLogImport.WriteInfo($"设备连接出错:{ip}"); + if (!IsError) + { + HKLog.HKLogImport.WriteInfo($"设备连接出错:{ip}"); + IsError = true; + } Thread.Sleep(3000); Connect(cpuType, ip, port); //Debug.WriteLine(ex.ToString());