Browse Source

Merge branch 'feature/FCC后支付相关补充' into develop

# Conflicts:
#	src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue
Zhenghanjv 4 months ago
parent
commit
77ae11ee27
56 changed files with 2660 additions and 430 deletions
  1. 13 1
      Edge.Core/Core/database/MysqlDbContext.cs
  2. 44 0
      Edge.Core/Domain/FccMachineInfo/FccMachineInfo.cs
  3. 30 0
      Edge.Core/Domain/FccMachineInfo/Input/UploadMachineInfo.cs
  4. 26 0
      Edge.Core/Domain/FccMachineInfo/Output/MachineInfoOutput.cs
  5. 22 0
      Edge.Core/Domain/FccMachineInfo/Output/SetMachineInfoOutput.cs
  6. 15 2
      Edge.Core/Domain/FccNozzleInfo/FccNozzleInfo.cs
  7. 57 1
      Edge.Core/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs
  8. 14 3
      Edge.Core/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs
  9. 13 0
      Edge.Core/Domain/FccNozzleInfo/Output/SimpleNozzleInfoOutput.cs
  10. 20 1
      Edge.Core/Domain/FccOrderInfo/FccOrderInfo.cs
  11. 9 9
      Edge.Core/Domain/FccOrderInfo/Input/OrderInfoPageInput.cs
  12. 45 13
      Edge.Core/Domain/FccOrderInfo/Output/OrderInfoOutput.cs
  13. 5 0
      Edge.Core/Domain/FccStationInfo/FccStationInfo.cs
  14. 7 1
      Edge.Core/Domain/FccStationInfo/Input/StationInfoInput.cs
  15. 37 0
      Edge.Core/Domain/FccStationInfo/Output/OrderFilterOutput.cs
  16. 5 4
      Edge.Core/Domain/FccStationInfo/Output/StationInfoOutput.cs
  17. 42 0
      Edge.Core/MqttClient/IMqttClientService.cs
  18. 110 0
      Edge.Core/MqttClient/MqttClientService.cs
  19. 14 1
      Edge.Core/Processor/GenericDeviceProcessor.cs
  20. 19 13
      Edge.Core/Processor/IDeviceHandler.cs
  21. 5 0
      Edge.Core/Processor/Outgoing/Outgoing.cs
  22. 253 63
      HengshanPaymentTerminal/HengshanPayTermHandler.cs
  23. 83 237
      HengshanPaymentTerminal/Http/HttpClientUtils.cs
  24. 28 0
      HengshanPaymentTerminal/Http/IHttpClientUtil.cs
  25. 123 0
      HengshanPaymentTerminal/Http/Request/HttpRequest.cs
  26. 0 53
      HengshanPaymentTerminal/Mqtt/Request/MqttAuthorizationRequest.cs
  27. 642 0
      HengshanPaymentTerminal/Mqtt/Request/MqttRequest.cs
  28. 11 0
      src/FccLife.Web/Controller/ConfigController.cs
  29. 39 0
      src/FccLife.Web/Controller/MachineController.cs
  30. 7 0
      src/FccLife.Web/Controller/TankController.cs
  31. 4 0
      src/FccLife.Web/Program.cs
  32. 14 0
      src/FccLife.Web/Repositories/FccMachineInfo/IMachineRepository.cs
  33. 88 0
      src/FccLife.Web/Repositories/FccMachineInfo/MachineReposity.cs
  34. 15 0
      src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs
  35. 43 1
      src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs
  36. 5 0
      src/FccLife.Web/Repositories/FccOrderInfo/IOrderInfoReposity.cs
  37. 9 1
      src/FccLife.Web/Repositories/FccOrderInfo/OrderInfoReposity.cs
  38. 7 0
      src/FccLife.Web/Repositories/FccStationInfo/IStationRepository.cs
  39. 11 0
      src/FccLife.Web/Repositories/FccStationInfo/StationRepository.cs
  40. 14 0
      src/FccLife.Web/Services/FccMachineInfo/IMachineService.cs
  41. 59 0
      src/FccLife.Web/Services/FccMachineInfo/MachineServiceImpl.cs
  42. 7 0
      src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs
  43. 52 9
      src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs
  44. 6 3
      src/FccLife.Web/Services/FccOrderInfo/OrderInfoService.cs
  45. 6 0
      src/FccLife.Web/Services/FccStaionInfo/IStationService.cs
  46. 45 0
      src/FccLife.Web/Services/FccStaionInfo/StationServiceImpl.cs
  47. 16 0
      src/FccWeb/admin.ui.plus-master/src/api/FormValidation.ts
  48. 35 0
      src/FccWeb/admin.ui.plus-master/src/api/api.ts
  49. BIN
      src/FccWeb/admin.ui.plus-master/src/assets/machine.png
  50. BIN
      src/FccWeb/admin.ui.plus-master/src/assets/nozzle.png
  51. BIN
      src/FccWeb/admin.ui.plus-master/src/assets/tank.png
  52. 90 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/addMachine.vue
  53. 92 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/editMachine.vue
  54. 162 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/editOilGunFromMachine.vue
  55. 131 13
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue
  56. 11 1
      src/FccWeb/admin.ui.plus-master/src/views/admin/station/station.vue

+ 13 - 1
Edge.Core/Core/database/MysqlDbContext.cs

@@ -1,4 +1,5 @@
-using Edge.Core.Domain.FccNozzleInfo;
+using Edge.Core.Domain.FccMachineInfo;
+using Edge.Core.Domain.FccNozzleInfo;
 using Edge.Core.Domain.FccOilInfo;
 using Edge.Core.Domain.FccOrderInfo;
 using Edge.Core.Domain.FccStationInfo;
@@ -39,8 +40,12 @@ namespace Edge.Core.Core.database
 
         public DbSet<FccOrderInfo> FccOrderInfos { get; set; }
 
+        public DbSet<FccMachineInfo> FccMachineInfos { get; set; }
+
         protected override void OnModelCreating(ModelBuilder modelBuilder)
         {
+            
+
             modelBuilder.Entity<FccTankInfo>()
                 .HasOne(tankInfos => tankInfos.Oil)
                 .WithMany(oilInfo => oilInfo.FccTankInfo)
@@ -54,6 +59,13 @@ namespace Edge.Core.Core.database
                 .HasForeignKey(nozzleInfo => nozzleInfo.TankId)
                 .OnDelete(DeleteBehavior.Restrict);
 
+            modelBuilder.Entity<FccNozzleInfo>()
+                .HasOne(nozzleInfo => nozzleInfo.FccMachineInfo)
+                .WithMany(machine => machine.fccNozzleInfos)
+                .HasForeignKey(nozzle => nozzle.MachineId)
+                .OnDelete(DeleteBehavior.Restrict);
+
+
             base.OnModelCreating(modelBuilder);
         }
     }

+ 44 - 0
Edge.Core/Domain/FccMachineInfo/FccMachineInfo.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccMachineInfo
+{
+    /// <summary>
+    /// 油机表
+    /// </summary>
+    [Table("qr_machine")]
+    public class FccMachineInfo
+    {
+        /// <summary>
+        /// 油机id
+        /// </summary>
+        [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+        public long Id {  get; set; }
+
+        /// <summary>
+        /// 油机名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 连接FCC端口
+        /// </summary>
+        public int Port { get; set; }
+
+        /// <summary>
+        /// 关联的站点id
+        /// </summary>
+        [ForeignKey("stationInfo")]
+        public long StationId { get; set; }
+
+        public FccStationInfo.FccStationInfo stationInfo { get; set; }
+
+        public ICollection<FccNozzleInfo.FccNozzleInfo> fccNozzleInfos { get; set; }
+    }
+}

+ 30 - 0
Edge.Core/Domain/FccMachineInfo/Input/UploadMachineInfo.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccMachineInfo.Input
+{
+    public class UploadMachineInfo
+    {
+        public long? Id { get; set; }
+
+        public string Name { get; set; }
+
+        public int Port { get; set; }
+
+        public long StationId { get; set; }
+
+        public FccMachineInfo ToComponent()
+        {
+            return new FccMachineInfo()
+            {
+                Name = this.Name,
+                Port = this.Port,
+                StationId = this.StationId
+            };
+
+        }
+    }
+}

+ 26 - 0
Edge.Core/Domain/FccMachineInfo/Output/MachineInfoOutput.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccMachineInfo.Output
+{
+    public class MachineInfoOutput
+    {
+        public long Id { get; set; }
+
+        public string Name { get; set; }
+
+        public int Port { get; set; }
+
+        public List<NozzleInfo> Nozzles { get; set; }
+    }
+
+    public class NozzleInfo
+    {
+        public long Id { get; set; }
+
+        public int NozzleNumer { get; set; }
+    }
+}

+ 22 - 0
Edge.Core/Domain/FccMachineInfo/Output/SetMachineInfoOutput.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccMachineInfo.Output
+{
+    public class SetMachineInfoOutput
+    {
+        /// <summary>
+        /// 结果
+        /// </summary>
+        public bool Result { get; set; }
+
+
+        /// <summary>
+        /// 信息
+        /// </summary>
+        public string Message { get; set; }
+    }
+}

+ 15 - 2
Edge.Core/Domain/FccNozzleInfo/FccNozzleInfo.cs

@@ -13,10 +13,15 @@ namespace Edge.Core.Domain.FccNozzleInfo
         [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
         public long Id { get; set; }
 
+        ///// <summary>
+        ///// 油机连接FCC端口
+        ///// </summary>
+        //public int Port { get; set; }
+
         /// <summary>
-        /// 油机连接FCC端口
+        /// 云端油枪id
         /// </summary>
-        public int Port { get; set; }
+        public long CloundNozzleId { get; set; } = 0;
 
         /// <summary>
         /// 加油点
@@ -44,6 +49,14 @@ namespace Edge.Core.Domain.FccNozzleInfo
         /// </summary>
         public int TankNum { get; set; }
 
+        /// <summary>
+        /// 关联的油机id
+        /// </summary>
+        [ForeignKey("FccMachineInfo")]
+        public long MachineId { get; set; }
+
         public FccTankInfo.FccTankInfo Tank { get; set; }
+
+        public FccMachineInfo.FccMachineInfo FccMachineInfo { get; set; }
     }
 }

+ 57 - 1
Edge.Core/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs

@@ -41,7 +41,6 @@
         {
             return new FccNozzleInfo()
             {
-                Port = this.Port,
                 FuelPoint = this.FuelPoint,
                 InternalNum = this.InternalNum,
                 ExternalNum = this.NozzleNum,
@@ -50,4 +49,61 @@
             };
         }
     }
+
+    public class UploadNozzleInfoForMazhineInput
+    {
+        /// <summary>
+        /// 油枪id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 云端油枪id
+        /// </summary>
+        public long? CloundNozzleId { get; set; }
+
+        /// <summary>
+        /// 加油点
+        /// </summary>
+        public int FuelPoint { get; set; }
+
+        /// <summary>
+        /// 内部枪号
+        /// </summary>
+        public int InternalNum { get; set; }
+
+        /// <summary>
+        /// 外部枪号
+        /// </summary>
+        public int NozzleNum { get; set; }
+
+        /// <summary>
+        /// 关联油罐id
+        /// </summary>
+        public long TankId { get; set; }
+
+        /// <summary>
+        /// 关联油罐号
+        /// </summary>
+        public int TankNum { get; set; }
+
+        /// <summary>
+        /// 油机id
+        /// </summary>
+        public long MachineId { get; set; }
+
+        public FccNozzleInfo ToComponent()
+        {
+            return new FccNozzleInfo()
+            {
+                CloundNozzleId = this.CloundNozzleId ?? 0,
+                FuelPoint = this.FuelPoint,
+                InternalNum = this.InternalNum,
+                ExternalNum = this.NozzleNum,
+                TankId = this.TankId,
+                TankNum = this.TankNum,
+                MachineId = this.MachineId
+            };
+        }
+    }
 }

+ 14 - 3
Edge.Core/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs

@@ -8,9 +8,9 @@
         public long Id { get; set; }
 
         /// <summary>
-        /// 油机连接FCC端口
+        /// 云端油枪id
         /// </summary>
-        public int Port { get; set; }
+        public long CloundNozzleId { get; set; }
 
         /// <summary>
         /// 加油点
@@ -42,17 +42,28 @@
         /// </summary>
         public List<RelatableTank> RelatableTanks { get; set; }
 
+        /// <summary>
+        /// 油机id
+        /// </summary>
+        public long MachineId { get; set; }
+
+        /// <summary>
+        /// 油品名
+        /// </summary>
+        public string OilName { get; set; }
+
         public DetailsNozzleInfoOutput() { }
 
         public DetailsNozzleInfoOutput(FccNozzleInfo fccNozzleInfo)
         {
             this.Id = fccNozzleInfo.Id;
-            this.Port = fccNozzleInfo.Port;
+            this.CloundNozzleId = fccNozzleInfo.CloundNozzleId;
             this.FuelPoint = fccNozzleInfo.FuelPoint;
             this.InternalNum = fccNozzleInfo.InternalNum;
             this.NozzleNum = fccNozzleInfo.ExternalNum;
             this.TankId = fccNozzleInfo.TankId;
             this.TankNum = fccNozzleInfo.TankNum;
+            this.MachineId = fccNozzleInfo.MachineId;
         }
         public class RelatableTank
         {

+ 13 - 0
Edge.Core/Domain/FccNozzleInfo/Output/SimpleNozzleInfoOutput.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccNozzleInfo.Output
+{
+    public class SimpleNozzleInfoOutput
+    {
+        public long Id { get; set; }
+    }
+}

+ 20 - 1
Edge.Core/Domain/FccOrderInfo/FccOrderInfo.cs

@@ -49,7 +49,7 @@ namespace Edge.Core.Domain.FccOrderInfo
         public String OilName { get; set; }
 
         /// <summary>
-        /// 支付状态
+        /// 支付状态: 0:未支付 1:已支付 2:退全款 3:退余额:4:卡支付
         /// </summary>
         public int PaymentStatus {  get; set; }
 
@@ -78,6 +78,10 @@ namespace Edge.Core.Domain.FccOrderInfo
         /// </summary>
         public decimal? AmountPayable { get; set; }
 
+        /// <summary>
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
         /// <summary>
         /// 单价
         /// </summary>
@@ -92,6 +96,21 @@ namespace Edge.Core.Domain.FccOrderInfo
         /// 是否删除——0:否;1:是
         /// </summary>
         public int IsDelete { get; set; }
+
+        /// <summary>
+        /// 支付用户名
+        /// </summary>
+        public string UserName { get; set; }
+
+        /// <summary>
+        /// 手机号
+        /// </summary>
+        public string PhoneNumber { get; set; }
+
+        /// <summary>
+        /// 支付类型名称
+        /// </summary>
+        public string PaymentName { get; set; }
     }
 
 }

+ 9 - 9
Edge.Core/Domain/FccOrderInfo/Input/OrderInfoPageInput.cs

@@ -41,14 +41,14 @@ namespace Edge.Core.Domain.FccOrderInfo.Input
         /// </summary>
         public DateTime? endCheckTime { get; set; }
 
-        ///// <summary>
-        ///// 流水号
-        ///// </summary>
-        //public int? ttc { get; set; }
-
-        ///// <summary>
-        ///// 支付状态
-        ///// </summary>
-        //public int? paymentStatus { get; set; }
+        /// <summary>
+        /// 支付类型
+        /// </summary>
+        public long? paymentType { get; set; }
+
+        /// <summary>
+        /// 手机号或支付用户名
+        /// </summary>
+        public string? phoneNumberOruserName { get; set; }
     }
 }

