Sfoglia il codice sorgente

Merge tag '2025.02.04' into develop

测试完毕版本
Zhenghanjv 2 settimane fa
parent
commit
632eb89ca5

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

@@ -118,7 +118,7 @@ namespace Edge.Core.Domain.FccOrderInfo
         public decimal? PumpCode { get; set; }
 
         /// <summary>
-        /// 授权状态:0:未授权;1:已授权
+        /// 授权状态:0:未授权;1:已授权;3:加油中;4:订单完成
         /// </summary>
         public int AuthorizationStatus { get; set; } = 0;
 

+ 3 - 1
Edge.Core/MqttClient/MqttClientService.cs

@@ -42,6 +42,8 @@ namespace Edge.Core.MqttClient
                 Domain.FccStationInfo.FccStationInfo? fccStationInfo = dbContext.FccStationInfos.FirstOrDefault();
                 string? mqttService = fccStationInfo?.MqttService;
                 buildId = fccStationInfo?.BuildId;
+                string clientId = buildId + "_" + Guid.NewGuid().ToString();
+                Logger.Info($"mqtt client id : {clientId}");
                 if (mqttService == null || buildId == null)
                 {
                     Logger.Info($"can not get mqttService:{mqttService} and buildId:{buildId}");
@@ -51,7 +53,7 @@ namespace Edge.Core.MqttClient
                 MqttClientOptions mqttClientOptions = new MqttClientOptionsBuilder()
                     .WithTcpServer(hostAndPort[0], hostAndPort[1].ToString().ToInt())
                     .WithCredentials(mqttConfiguration.user, mqttConfiguration.password)
-                    .WithClientId(buildId)
+                    .WithClientId(clientId)
                     .WithCleanSession()
                     .WithTlsOptions(new MqttClientTlsOptions()
                     {

+ 3 - 0
Edge.Core/Processor/Communicator/TcpServerCommunicator.cs

@@ -347,6 +347,9 @@ namespace Edge.Core.Processor.Communicator
                     //    this.logger.LogDebug("TCP to " + (this.exclusiveTcpClient_ClientRemoteEndPoint_Str) + " Outgoing--->: " + message.ToLogString() + "\r\n     0x" + rawData.ToHexLogString());
                     if(rawData.Length>8 && rawData[6] != 0x55 && rawData[7] != 0x10)
                         logger.Info("TCP to " + (this.exclusiveTcpClient_ClientRemoteEndPoint_Str) + " Outgoing--->: " + message.ToLogString() + "\r\n     0x" + rawData.ToHexLogString());
+                    //else
+                        //logger.Info($"发送心跳回复");
+
                     var sendCount = this.exclusiveTcpClient.Client.Send(rawData);
                     if (sendCount == 0)
                         throw new InvalidOperationException("the send count in this.exclusiveTcpClient.Client.Send is 0");

+ 15 - 8
Edge.Core/Processor/GenericDeviceProcessor.cs

@@ -44,6 +44,8 @@ namespace Edge.Core.Processor
         public IList<IInterceptor<TRaw, TMessage>> Interceptors { get; }
         public ICommunicator<TRaw, TMessage> Communicator { get; }
 
+        private static bool isStartMqtt = false;
+
         public GenericDeviceProcessor(IDeviceHandler<TRaw, TMessage> handler, ICommunicator<TRaw, TMessage> communicator, IServiceProvider services)
         {
             if (services != null)
@@ -152,16 +154,21 @@ namespace Edge.Core.Processor
             };
 
             //------------------------- MQTT ---------------------------------
-            MqttClientService mqttClientService = new MqttClientService(services.GetService<IConfiguration>());
-            mqttClientService.OnConnect += (s, a) => { };
-            mqttClientService.OnDisconnect += (s, a) => { };
-            mqttClientService.OnApplicationMessageReceived += (s, a) =>
+            if (!isStartMqtt)
             {
-                var message = Encoding.UTF8.GetString(a.ApplicationMessage.Payload);
-                handler.OnReceiveMqttMessage(a.ApplicationMessage.Topic, message);
-            };
+                MqttClientService mqttClientService = new MqttClientService(services.GetService<IConfiguration>());
+                mqttClientService.OnConnect += (s, a) => { };
+                mqttClientService.OnDisconnect += (s, a) => { };
+                mqttClientService.OnApplicationMessageReceived += (s, a) =>
+                {
+                    var message = Encoding.UTF8.GetString(a.ApplicationMessage.Payload);
+                    handler.OnReceiveMqttMessage(a.ApplicationMessage.Topic, message);
+                };
+
+                mqttClientService.Start();
+                isStartMqtt = true;
+            }
             
-            mqttClientService.Start();
         }
 
         //public void Dispose()

+ 200 - 113
HengshanPaymentTerminal/HengshanPayTermHandler.cs

@@ -109,6 +109,8 @@ namespace HengshanPaymentTerminal
 
         //记录油枪状态,key-枪号,value:01:离线  02:锁枪  03:空闲  04:提枪  06:开始加油  08:加油中
         private ConcurrentDictionary<int, int> nozzleStatusDic = new ConcurrentDictionary<int, int>(); 
+        //记录需要更新二维码信息的油枪
+        private HashSet<int> needUpdateQRSet = new HashSet<int>();
         #endregion
 
         #region Logger
@@ -464,6 +466,7 @@ namespace HengshanPaymentTerminal
                 {
                     Task.Run(() => SendUnAuthorizationTimerAsync());
                 };
+                timer.Start();
             }
             
         }
