using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DSWeb.Common.DB { public class BillTraceDataContext : BaseDbContext { public BillTraceDataContext() : base("DongShengDB") { } public BillTraceDataContext(string conn) : base(conn) { } public DbSet BillTrace { get; set; } public DbSet BillTraceCtn { get; set; } public DbSet BillTracePlan { get; set; } public DbSet BillTraceAlertRecord { get; set; } public DbSet BilltraceImmediate { get; set; } public DbSet KeyPwd { get; set; } public DbSet BilltraceLink { get; set; } public DbSet BilltraceLinkCtn { get; set; } /// /// 频率配置 /// public DbSet BilltraceIntervalConfig { get; set; } //public DbSet BillTraceYardid { get; set; } public DbSet BilltraceLastTime { get; set; } public DbSet BilltraceUserAccount { get; set; } /// /// 场站信息(运踪) /// public DbSet CodeYarddata { get; set; } /// /// 船公司信息(运踪) /// public DbSet CodeCarrier { get; set; } /// /// 运踪数据改变历史 /// public DbSet BilltraceChangeHis { get; set; } /// /// 运踪推送映射表 /// public DbSet billtracemapping { get; set; } /// /// 运踪自定义推送表 /// public DbSet billtracecustom { get; set; } } [Table("op_seae_billtrace")] public class OpSeaeBilltrace { public const string RelativeTypeBooking = "Booking"; //订舱 public OpSeaeBilltrace() { this.StaBeiXiang = "N"; this.StaFanChang = "N"; this.StaJiGang = "N"; this.StaYunDi = "N"; this.StaCangDan = "N"; //this.StaBaoGuan = "N"; this.StaZhuangZai = "N"; this.StaMaTouFangXing = "N"; this.StaZhuangChuan = "N"; this.StaLiGang = "N"; this.StaDaoGang = "N"; this.StaTiXiang = "N"; this.StaFanKong = "N"; this.StaTiDan = "N"; this.StaHaiGuan = "N"; this.StaWaiLi = "N"; this.StaZhongZhuanXC = "N"; this.StaZhongZhuanZC = "N"; this.StaMDGTiXiang = "N"; this.StaMDGFanKong = "N"; this.CreateTime = DateTime.Now; this.SpiderStage = "Yard"; this.StaGetBoxStart = "N"; this.StaGetBoxEnd = "N"; this.StaYDWATD = "N"; this.StaCARRIERETD = "N"; this.StaZhongzhuanKH = "N"; this.StaPortEndPlan = "N"; this.StaPortStartPlan = "N"; this.NotifyTiKong = true; this.NotifyFanChang = true; this.NotifyJiGang = true; this.NotifyYunDi = true; this.NotifyCangDan = true; this.NotifyBaoGuan = true; this.NotifyZhuangZai = true; this.NotifyMaTouFangXing = true; this.NotifyZhuangChuan = true; this.NotifyLiGang = true; this.NotifyDaoGang = true; this.NotifyTiXiang = true; this.NotifyFanKong = true; this.NotifyWeChat = false; this.NotifyEmail = false; this.StopBookYDW = false; this.IsBookYDW = false; this.IsFrontPort = true; } [Key] public string GID { get; set; } public string UserID { get; set; } public string CompID { get; set; } public string CompName { get; set; } public string MBLNO { get; set; } public string CARRIERID { get; set; } public string CARRIER { get; set; } public string YARD { get; set; } public string YardCode { get; set; } public string VESSEL { get; set; } public string VOYNO { get; set; } /// /// 场站背箱(提箱) /// public string StaBeiXiang { get; set; } public string StaFanChang { get; set; } public string StaJiGang { get; set; } public string StaYunDi { get; set; } public string StaCangDan { get; set; } //public string StaBaoGuan { get; set; } //2021-2-26修改后,次字段暂时不用,物流信息网的放行取的数据是海关放行 public string StaZhuangZai { get; set; } public string StaMaTouFangXing { get; set; } public string StaZhuangChuan { get; set; } public string StaLiGang { get; set; } public string StaDaoGang { get; set; } /// /// 到港后提箱(非场站提箱!!) /// public string StaTiXiang { get; set; } public string StaFanKong { get; set; } //public DateTime? TimeKaiChuan { get; set; } public DateTime? TimeYunDi { get; set; } public DateTime? TimeCangDan { get; set; } //public DateTime? TimeBaoGuan { get; set; } //2021-2-26修改后,次字段暂时不用,物流信息网的放行取的数据是海关放行 public DateTime? TimeZhuangZai { get; set; } //用ATA替代 //public DateTime? TimeKaoGang { get; set; } //用ATD替代 //public DateTime? TimeLiGang { get; set; } public DateTime? ETA { get; set; } public DateTime? ATA { get; set; } public DateTime? ETD { get; set; } public DateTime? ATD { get; set; } public DateTime CreateTime { get; set; } public DateTime? LastUpdate { get; set; } public bool NotifyTiKong { get; set; } public bool NotifyFanChang { get; set; } public bool NotifyJiGang { get; set; } public bool NotifyYunDi { get; set; } public bool NotifyCangDan { get; set; } public bool NotifyBaoGuan { get; set; } public bool NotifyZhuangZai { get; set; } public bool NotifyMaTouFangXing { get; set; } public bool NotifyZhuangChuan { get; set; } public bool NotifyLiGang { get; set; } public bool NotifyDaoGang { get; set; } public bool NotifyTiXiang { get; set; } public bool NotifyFanKong { get; set; } public bool NotifyWeChat { get; set; } public bool NotifyEmail { get; set; } public string OpenId { get; set; } public string Email { get; set; } public bool AlertEnable { get; set; } public string AlertPlan { get; set; } public string Remark { get; set; } public string SpiderStage { get; set; } public DateTime? TimeFangCang { get; set; } public DateTime? TimeLastBeiXiang { get; set; } public DateTime? TimeLastFanChang { get; set; } //最后返场时间 //提单放行状态和时间 public string StaTiDan { get; set; } public DateTime? TimeTiDan { get; set; } //海关放行状态和时间 public string StaHaiGuan { get; set; } public DateTime? TimeHaiGuan { get; set; } public bool HasError { get; set; } public DateTime? ErrorTime { get; set; } public string ErrorContent { get; set; } public int CtrnCount { get; set; } public int CtrnCountYunDi { get; set; } //运抵箱量 public int CtrnCountFanChang { get; set; } //返场箱量 public DateTime? BcTime { get; set; } //外理状态和时间 public string StaWaiLi { get; set; } public DateTime? TimeWaiLi { get; set; } public string UserName { get; set; } public string UserRemark { get; set; } //箱型箱量 public string CNTRTOTAL { get; set; } //订阅云当网港后数据 public bool IsBookYDW { get; set; } //订阅云当网港后数据的时间 public DateTime? TimeBookYDW { get; set; } //停止订阅云当网港后数据 public bool StopBookYDW { get; set; } //停止订阅云当网港后数据时间 public DateTime? StopBookYDWTime { get; set; } //停止订阅云当网港后数据备注 public string StopBookYDWContent { get; set; } //港后卸船 public string StaZhongZhuanXC { get; set; } public DateTime? TimeZhongZhuanXC { get; set; } //港后装船 public string StaZhongZhuanZC { get; set; } public DateTime? TimeZhongZhuanZC { get; set; } //目的港ETA public DateTime? TimeMDGETA { get; set; } //目的港ATA public DateTime? TimeMDGATA { get; set; } //目的港提箱 public string StaMDGTiXiang { get; set; } //目的港返空 public string StaMDGFanKong { get; set; } //关联数据类型 public string RelativeType { get; set; } //关联数据ID public string RelativeId { get; set; } public int? MDGNumDays { get; set; } public bool AlertFlag { get; set; } public string AlertMessage { get; set; } public bool IsFenDan { get; set; } public string StaGetBoxStart { get; set; } public string StaGetBoxEnd { get; set; } public string StaYDWATD { get; set; } public DateTime? TimeYDWATD { get; set; } public bool IsFrontPort { get; set; } public string CustomerNumber { get; set; } //中转港 public string TransitPort { get; set; } //目的港 public string DestinationPort { get; set; } public string StaCARRIERETD { get; set; } public DateTime? CARRIERETD { get; set; } public string StaZhongzhuanKH { get; set; } public DateTime? TimeJiGang { get; set; } public string StaPortEndPlan { get; set; } public DateTime? PortEndPlanTime { get; set; } public string StaPortStartPlan { get; set; } public DateTime? PortStartPlanTime { get; set; } /// /// 重置状态和数据 /// public void Reset() { this.StaBeiXiang = "N"; this.StaFanChang = "N"; this.StaJiGang = "N"; this.StaYunDi = "N"; this.StaCangDan = "N"; this.StaZhuangZai = "N"; this.StaMaTouFangXing = "N"; this.StaZhuangChuan = "N"; this.StaLiGang = "N"; this.StaDaoGang = "N"; this.StaTiXiang = "N"; this.StaFanKong = "N"; this.StaTiDan = "N"; this.StaHaiGuan = "N"; this.StaWaiLi = "N"; this.StaZhongZhuanXC = "N"; this.StaZhongZhuanZC = "N"; this.StaMDGTiXiang = "N"; this.StaMDGFanKong = "N"; this.StaCARRIERETD = "N"; this.StaZhongzhuanKH = "N"; this.StaPortEndPlan = "N"; this.StaPortStartPlan = "N"; this.TimeYunDi = null; this.TimeCangDan = null; this.TimeZhuangZai = null; this.TimeTiDan = null; this.TimeHaiGuan = null; this.TimeWaiLi = null; this.TimeZhongZhuanXC = null; this.PortEndPlanTime = null; this.PortStartPlanTime = null; this.CARRIERETD = null; this.CARRIERETD = null; this.CtrnCount = 0; this.CtrnCountFanChang = 0; this.CtrnCountYunDi = 0; this.VESSEL = string.Empty; this.VOYNO = string.Empty; } } [Table("op_seae_billtrace_ctn")] public class OpSeaeBilltraceCtn { public OpSeaeBilltraceCtn() { this.StaBeiXiang = "N"; this.StaFanChang = "N"; this.StaJiGang = "N"; this.StaZhuangChuan = "N"; this.StaMaTouFangXing = "N"; this.StaTiXiang = "N"; this.StaFanKong = "N"; this.StaWaiLi = "N"; this.StaYunDi = "N"; this.StaZhuangZai = "N"; this.StaHaiGuan = "N"; this.CreateTime = DateTime.Now; this.StaZhongZhuanXC = "N"; this.StaZhongZhuanZC = "N"; this.StaMDGTiXiang = "N"; this.StaMDGFanKong = "N"; this.StaGetBoxStart = "N"; this.StaGetBoxEnd = "N"; this.StaTimeMDGATA = "N"; this.StaTIMEMDGETA = "N"; this.StaCARRIERETD = "N"; this.StaZhongzhuanKH = "N"; } [Key] public string GID { get; set; } public string PID { get; set; } public string MBLNO { get; set; } public string CTNALL { get; set; } public string CNTRNO { get; set; } public string SEALNO { get; set; } public string CheHao { get; set; } public decimal? PKGS { get; set; } public decimal? KGS { get; set; } public decimal? CBM { get; set; } public DateTime CreateTime { get; set; } public decimal? VGM { get; set; } /// /// 场站背箱(提箱) /// public string StaBeiXiang { get; set; } public string StaFanChang { get; set; } public string StaJiGang { get; set; } public string StaZhuangChuan { get; set; } public string StaMaTouFangXing { get; set; } /// /// 到港后提箱(非场站提箱!!) /// public string StaTiXiang { get; set; } public string StaFanKong { get; set; } /// /// 场站背箱(提箱)时间 /// public DateTime? TimeBeiXiang { get; set; } public DateTime? TimeFanChang { get; set; } public DateTime? TimeJiGang { get; set; } public DateTime? TimeZhuangChuan { get; set; } public DateTime? TimeMaTouFangXing { get; set; } /// /// 到港后提箱(非场站提箱!!)时间 /// public DateTime? TimeTiXiang { get; set; } //外理状态和时间 public string StaWaiLi { get; set; } public DateTime? TimeWaiLi { get; set; } //运抵状态和时间 public string StaYunDi { get; set; } public DateTime? TimeYunDi { get; set; } //装载状态和时间 public string StaZhuangZai { get; set; } public DateTime? TimeZhuangZai { get; set; } //海关状态和时间 public string StaHaiGuan { get; set; } public DateTime? TimeHaiGuan { get; set; } public string StaZhongZhuanXC { get; set; } public DateTime? TimeZhongZhuanXC { get; set; } public string StaZhongZhuanZC { get; set; } public DateTime? TimeZhongZhuanZC { get; set; } public DateTime? TimeMDGATA { get; set; } public string StaMDGTiXiang { get; set; } public DateTime? TimeMDGTiXiang { get; set; } public string StaMDGFanKong { get; set; } public DateTime? TimeMDGFanKong { get; set; } public string StaGetBoxStart { get; set; } public string StaGetBoxEnd { get; set; } public DateTime? TimeGetBoxStart { get; set; } public DateTime? TimeGetBoxEnd { get; set; } public DateTime? TIMEMDGETA { get; set; } public string StaTIMEMDGETA { get; set; } public string StaTimeMDGATA { get; set; } public string StaCARRIERETD { get; set; } public DateTime? CARRIERETD { get; set; } public string StaZhongzhuanKH { get; set; } public DateTime? TimeZhongzhuanKH { get; set; } } [Table("op_seae_billtrace_plan")] public class OpSeaeBilltracePlan { [Key] public string GID { get; set; } public string UserID { get; set; } public string CompID { get; set; } public string Title { get; set; } public bool AlertCZ { get; set; } public bool AlertCZBeiXiang { get; set; } public int AlertCZBeiXiangDay { get; set; } public bool AlertCZZhongXiangFanChang { get; set; } public int AlertCZZhongXiangFanChangDay { get; set; } public bool AlertCZZhongXiangJiGang { get; set; } public int AlertCZZhongXiangJiGangDay { get; set; } public bool AlertCD { get; set; } public bool AlertCDYuPei { get; set; } public string AlertCDYuPeiType1 { get; set; } public int AlertCDYuPeiNum1 { get; set; } public string AlertCDYuPeiType2 { get; set; } public int AlertCDYuPeiNum2 { get; set; } public bool AlertCDYunDiBaoGao { get; set; } public int AlertCDYunDiBaoGaoHour { get; set; } public bool AlertCDBaoGuanFangXing { get; set; } public int AlertCDBaoGuanFangXingDay1 { get; set; } public int AlertCDBaoGuanFangXingDay2 { get; set; } public bool AlertCDZhuangZaiFangXing { get; set; } public int AlertCDZhuangZaiFangXingMinute { get; set; } public bool AlertMT { get; set; } public bool AlertMTFangXing { get; set; } public int AlertMTFangXingMinute { get; set; } public bool AlertMTZhuangChuan { get; set; } public int AlertMTZhuangChuanDay { get; set; } public bool AlertMTLiGang { get; set; } public int AlertMTLiGangDay { get; set; } public bool AlertMDG { get; set; } public bool AlertMDGChuanBoDaoGang { get; set; } public int AlertMDGChuanBoDaoGangDay { get; set; } public bool AlertMDGMuDiGangTiXiang { get; set; } public int AlertMDGMuDiGangTiXiangDay { get; set; } public bool AlertMDGMuDiGangFanKong { get; set; } public int AlertMDGMuDiGangFanKongDay { get; set; } public DateTime CreateTime { get; set; } public string Remark { get; set; } } [Table("op_seae_billtrace_alert_record")] public class OpSeaeBilltraceAlertRecord { [Key] public string GID { get; set; } public string UserID { get; set; } public string CompID { get; set; } public string TraceID { get; set; } public string TraceSubID { get; set; } public DateTime? CheckTimeCZBeiXiang { get; set; } public DateTime? CheckTimeCZZhongXiangFanChang { get; set; } public DateTime? CheckTimeCZZhongXiangJiGang { get; set; } public DateTime? CheckTimeCDYuPei { get; set; } public DateTime? CheckTimeCDYunDiBaoGao { get; set; } public DateTime? CheckTimeCDBaoGuanFangXing { get; set; } public DateTime? CheckTimeCDZhuangZaiFangXing { get; set; } public DateTime? CheckTimeMTFangXing { get; set; } public DateTime? CheckTimeMTZhuangChuan { get; set; } public DateTime? CheckTimeMTLiGang { get; set; } public DateTime? CheckTimeMDGChuanBoDaoGang { get; set; } public DateTime? CheckTimeMDGMuDiGangTiXiang { get; set; } public DateTime? CheckTimeMDGMuDiGangFanKong { get; set; } public DateTime? AlertTimeCZBeiXiang { get; set; } public DateTime? AlertTimeCZZhongXiangFanChang { get; set; } public DateTime? AlertTimeCZZhongXiangJiGang { get; set; } public DateTime? AlertTimeCDYuPei { get; set; } public DateTime? AlertTimeCDYunDiBaoGao { get; set; } public DateTime? AlertTimeCDBaoGuanFangXing { get; set; } public DateTime? AlertTimeCDZhuangZaiFangXing { get; set; } public DateTime? AlertTimeMTFangXing { get; set; } public DateTime? AlertTimeMTZhuangChuan { get; set; } public DateTime? AlertTimeMTLiGang { get; set; } public DateTime? AlertTimeMDGChuanBoDaoGang { get; set; } public DateTime? AlertTimeMDGMuDiGangTiXiang { get; set; } public DateTime? AlertTimeMDGMuDiGangFanKong { get; set; } } [Table("op_seae_billtrack_yardid")] public class OpSeaeBilltrackYardid { [Key] public string GID { get; set; } public string YARDID { get; set; } public string YARDNAME { get; set; } } /// /// 运踪频率配置 /// [Table("op_seae_billtrace_interval_config")] public class OpSeaeBilltraceIntervalConfig { public const string NodeCateTiXiang = "TiXiang"; public const string NodeCateFanChang = "FanChang"; public const string NodeCateCangDan = "CangDan"; public const string NodeCateHaiFang = "HaiFang"; public const string NodeCateZhuangZai = "ZhuangZai"; public const string NodeCateJiGang = "JiGang"; public const string NodeCateMaFang = "MaFang"; public const string NodeCateZhuangChuan = "ZhuangChuan"; public const string NodeCateKaiChuan = "KaiChuan"; [Key] public string GID { get; set; } /// /// 节点类型:提箱,返场,舱单,海放,装载,集港,码放,装船,开船 /// public string NodeCate { get; set; } /// /// 开始小时数(立即开始设置为0) /// public decimal StartHour { get; set; } /// /// 间隔查询小时 /// public decimal IntervalHour { get; set; } /// /// 查询结束天数 /// public decimal FinishDay { get; set; } public DateTime CreateTime { get; set; } public DateTime? ModifyTime { get; set; } public string CreateUser { get; set; } public string ModifyUser { get; set; } public string Remark { get; set; } } /// /// 最后查询时间 /// [Table("op_seae_billtrace_last_time")] public class OpSeaeBilltraceLastTime { public const string CateTiXiang = "TiXiang"; public const string CateFanChang = "FanChang"; public const string CateCangDan = "CangDan"; public const string CateHaiFang = "HaiFang"; public const string CateZhuangZai = "ZhuangZai"; public const string CateMaFang = "MaFang"; public const string CateZhuangChuan = "ZhuangChuan"; public const string CateKaiChuan = "KaiChuan"; public const string CateJiGang = "JiGang"; public const string CateYgtAtd = "YGT_ATD"; public const string CateYunDi = "YunDi"; public const string CateWaiLi = "WaiLi"; public const string CateYard = "Yard"; public const string CateHLW = "HLW+"; public const string CateYGT = "YGT"; public const string CateYGT_TD = "YGT_TD"; public const string CateYGT_WL = "YGT_WL"; public const string CateYDW_GH = "YDW_GH"; [Key] public string GID { get; set; } public string TraceID { get; set; } public string TraceCtrnID { get; set; } public string LastTimeCate { get; set; } public DateTime? TimeValue { get; set; } public string ExtValue { get; set; } } //运踪网站账号 [Table("op_seae_billtrace_user_account")] public class OpSeaeBilltraceUserAccount { [Key] public string GID { get; set; } public string CompId { get; set; } public string CompName { get; set; } public string Account { get; set; } public string Password { get; set; } public string AccType { get; set; } public string AccCate { get; set; } public DateTime CreateTime { get; set; } public DateTime? ModifyTime { get; set; } public string CreateBy { get; set; } public string ModifyBy { get; set; } public string Remark { get; set; } } //立即查询 [Table("op_seae_billtrace_immediate")] public class OpSeaeBilltraceImmediate { public const string QueryApiAll = "ALL"; public const string QueryApiYard = "YARD"; public const string QueryApiHLW = "HLW"; public const string QueryApiYGT = "YGT"; public const string QueryStatusYard = "Yard"; //场站 public const string QueryStatusHlwYgt = "HlwYgt"; //互联网、运港通 public const string QueryStatusFinish = "Finish"; [Key] [MaxLength(40)] public string GID { get; set; } [MaxLength(40)] public string TraceId { get; set; } [MaxLength(40)] public string MBLNO { get; set; } private string _QueryApi; [MaxLength(30)] public string QueryApi { get { return _QueryApi; } set { _QueryApi = value; if (_QueryApi == QueryApiAll || _QueryApi == QueryApiYard) { ExecuteStatus = QueryStatusYard; } else { ExecuteStatus = QueryStatusHlwYgt; } } } public DateTime CreateTime { get; set; } [MaxLength(40)] public string CreateName { get; set; } public DateTime? ExecuteTime { get; set; } [MaxLength(500)] public string ExecuteResult { get; set; } [MaxLength(200)] public string Remark { get; set; } [MaxLength(30)] public string ExecuteStatus { get; set; } } /// /// 场站信息(运踪) /// [Table("code_yarddata")] public class CodeYarddata { [MaxLength(36), Key] public string GID { get; set; } [MaxLength(20)] public string YARDCODE { get; set; } [MaxLength(20)] public string YARD { get; set; } [MaxLength(36)] public string CREATEUSER { get; set; } public DateTime? CREATETIME { get; set; } [MaxLength(100)] public string REMARK { get; set; } } /// /// 船公司 /// [Table("code_carrier")] public class CodeCarrier { [MaxLength(36), Key] public string GID { get; set; } [MaxLength(20)] public string CARRIERID { get; set; } [MaxLength(20)] public string CARRIER { get; set; } [MaxLength(36)] public string CREATEUSER { get; set; } public DateTime? CREATETIME { get; set; } [MaxLength(100)] public string REMARK { get; set; } } [Table("op_seae_billtrace_link")] public class OpSeaeBilltraceLink { [Key] public string GID { get; set; } public string UserID { get; set; } public string CompID { get; set; } public string Link { get; set; } public DateTime? CreateTime { get; set; } } [Table("op_seae_billtrace_link_ctn")] public class OpSeaeBilltraceLinkCtn { [Key] public string GID { get; set; } public string PID { get; set; } public string BillID { get; set; } public DateTime? CreateTime { get; set; } } [Table("op_seae_billtrace_change_his")] public class OpSeaeBilltraceChangeHis { [Key, MaxLength(50)] public string GID { get; set; } [MaxLength(50)] public string TraceID { get; set; } [MaxLength(20)] public string ChangeType { get; set; } public DateTime ChangeTime { get; set; } [MaxLength(500)] public string OldValue { get; set; } [MaxLength(500)] public string NewValue { get; set; } [MaxLength(50)] public string ChangeBy { get; set; } } [Table("Sys_KeyPwd")] public class Sys_KeyPwd { [Key] public string GID { get; set; } public string CompId { get; set; } public string Key { get; set; } public string Pwd { get; set; } } [Table("op_seae_billtrace_mapping")] public class op_seae_billtrace_mapping { [Key] public string Gid { get; set; } /// /// 业务id /// public string BusinessId { get; set; } /// /// 运踪id /// public string TraceId { get; set; } /// /// url /// public string Url { get; set; } /// /// 记录时间 /// public DateTime? OpTime { get; set; } } [Table("op_seae_billtrace_custom")] public class op_seae_billtrace_custom { [Key] public string Gid { get; set; } /// /// 往来单位ID /// public string ClientId { get; set; } /// /// 客户id /// public string ContactId { get; set; } /// /// 运踪id /// public string BillTraceId { get; set; } } }