+ 45 - 13
Edge.Core/Domain/FccOrderInfo/Output/OrderInfoOutput.cs

@@ -23,23 +23,41 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
     /// </summary>
     public class OrderInfo
     {
-        public OrderInfo(FccOrderInfo fccOrderInfo)
+        public OrderInfo(FccOrderInfo fccOrderInfo,string stationName,string machineName)
         {
+            this.StationName = stationName;
+            this.MachineName = machineName;
+
             this.Id = fccOrderInfo.Id;
-            this.CloundOrderId = fccOrderInfo.CloundOrderId;
             this.Ttc = fccOrderInfo.Ttc;
+            this.AuthorizationTime = fccOrderInfo.AuthorizationTime;
+            this.EndTime = fccOrderInfo.EndTime;
+            this.PaymentTime = fccOrderInfo.PaymentTime;
             this.NozzleNum = fccOrderInfo.NozzleNum;
             this.OilName = fccOrderInfo.OilName;
+            this.PaymentStatus = fccOrderInfo.PaymentStatus;
+            this.PayType = fccOrderInfo.PayType;
+            this.CloundOrderId = fccOrderInfo.CloundOrderId;
             this.Amount = fccOrderInfo.Amount;
             this.Volume = fccOrderInfo.Volume;
             this.AmountPayable = fccOrderInfo.AmountPayable;
             this.Price = fccOrderInfo.Price;
-            this.AuthorizationTime = fccOrderInfo.AuthorizationTime;
-            this.EndTime = fccOrderInfo.EndTime;
-            this.PaymentTime = fccOrderInfo.PaymentTime;
-            this.PaymentStatus = fccOrderInfo.PaymentStatus;
-            this.PayType = fccOrderInfo.PayType;
+            this.RefundAmount = fccOrderInfo.RefundAmount;
+            this.UserName = fccOrderInfo.UserName;
+            this.PhoneNumber = fccOrderInfo.PhoneNumber;
+            this.PaymentName = fccOrderInfo.PaymentName;
         }
+
+        /// <summary>
+        /// 油站名
+        /// </summary>
+        public string StationName { get; set; }
+
+        /// <summary>
+        /// 油机号
+        /// </summary>
+        public string MachineName { get; set; }
+
         /// <summary>
         /// 订单id
         /// </summary>
@@ -111,14 +129,25 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
         public decimal Price { get; set; }
 
         /// <summary>
-        /// 是否已上传云端—— 0:未上传;1:已上传;2:不需要上传
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 用户名
+        /// </summary>
+        public string UserName { get; set; }
+
+
+        /// <summary>
+        /// 手机号
         /// </summary>
-        public int UploadState { get; set; }
+        public string PhoneNumber { get; set; }
 
         /// <summary>
-        /// 是否删除——0:否;1:是
+        /// 支付类型名称
         /// </summary>
-        public int IsDelete { get; set; }
+        public string PaymentName { get; set; }
 
         public FccOrderInfo ToComponent()
         {
@@ -136,8 +165,11 @@ namespace Edge.Core.Domain.FccOrderInfo.Output
                 Amount = this.Amount,
                 Volume = this.Volume,
                 AmountPayable = this.AmountPayable,
-                UploadState = this.UploadState,
-                IsDelete = this.IsDelete
+                Price = this.Price,
+                RefundAmount =  this.RefundAmount,
+                UserName = this.UserName,
+                PhoneNumber = this.PhoneNumber,
+                PaymentName = this.PaymentName
             };
         }
     }

+ 5 - 0
Edge.Core/Domain/FccStationInfo/FccStationInfo.cs

@@ -69,6 +69,11 @@ namespace Edge.Core.Domain.FccStationInfo
         /// </summary>
         public string WebSocketPort { get; set; }
 
+        /// <summary>
+        /// 支付方式,逗号隔开
+        /// </summary>
+        public string PaymentType { get; set; }
+
         public ICollection<FccTankInfo.FccTankInfo> FccTankInfo { get; set; }
     }
 }

+ 7 - 1
Edge.Core/Domain/FccStationInfo/Input/StationInfoInput.cs

@@ -64,6 +64,11 @@ namespace Edge.Core.Domain.FccStationInfo.Input
         /// </summary>
         public string? WebSocketPort { get; set; }
 
+        /// <summary>
+        /// 支付方式,逗号隔开
+        /// </summary>
+        public string PaymentType { get; set; }
+
         public FccStationInfo? ToComponent()
         {
             if (IsNotNorm()) return null;
@@ -80,7 +85,8 @@ namespace Edge.Core.Domain.FccStationInfo.Input
                 CloudService = this.CloudService,
                 MqttService = this.MqttService,
                 IcardService = this.IcardService != null ? this.IcardService : "",
-                WebSocketPort = this.WebSocketPort
+                WebSocketPort = this.WebSocketPort,
+                PaymentType = this.PaymentType
             };
         }
 

+ 37 - 0
Edge.Core/Domain/FccStationInfo/Output/OrderFilterOutput.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccStationInfo.Output
+{
+    /// <summary>
+    /// 订单过滤条件输出
+    /// </summary>
+    public class OrderFilterOutput
+    {
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public List<PaymentType> payments { get; set; }
+
+        /// <summary>
+        /// 站点
+        /// </summary>
+        public string stations { get; set; }
+    }
+
+    public class PaymentType
+    {
+        /// <summary>
+        /// 支付类型id
+        /// </summary>
+        public long id { get; set; }
+
+        /// <summary>
+        /// 支付类型名称
+        /// </summary>
+        public string paymentName { get; set; }
+    }
+}

+ 5 - 4
Edge.Core/Domain/FccStationInfo/Output/StationInfoOutput.cs

@@ -36,6 +36,7 @@ namespace Edge.Core.Domain.FccStationInfo.Output
             this.MqttService = fccStationInfo.MqttService;
             this.IcardService = fccStationInfo.IcardService;
             this.WebSocketPort = fccStationInfo.WebSocketPort;
+            this.PaymentType = fccStationInfo.PaymentType;
         }
         /// <summary>
         /// id
@@ -93,13 +94,13 @@ namespace Edge.Core.Domain.FccStationInfo.Output
         public string? IcardService { get; set; }
 
         /// <summary>
-        /// 本地 fcc 与油机 socket 通讯端口
+        /// 本地 fcc 与 fcc 页面 webSocket 端口
         /// </summary>
-        public string ServicePort { get; set; }
+        public string WebSocketPort { get; set; }
 
         /// <summary>
-        /// 本地 fcc 与 fcc 页面 webSocket 端口
+        /// 支付方式,逗号隔开
         /// </summary>
-        public string WebSocketPort { get; set; }
+        public string PaymentType { get; set; }
     }
 }

+ 42 - 0
Edge.Core/MqttClient/IMqttClientService.cs

@@ -0,0 +1,42 @@
+using MQTTnet.Client;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.MqttClient
+{
+    public interface IMqttClientService
+    {
+        /// <summary>
+        /// 开启 Mqtt
+        /// </summary>
+        /// <param name="topics">要订阅的主题</param>
+        void Start();
+
+        /// <summary>
+        /// 发布主题
+        /// </summary>
+        /// <param name="topic">发布的主题</param>
+        /// <param name="paramsJson">参数 json 串</param>
+        void Public(string topic, string paramsJson);
+
+        /// <summary>
+        /// MQTT 已连接事件
+        /// </summary>
+        event EventHandler<MqttClientConnectedEventArgs> OnConnect;
+
+        /// <summary>
+        /// MQTT 已断开事件
+        /// </summary>
+        event EventHandler<MqttClientDisconnectedEventArgs> OnDisconnect;
+
+        /// <summary>
+        /// MQTT 获取到信息事件
+        /// </summary>
+        event EventHandler<MqttApplicationMessageReceivedEventArgs> OnApplicationMessageReceived;
+
+
+    }
+}

+ 110 - 0
Edge.Core/MqttClient/MqttClientService.cs

@@ -0,0 +1,110 @@
+using Edge.Core.Core.database;
+using MQTTnet;
+using MQTTnet.Client;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.MqttClient
+{
+    public class MqttClientService: IMqttClientService
+    {
+        private static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+
+        private string[] topics;//需要订阅的主题
+        private IMqttClient _mqttClient; //mqtt 客户端
+        public MqttClientService() { }
+
+        public event EventHandler<MqttClientConnectedEventArgs> OnConnect;
+        public event EventHandler<MqttClientDisconnectedEventArgs> OnDisconnect;
+        public event EventHandler<MqttApplicationMessageReceivedEventArgs> OnApplicationMessageReceived;
+
+        public void Public(string topic, string paramsJson)
+        {
+            
+        }
+
+        public void Start()
+        {
+            using (var dbContext = new MysqlDbContext())
+            {
+                Domain.FccStationInfo.FccStationInfo? fccStationInfo = dbContext.FccStationInfos.FirstOrDefault();
+                string? mqttService = fccStationInfo?.MqttService;
+                string? buildId = fccStationInfo?.BuildId;
+                if (mqttService == null || buildId == null)
+                {
+                    Logger.Info($"can not get mqttService:{mqttService} and buildId:{buildId}");
+                    return;
+                }
+                string[] hostAndPort = mqttService.Split(":");
+                MqttClientOptions mqttClientOptions = new MqttClientOptionsBuilder()
+                    .WithTcpServer(hostAndPort[0], hostAndPort[1].ToString().ToInt())
+                    .WithClientId(buildId)
+                    .WithCleanSession()
+                    .WithTlsOptions(new MqttClientTlsOptions()
+                    {
+                        UseTls = false
+                    })
+                    .Build();
+
+                _mqttClient = new MqttFactory().CreateMqttClient();
+
+                this.topics = new string[] { $"fromClound/{buildId}" };
+                _mqttClient.ConnectedAsync += mqttConnected;
+                _mqttClient.DisconnectedAsync += mqttDisConnected;
+                _mqttClient.ApplicationMessageReceivedAsync += mqttOnReceive;
+
+                _mqttClient.ConnectAsync(mqttClientOptions);
+            }
+        }
+
+        /// <summary>
+        /// MQTT 已连接事件
+        /// </summary>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private Task mqttConnected(MqttClientConnectedEventArgs args)
+        {
+            Logger.Info($"mqtt connected");
+
+            topics.ForEach(topic =>
+            {
+                _mqttClient.SubscribeAsync(topic, MQTTnet.Protocol.MqttQualityOfServiceLevel.AtLeastOnce);
+            });
+
+            OnConnect?.Invoke(this, args);
+            return Task.CompletedTask;
+        }
+
+        /// <summary>
+        /// MQTT 断开连接
+        /// </summary>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private Task mqttDisConnected(MqttClientDisconnectedEventArgs args)
+        {
+            Logger.Info($"mqtt disconnect",JsonConvert.SerializeObject(args));
+
+            Start();
+            OnDisconnect?.Invoke(this, args);
+            return Task.CompletedTask;
+        }
+
+        /// <summary>
+        /// MQTT 获取到数据
+        /// </summary>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private Task mqttOnReceive(MqttApplicationMessageReceivedEventArgs args)
+        {
+            Logger.Info($"mqtt receive message");
+
+            OnApplicationMessageReceived?.Invoke(this, args);
+            return Task.CompletedTask;
+        }
+
+    }
+}

+ 14 - 1
Edge.Core/Processor/GenericDeviceProcessor.cs

@@ -1,4 +1,5 @@
-using Edge.Core.Parser;
+using Edge.Core.MqttClient;
+using Edge.Core.Parser;
 using Edge.Core.Parser.BinaryParser.MessageEntity;
 using Edge.Core.Processor.Communicator;
 using Edge.Core.Processor.Dispatcher.Attributes;
@@ -147,6 +148,18 @@ namespace Edge.Core.Processor
                           + " From_CommOnDataReceived_To_CommOnDataWriting elapsed " + (this.perfWatch_From_CommOnDataReceived_To_CommOnDataWriting?.ElapsedMilliseconds ?? -1));
                 }
             };
+
+            //------------------------- MQTT ---------------------------------
+            MqttClientService mqttClientService = new MqttClientService();
+            mqttClientService.OnConnect += (s, a) => { };
+            mqttClientService.OnDisconnect += (s, a) => { };
+            mqttClientService.OnApplicationMessageReceived += (s, a) =>
+            {
+                var message = Encoding.UTF8.GetString(a.ApplicationMessage.Payload);
+                handler.OnReceiveMqttMessage(message);
+            };
+            
+            mqttClientService.Start();
         }
 
         //public void Dispose()

+ 19 - 13
Edge.Core/Processor/IDeviceHandler.cs

@@ -34,25 +34,31 @@ namespace Edge.Core.Processor
         Task Test(params object[] parameters) { throw new NotImplementedException("暂不支持测试"); }
 
         /// <summary>
-        /// 发送二维码信息
+        /// 接收到 MQTT 数据
         /// </summary>
-        void SendQRCodeAsync() { }
+        /// <param name="message">数据 json </param>
+        void OnReceiveMqttMessage(string message) { }
 
         /// <summary>
-        /// 发送实付金额给油机
+        /// 发送二维码信息
         /// </summary>
-        /// <param name="orderInfo"></param>
-        void SendActuallyPaid(FccOrderInfo orderInfo) { }
+        void SendQRCodeAsync() { }
 
-        /// <summary>
-        /// 设置tcp连接客户端,所连接的服务端端口
-        /// </summary>
-        void SetTcpClient(TcpClient? client,int? serverPort) { }
+        ///// <summary>
+        ///// 发送实付金额给油机
+        ///// </summary>
+        ///// <param name="orderInfo"></param>
+        //void SendActuallyPaid(FccOrderInfo orderInfo) { }
 
-        /// <summary>
-        /// 当与客户端断开链接
-        /// </summary>
-        void OnTcpDisconnect() { }
+        ///// <summary>
+        ///// 设置tcp连接客户端,所连接的服务端端口
+        ///// </summary>
+        //void SetTcpClient(TcpClient? client,int? serverPort) { }
+
+        ///// <summary>
+        ///// 当与客户端断开链接
+        ///// </summary>
+        //void OnTcpDisconnect() { }
     }
 
     public abstract class TestableActivePollingDeviceHandler<TRaw, TMessage> : IDeviceHandler<TRaw, TMessage> where TMessage : MessageBase

+ 5 - 0
Edge.Core/Processor/Outgoing/Outgoing.cs