@@ -472,7 +475,6 @@ namespace HengshanPaymentTerminal
 
         public async Task Process(IContext<byte[], CommonMessage> context)
         {
-            logger.Info($"获取到信息:{JsonConvert.SerializeObject(context.Incoming.Message)}");
             switch (context.Incoming.Message.Handle)
             {
                 //心跳,带油枪状态信息
@@ -487,7 +489,6 @@ namespace HengshanPaymentTerminal
                 case 0x18:
                     {
                         //添加或修改数据库订单
-                        logger.Info($"订单信息");
                         OrderFromMachine orderFromMachine = (OrderFromMachine)context.Incoming.Message;
                         if(nozzlePumpCode.TryGetValue(orderFromMachine.nozzleNum, out string pumpCodeAndTTC))
                         {
@@ -778,33 +779,41 @@ namespace HengshanPaymentTerminal
         /// <param name="message"></param>
         public async void OnReceiveMqttMessage(string topic,string message)
         {
-            logger.Info($"getMqtt topic:{topic},and message is {message}");
-            MqttRequest? mqttRequest = JsonConvert.DeserializeObject<MqttRequest>(message);
-            if (mqttRequest == null)
+            try
             {
-                logger.Error($"mqtt message turn on object fail,message:{message}");
-                return;
-            }
-            if ($"authorization/{buildID}".Equals(topic))
-            {
-                MqttAuthorizationRequest? mqttAuthorizationRequest = JsonConvert.DeserializeObject<MqttAuthorizationRequest>(mqttRequest.data);
-                await SendAuthorizationAsync(mqttAuthorizationRequest, mqttRequest.UserName, mqttRequest.UserPhoneNumber);
-            }
-            if($"unAuthorization/{buildID}".Equals(topic))
-            {
-                MqttUnAhorizationRequest? mqttUnAhorizationRequest = JsonConvert.DeserializeObject<MqttUnAhorizationRequest>(mqttRequest.data);
-                await SendUnAuthorizartion(mqttUnAhorizationRequest);
-            }
-            if ($"paid/{buildID}".Equals (topic))
-            {
-                MqttPaidRequest? mqttPaidRequest = JsonConvert.DeserializeObject<MqttPaidRequest>(mqttRequest.data);
-                await SendActuallyPaid(mqttPaidRequest, mqttRequest.UserName, mqttRequest.UserPhoneNumber);
+                logger.Info($"getMqtt topic:{topic},and message is {message}");
+                MqttRequest? mqttRequest = JsonConvert.DeserializeObject<MqttRequest>(message);
+                if (mqttRequest == null)
+                {
+                    logger.Error($"mqtt message turn on object fail,message:{message}");
+                    return;
+                }
+                if ($"authorization/{buildID}".Equals(topic))
+                {
+                    MqttAuthorizationRequest? mqttAuthorizationRequest = JsonConvert.DeserializeObject<MqttAuthorizationRequest>(mqttRequest.data);
+                    await SendAuthorizationAsync(mqttAuthorizationRequest, mqttRequest.UserName, mqttRequest.UserPhoneNumber);
+                }
+                if ($"unAuthorization/{buildID}".Equals(topic))
+                {
+                    MqttUnAhorizationRequest? mqttUnAhorizationRequest = JsonConvert.DeserializeObject<MqttUnAhorizationRequest>(mqttRequest.data);
+                    await SendUnAuthorizartion(mqttUnAhorizationRequest);
+                }
+                if ($"paid/{buildID}".Equals(topic))
+                {
+                    MqttPaidRequest? mqttPaidRequest = JsonConvert.DeserializeObject<MqttPaidRequest>(mqttRequest.data);
+                    await SendActuallyPaid(mqttPaidRequest, mqttRequest.UserName, mqttRequest.UserPhoneNumber);
+                }
+                if ($"refund/{buildID}".Equals(topic))
+                {
+                    MqttRefundRequest? mqttRefundRequest = JsonConvert.DeserializeObject<MqttRefundRequest>(mqttRequest.data);
+                    await OnRecieveOrderRefund(mqttRefundRequest);
+                }
             }
-            if ($"refund/{buildID}".Equals(topic))
+            catch (Exception ex)
             {
-                MqttRefundRequest? mqttRefundRequest = JsonConvert.DeserializeObject<MqttRefundRequest>(mqttRequest.data);
-                await OnRecieveOrderRefund(mqttRefundRequest);
+                logger.Error($"mqtt have error:{JsonConvert.SerializeObject(ex)}");
             }
+            
             //switch (mqttRequest.type)
             //{
             //    case MQTT_TYPE.AUTHORIZATION:
@@ -851,15 +860,6 @@ namespace HengshanPaymentTerminal
             
             foreach (var item in nozzleInfoList)
             {
-                //List<Byte> list = new List<Byte>();
-                //byte[] commandAndNozzle = { 0x63, (byte)item.NozzleNum };
-                //string qrCode = smallProgram + "/" + item.NozzleNum;
-                //byte[] qrCodeBytes = Encoding.ASCII.GetBytes(qrCode);
-                //list.AddRange(commandAndNozzle);
-                //list.Add((byte)qrCodeBytes.Length);
-                //list.AddRange(qrCodeBytes);
-                //byte[] sendBytes = content2data(list.ToArray(), null);
-
                 SendQrCode sendQrCode = new SendQrCode((int)item.CloundNozzleId,item.NozzleNum, smallProgram, getFrame(null));
                 byte[] commandAndNozzle = { sendQrCode.Handle, (byte)sendQrCode.NozzleNum };
 
@@ -873,8 +873,6 @@ namespace HengshanPaymentTerminal
                     }
                     return false;
                 }, sendQrCode);
-                //CommonMessage commonMessage = await SendMessageToMaichine("发送二维码", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendQrCode);
-                //CommonMessage commonMessage = await SendRequestToMachine("发送二维码", BitConverter.ToString(commandAndNozzle).Replace("-", ""), sendBytes);
                 if (commonMessage.IsError && commonMessage.TheErrorType == CommonMessage.ErrorType.DISCONNECT) break;
             }
 
@@ -919,18 +917,7 @@ namespace HengshanPaymentTerminal
             logger.Info($"send actuallyPaid result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
 
             FccOrderInfo? fccOrderInfo = mysqlDbContext.FccOrderInfos.FirstOrDefault(order => order.CloundOrderId == request.Id);
-            if (fccOrderInfo == null)
-            {
-                //未找到证明为预支付,这里插入订单
-                logger.Info($"[mqtt paid order notice]:can not find order by clounid:{request.Id},is perpay");
-                string paymentName = "未知类型";
-                if (request.PaymentMethod != null)
-                {
-                    paymentName = stationPayment[request.PaymentMethod ?? 0] ?? "未知类型";
-                }
-                fccOrderInfo = request.ToComponent(userName,phoneNumber, paymentName);
-                mysqlDbContext.Add(fccOrderInfo);
-            } else
+            if (fccOrderInfo != null)
             {
                 logger.Info($"[mqtt paid order notice]:find order,update order right now");
                 //后支付,这里更新支付信息
@@ -945,22 +932,23 @@ namespace HengshanPaymentTerminal
                 fccOrderInfo.UserName = userName ?? "";
                 fccOrderInfo.PhoneNumber = phoneNumber ?? string.Empty;
                 fccOrderInfo.PaymentStatus = 1;
-            }
-            
 
-            mysqlDbContext.SaveChanges();
+                mysqlDbContext.SaveChanges();
 
-            SendActuallyPaid sendActuallyPaid = new SendActuallyPaid(fccOrderInfo.NozzleNum, fccOrderInfo.Ttc, fccOrderInfo.AmountPayable ?? fccOrderInfo.Amount, getFrame(null));
-            byte[] commandAndNozzle = { sendActuallyPaid.Handle, (byte)sendActuallyPaid.NozzleNum };
-            await SendMessageToMaichine("发送实付金额", (request, response) =>
-            {
-                if (response.Handle == (byte)CommonMessage.Command.SEND_NEED_AMOUNT)
+
+                SendActuallyPaid sendActuallyPaid = new SendActuallyPaid(fccOrderInfo.NozzleNum, fccOrderInfo.Ttc, fccOrderInfo.AmountPayable ?? fccOrderInfo.Amount, getFrame(null));
+                byte[] commandAndNozzle = { sendActuallyPaid.Handle, (byte)sendActuallyPaid.NozzleNum };
+                await SendMessageToMaichine("发送实付金额", (request, response) =>
                 {
-                    CommonAnswerBack commonAnswerBack = (CommonAnswerBack)response;
-                    return commonAnswerBack.Command == (byte)CommonMessage.Command.SEND_NEED_AMOUNT && commonAnswerBack.NozzleNum == sendActuallyPaid.NozzleNum;
-                }
-                return false;
-            }, sendActuallyPaid);
+                    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);
+            }
+            
         }
 
         /// <summary>
@@ -977,15 +965,42 @@ namespace HengshanPaymentTerminal
                 return;
             }
 
