From b079910e5de15863c26e479ffab15cc45d706f1a Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期一, 19 五月 2025 16:25:22 +0800 Subject: [PATCH] 测试修复轮询出库、抽检流程的问题 --- Services/DebugService.cs | 94 ++++++++++++----------------------------------- 1 files changed, 24 insertions(+), 70 deletions(-) diff --git a/Services/DebugService.cs b/Services/DebugService.cs index bc72257..8537315 100644 --- a/Services/DebugService.cs +++ b/Services/DebugService.cs @@ -76,40 +76,41 @@ return returnResults; } - /// <summary> /// 鍒濆鏁版嵁搴撳缓绔� /// </summary> /// <returns></returns> - public static string CreateDatabase(bool cover = true) { + public static string CreateDatabase(bool cover = false) { try { var db = DbHelper.GetDbClient(); 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_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_Inbound_Order), + //typeof(TN_Inbound_Order), typeof(TN_Check_Detail), - typeof(TN_Check_Order), - typeof(TN_CNTR_ITEM), - typeof(TN_Outbound_Detail), - typeof(TN_Outbound_Order), + //typeof(TN_Check_Order), + //typeof(TN_CNTR_ITEM), + //typeof(TN_Outbound_Detail), + //typeof(TN_Outbound_Order), + //typeof(TN_Shift_Order), + //typeof(TN_Shift_Detail) }; 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); - } + //var tables = db.DbMaintenance.GetTableInfoList(); + //foreach (var table in tables.OrderByDescending(t => t.Name)) { + // db.DbMaintenance.DropTable(table.Name); + //} // 鍒涘缓鏂拌〃 db.CodeFirst.InitTables(entityTypes); @@ -175,16 +176,6 @@ 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)) { LogHelper.Info("瀹瑰櫒鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); continue; @@ -210,23 +201,23 @@ } } - if (string.IsNullOrEmpty(locCntrCg.CgId)) { + if (string.IsNullOrEmpty(locCntrCg.ItemCode)) { LogHelper.Info("鐗╂枡鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); continue; } var cgDetail = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == locCntrCg.CntrCode - && a.S_ITEM_CODE == locCntrCg.CgId); + && 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.CgId, S_BATCH_NO = locCntrCg.BatchNo ?? "" }); + 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(); } @@ -240,42 +231,5 @@ return $"Error reading CSV file: {ex.Message}"; } } - - /// <summary> - /// - /// </summary> - /// <returns></returns> - //public string InsertOutboundOrder() { - // string filePath = PathHelper.GetProjDir("./debug/outbound_order.csv"); - // var db = DbHelper.GetDbClient(); - - // try { - // var configuration = new CsvConfiguration(CultureInfo.InvariantCulture) { - // // 閰嶇疆閫夐」 - // Delimiter = ",", // 鍒嗛殧绗�- // HasHeaderRecord = true, // 鏈夋爣棰樿 - // MissingFieldFound = null, // 蹇界暐缂哄け瀛楁 - // HeaderValidated = null, // 璺宠繃鏍囬楠岃瘉 - // BadDataFound = context => { } // 澶勭悊閿欒鏁版嵁 - // }; - - // var locCntrCgList = new List<DebugModel.OutboundOrder>(); - - // using (var reader = new StreamReader(filePath)) - // using (var csv = new CsvReader(reader, configuration)) { - // // 璇诲彇璁板綍 - // locCntrCgList = csv.GetRecords<DebugModel.OutboundOrder>().ToList(); - // } - - // using (var tran = db.Ado.UseTran()) { - - // } - - // } - // catch (Exception) { - - // throw; - // } - //} } } -- Gitblit v1.9.1