@@ -112,6 +112,11 @@ namespace Edge.Core.Processor
 
         public virtual async Task<WriteRepsonse> WriteAsyncAndCheckIsConnect(TMessage request, Func<TMessage, TMessage, bool> responseCapture, int timeout)
         {
+            if(isConnectTask == null) return new WriteRepsonse()
+            {
+                ResponseType = WriteResponseType.DISCONNECT,
+                Data = false,
+            };
             Task<TMessage> sendTask = WriteAsync(request, responseCapture, timeout);
             Task responseTask = await Task.WhenAny(sendTask, isConnectTask.Task);
             var type = WriteResponseType.TIME_OUT;

+ 253 - 63
HengshanPaymentTerminal/HengshanPayTermHandler.cs

@@ -30,6 +30,9 @@ using Newtonsoft.Json;
 using HengshanPaymentTerminal.Http.Response;
 using HengshanPaymentTerminal.MessageEntity.Outgoing;
 using Microsoft.IdentityModel.Tokens;
+using Org.BouncyCastle.Asn1.Ocsp;
+using Newtonsoft.Json.Linq;
+using System.Net;
 
 namespace HengshanPaymentTerminal
 {
@@ -701,11 +704,61 @@ namespace HengshanPaymentTerminal
         /// <summary>
         /// 获取站点信息
         /// </summary>
-        private void GetInfo()
+        private async void GetInfo()
         {
             Edge.Core.Domain.FccStationInfo.FccStationInfo? fccStationInfo = MysqlDbContext.FccStationInfos.FirstOrDefault();
             if(fccStationInfo != null) stationInfo = new StationInfo(fccStationInfo);
-            nozzleInfoList = MysqlDbContext.NozzleInfos.ToList().Select(n => new DetailsNozzleInfoOutput(n)).ToList();
+            Edge.Core.Domain.FccMachineInfo.FccMachineInfo? fccMachineInfo = await MysqlDbContext.FccMachineInfos.FirstOrDefaultAsync(machine => machine.Port == serverPort);
+            if(fccMachineInfo == null)
+            {
+                nozzleInfoList = new List<DetailsNozzleInfoOutput>();
+            } else
+            {
+                nozzleInfoList = MysqlDbContext.NozzleInfos.Where(nozzle => nozzle.MachineId == fccMachineInfo.Id).Select(n => new DetailsNozzleInfoOutput(n)).ToList();
+            }
+            
+        }
+
+        /// <summary>
+        /// 接收到MQTT
+        /// </summary>
+        /// <param name="message"></param>
+        public async void OnReceiveMqttMessage(string message)
+        {
+            MqttRequest? mqttRequest = JsonConvert.DeserializeObject<MqttRequest>(message);
+            if (mqttRequest == null)
+            {
+                logger.Error($"mqtt message turn on object fail,message:{message}");
+                return;
+            }
+            switch (mqttRequest.type)
+            {
+                case MQTT_TYPE.AUTHORIZATION:
+                    {
+                        
+                        MqttAuthorizationRequest? mqttAuthorizationRequest = JsonConvert.DeserializeObject<MqttAuthorizationRequest>(mqttRequest.data);
+                        await SendAuthorizationAsync(mqttAuthorizationRequest);
+                        break;
+                    }
+                case MQTT_TYPE.UNAUTHORIZATION:
+                    {
+                        MqttUnAhorizationRequest? mqttUnAhorizationRequest = JsonConvert.DeserializeObject<MqttUnAhorizationRequest>(mqttRequest.data);
+                        await SendUnAuthorizartion(mqttUnAhorizationRequest);
+                        break;
+                    }
+                case MQTT_TYPE.PAID:
+                    {
+                        MqttPaidRequest? mqttPaidRequest = JsonConvert.DeserializeObject<MqttPaidRequest>(mqttRequest.data);
+                        await SendActuallyPaid(mqttPaidRequest);
+                        break;
+                    }
+                case MQTT_TYPE.REFUND:
+                    {
+                        MqttRefundRequest? mqttRefundRequest = JsonConvert.DeserializeObject<MqttRefundRequest>(mqttRequest.data);
+                        await OnRecieveOrderRefund(mqttRefundRequest);
+                        break;
+                    }
+            }
         }
 
         /// <summary>
@@ -721,8 +774,8 @@ namespace HengshanPaymentTerminal
                 return;
             }
 
-            List<DetailsNozzleInfoOutput> nozzles = nozzleInfoList.FindAll(nozzle => nozzle.Port == serverPort);
-            foreach (var item in nozzles)
+            
+            foreach (var item in nozzleInfoList)
             {
                 //List<Byte> list = new List<Byte>();
                 //byte[] commandAndNozzle = { 0x63, (byte)item.NozzleNum };
@@ -773,53 +826,69 @@ namespace HengshanPaymentTerminal
         /// 发送实付金额给油机
         /// </summary>
         /// <param name="orderInfo"></param>
-        public async void SendActuallyPaid(FccOrderInfo orderInfo) 
+        public async Task SendActuallyPaid(MqttPaidRequest? request) 
         {
-            //List<Byte> list = new List<Byte>();
-            //byte[] commandAndNozzle = { 0x19, (byte)orderInfo.NozzleNum };
-            //byte[] ttcBytes = NumberToByteArrayWithPadding(orderInfo.Ttc, 4);
-
-            //byte[] amountPayableBytes = FormatDecimal(orderInfo.AmountPayable ?? orderInfo.Amount);
-            //list.AddRange(commandAndNozzle);    //添加命令字和枪号
-            //list.AddRange(ttcBytes);            //添加流水号
-            //list.Add(0x21);                     //由fcc推送实付金额表示该订单是二维码小程序支付的
-            //list.AddRange(amountPayableBytes);  //添加实付金额
-            ////添加3位交易金额1,3位交易金额2,2位优惠规则代码,10位卡应用号,4位消息鉴别码
-            //list.AddRange(new byte[] { 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00 });
-            //byte[] sendBytes = content2data(list.ToArray(), null);
-
-
-            SendActuallyPaid sendActuallyPaid = new SendActuallyPaid(orderInfo.NozzleNum, orderInfo.Ttc, orderInfo.AmountPayable ?? orderInfo.Amount, getFrame(null));
-            byte[] commandAndNozzle = { sendActuallyPaid.Handle, (byte)sendActuallyPaid.NozzleNum };
-            await SendMessageToMaichine("发送实付金额", (request, response) =>
+            if (request == null)
             {
-                if (response.Handle == (byte)CommonMessage.Command.SEND_NEED_AMOUNT)
-                {
-                    CommonAnswerBack commonAnswerBack = (CommonAnswerBack)response;
-                    return commonAnswerBack.Command == (byte)CommonMessage.Command.SEND_NEED_AMOUNT && commonAnswerBack.NozzleNum == sendActuallyPaid.NozzleNum;
-                }
-                return false;
-            }, sendActuallyPaid);
+                logger.Error($"mqtt get paid request is null");
+                return;
+            }
+
+            //通知云端当前已收到消息
+            OnGetPaidInfo onGetPaidInfo = new OnGetPaidInfo()
+            {
+                Id = request.Id,
+                Result = 1
+            };
+            await httpClientUtil.SendRecievePaidNotice(JsonConvert.SerializeObject(onGetPaidInfo));
+
+            FccOrderInfo? fccOrderInfo = MysqlDbContext.FccOrderInfos.FirstOrDefault(order => order.CloundOrderId == request.Id);
+            if (fccOrderInfo == null)
+            {
+                logger.Error($"[mqtt paid order notice]:can not find order by clounid:{request.Id}");
+                return;
+            }
+            fccOrderInfo.AmountPayable = request.ActualPaymentAmount;
+            fccOrderInfo.PaymentTime = request.TransactionTime;
+            fccOrderInfo.PaymentStatus = 1;
+            MysqlDbContext.SaveChanges();
+
+            //SendActuallyPaid sendActuallyPaid = new SendActuallyPaid(orderInfo.NozzleNum, orderInfo.Ttc, orderInfo.AmountPayable ?? orderInfo.Amount, getFrame(null));
+            //byte[] commandAndNozzle = { sendActuallyPaid.Handle, (byte)sendActuallyPaid.NozzleNum };
+            //await SendMessageToMaichine("发送实付金额", (request, response) =>
+            //{
+            //    if (response.Handle == (byte)CommonMessage.Command.SEND_NEED_AMOUNT)
+            //    {
+            //        CommonAnswerBack commonAnswerBack = (CommonAnswerBack)response;
+            //        return commonAnswerBack.Command == (byte)CommonMessage.Command.SEND_NEED_AMOUNT && commonAnswerBack.NozzleNum == sendActuallyPaid.NozzleNum;
+            //    }
+            //    return false;
+            //}, sendActuallyPaid);
             //await SendMessageToMaichine("发送实付金额", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendActuallyPaid);
         }
 
-        public async Task<CommonMessage> SendAuthorization(MqttAuthorizationRequest request)
+        /// <summary>
+        /// 发送授权请求给油机
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task SendAuthorizationAsync(MqttAuthorizationRequest? request)
         {
-            //List<Byte> list = new List<Byte>();
-            //byte[] commandAndNozzle = { 0x65, (byte)request.NozzleNum };
-            //byte[] authorizationTimeBytes = ConvertDateTimeToByteArray(request.AuthorizationTime);
-            ////将小数点后移两位,因为油机只支持两位小数点,这边传过去的3位字节转为int后取后两位为十分位和百分位
-            //int value = (int)request.Value * 100;
-            //byte[] valueBytes = NumberToByteArrayWithPadding(value, 3);
-            //list.AddRange(commandAndNozzle);
-            //list.AddRange(authorizationTimeBytes);
-            //list.Add((byte)request.AuthorizationType);
-            //list.AddRange(valueBytes);
-            //byte[] sendBytes = content2data(list.ToArray(), null);
-
-            SendAuthorization sendAuthorization = new SendAuthorization(request.NozzleNum, request.AuthorizationTime, request.AuthorizationType,request.Value, getFrame(null));
+            if(request == null)
+            {
+                logger.Error($"mqtt authorization request is null");
+                return;
+            }
+
+            //添加订单到数据库
+            DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            FccOrderInfo fccOrderInfo = request.ToComponent(authorizationTime);
+            MysqlDbContext.FccOrderInfos.Add(fccOrderInfo);
+
+            //发送授权申请到油机
+            SendAuthorization sendAuthorization = new SendAuthorization((int)request.NozzleId, authorizationTime, 1,request.OriginalAmount, getFrame(null));
             byte[] commandAndNozzle = { sendAuthorization.Handle, (byte)sendAuthorization.NozzleNum };
-            return await SendMessageToMaichine("发送授权请求", (request, response) =>
+            CommonMessage commonMessage = await SendMessageToMaichine("发送授权请求", (request, response) =>
             {
                 if (response.Handle == (byte)CommonMessage.Command.ACCREDIT)
                 {
@@ -828,34 +897,155 @@ namespace HengshanPaymentTerminal
                 }
                 return false;
             }, sendAuthorization);
-            //return await SendMessageToMaichine("发送授权请求", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendAuthorization);
+
+            //发送授权结果给云端
+            string authorizationResultJson = string.Empty;
+            SendAuthorizationResult sendAuthorizationResult = new SendAuthorizationResult();
+            sendAuthorizationResult.NozzleId = request.NozzleId;
+
+            if (commonMessage.IsError)
+            {
+                ErrorMessage errorMessage = (ErrorMessage)commonMessage;
+                switch (errorMessage.TheErrorType)
+                {
+                    case CommonMessage.ErrorType.DISCONNECT:
+                        sendAuthorizationResult.OilMachineStatus = OilMachineStatus.Disconnected;
+                        break;
+                    case CommonMessage.ErrorType.TIMEOUT:
+                        sendAuthorizationResult.OilMachineStatus = OilMachineStatus.AuthorizationTimeout;
+                        break;
+                }
+            }
+            else
+            {
+                AuthorizationResponse authorization = (AuthorizationResponse)commonMessage;
+                if (authorization.Result == 0)
+                {
+                    sendAuthorizationResult.OilMachineStatus = OilMachineStatus.Failed;
+                }
+                else
+                {
+                    sendAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
+                    sendAuthorizationResult.TransactionNumber = authorization.Ttc.ToString();
+                    fccOrderInfo.Ttc = authorization.Result;
+                }
+            }
+            HttpResponseMessage httpResponseMessage = await httpClientUtil.SendAuthorizationResult(JsonConvert.SerializeObject(sendAuthorizationResult));
+            logger.Info($"send authorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content)}");
+
+            //更新订单
+            MysqlDbContext.SaveChanges();
         }
 
-        public async Task<CommonMessage> SendUnAuthorizartion(MqttUnAhorizationRequest request)
+        /// <summary>
+        /// 发送取消授权请求给油机
+        /// </summary>
+        /// <param name="request"></param>
+        public async Task SendUnAuthorizartion(MqttUnAhorizationRequest? request)
         {
-            //List<Byte> list = new List<Byte>();
-            //byte[] commandAndNozzle = { 0x66, (byte)request.NozzleNum };
-            //byte[] authorizationTimeBytes = ConvertDateTimeToByteArray(request.AuthorizationTime);
+            if (request == null)
+            {
+                logger.Error($"mqtt unauthorization request is null");
+                return;
+            }
 
-            //byte[] ttcBytes = NumberToByteArrayWithPadding(request.Ttc, 4);
-            //list.AddRange(commandAndNozzle);
-            //list.AddRange(authorizationTimeBytes);
-            //list.AddRange(ttcBytes);
-            //byte[] sendBytes = content2data(list.ToArray(), null);
+            //从请求信息中获取流水号与授权时间,没有就到数据库查找
+            int ttc = 0;
+            DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            bool ttsIntResult = int.TryParse(request.TransactionNumber, out ttc);
+            if (request.AuthorizationTime == null || !ttsIntResult)
+            {
+                FccOrderInfo? fccOrderInfo = MysqlDbContext.FccOrderInfos.FirstOrDefault(order => order.CloundOrderId == request.Id);
+                if(fccOrderInfo != null)
+                {
+                    ttc = fccOrderInfo.Ttc;
+                    authorizationTime = fccOrderInfo.AuthorizationTime;
+                }
+            }
 
-            SendUnAuthorization sendUnAuthorization = new SendUnAuthorization(request.NozzleNum, request.AuthorizationTime, request.Ttc, getFrame(null));
-            byte[] commandAndNozzle = { sendUnAuthorization.Handle, (byte)sendUnAuthorization.NozzleNum };
+            SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
+            sendUnAuthorizationResult.NozzleId = request.NozzleId;
+            sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
 
-            return await SendMessageToMaichine("发送取消授权请求", (request, response) =>
+            if (ttc != 0)
             {
-                if (response.Handle == (byte)CommonMessage.Command.CANCEL_ACCREDIT)
+                SendUnAuthorization sendUnAuthorization = new SendUnAuthorization((int)request.NozzleId, authorizationTime, ttc, getFrame(null));
+                byte[] commandAndNozzle = { sendUnAuthorization.Handle, (byte)sendUnAuthorization.NozzleNum };
+
+                CommonMessage commonMessage = await SendMessageToMaichine("发送取消授权请求", (request, response) =>
+                {
+                    if (response.Handle == (byte)CommonMessage.Command.CANCEL_ACCREDIT)
+                    {
+                        UnAhorizationResponse unauthorization = (UnAhorizationResponse)response;
+                        return unauthorization.NozzleNum == sendUnAuthorization.NozzleNum;
+                    }
+                    return false;
+                }, sendUnAuthorization);
+                if (commonMessage.IsError)
                 {
-                    UnAhorizationResponse unauthorization = (UnAhorizationResponse)response;
-                    return unauthorization.NozzleNum == sendUnAuthorization.NozzleNum;
+                    ErrorMessage errorMessage = (ErrorMessage)commonMessage;
+                    switch (errorMessage.TheErrorType)
+                    {
+                        case CommonMessage.ErrorType.DISCONNECT:
+                            sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Disconnected;
+                            break;
+                        case CommonMessage.ErrorType.TIMEOUT:
+                            sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.AuthorizationTimeout;
+                            break;
+                    }
                 }
-                return false;
-            }, sendUnAuthorization);
-            //return await SendMessageToMaichine("发送取消授权请求", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendUnAuthorization);
+                else
+                {
+                    UnAhorizationResponse unAuthorization = (UnAhorizationResponse)commonMessage;
+                    if (unAuthorization.Result == 0)
+                    {
+                        sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Failed;
+                    }
+                    else
+                    {
+                        sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
+                    }
+                }
+            }
+            else
+            {
+                sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.TransactionNumberNotFound;
+            }
+
+            HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
+            logger.Info($"send Unauthorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content)}");
+        }
+
+        /// <summary>
+        /// 接收到云端发送订单退款信息
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        private async Task OnRecieveOrderRefund(MqttRefundRequest? request)
+        {
+            if (request == null)
+            {
+                logger.Error($"mqtt OnRecieveOrderRefund request is null");
+                return;
+            }
+            //通知云端当前已收到消息
+            OnGetRefundInfo onGetRefundInfo = new OnGetRefundInfo()
+            {
+                Id = request.Id,
+                Result = 1
+            };
+            await httpClientUtil.SendRecieveRefundNotice(JsonConvert.SerializeObject(onGetRefundInfo));
+
+            FccOrderInfo? fccOrderInfo = MysqlDbContext.FccOrderInfos.FirstOrDefault(order => order.CloundOrderId == request.Id);
+            if (fccOrderInfo == null)
+            {
+                logger.Error($"[mqtt refund order notice]:can not find order by clounid:{request.Id}");
+                return;
+            }
+            fccOrderInfo.AmountPayable = request.ActualPaymentAmount;
+            fccOrderInfo.PaymentStatus = 2;
+            MysqlDbContext.SaveChanges();
+
         }
 
         //public void SetTcpClient(TcpClient? tcpClient, int? serverPort)

+ 83 - 237
HengshanPaymentTerminal/Http/HttpClientUtils.cs

@@ -13,6 +13,14 @@ using Newtonsoft.Json;
 
 namespace HengshanPaymentTerminal.Http
 {
+    public enum SEND_MOTHOD
+    {
+        GET,
+        POST,
+        PUT,
+        DELETE,
+    }
+
     public class HttpClientUtils:IHttpClientUtil
     {
         static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
@@ -33,18 +41,22 @@ namespace HengshanPaymentTerminal.Http
             _httpClientService = new HttpClientService(httpClientFactory);
         }
 
-
-        /// <summary>
-        /// 发送油品信息给云端
-        /// </summary>
-        /// <param name="requestJson"></param>
-        /// <returns></returns>
-        public async Task<HttpResponseMessage> SendOilInfo(string requestJson)
+        public async Task<HttpResponseMessage> SendRquest(string api,string requestJson,SEND_MOTHOD mothod)
         {
             try
             {
                 var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PostAsync("api/nozzle/uploadProduct", requesStr);
+                switch(mothod)
+                {
+                    case SEND_MOTHOD.POST:
+                        return await _httpClientService.PostAsync(api, requesStr);
+                    case SEND_MOTHOD.PUT:
+                        return await _httpClientService.PutAsync(api, requesStr);
+                    case SEND_MOTHOD.DELETE:
+                        return await _httpClientService.DeleteAsync(api, requesStr);
+                }
+
+                throw new Exception("未定义的请求方式");
             }
             catch (Exception ex)
             {
@@ -66,6 +78,16 @@ namespace HengshanPaymentTerminal.Http
             }
         }
 
+        /// <summary>
+        /// 发送油品信息给云端
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        public async Task<HttpResponseMessage> SendOilInfo(string requestJson)
+        {
+            return await SendRquest("api/nozzle/uploadProduct", requestJson,SEND_MOTHOD.POST);
+        }
+
         /// <summary>
         /// 更新油品信息给云端
         /// </summary>
@@ -73,29 +95,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> UpdateOilInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PutAsync("api/nozzle/UpdateProduct", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/UpdateProduct", requestJson, SEND_MOTHOD.PUT);
         }
 
         /// <summary>
@@ -105,29 +105,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> DeleteOilInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.DeleteAsync("api/nozzle/DeleteProduct", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/DeleteProduct", requestJson, SEND_MOTHOD.DELETE);
         }
 
         /// <summary>
@@ -137,29 +115,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> SendTankInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PostAsync("api/nozzle/uploadTanks", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/uploadTanks", requestJson, SEND_MOTHOD.POST);
         }
 
         /// <summary>
@@ -169,29 +125,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> UpdateTankInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PutAsync("api/nozzle/UpdateTanks", requesStr); ;
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/UpdateTanks", requestJson, SEND_MOTHOD.PUT);
         }
 
         /// <summary>
@@ -201,29 +135,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> DeleteTankInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.DeleteAsync("api/nozzle/DeleteTanks", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/DeleteTanks", requestJson, SEND_MOTHOD.DELETE);
         }
 
         /// <summary>
@@ -233,29 +145,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> SendNozzleInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PostAsync("api/nozzle/uploadNozzle", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/uploadNozzle", requestJson, SEND_MOTHOD.POST);
         }
 
         /// <summary>
@@ -265,29 +155,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> UpdateNozzleInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PutAsync("api/nozzle/UpdateNozzle ", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/UpdateNozzle", requestJson, SEND_MOTHOD.PUT);
         }
 
         /// <summary>
@@ -297,29 +165,7 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> DeleteNozzleInfo(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.DeleteAsync("api/nozzle/DeleteNozzle", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/DeleteNozzle", requestJson, SEND_MOTHOD.DELETE);
         }
 
 
@@ -331,58 +177,58 @@ namespace HengshanPaymentTerminal.Http
         /// <returns></returns>
         public async Task<HttpResponseMessage> SendNozzleStatu(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PutAsync("api/nozzle/updateNozzleStatus", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
-
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
-
-            }
+            return await SendRquest("api/nozzle/updateNozzleStatus", requestJson, SEND_MOTHOD.PUT);
         }
 
+        /// <summary>
+        /// 创建订单
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
         public async Task<HttpResponseMessage> CreateTransaction(string requestJson)
         {
-            try
-            {
-                var requesStr = new StringContent(requestJson, Encoding.UTF8, "application/json");
-                return await _httpClientService.PostAsync("api/Transactions/CreateTransactions", requesStr);
-            }
-            catch (Exception ex)
-            {
-                logger.Error(ex.Message);
-                // 创建自定义错误对象
-                var error = new
-                {
-                    Message = "发生错误",
-                    Error = ex.Message,
-                    StackTrace = ex.StackTrace
-                };
+            return await SendRquest("api/Transactions/CreateTransactions", requestJson, SEND_MOTHOD.POST);
+        }
 
-                // 返回 500 Internal Server Error 和 JSON 内容
-                return new HttpResponseMessage(HttpStatusCode.InternalServerError)
-                {
-                    Content = new StringContent(JsonConvert.SerializeObject(error), Encoding.UTF8, "application/json")
-                };
+        /// <summary>
+        /// 发送授权结果
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<HttpResponseMessage> SendAuthorizationResult(string requestJson)
+        {
+            return await SendRquest("api/Nozzle/UpdateNozzleAuthorization", requestJson, SEND_MOTHOD.PUT);
+        }
 
-            }
+        /// <summary>
+        /// 发送取消授权结果
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        public async Task<HttpResponseMessage> SendUnAuthorizationResult(string requestJson)
+        {
+            return await SendRquest("api/Nozzle/UpdateCancelNozzleAuthorization", requestJson, SEND_MOTHOD.PUT);
+        }
+
+        /// <summary>
+        /// 发送当前已收到云端发送的订单支付信息
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        public async Task<HttpResponseMessage> SendRecievePaidNotice(string requestJson)
+        {
+            return await SendRquest("", requestJson, SEND_MOTHOD.POST);
         }
 
-        
+        /// <summary>
+        /// 发送当前已收到云端发送的订单退款信息
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        public async Task<HttpResponseMessage> SendRecieveRefundNotice(string requestJson)
+        {
+            return await SendRquest("", requestJson, SEND_MOTHOD.POST);
+        }
     }
 }