+            //发送授权结果给云端
+            SendAuthorizationResult sendAuthorizationResult = new SendAuthorizationResult();
+            sendAuthorizationResult.NozzleId = request.NozzleId;
+
             //添加订单到数据库
-            DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            //DateTime authorizationTime = request.AuthorizationTime ?? DateTime.Now;
+            DateTime authorizationTime = DateTime.Now;
+            string paymentName = "未知类型";
+            if (request.PaymentMethod != null)
+            {
+                paymentName = stationPayment[request.PaymentMethod ?? 0] ?? "未知类型";
+            }
             FccOrderInfo? fccOrderInfo = await mysqlDbContext.FccOrderInfos.FirstOrDefaultAsync(order => order.CloundOrderId == request.Id);
-            if(fccOrderInfo == null)
+            if (fccOrderInfo != null && fccOrderInfo.AuthorizationStatus != 0)
             {
-                logger.Error($"authorization find order by clound id:{request.Id} is null");
+                sendAuthorizationResult.TransactionNumber = fccOrderInfo.Ttc.ToString();
+                sendAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
+                logger.Info($"订单已授权,发送授权结果:{JsonConvert.SerializeObject(sendAuthorizationResult)}");
+                HttpResponseMessage sendAuthorizationResponse = await httpClientUtil.SendAuthorizationResult(JsonConvert.SerializeObject(sendAuthorizationResult));
+                logger.Info($"订单已授权,发送授权结果响应:{JsonConvert.SerializeObject(sendAuthorizationResponse.Content.ReadAsStringAsync())}");
                 return;
             }
-            fccOrderInfo.AuthorizationTime = authorizationTime;
+
+            bool isInsertOrder = true; //用于标记数据库应为插入或者更新
+            if(fccOrderInfo == null)
+            {
+                logger.Info($"[mqtt authorization order notice]:insert order");
+                isInsertOrder = true;
+                fccOrderInfo = request.ToComponent(authorizationTime, paymentName, userName, phoneNumber);
+            } else
+            {
+                logger.Info($"该订单已存在,但未授权,更新授权时间");
+                isInsertOrder = false;
+                fccOrderInfo.AuthorizationTime = authorizationTime;
+            }
+
 
             //发送授权申请到油机
             SendAuthorization sendAuthorization = new SendAuthorization((int)request.NozzleId, authorizationTime, 1, request.OriginalAmount, getFrame(null));
@@ -1001,10 +1016,7 @@ namespace HengshanPaymentTerminal
             }, sendAuthorization);
             logger.Info($"获取到授权结果:{JsonConvert.SerializeObject(commonMessage)}");
 
-            //发送授权结果给云端
-            string authorizationResultJson = string.Empty;
-            SendAuthorizationResult sendAuthorizationResult = new SendAuthorizationResult();
-            sendAuthorizationResult.NozzleId = request.NozzleId;
+           
 
             if (commonMessage.IsError)
             {
@@ -1047,6 +1059,11 @@ namespace HengshanPaymentTerminal
             logger.Info($"send authorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
 
             //更新订单
+            if(isInsertOrder)
+            {
+                mysqlDbContext.FccOrderInfos.Add(fccOrderInfo);
+            }
+            
             mysqlDbContext.SaveChanges();
         }
 
@@ -1078,6 +1095,8 @@ namespace HengshanPaymentTerminal
             SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
             sendUnAuthorizationResult.NozzleId = request.NozzleId;
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
+            sendUnAuthorizationResult.TransactionID = request.Id;
+            sendUnAuthorizationResult.TransactionNumber = ttc.ToString();
 
             if (ttc != 0 && !isUnauthorization)
             {
@@ -1124,7 +1143,7 @@ namespace HengshanPaymentTerminal
                     }
                 }
             }
