From 1af49bdb3cdaa44a7e44ebdc843fb8180596365f Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期四, 15 五月 2025 16:34:39 +0800
Subject: [PATCH] 尾箱回库、移库逻辑开发

---
 Controllers/DebugController.cs |   94 ++--------------------------------------------
 1 files changed, 5 insertions(+), 89 deletions(-)

diff --git a/Controllers/DebugController.cs b/Controllers/DebugController.cs
index 174d012..f40ffe1 100644
--- a/Controllers/DebugController.cs
+++ b/Controllers/DebugController.cs
@@ -29,47 +29,15 @@
         {
             return DebugService.AgvSeriesReports(model);
         }
-
+            
         /// <summary>
         /// 鍒濆鍖栨暟鎹簱
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [Route("BuildDB")]
-        public string BuildDB()
-        {
-            try
-            {
-                var db = DbHelper.GetDbClient();
-                //db.CodeFirst.InitTables<WCSTask>(); //鎵�湁搴撻兘鏀寔     
-                //db.CodeFirst.InitTables<Zone>();
-                //db.CodeFirst.InitTables<Area>();
-
-                //db.CodeFirst.InitTables<Location>();
-                //db.CodeFirst.InitTables<LocCntrRel>();
-                //db.CodeFirst.InitTables<Container>();
-                //db.CodeFirst.InitTables<SYSHelper.OI_SYS_MAXID>();
-
-                db.CodeFirst.InitTables<TN_CG_Detail>();
-                db.CodeFirst.InitTables<TN_WorkOrder>();
-                db.CodeFirst.InitTables<TN_CAR_IN>();
-
-                db.CodeFirst.InitTables<TN_Task_Action>();
-                db.CodeFirst.InitTables<TN_Task>();
-                db.CodeFirst.InitTables<TN_Location>();
-                db.CodeFirst.InitTables<TN_Loc_Container>();
-
-                db.CodeFirst.InitTables<TN_Outbound_Order>();
-                db.CodeFirst.InitTables<TN_Outbound_Detail>();
-                db.CodeFirst.InitTables<TN_Outbound_Task>();
-            }
-            catch (Exception ex)
-            {
-                LogHelper.Info($"鍙戠敓浜嗗紓甯�);
-                return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message;
-            }
-            //return res ? "鎴愬姛" : "澶辫触";
-            return "鎴愬姛";
+        [Route("CreateDatabase")]
+        public string CreateDatabase() {
+            return DebugService.CreateDatabase();
         }
 
         [HttpPost]
@@ -104,62 +72,10 @@
             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_CG_ID == model.CgId);
-                    if (cgDetail == null) {
-                        var locList = new List<TN_CG_Detail>();
-                        locList.Add(new TN_CG_Detail { S_CNTR_CODE = model.CntId, S_CG_ID = model.CntId });
-                        if (db.Insertable<TN_CG_Detail>(locList).ExecuteCommand() <= 0) {
-                            tran.RollbackTran();
-                            return $"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{model.CntId}-{model.CgId}澶辫触";
-                        }
-                    }
-
-                    tran.CommitTran();
-                }
-            }
-            catch (Exception ex) {
-                return $"鍑洪敊锛歿ex}";
-            }
-
-            return "success";
-        }
     }
 
     public class CgInfo {
-        public string CgId { get; set; }
+        public string ItemCode { get; set; }
         public string CntId { get; set; }
         public string LocId { get; set; }
     }

--
Gitblit v1.9.1