+ 28 - 0
HengshanPaymentTerminal/Http/IHttpClientUtil.cs

@@ -84,5 +84,33 @@ namespace HengshanPaymentTerminal.Http
         /// <param name="requestJson"></param>
         /// <returns></returns>
         Task<HttpResponseMessage> SendNozzleStatu(string requestJson);
+
+        /// <summary>
+        /// 发送授权结果到云端
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        Task<HttpResponseMessage> SendAuthorizationResult(string requestJson);
+
+        /// <summary>
+        /// 发送取消授权结果到云端
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        Task<HttpResponseMessage> SendUnAuthorizationResult(string requestJson);
+
+        /// <summary>
+        /// 发送当前已收到云端发送订单支付信息
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        Task<HttpResponseMessage> SendRecievePaidNotice(string requestJson);
+
+        /// <summary>
+        /// 发送当前已收到云端发送订单退款信息
+        /// </summary>
+        /// <param name="requestJson"></param>
+        /// <returns></returns>
+        Task<HttpResponseMessage> SendRecieveRefundNotice(string requestJson);
     }
 }

+ 123 - 0
HengshanPaymentTerminal/Http/Request/HttpRequest.cs

@@ -36,6 +36,16 @@ namespace HengshanPaymentTerminal.Http.Request
             this.ProductId = fccTankInfo?.OilId ?? 0;
         }
 
+        public SendNozzleInfo(long id, UploadNozzleInfoForMazhineInput uploadNozzleInfoInput, FccTankInfo? fccTankInfo)
+        {
+            this.NozzleId = id;
+            this.PumpId = uploadNozzleInfoInput.FuelPoint;
+            this.InternalGunNumber = uploadNozzleInfoInput.InternalNum;
+            this.ExternalGunNumber = uploadNozzleInfoInput.NozzleNum;
+            this.TankID = fccTankInfo?.Id ?? 0;
+            this.ProductId = fccTankInfo?.OilId ?? 0;
+        }
+
         /// <summary>
         /// fcc油枪id
         /// </summary>
@@ -82,6 +92,16 @@ namespace HengshanPaymentTerminal.Http.Request
             this.ProductId = fccTankInfo?.OilId ?? 0;
         }
 
+        public UpdateNozzleInfo(long id, UploadNozzleInfoForMazhineInput uploadNozzleInfoInput, FccTankInfo? fccTankInfo)
+        {
+            this.NozzleId = id;
+            this.PumpId = uploadNozzleInfoInput.FuelPoint;
+            this.InternalGunNumber = uploadNozzleInfoInput.InternalNum;
+            this.ExternalGunNumber = uploadNozzleInfoInput.NozzleNum;
+            this.TankID = fccTankInfo?.Id ?? 0;
+            this.ProductId = fccTankInfo?.OilId ?? 0;
+        }
+
         /// <summary>
         /// fcc油枪id
         /// </summary>
@@ -472,6 +492,109 @@ namespace HengshanPaymentTerminal.Http.Request
         public int Status { get; set; }
     }
 