-            else if (!isUnauthorization)
+            else if (isUnauthorization)
             {
                 //若已经未授权
                 sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
@@ -1134,6 +1153,7 @@ namespace HengshanPaymentTerminal
                 sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.TransactionNumberNotFound;
             }
 
+            logger.Info($"send Unauthorization result:{JsonConvert.SerializeObject(sendUnAuthorizationResult)}");
             HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
             logger.Info($"send Unauthorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
         }
@@ -1283,8 +1303,7 @@ namespace HengshanPaymentTerminal
         private async Task SendUnAuthorizationTimerAsync()
         {
             MysqlDbContext mysqlDbContext = new MysqlDbContext();
-            DateTime timeOut = DateTime.Now.AddMonths(stationInfo.CheckOrderInterval);
-            FccOrderInfo? fccOrderInfo = await mysqlDbContext.FccOrderInfos.FirstOrDefaultAsync(order => order.AuthorizationStatus == 1 && order.AuthorizationTime < timeOut);
+            FccOrderInfo? fccOrderInfo = await mysqlDbContext.FccOrderInfos.FirstOrDefaultAsync(order => order.AuthorizationStatus == 1 && order.AuthorizationTime.AddMinutes(stationInfo.CheckOrderInterval) < DateTime.Now);
 
             if (fccOrderInfo == null)
             {
@@ -1293,6 +1312,8 @@ namespace HengshanPaymentTerminal
             }
             SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
             sendUnAuthorizationResult.NozzleId = fccOrderInfo.NozzleNum;
+            sendUnAuthorizationResult.TransactionID = fccOrderInfo.CloundOrderId;
+            sendUnAuthorizationResult.TransactionNumber = fccOrderInfo.Ttc.ToString();
             sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
 
             SendUnAuthorization sendUnAuthorization = new SendUnAuthorization(fccOrderInfo.NozzleNum, fccOrderInfo.AuthorizationTime, fccOrderInfo.Ttc, getFrame(null));
@@ -1340,6 +1361,7 @@ namespace HengshanPaymentTerminal
 
             mysqlDbContext.SaveChanges();
 
+            logger.Info($"定时任务取消授权:发送结果:{JsonConvert.SerializeObject(sendUnAuthorizationResult)}");
             HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
             logger.Info($"定时任务取消授权:send Unauthorization timer result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
 
@@ -1386,61 +1408,83 @@ namespace HengshanPaymentTerminal
 
         private async void CreateOrRedeemTransaction(FccOrderInfo fccOrderInfo)
         {
-            MysqlDbContext mysqlDbContext = new MysqlDbContext();
-            if (fccOrderInfo.CloundOrderId == null)
+            try
             {
-                CreateTransaction createTransaction = new CreateTransaction(fccOrderInfo);
-                logger.Info($"create transaction, {JsonConvert.SerializeObject(createTransaction)}");
-                HttpResponseMessage httpResponseMessage = await httpClientUtil.CreateTransaction(JsonConvert.SerializeObject(createTransaction));
+                MysqlDbContext mysqlDbContext = new MysqlDbContext();
+                if (fccOrderInfo.CloundOrderId == null)
+                {
+                    CreateTransaction createTransaction = new CreateTransaction(fccOrderInfo);
+                    logger.Info($"create transaction, {JsonConvert.SerializeObject(createTransaction)}");
+                    HttpResponseMessage httpResponseMessage = await httpClientUtil.CreateTransaction(JsonConvert.SerializeObject(createTransaction));
 
-                string responseStr = await httpResponseMessage.Content.ReadAsStringAsync();
-                Response<CreateTransactionResponse>? response = JsonConvert.DeserializeObject<Response<CreateTransactionResponse>>(responseStr);
-                logger.Info($"reveice create transaction response:{JsonConvert.SerializeObject(response)}");
+                    string responseStr = await httpResponseMessage.Content.ReadAsStringAsync();
+                    Response<CreateTransactionResponse>? response = JsonConvert.DeserializeObject<Response<CreateTransactionResponse>>(responseStr);
+                    logger.Info($"reveice create transaction response:{JsonConvert.SerializeObject(response)}");
 
-                fccOrderInfo.CloundOrderId = response?.data?.Id;
-                fccOrderInfo.UploadState = response?.data == null ? 0 : 1;
-                mysqlDbContext.SaveChanges();
-            } else
-            {
-                //MysqlDbContext mysqlDbContext = new MysqlDbContext();
-                if(fccOrderInfo.Amount == 0 && fccOrderInfo.Volume == 0)
-                {
-                    //0交易订单,证明为取消授权后产生的订单,不走核销,而是在小程序上显示为授权失败,让其重新发起授权或退款
-                    logger.Info("0交易,取消授权");
-                    fccOrderInfo.AuthorizationStatus = 0; //存在油机手动取消授权的情况,因此这里也要更新授权状态
-                    mysqlDbContext.SaveChanges();
-
-                    SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
-                    sendUnAuthorizationResult.NozzleId = fccOrderInfo.NozzleNum;
-                    sendUnAuthorizationResult.TransactionNumber = fccOrderInfo.Ttc.ToString();
-                    sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
-                    HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
-                    logger.Info($"手动取消授权:send Unauthorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
+                    FccOrderInfo? order = await mysqlDbContext.FccOrderInfos.FirstOrDefaultAsync(order => order.Id == fccOrderInfo.Id);
+                    if (order != null)
+                    {
+                        order.CloundOrderId = response?.data?.Id;
+                        order.UploadState = response?.data == null ? 0 : 1;
+                        int v = await mysqlDbContext.SaveChangesAsync();
+                        logger.Info($"修改行数{v}");
+                    }
                 }
                 else
                 {
-                    //核销
-                    Redeem redeem = new Redeem();
-                    redeem.trxId = (int)fccOrderInfo.CloundOrderId;
-                    redeem.OriginalQty = fccOrderInfo.Volume;
+                    //MysqlDbContext mysqlDbContext = new MysqlDbContext();
+                    if (fccOrderInfo.Amount == 0 && fccOrderInfo.Volume == 0)
+                    {
+                        //0交易订单,证明为取消授权后产生的订单,不走核销,而是在小程序上显示为授权失败,让其重新发起授权或退款
+                        logger.Info("0交易,取消授权");
+                        FccOrderInfo? order = await mysqlDbContext.FccOrderInfos.FirstOrDefaultAsync(order => order.Id == fccOrderInfo.Id);
+                        if (order != null)
+                        {
+                            order.AuthorizationStatus = 0; //存在油机手动取消授权的情况,因此这里也要更新授权状态
+                            int v = await mysqlDbContext.SaveChangesAsync();
+                            logger.Info($"修改行数{v}");
+                        }
+                        
+
+                        SendUnAuthorizationResult sendUnAuthorizationResult = new SendUnAuthorizationResult();
+                        sendUnAuthorizationResult.NozzleId = fccOrderInfo.NozzleNum;
+                        sendUnAuthorizationResult.TransactionID = fccOrderInfo.CloundOrderId;
+                        sendUnAuthorizationResult.TransactionNumber = fccOrderInfo.Ttc.ToString();
+                        sendUnAuthorizationResult.OilMachineStatus = OilMachineStatus.Success;
+                        logger.Info($"0交易,发送订单状态已为未授权:{JsonConvert.SerializeObject(sendUnAuthorizationResult)}");
+                        HttpResponseMessage httpResponseMessage = await httpClientUtil.SendUnAuthorizationResult(JsonConvert.SerializeObject(sendUnAuthorizationResult));
+                        logger.Info($"0交易,发送订单状态已为未授权响应:send Unauthorization result response:{JsonConvert.SerializeObject(httpResponseMessage.Content.ReadAsStringAsync())}");
+                    }
+                    else
+                    {
+                        //核销
+                        Redeem redeem = new Redeem();
+                        redeem.trxId = (int)fccOrderInfo.CloundOrderId;
+                        redeem.OriginalQty = fccOrderInfo.Volume;
+                        redeem.FuelItemPumpTotalizerVolume = fccOrderInfo.PumpCode ?? 0m;
 
-                    string param = JsonConvert.SerializeObject(redeem);
+                        string param = JsonConvert.SerializeObject(redeem);
 
-                    logger.Info($"Redeem order:{param}");
-                    HttpResponseMessage httpResponseMessage = await httpClientUtil.Redeem(param);
+                        logger.Info($"核销订单参数:{param}");
+                        HttpResponseMessage httpResponseMessage = await httpClientUtil.Redeem(param);
 
-                    string responseStr = await httpResponseMessage.Content.ReadAsStringAsync();
-                    Response<CreateTransactionResponse>? response = JsonConvert.DeserializeObject<Response<CreateTransactionResponse>>(responseStr);
-                    logger.Info($"Redeem order response:{JsonConvert.SerializeObject(response)}");
+                        string responseStr = await httpResponseMessage.Content.ReadAsStringAsync();
+                        Response<CreateTransactionResponse>? response = JsonConvert.DeserializeObject<Response<CreateTransactionResponse>>(responseStr);
+                        logger.Info($"核销订单回复:{JsonConvert.SerializeObject(response)}");
+
+                        //fccOrderInfo.CloundOrderId = response?.data?.Id;
+                        //fccOrderInfo.UploadState = response?.data == null ? 0 : 1;
+                        //mysqlDbContext.SaveChanges();
+                    }
 
-                    //fccOrderInfo.CloundOrderId = response?.data?.Id;
-                    //fccOrderInfo.UploadState = response?.data == null ? 0 : 1;
                     //mysqlDbContext.SaveChanges();
                 }
-                
-                //mysqlDbContext.SaveChanges();
+            } catch(Exception ex)
+            {
+                logger.Error($"创建或核销订单出错:{JsonConvert.SerializeObject(ex)}");
             }
             
+            
         }
 
         /// <summary>
@@ -1454,6 +1498,14 @@ namespace HengshanPaymentTerminal
             List<int> fuelingNozzle = new List<int>();
             foreach (var nozzleState in heartBeatMessage.NozzleStatus)
             {
+                //油机UI重启,重发二维码
+                if (nozzleState.STATU == 1) needUpdateQRSet.Add(nozzleState.NozzleNum);
+                if (nozzleState.STATU == 3 && needUpdateQRSet.Contains(nozzleState.NozzleNum))
+                {
+                    UpdateQRCode(nozzleState.NozzleNum);
+                    needUpdateQRSet.Remove(nozzleState.NozzleNum);
+                }
+
                 if (nozzleStatusDic.TryGetValue(nozzleState.NozzleNum, out var value))
                 {
                     if (nozzleState.STATU == value) continue;
@@ -1507,6 +1559,41 @@ namespace HengshanPaymentTerminal
             
         }
 
+        /// <summary>
+        /// 更新二维码信息
+        /// 油机ui进入配置后退出,会重启UI,此时需要重新发送二维码
+        /// </summary>
+        public async void UpdateQRCode(int nozzleNum)
+        {
+            string smallProgram = stationInfo?.SmallProgram ?? "";
+            if (string.IsNullOrEmpty(smallProgram))
+            {
+                logger.Info($"更新二维码信息:can not get smallProgram link");
+                return;
+            }
+
+            DetailsNozzleInfoOutput? item = nozzleInfoList.Find(nozzle => nozzle.NozzleNum == nozzleNum);
+            if (item == null)
+            {
+                logger.Error($"找不到{nozzleNum}号枪信息");
+                return;
+            }
+            SendQrCode sendQrCode = new SendQrCode((int)item.CloundNozzleId, item.NozzleNum, smallProgram, getFrame(null));
+            byte[] commandAndNozzle = { sendQrCode.Handle, (byte)sendQrCode.NozzleNum };
+
+            Thread.Sleep(5000);
+            CommonMessage commonMessage = await SendMessageToMaichine($"发送{sendQrCode.NozzleNum}号枪二维码", (request, response) =>
+            {
+                if (response.Handle == (byte)CommonMessage.Command.COMMON)
+                {
+                    CommonAnswerBack commonAnswerBack = (CommonAnswerBack)response;
+                    return commonAnswerBack.Command == (byte)CommonMessage.Command.SEND_QR_CODE && commonAnswerBack.NozzleNum == sendQrCode.NozzleNum;
+                }
+                return false;
+            }, sendQrCode);
+
+        }
+
         /// <summary>
         /// 获取发送帧号
         /// </summary>

+ 13 - 1
HengshanPaymentTerminal/Http/Request/HttpRequest.cs

@@ -408,7 +408,8 @@ namespace HengshanPaymentTerminal.Http.Request
             this.Qty = fccOrderInfo.Volume;
             this.FuelItemTransactionEndTime = fccOrderInfo.EndTime ?? DateTime.Now;
             this.TransactionTime = fccOrderInfo.PaymentTime;
-            this.Product = fccOrderInfo.OilName;
+            //this.Product = fccOrderInfo.OilName;
+            this.Product = "92#";
             this.Price = fccOrderInfo.Price;
             this.TransactionNumber = fccOrderInfo.Ttc.ToString();
             this.MiniProgramID = null;
@@ -482,6 +483,12 @@ namespace HengshanPaymentTerminal.Http.Request
         public int trxId { get; set; }
 
         public decimal OriginalQty {  get; set; }
+
+        /// <summary>
+        /// 泵码
+        /// </summary>
+        public decimal FuelItemPumpTotalizerVolume { get; set; }
+
     }
     /// <summary>
     /// 发送云端油枪状态数据对象
@@ -544,6 +551,11 @@ namespace HengshanPaymentTerminal.Http.Request
         /// 结果 1:FCC 与油机断开连接;2:FCC 发送信息到油机,但超时未回复;3:取消授权失败;4:取消授权成功;5:未找到流水号
         /// </summary>
         public OilMachineStatus OilMachineStatus { get; set; }
+
+        /// <summary>
+        /// 云端订单id
+        /// </summary>
+        public long? TransactionID { get; set; }
     }
 
     public enum OilMachineStatus

+ 20 - 17
HengshanPaymentTerminal/Http/Response/Response.cs

@@ -2,6 +2,8 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations.Schema;
+using System.Data.SqlTypes;
+using System.Data;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -70,8 +72,8 @@ namespace HengshanPaymentTerminal.Http.Response
     public class CreateTransactionResponse
     {
         /// <summary>
-        /// 订单唯一标识符
-        /// </summary>
+		/// 订单唯一标识符
+		/// </summary>
         public long Id { get; set; }
 
         /// <summary>
@@ -82,7 +84,7 @@ namespace HengshanPaymentTerminal.Http.Response
         /// <summary>
         /// 用户ID
         /// </summary>
-        public long MiniProgramID { get; set; }
+        public long? MiniProgramID { get; set; }
 
         /// <summary>
         /// 枪号
@@ -101,17 +103,12 @@ namespace HengshanPaymentTerminal.Http.Response
 
         /// <summary>
         /// 授权时间
-        /// </summary>
+        /// </summary
         public DateTime? AuthorizationTime { get; set; }
 
-        /// <summary>
-        /// 创建人
-        /// </summary>
         public string CreateBy { get; set; }
 
-        /// <summary>
-        /// 订单创建时间
-        /// </summary>
+        
         public DateTime? CreateTime { get; set; }
 
         /// <summary>
@@ -152,8 +149,7 @@ namespace HengshanPaymentTerminal.Http.Response
         /// <summary>
         /// 原升数
         /// </summary>
-        public decimal Qty { get; set; }
-
+        public decimal? Qty { get; set; }
         /// <summary>
         /// 实际加油升数
         /// </summary>
@@ -178,31 +174,38 @@ namespace HengshanPaymentTerminal.Http.Response
         /// 加密字符串,用于验证金额是否篡改
         /// </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 string BillNumber { get; set; }
+        /// <summary>
+        /// 退款状态
+        /// </summary>
+        public RefundStatus RefundStatus { get; set; }
+        /// <summary>
+        /// 泵码
+        /// </summary>
+        public decimal? FuelItemPumpTotalizerVolume { get; set; }
 
     }
 

+ 2 - 2
HengshanPaymentTerminal/MessageEntity/Outgoing/SendAuthorization.cs

@@ -49,8 +49,8 @@ namespace HengshanPaymentTerminal.MessageEntity.Outgoing
             byte[] commandAndNozzle = { this.Handle, (byte)this.NozzleNum };
             byte[] authorizationTimeBytes = ConvertDateTimeToByteArray(this.AuthorizationTime);
             //将小数点后移两位,因为油机只支持两位小数点,这边传过去的3位字节转为int后取后两位为十分位和百分位
-            int value = (int)this.Value * 100;
-            byte[] valueBytes = NumberToByteArrayWithPadding(value, 3);
+            //int value = (int)this.Value * 100;
+            byte[] valueBytes = FormatDecimal(this.Value);
             list.AddRange(commandAndNozzle);
             list.AddRange(authorizationTimeBytes);
             list.Add((byte)this.AuthorizationType);

+ 6 - 6
HengshanPaymentTerminal/MessageEntity/Outgoing/SendRefund.cs

@@ -59,16 +59,16 @@ namespace HengshanPaymentTerminal.MessageEntity.Outgoing
             byte[] ttcBytes = NumberToByteArrayWithPadding(this.TTC, 4);
 
             //加油金额
-            int amount = (int)(this.Amount * 100);
-            byte[] amountBytes = NumberToByteArrayWithPadding(amount, 3);
+            //int amount = (int)(this.Amount * 100);
+            byte[] amountBytes = FormatDecimal(this.Amount);
 
             //实付金额
-            int amountPayable = (int)(this.AmountPayable * 100);
-            byte[] amountPayableBytes = NumberToByteArrayWithPadding(amountPayable, 3);
+            //int amountPayable = (int)(this.AmountPayable * 100);
+            byte[] amountPayableBytes = FormatDecimal(this.AmountPayable);
 
             //退款金额
-            int refund = (int)(this.Refund * 100);
-            byte[] refundBytes = NumberToByteArrayWithPadding(refund, 3);
+            //int refund = (int)(this.Refund * 100);
+            byte[] refundBytes = FormatDecimal(this.Refund);
 
 
             list.AddRange(commandAndNozzle);

+ 14 - 10
HengshanPaymentTerminal/Mqtt/Request/MqttRequest.cs

@@ -203,24 +203,28 @@ namespace HengshanPaymentTerminal.Mqtt.Request
         {
             string userNameStr = userName ?? "";
             string phoneStr = phoneNumber ?? string.Empty;
+            int? paymentType = null;
+            if(this.PaymentMethod != null) paymentType = (int?)this.PaymentMethod;
             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,
+                PaymentTime = this.TransactionTime,
+                NozzleNum = (int)this.NozzleId,
+                OilName = this.ProductName,
+                PaymentStatus = (int) this.OrderStatus,
+                PayType = paymentType,
+                CloundOrderId = this.Id,
+                Amount = this.OriginalAmount,
+                Volume = this.Qty,
+                AmountPayable = this.ActualPaymentAmount,
                 UploadState = 1,
                 IsDelete = 0,
                 Price = this.Price,
                 PaymentName = paymentName,
                 UserName = userNameStr,
-                PhoneNumber = phoneStr
+                PhoneNumber = phoneStr,
+                RefundStatus = 0,
+                VolumePayable = this.Qty,
 
             };
         }

+ 15 - 1
src/FccLife.Web/Controller/ConfigController.cs

@@ -3,6 +3,7 @@ using Edge.Core.Domain.FccOilInfo.Ouput;
 using Edge.Core.Domain.FccStationInfo.Input;
 using Edge.Core.Domain.FccStationInfo.Output;
 using FccLite.Web.Services.FccOilInfo;
+using FccLite.Web.Services.FccProjectInfo;
 using FccLite.Web.Services.FccStaionInfo;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
@@ -21,10 +22,23 @@ namespace FccLite.Web.Controller
 
         private readonly IStationService _stationService;
         private readonly IOilInfoService _oilInfoService;
-        public ConfigController(IStationService stationService,IOilInfoService oilInfoService) 
+        private readonly IFccProjectInfoServices _fccProjectInfoServices;
+        public ConfigController(IStationService stationService,IOilInfoService oilInfoService,IFccProjectInfoServices fccProjectInfoServices) 
         {
             _stationService = stationService;
             _oilInfoService = oilInfoService;
+            _fccProjectInfoServices = fccProjectInfoServices;
+        }
+
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("getVersion")]
+        public async Task<IActionResult> GetVersion()
+        {
+            string version = await _fccProjectInfoServices.GetVersion();
+            return Ok(version);
         }
 
         /// <summary>

+ 1 - 0
src/FccLife.Web/Controller/OrderInfoController.cs

@@ -39,6 +39,7 @@ namespace FccLite.Web.Controller
         {
             logger.Info($"download after pay order excel:{JsonConvert.SerializeObject(orderInfoPageInput)}");
             byte[] fileBytes = await _orderInfoService.DownloadAfterPayOrderExcel(orderInfoPageInput);
+            logger.Info($"导出后支付excel,数据长度:{fileBytes.Length}");
             return File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "orders.xlsx");
         }
 

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

