1.前后端增加复位功能
2.tcpclient心跳设置 3.优化后端启动速度 4.增加后端出库日志
This commit is contained in:
@ -21,7 +21,7 @@ namespace WCS.BLL.Manager
|
||||
Logs.Write("【初始化数据库】开始", LogsType.StartBoot);
|
||||
//初始化数据库对象
|
||||
if (LocalFile.Config.IsMx)
|
||||
{
|
||||
{
|
||||
DbHelp.db = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = LocalFile.Config.DataDbPath,
|
||||
@ -57,60 +57,73 @@ namespace WCS.BLL.Manager
|
||||
{
|
||||
};
|
||||
});
|
||||
Logs.Write("【初始化数据库】MX", LogsType.StartBoot);
|
||||
}
|
||||
|
||||
|
||||
DbHelp.db.DbMaintenance.CreateDatabase();
|
||||
DbHelp.dbLog.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())
|
||||
//手动修改后台配置后再进行CodeFirst 数据库的生成、表的生成
|
||||
if (LocalFile.Config.IsResetDBOrTable)
|
||||
{
|
||||
var outDocumentSerialNumber = new DocumentSerialNumber()
|
||||
{
|
||||
DocumentType = DocumentTypeEnum.出库单据,
|
||||
UpdateDate = DateTime.Now,
|
||||
CurrentSerialNumber = 0
|
||||
};
|
||||
#region 建库建表 只在表有变动时运行
|
||||
DbHelp.db.DbMaintenance.CreateDatabase();
|
||||
DbHelp.dbLog.DbMaintenance.CreateDatabase();
|
||||
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
|
||||
|
||||
var stockTakingDocumentSerialNumber = new DocumentSerialNumber()
|
||||
{
|
||||
DocumentType = DocumentTypeEnum.盘点单据,
|
||||
UpdateDate = DateTime.Now,
|
||||
CurrentSerialNumber = 0
|
||||
};
|
||||
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)
|
||||
);
|
||||
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
|
||||
|
||||
DbHelp.db.Insertable(outDocumentSerialNumber).ExecuteCommand();
|
||||
DbHelp.db.Insertable(stockTakingDocumentSerialNumber).ExecuteCommand();
|
||||
DbHelp.dbLog.CodeFirst.InitTables(typeof(SystemApiLogRecord));
|
||||
Logs.Write("【初始化数据库】logdb建表", LogsType.StartBoot);
|
||||
|
||||
//初始化单据序列号数据
|
||||
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("【初始化数据库】DocumentSerialNumber", LogsType.StartBoot);
|
||||
|
||||
//初始化货架类型
|
||||
if (!DbHelp.db.Queryable<ShelfTypeInfo>().Any())
|
||||
{
|
||||
var smartShelf = new ShelfTypeInfo()
|
||||
{
|
||||
ShelfTypeName = "智能货架"
|
||||
};
|
||||
var singleLight = new ShelfTypeInfo()
|
||||
{
|
||||
ShelfTypeName = "信息化货架"
|
||||
};
|
||||
DbHelp.db.Insertable(smartShelf).ExecuteCommand();
|
||||
DbHelp.db.Insertable(singleLight).ExecuteCommand();
|
||||
}
|
||||
Logs.Write("【初始化数据库】初始化货架类型", LogsType.StartBoot);
|
||||
|
||||
//初始化权限数据库
|
||||
AuthDbHelp.InitDb();
|
||||
#endregion
|
||||
|
||||
LocalFile.Config.IsResetDBOrTable = false;
|
||||
LocalFile.SaveConfig();
|
||||
}
|
||||
//初始化货架类型
|
||||
if (!DbHelp.db.Queryable<ShelfTypeInfo>().Any())
|
||||
{
|
||||
var smartShelf = new ShelfTypeInfo()
|
||||
{
|
||||
ShelfTypeName = "智能货架"
|
||||
};
|
||||
var singleLight = new ShelfTypeInfo()
|
||||
{
|
||||
ShelfTypeName = "信息化货架"
|
||||
};
|
||||
DbHelp.db.Insertable(smartShelf).ExecuteCommand();
|
||||
DbHelp.db.Insertable(singleLight).ExecuteCommand();
|
||||
}
|
||||
|
||||
Logs.Write("【初始化数据库】结束", LogsType.StartBoot);
|
||||
|
||||
//初始化权限数据库
|
||||
AuthDbHelp.InitDb();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user