+    /// <summary>
+    /// 发送授权结果
+    /// </summary>
+    public class SendAuthorizationResult : HttpRequest
+    {
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 流水号
+        /// </summary>
+        public string TransactionNumber { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 结果 1:FCC 与油机断开连接;2:FCC 发送信息到油机,但超时未回复;3:授权失败;4:授权成功
+        /// </summary>
+        public OilMachineStatus OilMachineStatus { get; set; }
+    }
+
+    /// <summary>
+    /// 发送取消授权结果
+    /// </summary>
+    public class SendUnAuthorizationResult : HttpRequest
+    {
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 流水号
+        /// </summary>
+        public string TransactionNumber { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 结果 1:FCC 与油机断开连接;2:FCC 发送信息到油机,但超时未回复;3:授权失败;4:授权成功;5:未找到流水号
+        /// </summary>
+        public OilMachineStatus OilMachineStatus { get; set; }
+    }
+
+    public enum OilMachineStatus
+    {
+        /// <summary>
+        /// FCC与油机断开连接。
+        /// </summary>
+        Disconnected = 1,
+
+        /// <summary>
+        /// FCC向油机发送授权,油机超时未回复。
+        /// </summary>
+        AuthorizationTimeout = 2,
+
+        /// <summary>
+        /// 操作失败。
+        /// </summary>
+        Failed = 3,
+
+        /// <summary>
+        /// 操作成功。
+        /// </summary>
+        Success = 4,
+        /// <summary>
+        /// 未找到交易流水号。
+        /// </summary>
+        TransactionNumberNotFound = 5
+    }
+
+    /// <summary>
+    /// 云端发送订单完成信息后回复
+    /// </summary>
+    public class OnGetPaidInfo : HttpRequest
+    {
+
+        /// <summary>
+        /// 订单id
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 结果
+        /// </summary>
+        public int Result { get; set; }
+    }
+
+    /// <summary>
+    /// 云端发送订单退款后回复
+    /// </summary>
+    public class OnGetRefundInfo : HttpRequest
+    {
+
+        /// <summary>
+        /// 订单id
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 结果
+        /// </summary>
+        public int Result { get; set; }
+    }
+
     /// <summary>
     /// 定义DateTime转json格式
     /// </summary>

+ 0 - 53
HengshanPaymentTerminal/Mqtt/Request/MqttAuthorizationRequest.cs

@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace HengshanPaymentTerminal.Mqtt.Request
-{
-    /// <summary>
-    /// 云端 Mqtt 发送授权请求数据对象
-    /// </summary>
-    public class MqttAuthorizationRequest
-    {
-        /// <summary>
-        /// 枪号
-        /// </summary>
-        public int NozzleNum { get; set; }
-
-        /// <summary>
-        /// 授权时间
-        /// </summary>
-        public DateTime AuthorizationTime { get; set; }
-
-        /// <summary>
-        /// 定量类型 01:定金额;02:定升数
-        /// </summary>
-        public int AuthorizationType { get; set; }
-
-        /// <summary>
-        /// 定量值
-        /// </summary>
-        public decimal Value { get; set; }
-    }
-
-    public class MqttUnAhorizationRequest
-    {
-        /// <summary>
-        /// 枪号
-        /// </summary>
-        public int NozzleNum { get; set; }
-
-        /// <summary>
-        /// 授权时间
-        /// </summary>
-        public DateTime AuthorizationTime { get; set; }
-
-        /// <summary>
-        /// 交易流水号
-        /// </summary>
-        public int Ttc {  get; set; }
-
-    }
-}

+ 642 - 0
HengshanPaymentTerminal/Mqtt/Request/MqttRequest.cs

@@ -0,0 +1,642 @@
+using Edge.Core.Domain.FccOrderInfo;
+using HengshanPaymentTerminal.Http.Response;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace HengshanPaymentTerminal.Mqtt.Request
+{
+    /// <summary>
+    /// 云端 MQTT 数据对象
+    /// </summary>
+    public class MqttRequest
+    {
+        /// <summary>
+        /// 类型
+        /// </summary>
+        public MQTT_TYPE type { get; set; }
+
+        /// <summary>
+        /// 数据
+        /// </summary>
+        public string data { get; set; }
+
+    }
+
+    /// <summary>
+    /// 标识 MQTT 数据类型
+    /// </summary>
+    public enum MQTT_TYPE
+    {
+        /// <summary>
+        /// 授权
+        /// </summary>
+        AUTHORIZATION = 1,
+
+        /// <summary>
+        /// 取消授权
+        /// </summary>
+        UNAUTHORIZATION = 2,
+
+        /// <summary>
+        /// 已支付发送订单信息
+        /// </summary>
+        PAID = 3,
+
+        /// <summary>
+        /// 退款发送订单信息
+        /// </summary>
+        REFUND = 4
+    }
+
+    /// <summary>
+    /// 云端 Mqtt 发送授权请求数据对象
+    /// </summary>
+    public class MqttAuthorizationRequest
+    {
+        /// <summary>
+        /// 订单唯一标识符
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油站唯一标识符
+        /// </summary>
+        public Guid Buid { get; set; }
+
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        public long MiniProgramID { get; set; }
+
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 油品ID
+        /// </summary>
+        public long ProductId { get; set; }
+
+        /// <summary>
+        /// 实际支付金额
+        /// </summary>
+        public decimal? ActualPaymentAmount { get; set; }
+
+        /// <summary>
+        /// 授权时间
+        /// </summary>
+        public DateTime? AuthorizationTime { get; set; }
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        public string? CreateBy { get; set; }
+
+        /// <summary>
+        /// 订单创建时间
+        /// </summary>
+        public DateTime? CreateTime { get; set; }
+
+        /// <summary>
+        /// 挂枪时间
+        /// </summary>
+        public DateTime? FuelItemTransactionEndTime { get; set; }
+
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        public sbyte? IsDeleted { get; set; } = 0;
+
+        /// <summary>
+        /// 订单状态
+        /// </summary>
+        public transactionsORDERSTATUS OrderStatus { get; set; }
+
+        /// <summary>
+        /// 订单类型
+        /// </summary>
+        public transactionsORDERTYPE OrderType { get; set; }
+
+        /// <summary>
+        /// 原金额
+        /// </summary>
+        public decimal OriginalAmount { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public long? PaymentMethod { get; set; }
+
+        /// <summary>
+        /// 油品名称
+        /// </summary>
+        public string ProductName { get; set; }
+
+        /// <summary>
+        /// 原升数
+        /// </summary>
+        public decimal Qty { get; set; }
+
+        /// <summary>
+        /// 实际加油升数
+        /// </summary>
+        public decimal? OriginalQty { get; set; }
+
+        /// <summary>
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 订单流水号
+        /// </summary>
+        public string TransactionNumber { get; set; }
+
+        /// <summary>
+        /// 交易时间
+        /// </summary>
+        public DateTime? TransactionTime { get; set; }
+
+        /// <summary>
+        /// 加密字符串,用于验证金额是否篡改
+        /// </summary>
+        public string secret { get; set; }
+
+        /// <summary>
+        /// 支付返回结果
+        /// </summary>
+        public string RawResult { get; set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public string ErrorDetail { get; set; }
+
+        /// <summary>
+        /// 支付结果代码
+        /// </summary>
+        public string ResultCode { get; set; }
+
+        /// <summary>
+        /// 是否授权
+        /// </summary>
+        public AuthorizationStatus authorizationStatus { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal Price { get; set; }
+
+        public FccOrderInfo ToComponent(DateTime authorizationTime)
+        {
+            return new FccOrderInfo()
+            {
+                AuthorizationTime = authorizationTime,
+                PaymentTime = TransactionTime,
+                NozzleNum = (int)NozzleId,
+                OilName = ProductName,
+                PaymentStatus = 1,
+                PayType = (int?)PaymentMethod,
+                CloundOrderId = Id,
+                Amount = OriginalAmount,
+                Volume = Qty,
+                AmountPayable = ActualPaymentAmount,
+                UploadState = 1,
+                IsDelete = 0,
+                Price = this.Price
+                
+            };
+        }
+
+    }
+
+    /// <summary>
+    /// 云端发送取消授权数据对象
+    /// </summary>
+    public class MqttUnAhorizationRequest
+    {
+        /// <summary>
+        /// 订单唯一标识符
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油站唯一标识符
+        /// </summary>
+        public Guid Buid { get; set; }
+
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        public long MiniProgramID { get; set; }
+
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 油品ID
+        /// </summary>
+        public long ProductId { get; set; }
+
+        /// <summary>
+        /// 实际支付金额
+        /// </summary>
+        public decimal? ActualPaymentAmount { get; set; }
+
+        /// <summary>
+        /// 授权时间
+        /// </summary>
+        public DateTime? AuthorizationTime { get; set; }
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        public string? CreateBy { get; set; }
+
+        /// <summary>
+        /// 订单创建时间
+        /// </summary>
+        public DateTime? CreateTime { get; set; }
+
+        /// <summary>
+        /// 挂枪时间
+        /// </summary>
+        public DateTime? FuelItemTransactionEndTime { get; set; }
+
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        public sbyte? IsDeleted { get; set; } = 0;
+
+        /// <summary>
+        /// 订单状态
+        /// </summary>
+        public transactionsORDERSTATUS OrderStatus { get; set; }
+
+        /// <summary>
+        /// 订单类型
+        /// </summary>
+        public transactionsORDERTYPE OrderType { get; set; }
+
+        /// <summary>
+        /// 原金额
+        /// </summary>
+        public decimal OriginalAmount { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public long? PaymentMethod { get; set; }
+
+        /// <summary>
+        /// 油品名称
+        /// </summary>
+        public string ProductName { get; set; }
+
+        /// <summary>
+        /// 原升数
+        /// </summary>
+        public decimal Qty { get; set; }
+
+        /// <summary>
+        /// 实际加油升数
+        /// </summary>
+        public decimal? OriginalQty { get; set; }
+
+        /// <summary>
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 订单流水号
+        /// </summary>
+        public string TransactionNumber { get; set; }
+
+        /// <summary>
+        /// 交易时间
+        /// </summary>
+        public DateTime? TransactionTime { get; set; }
+
+        /// <summary>
+        /// 加密字符串,用于验证金额是否篡改
+        /// </summary>
+        public string secret { get; set; }
+
+        /// <summary>
+        /// 支付返回结果
+        /// </summary>
+        public string RawResult { get; set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public string ErrorDetail { get; set; }
+
+        /// <summary>
+        /// 支付结果代码
+        /// </summary>
+        public string ResultCode { get; set; }
+
+        /// <summary>
+        /// 是否授权
+        /// </summary>
+        public AuthorizationStatus authorizationStatus { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal? Price { get; set; }
+
+    }
+
+    /// <summary>
+    /// 云端发送订单已支付数据对象
+    /// </summary>
+    public class MqttPaidRequest : MqttRequest
+    {
+        /// <summary>
+        /// 订单唯一标识符
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油站唯一标识符
+        /// </summary>
+        public Guid Buid { get; set; }
+
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        public long MiniProgramID { get; set; }
+
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 油品ID
+        /// </summary>
+        public long ProductId { get; set; }
+
+        /// <summary>
+        /// 实际支付金额
+        /// </summary>
+        public decimal? ActualPaymentAmount { get; set; }
+
+        /// <summary>
+        /// 授权时间
+        /// </summary>
+        public DateTime? AuthorizationTime { get; set; }
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        public string? CreateBy { get; set; }
+
+        /// <summary>
+        /// 订单创建时间
+        /// </summary>
+        public DateTime? CreateTime { get; set; }
+
+        /// <summary>
+        /// 挂枪时间
+        /// </summary>
+        public DateTime? FuelItemTransactionEndTime { get; set; }
+
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        public sbyte? IsDeleted { get; set; } = 0;
+
+        /// <summary>
+        /// 订单状态
+        /// </summary>
+        public transactionsORDERSTATUS OrderStatus { get; set; }
+
+        /// <summary>
+        /// 订单类型
+        /// </summary>
+        public transactionsORDERTYPE OrderType { get; set; }
+
+        /// <summary>
+        /// 原金额
+        /// </summary>
+        public decimal OriginalAmount { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public long? PaymentMethod { get; set; }
+
+        /// <summary>
+        /// 油品名称
+        /// </summary>
+        public string ProductName { get; set; }
+
+        /// <summary>
+        /// 原升数
+        /// </summary>
+        public decimal Qty { get; set; }
+
+        /// <summary>
+        /// 实际加油升数
+        /// </summary>
+        public decimal? OriginalQty { get; set; }
+
+        /// <summary>
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 订单流水号
+        /// </summary>
+        public string TransactionNumber { get; set; }
+
+        /// <summary>
+        /// 交易时间
+        /// </summary>
+        public DateTime? TransactionTime { get; set; }
+
+        /// <summary>
+        /// 加密字符串,用于验证金额是否篡改
+        /// </summary>
+        public string secret { get; set; }
+
+        /// <summary>
+        /// 支付返回结果
+        /// </summary>
+        public string RawResult { get; set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public string ErrorDetail { get; set; }
+
+        /// <summary>
+        /// 支付结果代码
+        /// </summary>
+        public string ResultCode { get; set; }
+
+        /// <summary>
+        /// 是否授权
+        /// </summary>
+        public AuthorizationStatus authorizationStatus { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal? Price { get; set; }
+    }
+
+    /// <summary>
+    /// 云端发送订单退款数据对象
+    /// </summary>
+    public class MqttRefundRequest : MqttRequest
+    {
+        /// <summary>
+        /// 订单唯一标识符
+        /// </summary>
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 油站唯一标识符
+        /// </summary>
+        public Guid Buid { get; set; }
+
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        public long MiniProgramID { get; set; }
+
+        /// <summary>
+        /// 枪号
+        /// </summary>
+        public long NozzleId { get; set; }
+
+        /// <summary>
+        /// 油品ID
+        /// </summary>
+        public long ProductId { get; set; }
+
+        /// <summary>
+        /// 实际支付金额
+        /// </summary>
+        public decimal? ActualPaymentAmount { get; set; }
+
+        /// <summary>
+        /// 授权时间
+        /// </summary>
+        public DateTime? AuthorizationTime { get; set; }
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        public string? CreateBy { get; set; }
+
+        /// <summary>
+        /// 订单创建时间
+        /// </summary>
+        public DateTime? CreateTime { get; set; }
+
+        /// <summary>
+        /// 挂枪时间
+        /// </summary>
+        public DateTime? FuelItemTransactionEndTime { get; set; }
+
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        public sbyte? IsDeleted { get; set; } = 0;
+
+        /// <summary>
+        /// 订单状态
+        /// </summary>
+        public transactionsORDERSTATUS OrderStatus { get; set; }
+
+        /// <summary>
+        /// 订单类型
+        /// </summary>
+        public transactionsORDERTYPE OrderType { get; set; }
+
+        /// <summary>
+        /// 原金额
+        /// </summary>
+        public decimal OriginalAmount { get; set; }
+
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public long? PaymentMethod { get; set; }
+
+        /// <summary>
+        /// 油品名称
+        /// </summary>
+        public string ProductName { get; set; }
+
+        /// <summary>
+        /// 原升数
+        /// </summary>
+        public decimal Qty { get; set; }
+
+        /// <summary>
+        /// 实际加油升数
+        /// </summary>
+        public decimal? OriginalQty { get; set; }
+
+        /// <summary>
+        /// 退款金额
+        /// </summary>
+        public decimal? RefundAmount { get; set; }
+
+        /// <summary>
+        /// 订单流水号
+        /// </summary>
+        public string TransactionNumber { get; set; }
+
+        /// <summary>
+        /// 交易时间
+        /// </summary>
+        public DateTime? TransactionTime { get; set; }
+
+        /// <summary>
+        /// 加密字符串,用于验证金额是否篡改
+        /// </summary>
+        public string secret { get; set; }
+
+        /// <summary>
+        /// 支付返回结果
+        /// </summary>
+        public string RawResult { get; set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public string ErrorDetail { get; set; }
+
+        /// <summary>
+        /// 支付结果代码
+        /// </summary>
+        public string ResultCode { get; set; }
+
+        /// <summary>
+        /// 是否授权
+        /// </summary>
+        public AuthorizationStatus authorizationStatus { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal? Price { get; set; }
+    }
+}

+ 11 - 0
src/FccLife.Web/Controller/ConfigController.cs

@@ -71,6 +71,17 @@ namespace FccLite.Web.Controller
 
         }
 
+        /// <summary>
+        /// 获取订单过滤条件
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("getOrderFilter")]
+        public async Task<IActionResult> GetOrderFilter()
+        {
+            OrderFilterOutput orderFilterOutput = await _stationService.GetOrderFilter();
+            return Ok(orderFilterOutput);
+        }
+
         /// <summary>
         /// 分页获取油品信息
         /// </summary>

+ 39 - 0
src/FccLife.Web/Controller/MachineController.cs

@@ -0,0 +1,39 @@
+using Edge.Core.Domain.FccMachineInfo.Input;
+using FccLite.Web.Services.FccMachineInfo;
+using Microsoft.AspNetCore.Mvc;
+
+namespace FccLite.Web.Controller
+{
+    [Route("qrFueling/machine")]
+    [ApiController]
+    public class MachineController : ControllerBase
+    {
+        private IMachineService _machineService;
+
+        public MachineController(IMachineService machineService)
+        {
+            _machineService = machineService;
+        }
+
+        [HttpGet("getMachineInfo")]
+        public async Task<IActionResult> GetMachineInfo(long stationId)
+        {
+            List<Edge.Core.Domain.FccMachineInfo.Output.MachineInfoOutput> machineInfoOutputs = await _machineService.GetMachineInfo(stationId);
+            return Ok(machineInfoOutputs);
+        }
+
+        [HttpPost("uploadMachineInfo")]
+        public async Task<IActionResult> UploadMachine(UploadMachineInfo uploadMachineInfo)
+        {
+            Edge.Core.Domain.FccMachineInfo.Output.SetMachineInfoOutput setMachineInfoOutput = await _machineService.UploadMachine(uploadMachineInfo);
+            return Ok(setMachineInfoOutput);
+        }
+
+        [HttpPost("deleteMaichineInfo")]
+        public async Task<IActionResult> DeleteMachine(long machineId)
+        {
+            Edge.Core.Domain.FccMachineInfo.Output.SetMachineInfoOutput setMachineInfoOutput = await _machineService.DeleteMachine(machineId);
+            return Ok(setMachineInfoOutput);
+        }
+    }
+}

+ 7 - 0
src/FccLife.Web/Controller/TankController.cs

@@ -72,6 +72,13 @@ namespace FccLite.Web.Controller
             return Ok(result);
         }
 
+        [HttpPost("uploadDetailsNozzleInfoForMachine")]
+        public async Task<IActionResult> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput)
+        {
+            SetNozzleInfoOutput result = await _nozzleInfnService.UploadDetailsNozzleInfoForMachine(uploadNozzleInfoInput);
+            return Ok(result);
+        }
+
         [HttpPost("deleteNozzle")]
         public async Task<IActionResult> DeleteNozzle(long id)
         {

+ 4 - 0
src/FccLife.Web/Program.cs

@@ -15,6 +15,8 @@ using Edge.Core.HttpClient;
 using HengshanPaymentTerminal.Http;
 using FccLite.Web.Services.FccOrderInfo;
 using FccLite.Web.Repositories.FccOrderInfo;
+using FccLite.Web.Services.FccMachineInfo;
+using FccLite.Web.Repositories.FccMachineInfo;
 
 var builder = WebApplication.CreateBuilder(args);
  DefaultDispatcher processorsDispatcher = null;
@@ -41,6 +43,8 @@ builder.Services.AddScoped<INozzleInfnService, NozzleInfoServiceImpl>();
 builder.Services.AddScoped<INozzleInfoReposity, NozzleInfoReposity>();
 builder.Services.AddScoped<IOrderInfoService, OrderInfoService>();
 builder.Services.AddScoped<IOrderInfoReposity, OrderInfoReposity>();
+builder.Services.AddScoped<IMachineService, MachineServiceImpl>();
+builder.Services.AddScoped<IMachineRepository, MachineReposity>();
 builder.Services.AddScoped<IHttpClient, HttpClientService>();
 builder.Services.AddScoped<IHttpClientUtil, HttpClientUtils>();
 

+ 14 - 0
src/FccLife.Web/Repositories/FccMachineInfo/IMachineRepository.cs

@@ -0,0 +1,14 @@
+using Edge.Core.Domain.FccMachineInfo.Input;
+using Edge.Core.Domain.FccMachineInfo.Output;
+
+namespace FccLite.Web.Repositories.FccMachineInfo
+{
+    public interface IMachineRepository
+    {
+        Task<List<MachineInfoOutput>> GetMachine(long stationId);
+
+        Task<int> UploadMachine(UploadMachineInfo uploadMachineInfo);
+
+        Task<Edge.Core.Domain.FccMachineInfo.FccMachineInfo?> DeleteMachine(long machineId);
+    }
+}

+ 88 - 0
src/FccLife.Web/Repositories/FccMachineInfo/MachineReposity.cs

@@ -0,0 +1,88 @@
+using Edge.Core.Core.database;
+using Edge.Core.Domain.FccMachineInfo.Input;
+using Edge.Core.Domain.FccMachineInfo.Output;
+using Edge.Core.Domain.FccTankInfo.Output;
+using Microsoft.EntityFrameworkCore;
+
+namespace FccLite.Web.Repositories.FccMachineInfo
+{
+    public class MachineReposity : IMachineRepository
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+        private MysqlDbContext _dbContext;
+
+        public MachineReposity(MysqlDbContext dbContext) 
+        {
+            _dbContext = dbContext;
+        }
+
+        public async Task<List<MachineInfoOutput>> GetMachine(long stationId)
+        {
+            var result = await _dbContext.FccMachineInfos
+                    .Where(machine => machine.StationId == stationId) // 过滤指定加油站的油机
+                    .GroupJoin(
+                            _dbContext.NozzleInfos, // 关联的加油枪表
+                            machine => machine.Id,        // 油机 的主键
+                            nozzle => nozzle.MachineId,// NozzleInfos 的外键
+                            (machine, nozzles) => new MachineInfoOutput
+                            {
+                                Id = machine.Id,
+                                Name = machine.Name,
+                                Port = machine.Port,
+                                Nozzles = nozzles.Select(nozzle => new NozzleInfo
+                                {
+                                    Id = nozzle.Id,
+                                    NozzleNumer = nozzle.ExternalNum
+                                }).ToList()
+                            })
+                    .ToListAsync(); // 异步查询
+            return result;
+
+
+        }
+
+        public async Task<int> UploadMachine(UploadMachineInfo uploadMachineInfo)
+        {
+            if(uploadMachineInfo.Id == null)
+            {
+                Edge.Core.Domain.FccMachineInfo.FccMachineInfo fccMachineInfo = uploadMachineInfo.ToComponent();
+                _dbContext.FccMachineInfos.Add(fccMachineInfo);
+            } else
+            {
+                Edge.Core.Domain.FccMachineInfo.FccMachineInfo? fccMachineInfo = await _dbContext.FccMachineInfos.FirstOrDefaultAsync(machine => machine.Id == uploadMachineInfo.Id);
+                if(fccMachineInfo == null)
+                {
+                    Logger.Error($"UploadMachine:find machine by id {uploadMachineInfo.Id} is null");
+                    return 0;
+                }
+                fccMachineInfo.Name = uploadMachineInfo.Name;
+                fccMachineInfo.Port = uploadMachineInfo.Port;
+            }
+
+            return await _dbContext.SaveChangesAsync();
+        }
+
+        public async Task<Edge.Core.Domain.FccMachineInfo.FccMachineInfo?> DeleteMachine(long machineId)
+        {
+            Edge.Core.Domain.FccMachineInfo.FccMachineInfo? fccMachineInfo = await _dbContext.FccMachineInfos.FirstOrDefaultAsync(machine => machine.Id == machineId);
+            if(fccMachineInfo == null)
+            {
+                Logger.Error($"DeleteMachine:find machine by id {machineId} is null");
+                return null;
+            }
+
+            //删除关联油枪
+            List<Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo> fccNozzleInfos = await _dbContext.NozzleInfos.Where(nozzle => nozzle.MachineId == machineId).ToListAsync();
+            _dbContext.RemoveRange(fccNozzleInfos);
+
+            //删除油机
+            _dbContext.FccMachineInfos.Remove(fccMachineInfo);
+
+            await _dbContext.SaveChangesAsync();
+
+            return fccMachineInfo;
+        }
+
+        
+    }
+}

+ 15 - 0
src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs

@@ -18,11 +18,26 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
         /// <returns></returns>
         Task<long> UploadNozzleInfo(UploadNozzleInfoInput uploadNozzleInfoInput);
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<long> UploadNozzleInfoFroMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput);
+
         /// <summary>
         /// 根据id 删除油枪信息
         /// </summary>
         /// <param name="id"></param>
         /// <returns></returns>
         Task<Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo?> DeleteNozzleInfoById(long id);
+
+
+        /// <summary>
+        /// 根据油机id 获取油枪
+        /// </summary>
+        /// <param name="machineId"></param>
+        /// <returns></returns>
+        Task<List<Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo>> FindNozzlesByMachineId(long machineId);
     }
 }

+ 43 - 1
src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs

@@ -40,7 +40,6 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
                     Logger.Info($"find nozzle info with id : {uploadNozzleInfoInput.Id} for update, result is null");
                     return 0;
                 }
-                fccNozzleInfo.Port = uploadNozzleInfoInput.Port;
                 fccNozzleInfo.FuelPoint = uploadNozzleInfoInput.FuelPoint;
                 fccNozzleInfo.InternalNum = uploadNozzleInfoInput.InternalNum;
                 fccNozzleInfo.ExternalNum = uploadNozzleInfoInput.NozzleNum;
@@ -56,6 +55,37 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
             return info.Id;
         }
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns>油枪id</returns>
+        public async Task<long> UploadNozzleInfoFroMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput)
+        {
+            if (uploadNozzleInfoInput.Id != null)
+            {
+                Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo? fccNozzleInfo = await _dbContext.NozzleInfos.FirstOrDefaultAsync(info => info.Id == uploadNozzleInfoInput.Id);
+                if (fccNozzleInfo == null)
+                {
+                    Logger.Info($"find nozzle info with id : {uploadNozzleInfoInput.Id} for update by machine, result is null");
+                    return 0;
+                }
+                fccNozzleInfo.FuelPoint = uploadNozzleInfoInput.FuelPoint;
+                fccNozzleInfo.InternalNum = uploadNozzleInfoInput.InternalNum;
+                fccNozzleInfo.ExternalNum = uploadNozzleInfoInput.NozzleNum;
+                fccNozzleInfo.TankId = uploadNozzleInfoInput.TankId;
+                fccNozzleInfo.TankNum = uploadNozzleInfoInput.TankNum;
+                fccNozzleInfo.MachineId = uploadNozzleInfoInput.MachineId;
+                if(uploadNozzleInfoInput.CloundNozzleId != null) fccNozzleInfo.CloundNozzleId = (long)uploadNozzleInfoInput.CloundNozzleId;
+                await _dbContext.SaveChangesAsync();
+                return fccNozzleInfo.Id;
+            }
+
+            Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo info = uploadNozzleInfoInput.ToComponent();
+            _dbContext.NozzleInfos.Add(info);
+            await _dbContext.SaveChangesAsync();
+            return info.Id;
+        }
         /// <summary>
         /// 根据id 删除油枪信息
         /// </summary>
@@ -74,5 +104,17 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
             await _dbContext.SaveChangesAsync();
             return fccNozzleInfo;
         }
+
+        /// <summary>
+        /// 根据油机id获取枪信息
+        /// </summary>
+        /// <param name="machineId"></param>
+        /// <returns></returns>
+        public async Task<List<Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo>> FindNozzlesByMachineId(long machineId)
+        {
+            return await _dbContext.NozzleInfos.Where(nozzle => nozzle.MachineId == machineId).ToListAsync();
+        }
+
+       
     }
 }

