123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using Applications.FDC;
- using Edge.Core.Database;
- using Edge.Core.Processor;
- using Edge.Core.IndustryStandardInterface.Pump;
- using Microsoft.Extensions.Logging;
- using MySql.Data.MySqlClient;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Threading.Tasks;
- using Wayne.FDCPOSLibrary;
- using Edge.Core.Processor.Dispatcher.Attributes;
- using System.Threading;
- namespace Applications.PumpInfoToSinoChemPosSqlServerOrMySql
- {
- [MetaPartsDescriptor(
- "lang-zh-cn:加油机信息转发代理 MySQLlang-en-us:Pump Info Agent to MySQL",
- "lang-zh-cn:用于将加油机的状态和交易数据插入至 MySQL 目标数据库中" +
- "lang-en-us:Used for proxing pump state and trx to target MY SQL database",
- new[] { "lang-zh-cn:中化lang-en-us:SinoChem" })]
- public class AppMySql : AppBase, IAppProcessor
- {
- public string MetaConfigName { get; set; }
-
-
-
-
-
- [ParamsJsonSchemas("appCtorParamsJsonSchema")]
- public AppMySql(AppConfigV1 appConfig, IServiceProvider services) : base(appConfig, services)
- {
- }
- public void Init(IEnumerable<IProcessor> processors)
- {
- base.fdcServerHostApp = processors.OfType<FdcServerHostApp>().First();
- base.HandlePumpStateChangeToDatabase(
- () => new MySqlConnection(base.appConfig.DatabaseConnStr),
- () => new MySqlCommand());
- }
- protected override string InitTable_jy_info_SqlCommand(string siteLevelNozzleId, string gradeFriendlyName,
- double totalizerVol, double totalizerAmt)
- {
- return "call insert_jy_info_by_jihao('" + siteLevelNozzleId + "','F','" + gradeFriendlyName + "',0,0," + totalizerVol + "," + totalizerAmt + "); ";
- }
- public Task<bool> Start()
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return Task.FromResult(
- base.ReCreatePumpLayoutToDatabase(
- () => new MySqlConnection(base.appConfig.DatabaseConnStr),
- () => new MySqlCommand()));
- }
- public Task<bool> Stop()
- {
- return Task.FromResult(true);
- }
- }
- }
|