From 6abc355aeb4e6f7960c11795dbbcc26396b0c888 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期五, 16 五月 2025 17:20:45 +0800 Subject: [PATCH] 博实物料下发同步接口开发,满箱入库、出库逻辑测试与优化 --- Controllers/DebugController.cs | 97 +----------------------------------------------- 1 files changed, 3 insertions(+), 94 deletions(-) diff --git a/Controllers/DebugController.cs b/Controllers/DebugController.cs index 90a1f58..edb5232 100644 --- a/Controllers/DebugController.cs +++ b/Controllers/DebugController.cs @@ -29,37 +29,15 @@ { return DebugService.AgvSeriesReports(model); } - + /// <summary> /// 鍒濆鍖栨暟鎹簱 /// </summary> /// <returns></returns> [HttpPost] [Route("CreateDatabase")] - public string CreateDatabase() { - return DebugService.CreateDatabase(); - } - - [HttpPost] - [Route("InsertLocation")] - public string InsertLocation(InsertLocationInfo model) { - try { - var db = DbHelper.GetDbClient(); - - var locList = new List<TN_Location>(); - locList.Add(new TN_Location { S_AREA_CODE = model.AreaCode, S_CODE = model.Code}); - - if (db.Insertable<TN_Location>(locList).ExecuteCommand() <= 0) { - return "澶辫触"; - } - - } - catch (Exception ex) { - LogHelper.Info($"鍙戠敓浜嗗紓甯�); - return "娣诲姞璐т綅閿欒" + ex.Message; - } - //return res ? "鎴愬姛" : "澶辫触"; - return "鎴愬姛"; + public string CreateDatabase(CoverInfo model) { + return DebugService.CreateDatabase(model.IsCover); } /// <summary> @@ -71,74 +49,5 @@ public string InsertLocCntrCg() { return DebugService.InsertLocCntrCg(); } - - public string AddCgCntrLocRel(CgInfo model) { - var db = DbHelper.GetDbClient(); - - try { - using (var tran = db.Ado.UseTran()) { - var loc = db.Queryable<TN_Location>().First(a => a.S_CODE == model.LocId); - if (loc == null) { - var newLoc = new TN_Location { S_CODE = model.LocId, N_CURRENT_NUM = 1 }; - if (db.Insertable<TN_Location>(newLoc).ExecuteCommand() <= 0) { - tran.RollbackTran(); - return $"鎻掑叆浣嶇疆{model.LocId}澶辫触"; - } - loc = db.Queryable<TN_Location>().First(a => a.S_CODE == model.LocId); - } - 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(); - return $"淇敼浣嶇疆{model.LocId}澶辫触"; - } - } - - var locCntrRel = db.Queryable<TN_Loc_Container>().First(a => a.S_LOC_CODE == model.LocId && a.S_CNTR_CODE == model.CntId); - if (locCntrRel == null) { - var locList = new List<TN_Loc_Container>(); - locList.Add(new TN_Loc_Container { S_LOC_CODE = model.LocId, S_CNTR_CODE = model.CntId }); - if (db.Insertable<TN_Loc_Container>(locList).ExecuteCommand() <= 0) { - tran.RollbackTran(); - return $"鎻掑叆浣嶇疆鎵樼洏鍏崇郴{model.LocId}-{model.CntId}澶辫触"; - } - } - - var cgDetail = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == model.CntId && a.S_ITEM_CODE == model.ItemCode); - if (cgDetail == null) { - var locList = new List<TN_CG_Detail>(); - locList.Add(new TN_CG_Detail { S_CNTR_CODE = model.CntId, S_ITEM_CODE = model.ItemCode }); - if (db.Insertable<TN_CG_Detail>(locList).ExecuteCommand() <= 0) { - tran.RollbackTran(); - return $"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{model.CntId}-{model.ItemCode}澶辫触"; - } - } - - tran.CommitTran(); - } - } - catch (Exception ex) { - return $"鍑洪敊锛歿ex}"; - } - - return "success"; - } - } - - public class CgInfo { - public string ItemCode { get; set; } - public string CntId { get; set; } - public string LocId { get; set; } - } - - public class InsertLocationInfo { - public string Code { set; get; } - public string AreaCode { set; get; } - } - - public class UpdateTaskWeightInfo { - public string TaskID { set; get; } - public float Weight { set; get; } } } -- Gitblit v1.9.1