| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- using OHV.Common.Model;
- using OHV.Common.Shareds;
- using SQLite.CodeFirst;
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- namespace OHV.SqliteDAL
- {
- public class OHVDbInitializer : SqliteDropCreateDatabaseWhenModelChanges<OHVDbContext>
- {
- public OHVDbInitializer( DbModelBuilder modelBuilder ) : base( modelBuilder, typeof( CustomHistory ) )
- {
- }
- protected override void Seed( OHVDbContext context )
- {
- //base.Seed( context );
- // Here you can seed your core data if you have any.
- context.Set<VehicleInfo>().Add( new VehicleInfo { VehicleID = "V0001", CurrentTag="0000", VehicleState = eVehicleState.None } );
- context.Set<Config>().AddRange( new List<Config>()
- {
- new Config
- {
- ID = ConstString.Addr,
- Name = ConstString.Addr,
- Value = "127.0.0.1",
- Desc = "OCS Address",
- EditTime = DateTime.Now
- },
- new Config
- {
- ID = ConstString.PortNo,
- Name = ConstString.PortNo,
- Value = "5000",
- Desc = "OCS Port Number",
- EditTime = DateTime.Now
- },
- new Config
- {
- ID = ConstString.VehicleID,
- Name = ConstString.VehicleID,
- Value = "V0001",
- Desc = "Vehicle ID",
- EditTime = DateTime.Now
- },
- new Config
- {
- ID = ConstString.OCSID,
- Name = ConstString.OCSID,
- Value = "S0",
- Desc = "OCS ID",
- EditTime = DateTime.Now
- },
- new Config
- {
- ID = ConstString.BuzzerStartReadyTime,
- Name = ConstString.BuzzerStartReadyTime,
- Value = "3000",
- Desc = "BeforeMoveBuzzer",
- EditTime = DateTime.Now
- },
- new Config
- {
- ID = ConstString.PIOInterLockTimeout,
- Name= ConstString.PIOInterLockTimeout,
- Value = "30000",
- Desc = "PIO InterLock Time Out",
- EditTime = DateTime.Now,
- },
- new Config
- {
- ID = ConstString.PIOTimeOut,
- Name= ConstString.PIOTimeOut,
- Value = "5000",
- Desc = "PIO Time Out",
- EditTime = DateTime.Now,
- },
- new Config
- {
- ID = ConstString.DriveSpeed,
- Name= ConstString.DriveSpeed,
- Value = "100",
- Desc = "Drive Speed",
- EditTime = DateTime.Now,
- },
- new Config
- {
- ID = ConstString.BatteryCanType,
- Name= ConstString.BatteryCanType,
- Value = "1",
- Desc = "Can Kind",
- EditTime = DateTime.Now,
- },
- new Config
- {
- ID = ConstString.RouteFilePath,
- Name= ConstString.RouteFilePath,
- Value = @"C:\OHV\mahaOHV\route_map\ohv_testmap7.json",
- Desc = "Route File Path",
- EditTime = DateTime.Now,
- },
- } );
- context.Set<AxisPositionData>().AddRange( new List<AxisPositionData>()
- {
- new AxisPositionData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_LEFT,
- Name = ConstString.TEACH_POSITION_LOCK,
- Value = 25,
- },
- new AxisPositionData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_LEFT,
- Name = ConstString.TEACH_POSITION_UNLOCK,
- },
- new AxisPositionData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_RIGHT,
- Name = ConstString.TEACH_POSITION_LOCK,
- Value = 25,
- },
- new AxisPositionData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_RIGHT,
- Name = ConstString.TEACH_POSITION_UNLOCK,
- },
- } );
- context.Set<AxisVelocityData>().AddRange( new List<AxisVelocityData>()
- {
- new AxisVelocityData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_LEFT,
- AutoRunVelocity = 200,
- AutoRunAccelerate = 100,
- AutoRunDecelerate = 100,
- ManualRunVelocity = 100,
- JogFast = 10,
- JogSlow = 2,
- Tolerance = 1,
- },
- new AxisVelocityData
- {
- AxisName = ConstString.AXIS_CARRIER_LOCK_RIGHT,
- AutoRunVelocity = 200,
- AutoRunAccelerate = 100,
- AutoRunDecelerate = 100,
- ManualRunVelocity = 100,
- JogFast = 10,
- JogSlow = 2,
- Tolerance = 1,
- },
- } );
- context.Set<AxisConfig>().AddRange( new List<AxisConfig>()
- {
- new AxisConfig
- {
- Name = ConstString.AXIS_CARRIER_LOCK_LEFT,
- Scale = 0.001,
- Address = "192.168.0.40",
- },
- new AxisConfig
- {
- Name = ConstString.AXIS_CARRIER_LOCK_RIGHT,
- Scale = 0.001,
- Address = "192.168.0.41",
- }
- } );
- context.Set<Alarm>().AddRange( new List<Alarm>()
- {
- new Alarm { AlarmId = 1, Kind = eAlarmKind.Axis, Name = "LeftClampServo", Text="Left Clamp Lock Motion Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 2, Kind = eAlarmKind.Axis, Name = "LeftClampServo", Text="Left Clamp Unlock Motion Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 3, Kind = eAlarmKind.Axis, Name = "RightClamServo", Text="Right Clamp Lock Motion Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 4, Kind = eAlarmKind.Axis, Name = "RightClamServo", Text="Right Clamp Unlock Motion Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 5, Kind = eAlarmKind.Axis, Name = "RightClamServo", Text="Is Not Origin Return", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 6, Kind = eAlarmKind.Axis, Name = "LeftClampServo", Text="Is Not Origin Return", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 7, Kind = eAlarmKind.Axis, Name = "RightClamServo", Text="Origin Return Fail", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 8, Kind = eAlarmKind.Axis, Name = "LeftClampServo", Text="Origin Return Fail", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 9, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Already Exist Carrier", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 10, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Loading Time Over", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 11, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Not Exist Carrier", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 12, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Unloading Time Over", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 13, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Lifter Not Unloading Position", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 14, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Lifter Not Loading Position", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 15, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Lifter have not Carrier", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 16, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Inverter Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 17, Kind = eAlarmKind.Axis, Name = "PIO", Text="Port PIO Ready Off", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 18, Kind = eAlarmKind.Axis, Name = "PIO", Text="Port PIO Time Out", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 19, Kind = eAlarmKind.Axis, Name = "PIO", Text="Port PIO InterLock On", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 20, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Loading Position Wrong", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 21, Kind = eAlarmKind.Axis, Name = "Conveyor", Text="Unloading Position Wrong", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 22, Kind = eAlarmKind.Axis, Name = "Init", Text="Vehicle Drive Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 23, Kind = eAlarmKind.Axis, Name = "EStop", Text="EStop", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 24, Kind = eAlarmKind.Axis, Name = "Vehicle Move Error", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 25, Kind = eAlarmKind.Axis, Name = "Charge", Text="Charge Point Not Ready", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 26, Kind = eAlarmKind.Axis, Name = "Charge", Text="Charge Point PIO Error", Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 27, Kind = eAlarmKind.Axis, Name = "Charge", Text="while Vehicle Move Obstacle Detected",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 28, Kind = eAlarmKind.Axis, Name = "System", Text="E - Stop Switch On",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 29, Kind = eAlarmKind.Axis, Name = "System", Text="MC Off",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 30, Kind = eAlarmKind.Axis, Name = "System", Text="CP Off 24V",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 31, Kind = eAlarmKind.Axis, Name = "System", Text="CP Off Safety",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 32, Kind = eAlarmKind.Axis, Name = "BMS", Text="Battery Manage System Disconnected",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 33, Kind = eAlarmKind.Axis, Name = "Steering", Text="Steering State Abnormal",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 34, Kind = eAlarmKind.Drive, Name = "PIO", Text="Battery Charge PIO Not Ready On",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 35, Kind = eAlarmKind.Drive, Name = "PIO", Text="Battery Charge PIO Not SEND_RUN On TimeOver",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 36, Kind = eAlarmKind.Drive, Name = "PIO", Text="Battery Charge PIO Not SEND_COMPLETE On TimeOver",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 37, Kind = eAlarmKind.Drive, Name = "PIO", Text="Steering State Abnormal",Solution="", Description="", Level = eAlarmLevel.Falut, },
- new Alarm { AlarmId = 38, Kind = eAlarmKind.Drive, Name = "PIO", Text="Steering State Abnormal",Solution="", Description="", Level = eAlarmLevel.Falut, },
- } );
- //context.Set<HisAlarm>().Add(new HisAlarm { AlarmId = 1, OccurTime = DateTime.Now.AddDays(-10) });
- context.Set<Route>().Add( new Route { Id = 1, Name = "P01", PrePoint = "P11", NextPoint = "P02", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1000", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 2, Name = "P02", PrePoint = "P01", NextPoint = "P03", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1001", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 3, Name = "P03", PrePoint = "P02", NextPoint = "P04", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1002", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 4, Name = "P04", PrePoint = "P03", NextPoint = "P05", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1003", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 5, Name = "P05", PrePoint = "P04", NextPoint = "P06", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1004", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 6, Name = "P06", PrePoint = "P05", NextPoint = "P07", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1005", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 7, Name = "P07", PrePoint = "P06", NextPoint = "P08", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1006", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 8, Name = "P08", PrePoint = "P07", NextPoint = "P09", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1007", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 9, Name = "P09", PrePoint = "P08", NextPoint = "P10", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1008", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 10, Name = "P10", PrePoint = "P09", NextPoint = "P11", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1009", UsePIO = true } );
- context.Set<Route>().Add( new Route { Id = 11, Name = "P11", PrePoint = "P10", NextPoint = "P01", ScaleTolerance = 0.5, Form = eRoadForm.Straight, ScaleValue = 0.0, Type = ePointType.LoadPort, OCSMatchID = "1010", UsePIO = true } );
- }
- }
- }
|