From 6abc355aeb4e6f7960c11795dbbcc26396b0c888 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期五, 16 五月 2025 17:20:45 +0800 Subject: [PATCH] 博实物料下发同步接口开发,满箱入库、出库逻辑测试与优化 --- Services/DebugService.cs | 56 ++++---------------------------------------------------- 1 files changed, 4 insertions(+), 52 deletions(-) diff --git a/Services/DebugService.cs b/Services/DebugService.cs index bc72257..cbc8c2a 100644 --- a/Services/DebugService.cs +++ b/Services/DebugService.cs @@ -76,7 +76,6 @@ return returnResults; } - /// <summary> /// 鍒濆鏁版嵁搴撳缓绔� /// </summary> @@ -175,16 +174,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 +199,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 +229,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