@@ -19,6 +19,7 @@ using FccLite.Web.Services.FccMachineInfo;
 using FccLite.Web.Repositories.FccMachineInfo;
 using OfficeOpenXml;
 using System.Text.Json;
+using FccLite.Web.Services.FccProjectInfo;
 
 var builder = WebApplication.CreateBuilder(args);
 // 自动加载 appsettings.json 和 appsettings.{Environment}.json
@@ -56,6 +57,7 @@ builder.Services.AddScoped<IMachineService, MachineServiceImpl>();
 builder.Services.AddScoped<IMachineRepository, MachineReposity>();
 builder.Services.AddScoped<IHttpClient, HttpClientService>();
 builder.Services.AddScoped<IHttpClientUtil, HttpClientUtils>();
+builder.Services.AddScoped<IFccProjectInfoServices, FccProjectInfoServices>();
 
 //excel
 ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

+ 1 - 1
src/FccLife.Web/Services/FccOrderInfo/OrderInfoService.cs

@@ -98,7 +98,7 @@ namespace FccLite.Web.Services.FccOrderInfo
             } catch(Exception e)
             {
                 Console.WriteLine(e);
-                Logger.Error(e.Message);
+                Logger.Error($"报错:{e.Message}");
             }
 
             return new byte[0];

+ 22 - 0
src/FccLife.Web/Services/FccProjectInfo/FccProjectInfoServices.cs