+ 5 - 0
src/FccLife.Web/Repositories/FccOrderInfo/IOrderInfoReposity.cs

@@ -5,6 +5,11 @@ namespace FccLite.Web.Repositories.FccOrderInfo
 {
     public interface IOrderInfoReposity
     {
+        /// <summary>
+        /// 分页查询订单
+        /// </summary>
+        /// <param name="orderInfoPageInput"></param>
+        /// <returns></returns>
         Task<IEnumerable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo>> GetPage(OrderInfoPageInput orderInfoPageInput);
     }
 }

+ 9 - 1
src/FccLife.Web/Repositories/FccOrderInfo/OrderInfoReposity.cs

@@ -13,18 +13,26 @@ namespace FccLite.Web.Repositories.FccOrderInfo
             _dbContext = mysqlDbContext;
         }
 
+        /// <summary>
+        /// 分页查询订单
+        /// </summary>
+        /// <param name="orderInfoPageInput"></param>
+        /// <returns></returns>
         public async Task<IEnumerable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo>> GetPage(OrderInfoPageInput orderInfoPageInput)
         {
             IQueryable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo> query = _dbContext.FccOrderInfos.AsQueryable();
 
             query = query.Where(order => order.IsDelete == 0);
-            query = query.WhereIf(orderInfoPageInput.oilName != null && "".Equals(orderInfoPageInput.oilName),order => order.OilName.Equals(orderInfoPageInput.oilName));
+            query = query.WhereIf(orderInfoPageInput.oilName != null && !"".Equals(orderInfoPageInput.oilName),order => order.OilName.Equals(orderInfoPageInput.oilName));
             query = query.WhereIf(orderInfoPageInput.nozzleNum != null, order => order.NozzleNum == orderInfoPageInput.nozzleNum);
             //query = query.WhereIf(orderInfoPageInput.ttc != null, order => order.Ttc == orderInfoPageInput.ttc);
             if (orderInfoPageInput.startCheckTime != null && orderInfoPageInput.endCheckTime != null)
             {
                 query = query.Where(order => order.EndTime != null && (order.EndTime >= orderInfoPageInput.startCheckTime && order.EndTime <= orderInfoPageInput.endCheckTime));
             }
+            query = query.WhereIf(orderInfoPageInput.paymentType != null, order => order.PayType == orderInfoPageInput.paymentType);
+            query = query.WhereIf(orderInfoPageInput.phoneNumberOruserName != null, order => order.UserName.Equals(orderInfoPageInput.phoneNumberOruserName) || order.PhoneNumber.Equals(orderInfoPageInput.phoneNumberOruserName));
+            query = query.OrderByDescending(order => order.EndTime);
             return await query.Skip((orderInfoPageInput.page - 1) * orderInfoPageInput.pageSize).Take(orderInfoPageInput.pageSize).ToListAsync();
         }
     }

+ 7 - 0
src/FccLife.Web/Repositories/FccStationInfo/IStationRepository.cs

@@ -1,4 +1,5 @@
 using Edge.Core.Domain.FccStationInfo.Input;
+using Edge.Core.Domain.FccStationInfo.Output;
 
 namespace FccLite.Web.Repositories.FccStationInfo
 {
@@ -36,5 +37,11 @@ namespace FccLite.Web.Repositories.FccStationInfo
         /// <param name="id">id</param>
         /// <returns>站点信息</returns>
         Task<Boolean> DeleteByID(long id);
+
+        /// <summary>
+        /// 获取第一个站点信息
+        /// </summary>
+        /// <returns></returns>
+        Task<Edge.Core.Domain.FccStationInfo.FccStationInfo?> GetFirstStation();
     }
 }

+ 11 - 0
src/FccLife.Web/Repositories/FccStationInfo/StationRepository.cs

@@ -1,5 +1,6 @@
 using Edge.Core.Core.database;
 using Edge.Core.Domain.FccStationInfo.Input;
+using Edge.Core.Domain.FccStationInfo.Output;
 using Microsoft.AspNetCore.Cors.Infrastructure;
 using Microsoft.EntityFrameworkCore;
 using System.Net;
@@ -86,6 +87,7 @@ namespace FccLite.Web.Repositories.FccStationInfo
                 station.MqttService = stationInfoInput.MqttService;
                 station.IcardService = stationInfoInput.IcardService != null ? stationInfoInput.IcardService : "";
                 station.WebSocketPort = stationInfoInput.WebSocketPort;
+                station.PaymentType = stationInfoInput.PaymentType;
                 _dbContext.SaveChanges();
                 return station;
             }
@@ -112,5 +114,14 @@ namespace FccLite.Web.Repositories.FccStationInfo
             _dbContext.SaveChanges();
             return true;
         }
+
+        /// <summary>
+        /// 获取第一个站点
+        /// </summary>
+        /// <returns></returns>
+        public async Task<Edge.Core.Domain.FccStationInfo.FccStationInfo?> GetFirstStation()
+        {
+            return await _dbContext.FccStationInfos.FirstOrDefaultAsync();
+        }
     }
 }

+ 14 - 0
src/FccLife.Web/Services/FccMachineInfo/IMachineService.cs

@@ -0,0 +1,14 @@
+using Edge.Core.Domain.FccMachineInfo.Input;
+using Edge.Core.Domain.FccMachineInfo.Output;
+
+namespace FccLite.Web.Services.FccMachineInfo
+{
+    public interface IMachineService
+    {
+        Task<List<MachineInfoOutput>> GetMachineInfo(long stationId);
+
+        Task<SetMachineInfoOutput> UploadMachine(UploadMachineInfo uploadMachineInfo);
+
+        Task<SetMachineInfoOutput> DeleteMachine(long machineId);
+    }
+}

+ 59 - 0
src/FccLife.Web/Services/FccMachineInfo/MachineServiceImpl.cs

@@ -0,0 +1,59 @@
+using Edge.Core.Domain.FccMachineInfo.Input;
+using Edge.Core.Domain.FccMachineInfo.Output;
+using FccLite.Web.Repositories.FccMachineInfo;
+using FccLite.Web.Repositories.FccNozzleInfo;
+
+namespace FccLite.Web.Services.FccMachineInfo
+{
+    public class MachineServiceImpl : IMachineService
+    {
+        static NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
+        private IMachineRepository _machineRepository;
+        private INozzleInfoReposity _nozzleInfoReposity;
+        public MachineServiceImpl(IMachineRepository machineRepository,INozzleInfoReposity nozzleInfoReposity)
+        {
+            _machineRepository = machineRepository;
+            _nozzleInfoReposity = nozzleInfoReposity;
+        }
+
+        public async Task<List<MachineInfoOutput>> GetMachineInfo(long stationId)
+        {
+            return await _machineRepository.GetMachine(stationId);
+        }
+
+        public async Task<SetMachineInfoOutput> UploadMachine(UploadMachineInfo uploadMachineInfo)
+        {
+            int row = await _machineRepository.UploadMachine(uploadMachineInfo);
+            if (row > 0)
+            {
+                return new SetMachineInfoOutput()
+                {
+                    Result = true,
+                    Message = "更新成功"
+                };
+            }
+            return new SetMachineInfoOutput()
+            {
+                Result = true,
+                Message = "无更新"
+            };
+        }
+        public async Task<SetMachineInfoOutput> DeleteMachine(long machineId)
+        {
+            Edge.Core.Domain.FccMachineInfo.FccMachineInfo? fccMachineInfo = await _machineRepository.DeleteMachine(machineId);
+            if(fccMachineInfo != null)
+            {
+                return new SetMachineInfoOutput()
+                {
+                    Result = true,
+                    Message = "更新成功"
+                };
+            }
+            return new SetMachineInfoOutput()
+            {
+                Result = true,
+                Message = "无更新"
+            };
+        }
+    }
+}

