| | |
| | | return gzResults; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化数据库 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("CreateDatabase")] |
| | | public string CreateDatabase(CoverInfo model) { |
| | | try { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var cover = model.IsCover; |
| | | ///// <summary> |
| | | ///// 初始化数据库 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //[HttpPost] |
| | | //[Route("CreateDatabase")] |
| | | //public string CreateDatabase(CoverInfo model) { |
| | | // try { |
| | | // var db = new SqlHelper<object>().GetInstance(); |
| | | // var cover = model.IsCover; |
| | | |
| | | var entityTypes = new Type[] { |
| | | typeof(TN_CAR_IN), |
| | | typeof(TN_CG_Detail), |
| | | typeof(TN_Container), |
| | | typeof(TN_Loc_Container), |
| | | typeof(TN_Location), |
| | | typeof(TN_Task), |
| | | typeof(TN_Task_Action), |
| | | typeof(SYSHelper.OI_SYS_MAXID), |
| | | // var entityTypes = new Type[] { |
| | | // typeof(TN_CAR_IN), |
| | | // typeof(TN_CG_Detail), |
| | | // typeof(TN_Container), |
| | | // typeof(TN_Loc_Container), |
| | | // typeof(TN_Location), |
| | | // typeof(TN_Task), |
| | | // typeof(TN_Task_Action), |
| | | // typeof(SYSHelper.OI_SYS_MAXID), |
| | | |
| | | }; |
| | | // typeof(TN_Count_Plan), |
| | | // typeof(TN_Count_Order), |
| | | // typeof(TN_Count_CG_Detail), |
| | | // typeof(TN_Count_Diff), |
| | | // }; |
| | | |
| | | using (var tran = db.Ado.UseTran()) { |
| | | if (cover) { |
| | | // 删除所有表(按依赖关系倒序) |
| | | var tables = db.DbMaintenance.GetTableInfoList(); |
| | | foreach (var table in tables.OrderByDescending(t => t.Name)) { |
| | | db.DbMaintenance.DropTable(table.Name); |
| | | } |
| | | // using (var tran = db.Ado.UseTran()) { |
| | | // if (cover) { |
| | | // // 删除所有表(按依赖关系倒序) |
| | | // var tables = db.DbMaintenance.GetTableInfoList(); |
| | | // foreach (var table in tables.OrderByDescending(t => t.Name)) { |
| | | // db.DbMaintenance.DropTable(table.Name); |
| | | // } |
| | | |
| | | // 创建新表 |
| | | db.CodeFirst.InitTables(entityTypes); |
| | | // // 创建新表 |
| | | // db.CodeFirst.InitTables(entityTypes); |
| | | |
| | | //db.CodeFirst.BackupTable().InitTables(entityTypes); |
| | | } |
| | | else { |
| | | db.CodeFirst.InitTables(entityTypes); |
| | | } |
| | | // //db.CodeFirst.BackupTable().InitTables(entityTypes); |
| | | // } |
| | | // else { |
| | | // db.CodeFirst.InitTables(entityTypes); |
| | | // } |
| | | |
| | | tran.CommitTran(); |
| | | } |
| | | // tran.CommitTran(); |
| | | // } |
| | | |
| | | } |
| | | catch (Exception ex) { |
| | | LogHelper.Info($"发生了异常"); |
| | | return "初始化数据库错误" + ex.Message; |
| | | } |
| | | // } |
| | | // catch (Exception ex) { |
| | | // LogHelper.Info($"发生了异常"); |
| | | // return "初始化数据库错误" + ex.Message; |
| | | // } |
| | | |
| | | return "成功"; |
| | | } |
| | | // return "成功"; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// DEBUG:插入货位、容器、货品信息 |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// DEBUG:根据任务号设置物料重量 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("SetTaskWeight")] |
| | | public string SetTaskWeight(SetTaskWeightInfo model) { |