123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using SinochemCarplateService.Models;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml.Serialization;
- using Wayne.Lib.StateEngine;
- using Wayne.Lib.StateEngine.Generic;
- using WayneChina_IcCardReader_SinoChem.MessageEntity.Incoming;
- namespace SinochemInternetPlusApp.States.CarPlateManualMode
- {
- class Composite : CompositeState<FuelingPoint>
- {
- protected override void ConfigureCompositeStateMachine()
- {
- CONFIGURATION.Config(StateMachine.StateTransitionLookup);
- }
- public override void UnhandledEvent(StateEngineEvent stateEngineEvent, ref Transition transition)
- {
- base.UnhandledEvent(stateEngineEvent, ref transition);
-
- if (stateEngineEvent.Type.Equals(EventType.CarPlateScanned))
- {
- var genericEvent = stateEngineEvent as GenericEvent<CarPlateTrxRequest>;
- if (genericEvent != null && genericEvent.EventArgs != null)
- {
- var newNozzleId = Convert.ToInt32(genericEvent.EventArgs.gun);
- Main.NewEpsTrx = EpsTransaction.CreateEpsTrx(newNozzleId, EpsTransactionMode.CarPlateMode, Main.DebugLogger);
- Main.NewEpsTrx.Model.car_number = genericEvent.EventArgs.car_Number;
- Main.NewEpsTrx.Model.ttc = genericEvent.EventArgs.ttc;
- Main.NewEpsTrx.Model.balance_before_trx = genericEvent.EventArgs.amount;
- Main.NewEpsTrx.Model.token = genericEvent.EventArgs.token;
- Main.NewEpsTrx.Model.tid = genericEvent.EventArgs.tid;
- Main.NewEpsTrx.Model.xf_date = DateTime.Parse(DateTime.Now.Date.ToString("yyyy-MM-dd"));
- Main.NewEpsTrx.Model.trx_status = EpsTrxStatus.BeforeFueling;
- Main.NewEpsTrx.SaveToDb();
-
- var validTrx = EpsTransactionQuery.GetValidCarPlateEpsTrxModels(
- Main.GetAllNozzlesOnThisSide(),
- ConfigurationValues.AlreadyDoneEpsTrxCountPerDisplay,
- Main.DebugLogger);
- Main.ActiveTrx = validTrx;
- if (Main.Eps.NozzleMappingGradeName() != null)
- {
- foreach (var trx in validTrx)
- {
- if (trx.trx_status == EpsTrxStatus.BeforeFueling || trx.trx_status == EpsTrxStatus.Fueling)
- {
- trx.AvailableNozzleGrade = Main.GetAvailableNozzleInfo();
- }
- }
- }
- int requestId;
- var text = Main.Eps.CreateDisplayTrxCommand(validTrx, out requestId, 0);
- if (Main.Eps.CarPlateHandler != null)
- {
- DebugLog(text);
- Main.Eps.CarPlateHandler.BroadcastMessageViaFdc(text);
- }
- genericEvent.Handled = true;
- return;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- private void BroadcastTrxListChanged()
- {
- var validTrx = EpsTransactionQuery.GetValidCarPlateEpsTrxModels(
- Main.GetAllNozzlesOnThisSide(),
- ConfigurationValues.AlreadyDoneEpsTrxCountPerDisplay,
- Main.DebugLogger);
- int trxOpRequestId;
-
- var text = Main.Eps.CreateDisplayTrxCommand(validTrx, out trxOpRequestId, 0);
- if (Main.Eps.CarPlateHandler != null)
- {
- Main.Eps.CarPlateHandler.BroadcastMessageViaFdc(text);
- }
- }
- }
- }
|