@@ -0,0 +1,22 @@
+
+namespace FccLite.Web.Services.FccProjectInfo
+{
+    public class FccProjectInfoServices : IFccProjectInfoServices
+    {
+        private readonly IConfiguration _configuration;
+        public FccProjectInfoServices(IConfiguration configuration) 
+        {
+            _configuration = configuration;
+        }
+
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        public Task<string> GetVersion()
+        {
+            string version = _configuration.GetSection("Version").Get<string>() ?? "null";
+            return Task.FromResult(version);
+        }
+    }
+}

+ 11 - 0
src/FccLife.Web/Services/FccProjectInfo/IFccProjectInfoServices.cs

@@ -0,0 +1,11 @@
+namespace FccLite.Web.Services.FccProjectInfo
+{
+    public interface IFccProjectInfoServices
+    {
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        Task<String> GetVersion();
+    }
+}

+ 2 - 1
src/FccLife.Web/appsettings.Production.json

@@ -20,5 +20,6 @@
     "subTopic": [ "authorization", "unAuthorization", "paid", "refund" ],
     "user": "HSClient",
     "password": "HS202503"
-  }
+  },
+  "Version": "2025.02.04"
 }

+ 1 - 1
src/FccWeb/admin.ui.plus-master/index.html

@@ -21,6 +21,6 @@
       })()
     </script> -->
     <script type="module" src="/src/main.ts"></script>
