Files
wcs/WCS.BLL/Manager/DbInit.cs
hehaibing-1996 649e22b4ce 1.WebSocket登录注册
2.数据重发机制
2024-05-17 15:12:07 +08:00

54 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels;
using WCS.DAL.Db;
using WCS.DAL.Db.AuthDb;
using WCS.DAL.DbModels;
namespace WCS.BLL.Manager
{
public static class DbInit
{
public static void InitDb()
{
Logs.Write("【初始化数据库】开始", LogsType.StartBoot);
DbHelp.db.DbMaintenance.CreateDatabase();
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
, typeof(DocumentSerialNumber)
);
DbHelp.dbLog.CodeFirst.InitTables(typeof(SystemApiLogRecord));
//初始化单据序列号数据
if (!DbHelp.db.Queryable<DocumentSerialNumber>().Any())
{
var outDocumentSerialNumber = new DocumentSerialNumber()
{
DocumentType = DocumentTypeEnum.,
UpdateDate = DateTime.Now,
CurrentSerialNumber = 0
};
var stockTakingDocumentSerialNumber = new DocumentSerialNumber()
{
DocumentType = DocumentTypeEnum.,
UpdateDate = DateTime.Now,
CurrentSerialNumber = 0
};
DbHelp.db.Insertable(outDocumentSerialNumber).ExecuteCommand();
DbHelp.db.Insertable(stockTakingDocumentSerialNumber).ExecuteCommand();
}
Logs.Write("【初始化数据库】结束", LogsType.StartBoot);
}
}
}