You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

517 lines
17 KiB
C#

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 BillCenterDataContext : BaseDbContext
{
public BillCenterDataContext(string conn) : base(conn)
{
}
public BillCenterDataContext() : base("BillCenterDB")
{
}
//邮件
public DbSet<Mails> Mails { get; set; }
//附件
public DbSet<Attachments> Attachments { get; set; }
//账单表
public DbSet<BillRecord> BillCenterRecord { get; set; }
//账单明细
public DbSet<BillRecordDetail> BillCenterRecordDetail { get; set; }
//对应关系
public DbSet<BillRecordDetailMapping> BillRecordDetailMapping { get; set; }
//收件邮箱
public DbSet<MailUserAccount> UserAccounts { get; set; }
//api账户
public DbSet<ApiAccount> ApiAccount { get; set; }
//结算对象
public DbSet<BillCenterCodeSettleFor> CodeSettleFor { get; set; }
//币种
public DbSet<BillCenterCodeCurrency> CodeCurrency { get; set; }
//费用
public DbSet<BillCenterCodeFee> CodeFee { get; set; }
//费用标准
public DbSet<BillCenterCodeFeeStandard> CodeFeeStandard { get; set; }
//账单输出配置
public DbSet<BillOutputMapping> OutputMapping { get; set; }
//模板解析相关配置
public DbSet<ParseModels> ParseModels { get; set; }
public DbSet<SettleNames> SettleNames { get; set; }
public DbSet<SettleConfigs> SettleConfigs { get; set; }
//扣费记录
public DbSet<BillFeeRecord> BillFeeRecord { get; set; }
//邮箱所属人员公司配置
public DbSet<MailUserCompanyRelation> MailUserCompanyRelation { get; set; }
//解析器配置
public DbSet<MailParser> MailParser { get; set; }
}
//邮件
[Table("Mails")]
public class Mails
{
public const string SourceTypeMail = "Mail";
public const string SourceTypeApi = "Api";
public const string SourceTypeApiDirect = "ApiDirect";
public const string SourceTypeSysCall = "SysCall"; //系统模块直接调用
public Mails()
{
this.ReceiveTime = DateTime.Now;
this.SourceType = SourceTypeMail;
}
[Key]
public string GID { get; set; }
public string MailId { get; set; }
public string MailPath { get; set; }
public string SendUserMail { get; set; }
public string MailSubject { get; set; }
public string Status { get; set; }
public DateTime? EmailDate { get; set; }
public DateTime ReceiveTime { get; set; }
public DateTime? UpdateTime { get; set; }
public string CompId { get; set; }
public string CompName { get; set; }
public string UserName { get; set; }
public string MailAccount { get; set; }
public int ImapId { get; set; }
public string MailUrl { get; set; }
public string UserId { get; set; }
public DateTime? MailDate { get; set; }
public string SourceType { get; set; }
}
//附件
[Table("Attachments")]
public class Attachments
{
[Key]
public string GID { get; set; }
public string MailGID { get; set; }
public string MailID { get; set; }
public string AttachMD5 { get; set; }
public string AttachPath { get; set; }
public string AttachUrl { get; set; }
public string AttachName { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? UpdateTime { get; set; }
public string Status { get; set; }
public string FileType { get; set; }
public string Tips { get; set; }
public string SendStatus { get; set; }
public string DownloadStatus { get; set; }
}
//账单表
[Table("BillRecord")]
public class BillRecord
{
public const string InnerStausSave = "SAVE";//已保存未发送
public const string InnerStausPost = "POST";//已发送
[Key]
public string GID { get; set; }
public string AttachId { get; set; }
public string BookingBill { get; set; }
public string HouseBill { get; set; }
public string InvoiceNumber { get; set; }
public string ReceiptNumber { get; set; }
public string BillingTime { get; set; }
public string BillDate { get; set; }
public string ShippingCompany { get; set; }
public string Departure { get; set; }
public string PortOfLoading { get; set; }
public string Destination { get; set; }
public string UnloadingPort { get; set; }
public string SailingDate { get; set; }
public string ArrivalDate { get; set; }
public string ShipName { get; set; }
public string Voyage { get; set; }
public string Route { get; set; }
public string TransitPort { get; set; }
public string SecondShipName { get; set; }
public string SecondVoyage { get; set; }
public string SigningMethod { get; set; }
public string DateOfSigning { get; set; }
public string SigningLocation { get; set; }
public string PaymentMethods { get; set; }
public string ShippingTerms { get; set; }
public string BillRecipient { get; set; }
public string BillRecipientContactInformation { get; set; }
public string ContainerModel { get; set; }
public int? ContainerCount { get; set; }
public int? Pieces { get; set; }
public decimal? weight { get; set; }
public string Size { get; set; }
public decimal? TotalRMB { get; set; }
public decimal? TotalUSD { get; set; }
public string Currency { get; set; }
public decimal? TotalInvoiceAmount { get; set; }
public string AppointmentNumber { get; set; }
public string OutGate { get; set; }
public string InGate { get; set; }
public string LastFreeDay { get; set; }
public string PayingFor { get; set; }
public string Status { get; set; }
public DateTime? SendTime { get; set; }
public string SendBy { get; set; }
public string StatusInner { get; set; }
public DateTime ReceiveTime { get; set; }
public string OperatorUserId { get; set; }
public string OperatorName { get; set; }
public DateTime? OperatorTime { get; set; }
public string SendStatus { get; set; }
public string SendResult { get; set; }
public string CustSysRecStatus { get; set; }
public DateTime? CustSysRecTime { get; set; }
public string CustSysRecResult { get; set; }
public string FileSavePath { get; set; }
}
//账单明细
[Table("BillRecordDetail")]
public class BillRecordDetail
{
public const string StausOk = "OK";
public const string StausNoCodeMapping = "NoCodeMapping";
[Key]
public string GID { get; set; }
public string RecordId { get; set; }
public string CostName { get; set; }
public string ContainerNumber { get; set; }
public string ContainerModel { get; set; }
public decimal? UnitPrice { get; set; }
public int? Quantity { get; set; }
public decimal? Amount { get; set; }
public string Currency { get; set; }
public decimal? ExchangeRate { get; set; }
public string UnitStandard { get; set; }
public string ToCurrency { get; set; }
public decimal? ToCurrencyAmount { get; set; }
public string MyshippingSysCode { get; set; }
public string MyshippingSysName { get; set; }
public string FeeStandard { get; set; }
public string Status { get; set; }
public string Remark { get; set; }
public string Tips { get; set; }
}
//账单对应明细
[Table("BillRecordDetailMapping")]
public class BillRecordDetailMapping
{
[Key]
public string GID { get; set; }
public string CompId { get; set; }
public string CompName { get; set; }
public string CustSysCode { get; set; }
public string SettleName { get; set; }
public string FeeStandard { get; set; }
public string SourceCode { get; set; }
public string CustSysName { get; set; }
}
[Table("MailUserAccount")]
public class MailUserAccount
{
[Key]
public string GID { get; set; }
public string MailAccount { get; set; }
public string Password { get; set; }
public string ReceiveServer { get; set; }
public bool UseImap { get; set; }
public int ReceivePort { get; set; }
public bool ReceiveSSL { get; set; }
public string SmtpServer { get; set; }
public int SmtpPort { get; set; }
public bool SmtpSSL { get; set; }
public bool IsChanged { get; set; }
public string RelativeId { get; set; }
public int ProcessorCount { get; set; }
public int SenderCount { get; set; }
public string ManagerMailAddress { get; set; }
public int ParserCount { get; set; }
public string UserId { get; set; }
public string CompId { get; set; }
public string UserName { get; set; }
public string CompName { get; set; }
public string CREATEUSER { get; set; }
public DateTime CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
//api账号
[Table("ApiAccount")]
public class ApiAccount
{
[Key]
public string GID { get; set; }
public string CompanyId { get; set; }
public string CompanyName { get; set; }
public string LoginAccount { get; set; }
public string LoginPassword { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? UpdateTime { get; set; }
public bool IsDisable { get; set; }
public string CreateUser { get; set; }
public string UpdateUser { get; set; }
}
//结算对象
[Table("CodeSettleFor")]
public class BillCenterCodeSettleFor
{
[Key]
public string GID { get; set; }
public string CODENAME { get; set; }
public string SHORTNAME { get; set; }
public string DESCRIPTION { get; set; }
public string NAME { get; set; }
public string CREATEUSER { get; set; }
public DateTime? CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
//币种
[Table("CodeCurrency")]
public class BillCenterCodeCurrency
{
[Key]
public string GID { get; set; }
public string CODENAME { get; set; }
public string NAME { get; set; }
public string DESCRIPTION { get; set; }
public decimal? DEFAULTRATE { get; set; }
public string CREATEUSER { get; set; }
public DateTime? CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
public string FINANCESOFTCODE { get; set; }
}
//费用
[Table("CodeFee")]
public class BillCenterCodeFee
{
[Key]
public string GID { get; set; }
public string FEECODE { get; set; }
public string NAME { get; set; }
public string DESCRIPTION { get; set; }
public string DEFAULTCURR { get; set; }
public bool? ISSEA { get; set; }
public bool? ISAIR { get; set; }
public int? DEFAULTUNIT { get; set; }
public int? DEFAULTDEBIT { get; set; }
public int? DEFAULTCREDIT { get; set; }
public string CREATEUSER { get; set; }
public DateTime? CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
public string FEETYPE { get; set; }
public bool? ISTRUCKING { get; set; }
public bool? ISTRUCKINGFIXED { get; set; }
public bool? ISWMS { get; set; }
public string FEEGROUP { get; set; }
public string FEEFRT { get; set; }
public bool? ISADVANCEDPAY { get; set; }
public decimal? TAXRATE { get; set; }
public string DUITYPE { get; set; }
}
//费用标准
[Table("CodeFeeStandard")]
public class BillCenterCodeFeeStandard
{
[Key]
public string GID { get; set; }
public string CODENAME { get; set; }
public string SHORTNAME { get; set; }
public string DESCRIPTION { get; set; }
public string NAME { get; set; }
public int? STATUS { get; set; }
public string CREATEUSER { get; set; }
public DateTime? CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
//账单输出配置
[Table("BillOutputMapping")]
public class BillOutputMapping
{
[Key]
public string GID { get; set; }
public string CompId { get; set; }
public string CompName { get; set; }
public string MyshippingCode { get; set; }
public string MyshippingCurrency { get; set; }
public string MyshippingSettleFor { get; set; }
public string MyshippingFeeStandard { get; set; }
public string CustSysCode { get; set; }
public string CustSysName { get; set; }
public string CustCurrency { get; set; }
public string CustFeeStandard { get; set; }
public string CustSettleFor { get; set; }
public bool IsMerge { get; set; }
public string CREATEUSER { get; set; }
public DateTime CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
//解析模板
[Table("m_ParseModels")]
public class ParseModels
{
[Key]
public string GID { get; set; }
public string ModelName { get; set; }
public byte Status { get; set; }
public int SuccessCount { get; set; }
public int FailedCount { get; set; }
}
//模板与结算对象配置
[Table("m_SettleNames")]
public class SettleNames
{
[Key]
public string GID { get; set; }
public string ModelID { get; set; }
public string SettleCode { get; set; }
public string Keywords { get; set; }
}
//模板对应关系配置
[Table("m_SettleConfigs")]
public class SettleConfigs
{
[Key]
public string GID { get; set; }
public string SettleID { get; set; }
public string CostNameCode { get; set; }
public string CurrencyCode { get; set; }
public string FeeStandardCode { get; set; }
public string FeeSourceCode { get; set; }
public string CurrencySourceCode { get; set; }
public string StandardSourceCode { get; set; }
public string CREATEUSER { get; set; }
public DateTime CREATETIME { get; set; }
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
//扣费记录
[Table("BillFeeRecord")]
public class BillFeeRecord
{
[Key]
public string GID { get; set; }
public string BookingBill { get; set; }
public string PayingFor { get; set; }
public string CompId { get; set; }
public DateTime FeeTime { get; set; }
public bool IsFee { get; set; }
}
//邮箱所属人员公司配置
[Table("MailUserCompanyRelation")]
public class MailUserCompanyRelation
{
public MailUserCompanyRelation()
{
this.CREATETIME = DateTime.Now;
}
[Key]
[MaxLength(40)]
public string GID { get; set; }
[MaxLength(60)]
public string MailAccount { get; set; }
[MaxLength(40)]
public string UserId { get; set; }
[MaxLength(100)]
public string UserName { get; set; }
[MaxLength(40)]
public string CompId { get; set; }
[MaxLength(200)]
public string CompName { get; set; }
[MaxLength(36)]
public string CREATEUSER { get; set; }
public DateTime CREATETIME { get; set; }
[MaxLength(36)]
public string MODIFIEDUSER { get; set; }
public DateTime? MODIFIEDTIME { get; set; }
}
[Table("MailParser")]
public class MailParser
{
[Key]
[MaxLength(40)]
public string GID { get; set; }
[MaxLength(100)]
public string ParserName { get; set; }
[MaxLength(100)]
public string RegexSubject { get; set; }
[MaxLength(100)]
public string RegexSender { get; set; }
[MaxLength(200)]
public string ParserType { get; set; }
}
}