-    <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=wsijQt8sLXrCW71YesmispvYHitfG9gv&s=1"></script>
+    <!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=wsijQt8sLXrCW71YesmispvYHitfG9gv&s=1"></script> -->
   </body>
 </html>

+ 10 - 1
src/FccWeb/admin.ui.plus-master/src/api/api.ts

@@ -1,6 +1,15 @@
 import axios from 'axios'
 import request from './request'    // 引入封装的axios
 
+/** ----- 项目信息 ------- */
+//获取FCC版本信息
+export const getFccVersion = () =>{
+	return request({
+		url:'/qrFueling/config/getVersion',
+		method:'get'
+	})
+}
+
 /** ----- 站点 ----- */
 // 获取油站信息
 export const getDataList = (data:any)=>{
@@ -196,7 +205,7 @@ export const getOrderFilter =(data:any)=>{
 //导出后支付订单excel
 export const downloadAfterpayOrder = (data:any) => {
 	const send = axios.create({
-		timeout: 5000, // 超时
+		timeout: 60000, // 超时
 		baseURL: import.meta.env.VITE_API_URL_FCC,
 	})
 	return send.post('/qrFueling/order/downloadOrderAfterPayOrderExcel', data, { responseType: 'arraybuffer' })

+ 17 - 1
src/FccWeb/admin.ui.plus-master/src/layout/logo/index.vue

@@ -2,6 +2,7 @@
   <div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
     <img v-if="showLogoMini" :src="logoMini" class="layout-logo-medium-img" />
     <span class="my-line-1">{{ themeConfig.globalTitle }}</span>
+    <span class="my-line-1">_v{{ version }}</span>
   </div>
   <div class="layout-logo-size" v-else @click="onThemeConfigChange">
     <img v-if="showLogoMini" :src="logoMini" class="layout-logo-size-img" />
@@ -9,15 +10,18 @@
 </template>
 
 <script setup lang="ts" name="layoutLogo">
-import { computed } from 'vue'
+import { computed, onMounted, ref } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useThemeConfig } from '/@/stores/themeConfig'
 import logoMini from '/@/assets/logo-com.png'
+import { getFccVersion } from "/@/api/api";
 
 // 定义变量内容
 const storesThemeConfig = useThemeConfig()
 const { themeConfig } = storeToRefs(storesThemeConfig)
 
+let version = ref('');
+
 // 设置 logo 的显示。classic 经典布局默认显示 logo
 const setShowLogo = computed(() => {
   let { isCollapse, layout } = themeConfig.value
@@ -29,6 +33,18 @@ const showLogoMini = computed(() => {
   return layout !== 'columns'
 })
 
+// 页面加载时
+onMounted(() => {
+  getVersion();
+})
+
+//获取版本号
+const getVersion = async () => {
+  const res = await getFccVersion();
+  console.log(res)
+  version.value = res;
+}
+
 // logo 点击实现菜单展开/收起
 const onThemeConfigChange = () => {
   if (themeConfig.value.layout === 'transverse') return false

+ 6 - 3
src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue

@@ -144,14 +144,17 @@ const DeviceDialog = defineAsyncComponent(() => import('/@/views/admin/component
 const MachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/editMachine.vue'))
 import { Loading, Switch } from '@element-plus/icons-vue'; // 引入加载图标
 import { watch } from 'fs';
+import machineImg from '/@/assets/machine.png'
+import tankImg from '/@/assets/tank.png'
+import nozzleImg from '/@/assets/nozzle.png'
 const editDialogRef = ref()
 const editNozzleFromMachineDialogRef = ref()
 const DeviceDialogRef = ref()
 const MachineDialogRef = ref()
 
-const machineImgUrl = ref('/src/assets/machine.png')
-const tankImgUrl = ref('/src/assets/tank.png')
-const nozzleImgUrl = ref('/src/assets/nozzle.png')
+const machineImgUrl = ref(machineImg)
+const tankImgUrl = ref(tankImg)
+const nozzleImgUrl = ref(nozzleImg)
 const displayData = reactive({
     isShowDialog: false,
     isShowTank:true,

+ 14 - 3
src/FccWeb/admin.ui.plus-master/src/views/admin/login/index.vue

@@ -13,7 +13,7 @@
           <img :src="loginMain" />
         </div>
         <img :src="loginBg" class="login-left-waves" />
-        <div class="floor">托肯恒山科技(广州)有限公司&nbsp;&nbsp;版本号:v2.00.1</div>
+        <div class="floor">托肯恒山科技(广州)有限公司&nbsp;&nbsp;版本号:v{{ version }}</div>
       </div>
       <div class="login-right flex">
         <div class="login-right-warp flex-margin">
@@ -46,13 +46,14 @@
 </template>
 
 <script setup lang="ts" name="loginIndex">
-import { defineAsyncComponent, onMounted, reactive, computed } from 'vue'
+import { defineAsyncComponent, onMounted, reactive, computed, ref } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useThemeConfig } from '/@/stores/themeConfig'
 import { NextLoading } from '/@/utils/loading'
 import logoMini from '/src/assets/logo-com.png'
 import loginMain from '/@/assets/login-main.svg'
 import loginBg from '/@/assets/login-bg.svg'
+import { getFccVersion } from "/@/api/api";
 
 // 引入组件
 const Account = defineAsyncComponent(() => import('./component/account.vue'))
@@ -64,8 +65,10 @@ const storesThemeConfig = useThemeConfig()
 const { themeConfig } = storeToRefs(storesThemeConfig)
 const state = reactive({
   tabsActiveName: 'account',
-  isScan: false,
+  isScan: false
 })
+let version = ref('');
+
 
 // 获取布局配置信息
 const getThemeConfig = computed(() => {
@@ -73,8 +76,16 @@ const getThemeConfig = computed(() => {
 })
 // 页面加载时
 onMounted(() => {
+  getVersion();
   NextLoading.done()
 })
+
+//获取版本号
+const getVersion = async () => {
+  const res = await getFccVersion();
+  console.log(res)
+  version.value = res;
+}
 </script>
 
 <style scoped lang="scss">