From 6ed44f32c96a17fd10601a24c3c36ca1229bc89b Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期四, 17 七月 2025 17:18:12 +0800 Subject: [PATCH] 优化货位绑定图片链接保存逻辑,删除不使用的代码 --- api/DebugController.cs | 160 +++-------------------------------------------------- 1 files changed, 9 insertions(+), 151 deletions(-) diff --git a/api/DebugController.cs b/api/DebugController.cs index 7f8d113..e2c950a 100644 --- a/api/DebugController.cs +++ b/api/DebugController.cs @@ -100,155 +100,25 @@ 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; - - // 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); - // } - - // // 鍒涘缓鏂拌〃 - // db.CodeFirst.InitTables(entityTypes); - - // //db.CodeFirst.BackupTable().InitTables(entityTypes); - // } - // else { - // db.CodeFirst.InitTables(entityTypes); - // } - - // tran.CommitTran(); - // } - - // } - // catch (Exception ex) { - // LogHelper.Info($"鍙戠敓浜嗗紓甯�); - // return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message; - // } - - // return "鎴愬姛"; - //} - /// <summary> - /// DEBUG锛氭彃鍏ヨ揣浣嶃�瀹瑰櫒銆佽揣鍝佷俊鎭�+ /// 鍒濆鍖栨暟鎹簱 /// </summary> /// <returns></returns> [HttpPost] - [Route("InsertLocCntrCg")] - public string InsertLocCntrCg(LocCntrCg locCntrCg) { - var db = new SqlHelper<object>().GetInstance(); - + [Route("CreateDatabase")] + public string CreateDatabase() { try { - using (var tran = db.UseTran()) { - LogHelper.Info("LogCntrCg锛� + JsonConvert.SerializeObject(locCntrCg)); - if (string.IsNullOrEmpty(locCntrCg.LocCode)) { - return "鍙傛暟闈炴硶"; - } + var db = new SqlHelper<object>().GetInstance(); - var loc = db.Queryable<TN_Location>().First(a => a.S_CODE == locCntrCg.LocCode); - if (loc == null) { - var newLoc = new TN_Location { - S_CODE = locCntrCg.LocCode, - S_AREA_CODE = locCntrCg.LocArea ?? "" - }; + var entityTypes = new Type[] { }; - if (db.Insertable<TN_Location>(newLoc).ExecuteCommand() <= 0) { - tran.RollbackTran(); - LogHelper.Info($"鎻掑叆浣嶇疆{locCntrCg.LocCode}澶辫触"); - return "鎻掑叆澶辫触"; - } - - loc = newLoc; - } - - //if (loc.N_CURRENT_NUM == 0) { - // loc.N_CURRENT_NUM = 1; - // if (db.Updateable<TN_Location>(loc).UpdateColumns( - // it => new { it.N_CURRENT_NUM, it.T_MODIFY }).ExecuteCommand() <= 0) { - // tran.RollbackTran(); - // LogHelper.Info($"淇敼浣嶇疆{locCntrCg.LocCode}澶辫触"); - // continue; - // } - //} - - if (string.IsNullOrEmpty(locCntrCg.CntrCode)) { - tran.CommitTran(); - LogHelper.Info("瀹瑰櫒鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); - return "瀹瑰櫒鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�; - } - - var locCntrRel = db.Queryable<TN_Loc_Container>().First(a => a.S_LOC_CODE == locCntrCg.LocCode - && a.S_CNTR_CODE == locCntrCg.CntrCode); - - if (locCntrRel == null) { - var newLocCntrRel = new TN_Loc_Container { - S_LOC_CODE = locCntrCg.LocCode, - S_CNTR_CODE = locCntrCg.CntrCode - }; - - loc.N_CURRENT_NUM = 1; - - if (db.Insertable<TN_Loc_Container>(newLocCntrRel).ExecuteCommand() <= 0 - && db.Updateable<TN_Location>(loc).UpdateColumns(c => c.N_CURRENT_NUM).ExecuteCommand() <= 0) { - tran.RollbackTran(); - LogHelper.Info($"鎻掑叆浣嶇疆鎵樼洏鍏崇郴{locCntrCg.LocCode}-{locCntrCg.CntrCode}澶辫触"); - return "鎻掑叆澶辫触"; - } - } - - if (string.IsNullOrEmpty(locCntrCg.ItemCode)) { - tran.CommitTran(); - LogHelper.Info("鐗╂枡鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); - return "鐗╂枡鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�; - } - - var cgDetail = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == locCntrCg.CntrCode - && a.S_ITEM_CODE == locCntrCg.ItemCode); - if (cgDetail == null) { - var locList = new List<TN_CG_Detail>(); - locList.Add(new TN_CG_Detail { S_CNTR_CODE = locCntrCg.CntrCode, S_ITEM_CODE = locCntrCg.ItemCode, S_BATCH_NO = locCntrCg.BatchNo ?? "" }); - if (db.Insertable<TN_CG_Detail>(locList).ExecuteCommand() <= 0) { - tran.RollbackTran(); - LogHelper.Info($"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{locCntrCg.CntrCode}-{locCntrCg}澶辫触"); - return "鎻掑叆澶辫触"; - } - } - tran.CommitTran(); - } - - return "鎻掑叆鏁版嵁鎴愬姛"; - + //db.CodeFirst.InitTables(entityTypes); } catch (Exception ex) { - return $"{ex.Message}"; + LogHelper.Info($"鍙戠敓浜嗗紓甯�); + return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message; } + return "鎴愬姛"; } /// <summary> @@ -310,14 +180,6 @@ public List<GzResult> GzResultList { set; get; } } - public class LocCntrCg { - public string LocCode { get; set; } - public string LocArea { get; set; } - public string CntrCode { get; set; } - public string ItemCode { get; set; } - public string BatchNo { get; set; } - } - /// <summary> /// 妯℃嫙 AGV 浼犻�淇″彿锛岀敤浜庢洿鏀逛换鍔$姸鎬� /// </summary> @@ -334,10 +196,6 @@ /// AGV 涓嬩竴涓姸鎬� /// </summary> public int NextState { set; get; } - } - - public class CoverInfo { - public bool IsCover { set; get; } = true; } public class SetTaskWeightInfo { -- Gitblit v1.9.1