+ 7 - 0
src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs

@@ -12,6 +12,13 @@ namespace FccLite.Web.Services.FccNozzleInfo
         /// <returns></returns>
         Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput);
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<SetNozzleInfoOutput> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput nozzleInfoInput);
+
         /// <summary>
         /// 根据id获取油枪信息
         /// </summary>

+ 52 - 9
src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs

@@ -33,7 +33,6 @@ namespace FccLite.Web.Services.FccNozzleInfo
         /// <returns></returns>
         public async Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput)
         {
-            await _httpClientUtils.SendNozzleStatu("[{\"NozzleId\":68,\"Status\":3},{\"NozzleId\":63,\"Status\":3},{\"NozzleId\":64,\"Status\":3},{\"NozzleId\":65,\"Status\":3},{\"NozzleId\":66,\"Status\":3},{\"NozzleId\":69,\"Status\":3}]");
             long id = await _nozzleInfoReposity.UploadNozzleInfo(nozzleInfoInput);
             Logger.Info($"upload nozzle info , id {id}");
 
@@ -74,6 +73,54 @@ namespace FccLite.Web.Services.FccNozzleInfo
             };
         }
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        public async Task<SetNozzleInfoOutput> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput nozzleInfoInput)
+        {
+            long id = await _nozzleInfoReposity.UploadNozzleInfoFroMachine(nozzleInfoInput);
+            Logger.Info($"upload nozzle info for machine , id {id}");
+
+            if (id > 0)
+            {
+                try
+                {
+                    Edge.Core.Domain.FccTankInfo.FccTankInfo? fccTankInfo = await _tankReposity.GetDetailsTankByTankIdAsync(nozzleInfoInput.TankId);
+                    if (nozzleInfoInput.Id == null)
+                    {
+                        SendNozzleInfo sendNozzleInfo = new SendNozzleInfo(id, nozzleInfoInput, fccTankInfo);
+                        var requestJson = JsonConvert.SerializeObject(sendNozzleInfo);
+                        HttpResponseMessage httpResponseMessage = await _httpClientUtils.SendNozzleInfo(requestJson);
+                        Logger.Info($"send nozzle response : {httpResponseMessage.Content}");
+                    }
+                    else
+                    {
+                        UpdateNozzleInfo updateNozzleInfo = new UpdateNozzleInfo(id, nozzleInfoInput, fccTankInfo);
+                        var requestJson = JsonConvert.SerializeObject(updateNozzleInfo);
+                        HttpResponseMessage httpResponseMessage = await _httpClientUtils.UpdateNozzleInfo(requestJson);
+                        Logger.Info($"update nozzle response : {httpResponseMessage.Content}");
+                    }
+                }
+                catch (Exception e)
+                {
+                    Logger.Error($"send nozzle to cloud error:{e.Message}", e);
+                }
+                return new SetNozzleInfoOutput()
+                {
+                    Result = true,
+                    Message = "保存成功"
+                };
+            }
+
+            return new SetNozzleInfoOutput()
+            {
+                Result = true,
+                Message = "无更新"
+            };
+        }
+
         /// <summary>
         /// 根据id获取油枪信息
         /// </summary>
@@ -90,15 +137,9 @@ namespace FccLite.Web.Services.FccNozzleInfo
             List<DetailsNozzleInfoOutput.RelatableTank> tanks = await _tankReposity.GetTankInfo();
             Logger.Info($"find all tanks info for nozzle info details,count is {tanks.Count}");
 
-            return new DetailsNozzleInfoOutput()
+            return new DetailsNozzleInfoOutput(fccNozzleInfo)
             {
-                Id = fccNozzleInfo.Id,
-                NozzleNum = fccNozzleInfo.ExternalNum,
-                Port = fccNozzleInfo.Port,
-                FuelPoint = fccNozzleInfo.FuelPoint,
-                InternalNum = fccNozzleInfo.InternalNum,
-                TankId = fccNozzleInfo.TankId,
-                TankNum = fccNozzleInfo.TankNum,
+                
                 RelatableTanks = tanks,
             };
             
@@ -142,5 +183,7 @@ namespace FccLite.Web.Services.FccNozzleInfo
                 Message = "删除失败"
             };
         }
+
+        
     }
 }

+ 6 - 3
src/FccLife.Web/Services/FccOrderInfo/OrderInfoService.cs

@@ -1,23 +1,26 @@
 using Edge.Core.Domain.FccOrderInfo.Input;
 using Edge.Core.Domain.FccOrderInfo.Output;
 using FccLite.Web.Repositories.FccOrderInfo;
+using FccLite.Web.Repositories.FccStationInfo;
 
 namespace FccLite.Web.Services.FccOrderInfo
 {
     public class OrderInfoService : IOrderInfoService
     {
         private readonly IOrderInfoReposity _orderInfoReposity;
-        public OrderInfoService(IOrderInfoReposity orderInfoReposity) 
+        private readonly IStationRepository _stationRepository;
+        public OrderInfoService(IOrderInfoReposity orderInfoReposity,IStationRepository stationRepository) 
         {
             _orderInfoReposity = orderInfoReposity;
+            _stationRepository = stationRepository;
         }
 
 
         public async Task<OrderInfoOutput> GetPage(OrderInfoPageInput orderInfoPageInput)
         {
-            //throw new NotImplementedException();
+            Edge.Core.Domain.FccStationInfo.FccStationInfo? fccStationInfo = await _stationRepository.GetFirstStation();
             IEnumerable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo> enumerable = await _orderInfoReposity.GetPage(orderInfoPageInput);
-            List<OrderInfo> orderInfos = enumerable.Select(order => new OrderInfo(order)).ToList();
+            List<OrderInfo> orderInfos = enumerable.Select(order => new OrderInfo(order,fccStationInfo?.Name ?? "","")).ToList();
             return new OrderInfoOutput()
             {
                 Total = orderInfos.Count,

+ 6 - 0
src/FccLife.Web/Services/FccStaionInfo/IStationService.cs

@@ -30,5 +30,11 @@ namespace FccLite.Web.Services.FccStaionInfo
         /// <param name="id">站点id</param>
         /// <returns></returns>
         Task<StationSetOutput> DeleteBaseInfo(long id);
+
+        /// <summary>
+        /// 获取订单过滤信息
+        /// </summary>
+        /// <returns></returns>
+        Task<OrderFilterOutput> GetOrderFilter();
     }
 }

+ 45 - 0
src/FccLife.Web/Services/FccStaionInfo/StationServiceImpl.cs

@@ -94,6 +94,51 @@ namespace FccLite.Web.Services.FccStaionInfo
             };
         }
 
+        /// <summary>
+        /// 获取订单过滤信息
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<OrderFilterOutput> GetOrderFilter()
+        {
+            FccStationInfo? fccStationInfo = await _stationRepository.GetFirstStation();
+            List<PaymentType> paymentTypes = new List<PaymentType>();
+
+            if (fccStationInfo == null)
+            {
+                return new OrderFilterOutput()
+                {
+                    payments = paymentTypes,
+                    stations = string.Empty
+                };
+            }
 
+            
+            string paymentType = fccStationInfo.PaymentType;
+            string[] paymentGround = paymentType.Split(",");
+            foreach (var item in paymentGround)
+            {
+                string[] payment = item.Split("+");
+                if (payment.Length == 2)
+                {
+                    if (long.TryParse(payment[0], out long id))
+                    {
+                        PaymentType type = new PaymentType()
+                        {
+                            id = id,
+                            paymentName = payment[1]
+                        };
+                        paymentTypes.Add(type);
+                    }
+                }
+            }
+
+
+            return new OrderFilterOutput()
+            {
+                payments = paymentTypes,
+                stations = fccStationInfo.Name
+            };
+        }
     }
 }

+ 16 - 0
src/FccWeb/admin.ui.plus-master/src/api/FormValidation.ts

@@ -23,6 +23,12 @@ const addStationRules = reactive({
     capacity: [{ required: true, message: '请输入罐容量', trigger: 'blur', }],
   })
   
+  // 验证规则 - 添加油机
+  const addMachineRules = reactive({
+    name: [{ required: true, message: '请输入油机名称', trigger: 'blur', }],
+    port: [{ required: true, message: '请输入连接FCC端口', trigger: 'blur', }],
+  })
+
   // 验证规则 - 编辑油品
   const editOilRules = reactive({
     code: [{ required: true, message: '请输入油品码', trigger: 'blur', }],
@@ -39,10 +45,20 @@ const addStationRules = reactive({
     tankId: [{ required: true, message: '请输入关联油罐ID', trigger: 'blur', }],
     tankNum: [{ required: true, message: '请输入关联油罐号', trigger: 'blur', }],
   })
+
+  // 验证规则 - 编辑油枪(油机页)
+  const editOilGunForMachineRules = reactive({
+    nozzleNum: [{ required: true, message: '请输入油枪号', trigger: 'blur', }],
+    fuelPoint: [{ required: true, message: '请输入加油点', trigger: 'blur', }],
+    internalNum: [{ required: true, message: '请输入内部油枪号', trigger: 'blur', }],
+    // tankName: [{ required: true, message: '请选择油罐号', trigger: 'blur', }],
+  })
   
   export {
     addStationRules,
     addDeviceRules,
     editOilRules,
     editOilGunRules,
+    addMachineRules,
+    editOilGunForMachineRules,
   }

+ 35 - 0
src/FccWeb/admin.ui.plus-master/src/api/api.ts

@@ -74,6 +74,32 @@ export const deleteTank = (data:any)=>{
 	})
 }
 
+/** ----- 油机 ----- */
+//获取油机
+export const getMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/getMachineInfo',
+		method:'get',
+		params:data
+	})
+}
+//更新油机信息
+export const uploadMaichine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/uploadMachineInfo',
+		method:'post',
+		data:data
+	})
+}
+//删除油机
+export const deleteMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/deleteMaichineInfo',
+		method:'post',
+		params:data
+	})
+}
+
 /** ----- 油枪 ----- */
 // 获取油枪信息
 export const getNozzleInfo = (data:any)=>{
@@ -93,6 +119,15 @@ export const uploadNozzleInfo = (data:any)=>{
 	})
 }
 
