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

137 lines
8.6 KiB

using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using ChangkeTec.SDMS.Model.ExchangeCenterTables;
using CK.SCP.Utils;
namespace ChangkeTec.SDMS.Model
{
public class ExchangeCenterDatabaseInitializer : DropCreateDatabaseIfModelChanges<ExchangeCenterContext> // DropCreateDatabaseAlways<AppBoxContext> DropCreateDatabaseIfModelChanges<AppBoxContext>
{
protected override void Seed(ExchangeCenterContext db)
{
base.InitializeDatabase(db);
db.TEA_CONFIG.AddOrUpdate(EcConfigInitializer.ConfigList.ToArray());
db.TEA_SYSTEM.AddOrUpdate(SystemInitializer.SystemList.ToArray());
db.TEA_TABLE.AddOrUpdate(TableInitializer.TableList.ToArray());
db.TEA_SUBSCRIBE.AddOrUpdate(SubscribeInitializer.SubscribeList.ToArray());
db.Database.ExecuteSqlCommand(ProcedureInitializer.P_GetAllTables);
db.SaveChanges();
base.Seed(db);
}
public IEnumerable<TEA_CONFIG> InitConfigList { get; set; }
public IEnumerable<TEA_SUBSCRIBE> InitSubscribeList { get; set; }
public IEnumerable<TEA_TABLE> InitTableList { get; set; }
public IEnumerable<TEA_SYSTEM> InitSystemList { get; set; }
}
public static class EcConfigInitializer
{
public static List<TEA_CONFIG> ConfigList { get; set; } = new List<TEA_CONFIG>();
}
public static class SystemInitializer
{
public static List<TEA_SYSTEM> SystemList { get; set; } =new List<TEA_SYSTEM>
{
new TEA_SYSTEM{SystemName = "QAD",Password = EncryptHelper.Encrypt("1234qwer"), SystemDesc = "QAD系统",CreateUser = "Init"},
new TEA_SYSTEM{SystemName = "SCP",Password = EncryptHelper.Encrypt("1234qwer"), SystemDesc = "QAD系统",CreateUser = "Init"},
new TEA_SYSTEM{SystemName = "WMS",Password = EncryptHelper.Encrypt("1234qwer"), SystemDesc = "QAD系统",CreateUser = "Init",Domain = "DM",Site="ST"},
new TEA_SYSTEM{SystemName = "MES",Password = EncryptHelper.Encrypt("1234qwer"), SystemDesc = "QAD系统",CreateUser = "Init",Domain = "DM",Site="ST"},
};
}
public static class TableInitializer
{
public static List<TEA_TABLE> TableList { get; set; } = new List<TEA_TABLE>()
{
new TEA_TABLE {TableName = "TED_ASN_DET", TableDesc = "发货单明细表",},
new TEA_TABLE {TableName = "TED_ASN_MSTR", TableDesc = "发货单主表",},
new TEA_TABLE {TableName = "TED_ASSEMBLE", TableDesc = "MES装配信息表",},
new TEA_TABLE {TableName = "TED_BK_DET", TableDesc = "生产回冲明细表",},
new TEA_TABLE {TableName = "TED_BK_MSTR", TableDesc = "生产回冲主表",},
new TEA_TABLE {TableName = "TED_CHECK_DET", TableDesc = "盘点明细表",},
new TEA_TABLE {TableName = "TED_CHECK_MSTR", TableDesc = "盘点主表",},
new TEA_TABLE {TableName = "TED_FIXED_DET", TableDesc = "固定资产明细表",},
new TEA_TABLE {TableName = "TED_FIXED_MSTR", TableDesc = "固定资产主表",},
new TEA_TABLE {TableName = "TED_INJECTION", TableDesc = "MES注塑信息表",},
new TEA_TABLE {TableName = "TED_INVOICE_ADD", TableDesc = "发票附加表",},
new TEA_TABLE {TableName = "TED_INVOICE_DET", TableDesc = "发票明细表",},
new TEA_TABLE {TableName = "TED_INVOICE_MSTR", TableDesc = "发票主表",},
new TEA_TABLE {TableName = "TED_ISSUNP_DET", TableDesc = "计划外出库明细表",},
new TEA_TABLE {TableName = "TED_ISSUNP_MSTR", TableDesc = "计划外出库主表",},
new TEA_TABLE {TableName = "TED_KANBAN_DET", TableDesc = "看板明细表",},
new TEA_TABLE {TableName = "TED_KANBAN_MSTR", TableDesc = "看板主表",},
new TEA_TABLE {TableName = "TED_LED", TableDesc = "MES亮灯信息表",},
new TEA_TABLE {TableName = "TED_MRP_DET", TableDesc = "MRP明细表",},
new TEA_TABLE {TableName = "TED_MRP_MSTR", TableDesc = "MRP主表",},
new TEA_TABLE {TableName = "TED_PO_DET", TableDesc = "采购订单明细表",},
new TEA_TABLE {TableName = "TED_PO_MSTR", TableDesc = "采购订单主表",},
new TEA_TABLE {TableName = "TED_RCTUNP_DET", TableDesc = "计划外入库明细表",},
new TEA_TABLE {TableName = "TED_RCTUNP_MSTR", TableDesc = "计划外入库主表",},
new TEA_TABLE {TableName = "TED_RECEIPT_DET", TableDesc = "采购收货明细表",},
new TEA_TABLE {TableName = "TED_RECEIPT_MSTR", TableDesc = "采购收货主表",},
new TEA_TABLE {TableName = "TED_RETURN_DET", TableDesc = "采购退货明细表",},
new TEA_TABLE {TableName = "TED_RETURN_MSTR", TableDesc = "采购退货主表",},
new TEA_TABLE {TableName = "TED_SO_DET", TableDesc = "销售订单明细表",},
new TEA_TABLE {TableName = "TED_SO_MSTR", TableDesc = "销售订单主表",},
new TEA_TABLE {TableName = "TED_SPRAYING", TableDesc = "MES喷涂信息表",},
new TEA_TABLE {TableName = "TED_SPRAYING_REPAIR", TableDesc = "MES点修补信息表",},
new TEA_TABLE {TableName = "TED_STOCK", TableDesc = "库存表",},
new TEA_TABLE {TableName = "TED_TRANSFER_DET", TableDesc = "移库明细表",},
new TEA_TABLE {TableName = "TED_TRANSFER_MSTR", TableDesc = "移库主表",},
new TEA_TABLE {TableName = "TES_ACCOUNT", TableDesc = "科目表",},
new TEA_TABLE {TableName = "TES_BOM", TableDesc = "BOM表",},
new TEA_TABLE {TableName = "TES_CODE", TableDesc = "通用代码表",},
new TEA_TABLE {TableName = "TES_CODE_TYPE", TableDesc = "通用代码类型表",},
new TEA_TABLE {TableName = "TES_COLOR", TableDesc = "MES颜色代码表",},
new TEA_TABLE {TableName = "TES_COST_CENTER", TableDesc = "成本中心表",},
new TEA_TABLE {TableName = "TES_CUSTOMER", TableDesc = "客户表",},
new TEA_TABLE {TableName = "TES_CUSTOMER_PART", TableDesc = "客户零件表",},
new TEA_TABLE {TableName = "TES_CUSTOMER_TYPE", TableDesc = "客户类型表",},
new TEA_TABLE {TableName = "TES_DEPARTMENT", TableDesc = "部门表",},
new TEA_TABLE {TableName = "TES_DOMAIN", TableDesc = "域表",},
new TEA_TABLE {TableName = "TES_EDI_DATA", TableDesc = "EDI数据表",},
new TEA_TABLE {TableName = "TES_ENTITY", TableDesc = "会计单位表",},
new TEA_TABLE {TableName = "TES_LINE", TableDesc = "生产线表",},
new TEA_TABLE {TableName = "TES_LINE_PART", TableDesc = "产线零件关系表",},
new TEA_TABLE {TableName = "TES_LOCATION", TableDesc = "库位表",},
new TEA_TABLE {TableName = "TES_MES_DATA", TableDesc = "MES数据表",},
new TEA_TABLE {TableName = "TES_PACK", TableDesc = "标准包装表",},
new TEA_TABLE {TableName = "TES_PART_DET", TableDesc = "零件明细表",},
new TEA_TABLE {TableName = "TES_PART_MSTR", TableDesc = "零件主表",},
new TEA_TABLE {TableName = "TES_PRODUCT_LINE", TableDesc = "产品类表",},
new TEA_TABLE {TableName = "TES_PROJECT", TableDesc = "项目表",},
new TEA_TABLE {TableName = "TES_PURCHASE_PRICE", TableDesc = "采购价格表",},
new TEA_TABLE {TableName = "TES_ROUTING", TableDesc = "工艺路由表",},
new TEA_TABLE {TableName = "TES_SALE_PRICE", TableDesc = "销售价格表",},
new TEA_TABLE {TableName = "TES_SHIFT", TableDesc = "班次表",},
new TEA_TABLE {TableName = "TES_SITE", TableDesc = "地点表",},
new TEA_TABLE {TableName = "TES_STAND_COST_PRICE", TableDesc = "标准成本表",},
new TEA_TABLE {TableName = "TES_SUB_ACCOUNT", TableDesc = "分账户表",},
new TEA_TABLE {TableName = "TES_SUPPLIER", TableDesc = "供应商表",},
new TEA_TABLE {TableName = "TES_SUPPLIER_PART", TableDesc = "供应商零件表",},
new TEA_TABLE {TableName = "TES_SUPPLIER_TYPE", TableDesc = "供应商类型表",},
new TEA_TABLE {TableName = "TES_TEAM", TableDesc = "班组表",},
new TEA_TABLE {TableName = "TES_WMS_LOCATION", TableDesc = "WMS库位表",},
new TEA_TABLE {TableName = "TES_WORK_CENTER", TableDesc = "工作中心表",},
};
}
public static class SubscribeInitializer
{
public static List<TEA_SUBSCRIBE> SubscribeList { get; set; } = new List<TEA_SUBSCRIBE>();
}
}