+// 添加油枪信息(油机页)
+export const uploadNozzleInfoForMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/tank/uploadDetailsNozzleInfoForMachine',
+		method:'post',
+		data:data
+	})
+}
+
 // 删除油枪信息
 export const deleteNozzle = (data:any)=>{
 	return request({

BIN
src/FccWeb/admin.ui.plus-master/src/assets/machine.png


BIN
src/FccWeb/admin.ui.plus-master/src/assets/nozzle.png


BIN
src/FccWeb/admin.ui.plus-master/src/assets/tank.png


+ 90 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/addMachine.vue

@@ -0,0 +1,90 @@
+<!-- 
+** 新增设备 - 油罐
+-->
+<template>
+    <el-dialog title="新增油机" v-model="isDisplay.isShowDialog" class="main-content" width="769px">
+        <el-form :model="dataList" ref="ruleFormRef" label-width="5em" :rules="addMachineRules" size="default">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油站ID" :required="true" prop="stationId">
+                        <el-input v-model="dataList.stationId" disabled placeholder="油站ID" clearable />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10" class="mb20">
+                    <el-form-item label="油机号" :required="true" prop="name">
+                        <el-input v-model="dataList.name" placeholder="油机号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="13" :md="13" :lg="13" :xl="13" class="mb20">
+                    <el-form-item label="连接FCC端口" prop="port">
+                        <el-input v-model="dataList.port" placeholder="连接FCC端口" clearable />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive, onMounted } from 'vue';
+import { uploadMaichine } from "/@/api/api"
+import { addMachineRules } from '/@/api/FormValidation';
+import eventBus from "/@/utils/mitt";
+
+
+
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const data = reactive({
+    oilsList: <any>[],
+    NameList: <any>[]
+})
+
+// 定义 所需添加数据
+let dataList = reactive({
+    /** 油站 */
+    stationId: null,
+    /** 油机号 */
+    name: null,
+    /** 连接FCC的端口 */
+    port: null,
+})
+
+// 创建表单实例
+const ruleFormRef = ref()
+// 提交 油罐添加信息
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadMaichine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+        })
+
+        dataList.stationId = null
+        dataList.name = null
+        dataList.port = null
+        eventBus.emit('refreshViewMachine')
+        isDisplay.isShowDialog = false
+    })
+
+}
+
+const openDialog = (id: any) => {
+    dataList.stationId = id
+    isDisplay.isShowDialog = true
+
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss"></style>

+ 92 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/editMachine.vue

@@ -0,0 +1,92 @@
+<!-- 
+** 编辑设备 - 油罐
+-->
+<template>
+    <el-dialog title="编辑油机" v-model="isDisplay.isShowDialog" width="769px" class="main-content">
+        <el-form :model="dataList" v-loading="isDisplay.loading" ref="ruleFormRef" label-width="5em" :rules="addMachineRules">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐号" :required="true" @focus="getOil" prop="number">
+                        <el-input v-model="dataList.number" />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10" class="mb20">
+                    <el-form-item label="油机号" :required="true" prop="name">
+                        <el-input v-model="dataList.name" placeholder="油机号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="13" :md="13" :lg="13" :xl="13" class="mb20">
+                    <el-form-item label="连接FCC端口" prop="port">
+                        <el-input v-model="dataList.port" placeholder="连接FCC端口" clearable />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive, onMounted } from 'vue';
+import { uploadMaichine,deleteMachine } from "/@/api/api"
+import { addMachineRules } from '/@/api/FormValidation'
+import eventBus from "/@/utils/mitt";
+
+// 子 传数据给父
+const emit = defineEmits(['getDialogData'])
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const data = reactive({
+    oilsList: <any>[],
+    NameList: <any>[]
+
+})
+
+// 定义 所需添加数据
+let dataList = reactive({
+    /** 油站 */
+    stationId: null,
+    /** 油机id */
+    id: null,
+    /** 油机号 */
+    name: null,
+    /** 连接FCC的端口 */
+    port: null,
+})
+
+// 创建表单实例
+const ruleFormRef = ref()
+// 提交 油罐编辑信息
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadMaichine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+            eventBus.emit('refreshViewMachine')
+            isDisplay.isShowDialog = false
+        })
+    })
+}
+
+const openDialog = (data: any) => {
+    dataList.stationId = data.stationId
+    dataList.id = data.id
+    dataList.name = data.name
+    dataList.port = data.port
+    isDisplay.isShowDialog = true
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss">
+// @import url('@/theme/form.scss');</style>

+ 162 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/editOilGunFromMachine.vue

@@ -0,0 +1,162 @@
+<!-- 
+** 修改油枪信息(油机页)
+-->
+
+<template>
+    <el-dialog :title=title v-model="isDisplay.isShowDialog" class="main-content" width="769px">
+        <el-form :model="dataList" v-loading="isDisplay.loading" ref="ruleFormRef" label-width="6em" :rules="editOilGunForMachineRules">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐号" prop="tankNum">
+                        <el-input v-model="dataList.tankNum" disabled placeholder="请输入油罐号" clearable />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="加油点" prop="fuelPoint">
+                        <el-input v-model="dataList.fuelPoint" placeholder="请输入加油点" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="内部枪号" prop="internalNum">
+                        <el-input v-model="dataList.internalNum" placeholder="请输入内部油枪号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油枪号" :required="true" prop="nozzleNum">
+                        <el-input v-model="dataList.nozzleNum" placeholder="请输入油枪号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col v-if="dataInfos.flag == 1" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="云端油枪id" prop="cloundNozzleId">
+                        <el-input v-model="dataList.cloundNozzleId" placeholder="请输入云端油枪id" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐" prop="tankName">
+                        <el-select v-model="dataList.tankId" placeholder="请选择绑定油罐" @change="getTank(dataList.tankId)">
+                            <el-option v-for="(item) in dataInfos.tankDatas.value" :key="item.id" :label="getLable(item)"
+                                :value="item.id" />
+                        </el-select>
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive } from 'vue';
+import { getTankInfo,uploadNozzleInfoForMachine, getNozzleInfo } from '/@/api/api'
+import { editOilGunForMachineRules } from '/@/api/FormValidation'
+import eventBus from "/@/utils/mitt";
+
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const dataInfos = reactive({
+    /** 站点id */
+    stationId:null,
+    /** 操作:0:新增;1:编辑 */
+    flag:0,
+    /** 油罐列表 */
+    tankDatas:[]
+})
+let title = ref('')
+
+
+let dataList = reactive({
+    /** 油枪id */
+    id: null,
+    /** 油枪号 */
+    nozzleNum: null,
+    /** 加油点 */
+    fuelPoint: null,
+    /** 内部油枪号 */
+    internalNum: null,
+    /** 关联油罐id */
+    tankId: null as any,
+    /** 关联油罐号 */
+    tankNum: null,
+    /** 关联的油机id */
+    machineId:null,
+    /** 关联的云端油枪id */
+    cloundNozzleId:null
+})
+// 创建表单实例
+const ruleFormRef = ref()
+
+// 获取油罐信息
+const getInfo = async () => {
+    await getTankInfo({ 'id': dataInfos.stationId }).then((res) => {
+        dataInfos.tankDatas.value = res
+        console.log("获取到油罐信息",dataInfos.tankDatas.value)
+    })
+}
+
+/** 拼接下拉框选项 */
+const getLable = (row:any) => {
+    return row.number + "号油罐(" + row.oilName + ")"
+}
+// 获取绑定的油罐信息 
+const getTank = (tankId:number) => {
+    const tankInfo = dataInfos.tankDatas.value.find(tank => tank.id == tankId)
+    dataList.tankNum = tankInfo.number
+}
+
+// 添加油枪数据
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadNozzleInfoForMachine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+            eventBus.emit('refreshViewNozzle')
+            isDisplay.isShowDialog = false
+            
+        })
+    })
+}
+
+const openDialog = async (data: any) => {
+    dataInfos.flag = data.flag
+    dataInfos.stationId = data.stationId
+    await getInfo()
+    if (data.flag == 0) {
+        title.value = '新增油枪'
+        dataList.id = null
+        dataList.nozzleNum = null
+        dataList.fuelPoint = null
+        dataList.internalNum = null
+        dataList.tankId = null
+        dataList.tankNum = null
+        dataList.cloundNozzleId = null
+        dataList.machineId = data.machineId
+    } else {
+        title.value = '编辑油枪'
+        await getNozzleInfo({ 'id': data.nozzleId }).then((res: any) => {
+            console.log(res)
+            dataList.id = res.id
+            dataList.nozzleNum = res.nozzleNum
+            dataList.fuelPoint = res.fuelPoint
+            dataList.internalNum = res.internalNum
+            dataList.tankId = res.tankId
+            dataList.tankNum = res.number
+            dataList.cloundNozzleId = res.cloundNozzleId
+            dataList.machineId = res.machineId
+        })
+    }
+    isDisplay.isShowDialog = true
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss"></style>

+ 131 - 13
src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue

@@ -9,12 +9,18 @@
             <Loading />
             </el-icon>
         </div>
-        <el-row v-for="(item, index) in TableData" :key="index" style="margin-bottom: 10px;height: 100%;">
+
+        <div class="switch" @click.stop="switchDisplay()">
+            <el-icon size="30"><Switch /></el-icon>
+            <el-text>切换显示设备</el-text>
+        </div>
+
+        <el-row v-if="displayData.isShowTank" v-for="(item, index) in TableDataTank" :key="index" style="margin-bottom: 10px;height: 100%;">
             <el-col :span="6">
                 <el-card style="height: 100%;display: flex;align-items: center;">
                     <el-row>
                         <el-col :span="8">
-                            <img :src="url" style="width: 70px;height:70px;">
+                            <img :src="tankImgUrl" style="width: 70px;height:70px;">
                         </el-col>
                         <el-col :span="8">
                             <div style="margin-left: 1em;">
@@ -27,7 +33,7 @@
                         <el-col :span="8">
                             <div style="margin-left: 1em;">
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Edit" @click.stop="editStation(item.id)"> 编辑 </el-link>
+                                    icon="ele-Edit" @click.stop="editTank(item.id)"> 编辑 </el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
                                     icon="ele-Delete" @click.stop="deleteDevice(item.id)">删除</el-link>
                                 <!-- <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
@@ -42,7 +48,7 @@
                 <el-row style="display: flex;flex-wrap: wrap;">
                     <el-col :span="7" v-for="itemm in item.associatedNozzles" :key="itemm"
                         style="text-align: center;padding: 10px;background-color: #fff; margin: 10px; border-radius: 5px; display: flex;align-items: center;">
-                        <img :src="url" style="width: 30px;height:30px;">
+                        <img :src="nozzleImgUrl" style="width: 30px;height:30px;">
                         <div style="margin-left: 1em;">
                             <div>油枪号</div>
                             <div>{{ itemm.nozzleNum }}</div>
@@ -60,33 +66,100 @@
                 </el-row>
             </el-col>
         </el-row>
+
+        <el-row v-if="!displayData.isShowTank" v-for="(item, index) in TableDataMachine" :key="index" style="margin-bottom: 10px;height: 150px;">
+            <el-col :span="6">
+                <el-card style="height: 100%;display: flex;align-items: center;">
+                    <el-row>
+                        <el-col :span="8">
+                            <img :src="machineImgUrl" style="width: 70px;height:70px;">
+                        </el-col>
+                        <el-col :span="8">
+                            <div style="margin-left: 1em;">
+                                <div>油机号</div>
+                                <div>{{ item.name }}</div>
+                                <div>连接端口</div>
+                                <div>{{ item.port }}</div>
+                            </div>
+                        </el-col>
+                        <el-col :span="8">
+                            <div style="margin-left: 1em;">
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Edit" @click.stop="editMachine(item)"> 编辑 </el-link>
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Delete" @click.stop="deleteMachineInfo(item.id)">删除</el-link>
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Plus"
+                                    @click.stop="editOilGunFromMachine({ 
+                                        'flag': 0, 
+                                        'stationId':displayData.inputId,
+                                        'machineId': item.id })">油枪</el-link>
+                            </div>
+                        </el-col>
+                    </el-row>
+                </el-card>
+            </el-col>
+            
+            <el-col :span="18" style="width: 100%;height: 100%;background-color: #ebebeb;">
+                <el-row>
+                    <el-col :span="7" v-for="itemm in item.nozzles" :key="itemm"
+                        style="text-align: center;padding: 10px;background-color: #fff; margin: 10px; border-radius: 5px; display: flex;align-items: center;">
+                        <img :src="nozzleImgUrl" style="width: 30px;height:30px;">
+                        <div style="margin-left: 1em;">
+                            <div>油枪号</div>
+                            <div>{{ itemm.nozzleNumer }}</div>
+                        </div>
+                        <div style="margin-left: 1em;">
+                            <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                icon="ele-Edit"
+                                @click.stop="editOilGunFromMachine({ 'flag': 1,'stationId':displayData.inputId, 'nozzleId': itemm.id })">
+                                编辑
+                            </el-link>
+                            <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                icon="ele-Delete" @click.stop="deleteOilGun(itemm.id)">删除</el-link>
+                        </div>
+                    </el-col>
+                </el-row>
+            </el-col>
+            
+        </el-row>
         <EditDialog ref="editDialogRef" />
+        <EditNozzleFromMachineDialog ref="editNozzleFromMachineDialogRef" />
         <DeviceDialog ref="DeviceDialogRef" />
+        <MachineDialog ref="MachineDialogRef" />
 
     </el-dialog>
 </template>
 <script setup lang="ts">
 import { defineAsyncComponent, onBeforeMount, onMounted, reactive, ref } from 'vue';
-import { getTankInfo, deleteTank, getDetailsTankInfo, deleteNozzle } from "/@/api/api"
+import { getTankInfo, deleteTank, getDetailsTankInfo, deleteNozzle, getMachine,deleteMachine } from "/@/api/api"
 import eventBus from "/@/utils/mitt";
 import { tr } from 'element-plus/es/locale';
-import { ElLoading } from 'element-plus';
+import { ElLoading, ElSwitch } from 'element-plus';
 
 // 引入组件
 const EditDialog = defineAsyncComponent(() => import('/@/views/admin/components/editOilGun.vue'))
+const EditNozzleFromMachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/editOilGunFromMachine.vue'))
 const DeviceDialog = defineAsyncComponent(() => import('/@/views/admin/components/editDevice.vue'))
-import { Loading } from '@element-plus/icons-vue'; // 引入加载图标
+const MachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/editMachine.vue'))
+import { Loading, Switch } from '@element-plus/icons-vue'; // 引入加载图标
 import { watch } from 'fs';
 const editDialogRef = ref()
+const editNozzleFromMachineDialogRef = ref()
 const DeviceDialogRef = ref()
+const MachineDialogRef = ref()
 
-const url = ref('/src/assets/logo-com.png')
+const machineImgUrl = ref('/src/assets/machine.png')
+const tankImgUrl = ref('/src/assets/tank.png')
+const nozzleImgUrl = ref('/src/assets/nozzle.png')
 const displayData = reactive({
     isShowDialog: false,
+    isShowTank:true,
     inputId: 0,
     loading:false
 })
-let TableData = ref([]) as any
+let TableDataTank = ref([]) as any
+let TableDataMachine = ref([]) as any
 const removeKey = ref(0)
 
 let loadingInstance: any = null; // 保存 Loading 实例
@@ -96,27 +169,46 @@ const dialogRef = ref(); // 用于获取对话框的 DOM 元素
 onBeforeMount(() => {
     eventBus.off('refreshViewNozzle')
     eventBus.off('refreshViewDevice')
+    eventBus.off('refreshViewMachine')
 })
 
 // 挂载时
 onMounted(async () => {
     await getInfo()
+    await getMachineInfo()
     eventBus.off('refreshViewNozzle')
     eventBus.off('refreshViewDevice')
+    eventBus.off('refreshViewMachine')
     eventBus.on('refreshViewNozzle', async () => {
         await getInfo()
+        await getMachineInfo()
     })
     eventBus.on('refreshViewDevice', async () => {
         await getInfo()
     })
+    eventBus.on('refreshViewMachine', async () => {
+        await getMachineInfo()
+    })
 })
 
+// 切换显示内容
+const switchDisplay = () =>{
+    displayData.isShowTank = !displayData.isShowTank
+}
+
+//-- 获取油机信息。通过station中传过来的 油站id,将油机信息获取出来。
+const getMachineInfo = async () => {
+    await getMachine({'stationId':displayData.inputId}).then((res) => {
+        TableDataMachine.value = res
+        console.log("获取到的油枪信息",res,TableDataMachine.value)
+    })
+}
 
 // -- 获取油罐信息。通过station中传过来的 油站id,将油罐信息获取出来。
 // 获取油罐信息
 const getInfo = async () => {
     await getTankInfo({ 'id': displayData.inputId }).then((res) => {
-        TableData.value = res
+        TableDataTank.value = res
         console.log(res)
     })
 }
@@ -141,7 +233,7 @@ const deleteDevice = async (id: number) => {
 }
 
 // 编辑油罐
-const editStation = async (id: number) => {
+const editTank = async (id: number) => {
     // 调用查询接口获取 数据
     await getDetailsTankInfo({ 'id': id }).then((res: any) => {
         DeviceDialogRef.value.openDialog(res)
@@ -156,19 +248,39 @@ const editOilGun = (row: any) => {
 // 删除油枪
 const deleteOilGun = async (id: number) => {
     displayData.loading = true
-    console.log('id')
-    console.log(id)
     await deleteNozzle({ 'id': id }).then((res) => {
         console.log(res)
     })
     await getInfo()
+    await getMachineInfo()
+    displayData.loading = false
+}
+
+// 编辑油机
+const editMachine = async (row: any) => {
+    // 调用查询接口获取 数据
+    MachineDialogRef.value.openDialog(row)
+}
+
+const deleteMachineInfo = async (id:number) => {
+    displayData.loading = true
+    await deleteMachine({ 'machineId': id }).then((res) => {
+        console.log(res)
+    })
+    await getInfo()
+    await getMachineInfo()
     displayData.loading = false
 }
+// 添加油枪(油机页)
+const editOilGunFromMachine = (row: any) => {
+    editNozzleFromMachineDialogRef.value.openDialog(row)
+}
 
 const openDialog = async (id: number) => {
     displayData.inputId = id
     displayData.isShowDialog = true
     await getInfo()
+    await getMachineInfo()
 }
 
 defineExpose({
@@ -190,4 +302,10 @@ defineExpose({
   color: #409eff; /* 设置加载图标颜色 */
 }
 
+.switch{
+    display: flex;
+    justify-content: start;
+    align-content: center;
+    margin-bottom: 2%;
+}
 </style>

+ 11 - 1
src/FccWeb/admin.ui.plus-master/src/views/admin/station/station.vue

@@ -29,7 +29,9 @@
                             class="right-operation" width="140">
                             <template #default="scope">
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Plus" @click.stop="addDetails(scope.row.id)">设备</el-link>
+                                    icon="ele-Plus" @click.stop="addDetails(scope.row.id)">油罐</el-link>
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Plus" @click.stop="addMachine(scope.row.id)">油机</el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
                                     icon="ele-Edit" @click.stop="uploadStation(scope.row)">编辑</el-link>
                                 <!-- <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
@@ -49,6 +51,7 @@
         </el-row>
         <EditDialog ref="editDialogRef" />
         <DeviceDialog ref="deviceDialogRef" />
+        <MachineDialog ref="machineDialogRef" />
         <oilcanDialog ref="oilcanDialogRef"></oilcanDialog>
     </div>
 
@@ -64,10 +67,12 @@ import eventBus from "/@/utils/mitt";
 /**引入组件*/
 const EditDialog = defineAsyncComponent(() => import('/@/views/admin/components/addStation.vue'))
 const DeviceDialog = defineAsyncComponent(() => import('/@/views/admin/components/addDevice.vue'))
+const MachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/addMachine.vue'))
 const oilcanDialog = defineAsyncComponent(() => import('/@/views/admin/components/oilcanDetail.vue'))
 const oilcanDialogRef = ref()
 const editDialogRef = ref()
 const deviceDialogRef = ref()
+const machineDialogRef = ref()
 
 const data = reactive([
     { prop: 'name', label: '油站名称' },
@@ -145,6 +150,11 @@ const addDetails = (id: number) => {
     deviceDialogRef.value.openDialog(id)
 }
 
+//新增油机
+const addMachine = (id:number) => {
+    machineDialogRef.value.openDialog(id)
+}
+
 /**
  * 页条变化
  * @param val