From 67f74c1d68ccbb69eb8436e70018357533ef9c0a Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期五, 16 五月 2025 17:32:27 +0800
Subject: [PATCH] ERP同步功能部分完善,测试逻辑优化

---
 Helpers/WCSHelper.cs                                                                 |    2 
 Models/TN_Outbound_Order.cs                                                          |   74 ++
 Dtos/Response/MoboxResponse.cs                                                       |   11 
 Controllers/DebugController.cs                                                       |  254 --------
 config/config.json                                                                   |    2 
 Helpers/AgvHelper.cs                                                                 |   64 ++
 Services/ErpService.cs                                                               |   40 +
 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx |    0 
 Dtos/Request/DebugRequest.cs                                                         |   31 +
 packages.config                                                                      |    2 
 Helpers/WMSHelper.cs                                                                 |    1 
 Helpers/SYSHelper.cs                                                                 |    2 
 Models/TN_Inbound_Order.cs                                                           |   79 ++
 Controllers/MoboxController.cs                                                       |   30 
 Controllers/ApiModel.cs                                                              |  152 -----
 Models/TN_Loc_Container.cs                                                           |    2 
 /dev/null                                                                            |   18 
 Dispatch/GZRobot.cs                                                                  |    1 
 Dtos/Response/DebugResponse.cs                                                       |   18 
 Helpers/LocationHelper.cs                                                            |    1 
 Models/DebugModel.cs                                                                 |   18 
 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx |    0 
 Dtos/Request/AgvRequest.cs                                                           |   56 +
 Services/DebugService.cs                                                             |  226 +++++++
 Dtos/Request/ErpRequest.cs                                                           |  244 ++++++++
 Dtos/Response/ErpResponse.cs                                                         |   27 
 Controllers/ErpController.cs                                                         |   32 
 HH.WCS.Mobox3.AnGang.csproj                                                          |   19 
 Helpers/PathHelper.cs                                                                |   22 
 Services/MoboxService.cs                                                             |   38 
 Models/TN_CG_Detail.cs                                                               |    2 
 Dtos/Request/MoboxRequest.cs                                                         |  248 --------
 AppStart/Startup.cs                                                                  |    4 
 Dtos/Response/AgvResponse.cs                                                         |    8 
 34 files changed, 1,008 insertions(+), 720 deletions(-)

diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx
new file mode 100644
index 0000000..76b7280
--- /dev/null
+++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx
Binary files differ
diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx
new file mode 100644
index 0000000..c7797ef
--- /dev/null
+++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx
Binary files differ
diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/50517d0d-5669-4550-a9e0-16e8cf245074.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/50517d0d-5669-4550-a9e0-16e8cf245074.vsidx
deleted file mode 100644
index 6954596..0000000
--- a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/50517d0d-5669-4550-a9e0-16e8cf245074.vsidx
+++ /dev/null
Binary files differ
diff --git a/AppStart/Startup.cs b/AppStart/Startup.cs
index e044d06..6c76727 100644
--- a/AppStart/Startup.cs
+++ b/AppStart/Startup.cs
@@ -32,8 +32,8 @@
             config.MapHttpAttributeRoutes();
             config.EnableSwagger(c => {
                 c.SingleApiVersion("v1", "hh wms api");
-                c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + "\\HH.WCS.Mobox3.DSZSH.xml");
-                c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{System.AppDomain.CurrentDomain.BaseDirectory}\\HH.WCS.Mobox3.DSZSH.xml"));
+                c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + "\\HH.WCS.Mobox3.AnGang.xml");
+                c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{System.AppDomain.CurrentDomain.BaseDirectory}\\HH.WCS.Mobox3.AnGang.xml"));
                 c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
             }
             ).EnableSwaggerUi(c => {
diff --git a/Controllers/ApiModel.cs b/Controllers/ApiModel.cs
index 93bd3d9..9d11717 100644
--- a/Controllers/ApiModel.cs
+++ b/Controllers/ApiModel.cs
@@ -16,21 +16,7 @@
         {
             public string TaskNo { get; set; }
         }
-        /// <summary>
-        /// mobox 鎺ュ彛杩斿洖
-        /// </summary>
-        public class SimpleResult
-        {
-            public int resultCode { get; set; }
-            public string resultMsg { get; set; }
-            public List<object> result { get; set; } = new List<object>();
-        }
-
-        public class Result
-        {
-            public int resultCode { get; set; }
-            public string resultMsg { get; set; }
-        }
+        
 
         /// <summary>
         /// 缁戝畾 鍙傛暟
@@ -80,131 +66,7 @@
             public string ts { get; set; }
         }
 
-        /// <summary>
-        /// 鏇存柊琛ヨ揣鐘舵�鍙傛暟
-        /// </summary>
-        public class replenishmentParme
-        {
-            /// <summary>
-            /// Y寮�浜哄伐琛ヨ揣杩涘叆浜ら�绠″埗,N琛ㄧず浜哄伐琛ヨ揣瀹屾垚鍙互寮�惎鑷姩杞繍
-            /// </summary>
-            public string stauts { get; set; }
-        }
 
-
-        public class orderStatusReportParme
-        {
-            /// <summary>
-            /// 璁㈠崟ID
-            /// </summary>
-            public int orderID { get; set; }
-            /// <summary>
-            /// 璁㈠崟鍚�-            /// </summary>
-            public string orderName { get; set; }
-            /// <summary>
-            /// 璁㈠崟鐘舵�
-            /// </summary>
-            public string orderStatus { get; set; }
-            /// <summary>
-            /// agv杞﹀彿鍒楄〃
-            /// </summary>
-            public string agvIDList { get; set; }
-            /// <summary>
-            /// 浼樺厛绾�-            /// </summary>
-            public string priority { get; set; }
-            /// <summary>
-            /// 璁㈠崟褰撳墠鐨勭洰鐨勫湴
-            /// </summary>
-            public string currentDes { get; set; }
-            /// <summary>
-            /// 褰撳墠鎸囦护
-            /// </summary>
-            public string currentCmd { get; set; }
-
-            /// <summary>
-            /// 閿欒鐮�-            /// </summary>
-            public int errorCode { get; set; }
-
-            /// <summary>
-            /// 璁㈠崟鐨勬埅鑷虫椂闂�-            /// </summary>
-            public string deadLine { get; set; }
-
-            /// <summary>
-            /// 璁㈠崟鐨勫垱寤烘椂闂�-            /// </summary>
-            public string createdTime { get; set; }
-
-            /// <summary>
-            /// 棰濆淇℃伅1
-            /// </summary>
-            public string extraInfo1 { get; set; }
-
-            /// <summary>
-            /// 棰濆淇℃伅2
-            /// </summary>
-            public string extraInfo2 { get; set; }
-        }
-
-        /// <summary>
-        /// 鍒嗘嫞纭
-        /// </summary>
-        public class SortingResultCheck
-        {
-            public string sortNo { get; set; }
-            public string cntrCode { get; set; }
-            public string itemCode { get; set; }
-            public float qty { get; set; }
-        }
-        public class CheckSortingWholeCntr
-        {
-            public string cntr { get; set; }
-            /// <summary>
-            /// 榛樿0锛�琛ㄧず鑷姩鐢熸垚鍒嗘嫞缁撴灉
-            /// </summary>
-            public int autoSort { get; set; }
-        }
-
-        /// <summary>
-        /// lua 璋冪敤鎺ュ彛锛岀爜鐩樹俊鎭�-        /// </summary>
-        public class PalletSorting
-        {
-            public string cntr_code { get; set; }
-            public string item_code { get; set; }
-            public float qty { get; set; }
-            public string arrival_no { get; set; }
-        }
-        public class PalletSorting1
-        {
-            public string cntr_code { get; set; }
-            public string bar_code { get; set; }
-            public string org { get; set; }
-            public float qty { get; set; }
-        }
-
-        public class ShippingOrderCheck
-        {
-            /// <summary>
-            /// 澶氫釜鍙戣揣鍗曞彿
-            /// </summary>
-            public string out_nos { get; set; }
-        }
-        public class SortingOrderCheck
-        {
-
-            public string s_no { get; set; }
-        }
-
-        public class ReturnResult1
-        {
-            public int code { get; set; }
-            public string msg { get; set; }
-
-        }
 
         /// <summary>
         /// 瀹夊叏浜や簰
@@ -214,17 +76,9 @@
             public string station_name { get; set; }
             public string apply_code { get; set; }
             public int orderid { get; set; }
+        }
 
-        }
-        /// <summary>
-        /// 杩斿洖缁橤Z
-        /// </summary>
-        public class GzResult
-        {
-            public int resultCode { get; set; }
-            public string msg { get; set; }
-            public int orderID { get; set; }
-        }
+        
         #endregion
     }
 }
diff --git a/Controllers/DebugController.cs b/Controllers/DebugController.cs
index 7dda76b..2d954b3 100644
--- a/Controllers/DebugController.cs
+++ b/Controllers/DebugController.cs
@@ -16,6 +16,9 @@
 using static HH.WCS.Mobox3.AnGang.Dtos.Request.AgvRequest;
 using static HH.WCS.Mobox3.AnGang.Dtos.Response.AgvResponse;
 using HH.WCS.Mobox3.AnGang.Helpers;
+using HH.WCS.Mobox3.AnGang.Debug;
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.DebugRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.DebugResponse;
 
 namespace HH.WCS.Mobox3.AnGang.Controllers
 {
@@ -26,108 +29,14 @@
     public class DebugController : System.Web.Http.ApiController
     {
         /// <summary>
-        /// AGV鐘舵�涓�敭鍥炴姤134562
+        /// 妯℃嫙 AGV 澶氭鍥炴姤浠诲姟鐘舵�
         /// </summary>
         /// <param name="model">瀹瑰櫒鍙�/param>
         /// <returns></returns>
         [HttpPost]
-        [Route("AGVSeriesReports")]
-        public ReturnResults AGVSeriesReports(UpdateTaskState model)
-        {
-            var agvTaskState = new AgvTaskState()
-            {
-                task_no = model.TaskID,
-                forklift_no = model.ForkliftNo,
-                state = 1
-            };
-            ReturnResults returnResults = new ReturnResults();
-            returnResults.resultList = new List<ReturnResult>();
-
-            var temp1 =  AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp1);
-
-            agvTaskState.state = 3;
-            var temp3 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp3);
-
-            agvTaskState.state = 4;
-            var temp4 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp4);
-
-            agvTaskState.state = 5;
-            var temp5 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp5);
-
-            agvTaskState.state = 6;
-            var temp6 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp6);
-
-            agvTaskState.state = 2;
-            var temp2 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp2);
-
-            return returnResults;
-        }
-
-        /// <summary>
-        /// AGV鐘舵�涓�敭鍥炴姤134
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        [HttpPost]
-        [Route("AGVSeriesReportsPartA")]
-        public ReturnResults AGVSeriesReportsPartA(UpdateTaskState model) {
-            var agvTaskState = new AgvTaskState() {
-                task_no = model.TaskID,
-                forklift_no = model.ForkliftNo,
-                state = 1
-            };
-            ReturnResults returnResults = new ReturnResults();
-            returnResults.resultList = new List<ReturnResult>();
-
-            var temp1 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp1);
-
-            agvTaskState.state = 3;
-            var temp3 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp3);
-
-            agvTaskState.state = 4;
-            var temp4 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp4);
-
-            return returnResults;
-        }
-
-        /// <summary>
-        /// AGV鐘舵�涓�敭鍥炴姤562
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        [HttpPost]
-        [Route("AGVSeriesReportsPartB")]
-        public ReturnResults AGVSeriesReportsPartB(UpdateTaskState model) {
-            var agvTaskState = new AgvTaskState() {
-                task_no = model.TaskID,
-                forklift_no = model.ForkliftNo,
-                state = 4
-            };
-            ReturnResults returnResults = new ReturnResults();
-            returnResults.resultList = new List<ReturnResult>();
-
-            agvTaskState.state = 5;
-            var temp5 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp5);
-
-            agvTaskState.state = 6;
-            var temp6 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp6);
-
-            agvTaskState.state = 2;
-            var temp2 = AgvService.OperateAgvTaskStatus(agvTaskState);
-            returnResults.resultList.Add(temp2);
-
-            return returnResults;
+        [Route("AgvSeriesReports")]
+        public ReturnResults AgvSeriesReports(UpdateTaskState model) {
+            return DebugService.AgvSeriesReports(model);
         }
 
         /// <summary>
@@ -135,154 +44,19 @@
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [Route("BuildDB")]
-        public string BuildDB()
-        {
-            //bool res = false;
-            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<TN_CG_Detail>();
-                //db.CodeFirst.InitTables<TN_WorkOrder>();
-                //db.CodeFirst.InitTables<TN_CAR_IN>();
-                //db.CodeFirst.InitTables<SYSHelper.OI_SYS_MAXID>();
-                //db.CodeFirst.InitTables<TN_Task_Action>();
-                //db.CodeFirst.InitTables<TN_Task>();
-                //db.CodeFirst.InitTables<TN_Location>();
-                //db.CodeFirst.InitTables<TN_Loc_Container>();
-
-                var locList = new List<TN_Location>();
-                //foreach (var area in Settings.Areas.Skip(1).ToList()) {
-                //    for (int i = 0; i < 8; i++) {
-                //        for (int j = 0; j < 30; j++) {
-                //            locList.Add(new TN_Location { S_SHELF_CODE = area, S_CODE = $"{area}-{i + 1}-{j + 1}", S_NAME = $"{area}璐ф灦 绗瑊i + 1}灞�绗瑊j + 1}鍙疯揣浣�, S_AGV_SITE = $"{area}-{i + 1}-{j + 1}", N_HEIGHT = i + 1 });
-                //        }
-                //    }
-                //}
-                locList.Add(new TN_Location { S_AREA_CODE = "B111", S_CODE = "B111-1-1", S_NAME = "B111-1-1", S_AGV_SITE = "B111-1-1"});
-                locList.Add(new TN_Location { S_AREA_CODE = "B111", S_CODE = "B111-4-1", S_NAME = "B111-4-1", S_AGV_SITE = "B111-4-1"});
-                locList.Add(new TN_Location { S_AREA_CODE = "B112", S_CODE = "B112-1-1", S_NAME = "B112-1-1", S_AGV_SITE = "B112-1-1"});
-
-                //locList.Add(new TN_Location { S_AREA_CODE = Settings.Areas[0], S_SHELF_CODE = Settings.Areas[0], S_CODE = Settings.Areas[0] + "-1", S_NAME = "鍙栨斁璐у尯-1", S_AGV_SITE = "P0-1"});
-                //locList.Add(new TN_Location { S_AREA_CODE = Settings.Areas[0], S_SHELF_CODE = Settings.Areas[0], S_CODE = Settings.Areas[0] + "-2", S_NAME = "鍙栨斁璐у尯-2", S_AGV_SITE = "P0-2"});
-                if (db.Insertable<TN_Location>(locList).ExecuteCommand() <= 0) {
-                    return "澶辫触";
-                }
-
-
-            }
-            catch (Exception ex)
-            {
-                LogHelper.Info($"鍙戠敓浜嗗紓甯�);
-                return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message;
-            }
-            //return res ? "鎴愬姛" : "澶辫触";
-            return "鎴愬姛";
+        [Route("CreateDatabase")]
+        public string CreateDatabase(CoverInfo model) {
+            return DebugService.CreateDatabase(model.IsCover);
         }
 
         /// <summary>
-        /// 淇敼浠诲姟鐨勯噸閲忥紝渚夸簬娴嬭瘯
+        /// DEBUG锛氭彃鍏ヨ揣浣嶃�瀹瑰櫒銆佽揣鍝佷俊鎭�         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [Route("UpdateTaskWeight")]
-
-        public string UpdateTaskWeight(UpdateTaskWeightInfo model) {
-            var db = DbHelper.GetDbClient();
-            var task = db.Queryable<TN_Task>().First(a => a.S_CODE == model.TaskID);
-            if (task == null) {
-                return "浠诲姟鍙蜂笉瀛樺湪";
-            }
-            task.F_WEIGHT = model.Weight;
-
-            try {
-                using (var trans = db.Ado.UseTran()) {
-                    if (db.Updateable<TN_Task>(task).ExecuteCommand() > 0) {
-                        trans.CommitTran();
-                        return $"鎴愬姛 | 淇敼浠诲姟{task.S_CODE}閲嶉噺涓簕task.F_WEIGHT}";
-                    }
-                    else {
-                        trans.RollbackTran();
-                        return $"澶辫触 | 淇敼浠诲姟{task.S_CODE}閲嶉噺涓簕task.F_WEIGHT}";
-                    }
-                }
-            }
-            catch (Exception ex) {
-                return ex.Message;
-            }
+        [Route("InsertLocCntrCg")]
+        public string InsertLocCntrCg() {
+            return DebugService.InsertLocCntrCg();
         }
-
-        [HttpPost]
-        public string AddCgCntrLocRel(CgInfo model) {
-            var db = DbHelper.GetDbClient();
-
-            try {
-                var loc = db.Queryable<TN_Location>().First(a => a.S_CODE == model.LocId);
-                if (loc == null) {
-                    var locList = new List<TN_Location>();
-                    locList.Add(new TN_Location { S_CODE = model.LocId, N_CURRENT_NUM = 1 });
-                    if (db.Insertable<TN_Location>(locList).ExecuteCommand() <= 0) {
-                        return $"鎻掑叆浣嶇疆{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) {
-                        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 (loc == 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) {
-                        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) {
-                        return $"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{model.CntId}-{model.CgId}澶辫触";
-                    }
-                }
-            }
-            catch (Exception ex) {
-                return $"鍑洪敊锛歿ex}";
-            }
-
-            return "success";
-        }
-    }
-
-    public class CgInfo {
-        public string CgId { get; set; }
-        public string CntId { get; set; }
-        public string LocId { get; set; }
-    }
-
-    public class UpdateTaskState
-    {
-        public string TaskID { set; get; } // 浠诲姟ID
-        public string ForkliftNo { set; get; } // AGV 灏忚溅鍙�-    }
-
-    public class UpdateTaskWeightInfo {
-        public string TaskID { set; get; }
-        public float Weight { set; get; }
-    }
-
-    public class ReturnResults
-    {
-        public List<ReturnResult> resultList { set; get; }
     }
 }
diff --git a/Controllers/ErpController.cs b/Controllers/ErpController.cs
index a9761de..50483c5 100644
--- a/Controllers/ErpController.cs
+++ b/Controllers/ErpController.cs
@@ -1,10 +1,9 @@
-锘縰sing System;
-using HH.WCS.Mobox3.AnGang.config;
-using Newtonsoft.Json;
-using System.Collections.Generic;
-using System.Web.Http;
+锘縰sing System.Web.Http;
 
-using static HH.WCS.Mobox3.AnGang.Controllers.ApiModel;
+using HH.WCS.Mobox3.AnGang.Services;
+
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.ErpRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.ErpResponse;
 
 namespace HH.WCS.Mobox3.AnGang.Controllers {
     /// <summary>
@@ -12,5 +11,26 @@
     /// </summary>
     [RoutePrefix("api")]
     public class ErpController : ApiController {
+        /// <summary>
+        /// 鍏ュ簱鏁版嵁鍚屾(ERP)
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("InboundDataSync")]
+        public static ErpResult InboundDataSync(InboundDataSyncInfo model) {
+            return ErpService.InboundDataSync(model);
+        }
+
+        /// <summary>
+        /// 鍑哄簱鍙戞枡鍚屾(ERP)
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("OutboundDataSync")]
+        public static ErpResult OutboundDataSync(OutboundDataSyncInfo model) {
+            return ErpService.OutboundDataSync(model);
+        }
     }
 }
\ No newline at end of file
diff --git a/Controllers/MoboxController.cs b/Controllers/MoboxController.cs
index 142de27..351737b 100644
--- a/Controllers/MoboxController.cs
+++ b/Controllers/MoboxController.cs
@@ -20,9 +20,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        [Route("InWarehouse")]
-        public SimpleResult InWarehouse(InWarehouseInfo model) {
-            return MoboxService.InWarehouse(model);
+        [Route("Inbound")]
+        public SimpleResult Inbound(InboundInfo model) {
+            return MoboxService.Inbound(model);
         }
 
         /// <summary>
@@ -42,9 +42,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        [Route("PartOutWarehouse")]
-        public SimpleResult PartOutWarehouse(PartOutWarehouseInfo model) {
-            return MoboxService.PartOutWarehouse(model);
+        [Route("PartOutbound")]
+        public SimpleResult PartOutbound(PartOutboundInfo model) {
+            return MoboxService.PartOutbound(model);
         }
 
         /// <summary>
@@ -53,9 +53,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        [Route("PartInWarehouse")]
-        public SimpleResult PartInWarehouse(PartInWarehouseInfo model) {
-            return MoboxService.PartInWarehouse(model);
+        [Route("PartInbound")]
+        public SimpleResult PartInbound(PartInboundInfo model) {
+            return MoboxService.PartInbound(model);
         }
 
         /// <summary>
@@ -64,9 +64,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        [Route("CheckOutWarehouse")]
-        public SimpleResult CheckOutWarehouse(CheckOutWarehouseInfo model) {
-            return MoboxService.CheckOutWarehouse(model);
+        [Route("CheckOutbound")]
+        public SimpleResult CheckOutbound(CheckOutboundInfo model) {
+            return MoboxService.CheckOutbound(model);
         }
 
         /// <summary>
@@ -75,9 +75,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        [Route("CheckInWarehouse")]
-        public SimpleResult CheckInWarehouse(CheckInWarehouseInfo model) {
-            return MoboxService.CheckInWarehouse(model);
+        [Route("CheckInbound")]
+        public SimpleResult CheckInbound(CheckInboundInfo model) {
+            return MoboxService.CheckInbound(model);
         }
     }
 }
diff --git a/Dispatch/GZRobot.cs b/Dispatch/GZRobot.cs
index 4479bcf..8cdc3f3 100644
--- a/Dispatch/GZRobot.cs
+++ b/Dispatch/GZRobot.cs
@@ -13,6 +13,7 @@
 
 using static HH.WCS.Mobox3.AnGang.Controllers.ApiModel;
 using static HH.WCS.Mobox3.AnGang.Dtos.Request.AgvRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.AgvResponse;
 
 namespace HH.WCS.Mobox3.AnGang.Dispatch {
     /// <summary>
diff --git a/Dtos/Request/AgvRequest.cs b/Dtos/Request/AgvRequest.cs
index c8fb4f5..c5d7e76 100644
--- a/Dtos/Request/AgvRequest.cs
+++ b/Dtos/Request/AgvRequest.cs
@@ -35,5 +35,61 @@
             public string apply_code { get; set; }
             public string task_no { set; get; }
         }
+
+        public class orderStatusReportParme {
+            /// <summary>
+            /// 璁㈠崟ID
+            /// </summary>
+            public int orderID { get; set; }
+            /// <summary>
+            /// 璁㈠崟鍚�+            /// </summary>
+            public string orderName { get; set; }
+            /// <summary>
+            /// 璁㈠崟鐘舵�
+            /// </summary>
+            public string orderStatus { get; set; }
+            /// <summary>
+            /// agv杞﹀彿鍒楄〃
+            /// </summary>
+            public string agvIDList { get; set; }
+            /// <summary>
+            /// 浼樺厛绾�+            /// </summary>
+            public string priority { get; set; }
+            /// <summary>
+            /// 璁㈠崟褰撳墠鐨勭洰鐨勫湴
+            /// </summary>
+            public string currentDes { get; set; }
+            /// <summary>
+            /// 褰撳墠鎸囦护
+            /// </summary>
+            public string currentCmd { get; set; }
+
+            /// <summary>
+            /// 閿欒鐮�+            /// </summary>
+            public int errorCode { get; set; }
+
+            /// <summary>
+            /// 璁㈠崟鐨勬埅鑷虫椂闂�+            /// </summary>
+            public string deadLine { get; set; }
+
+            /// <summary>
+            /// 璁㈠崟鐨勫垱寤烘椂闂�+            /// </summary>
+            public string createdTime { get; set; }
+
+            /// <summary>
+            /// 棰濆淇℃伅1
+            /// </summary>
+            public string extraInfo1 { get; set; }
+
+            /// <summary>
+            /// 棰濆淇℃伅2
+            /// </summary>
+            public string extraInfo2 { get; set; }
+        }
     }
 }
diff --git a/Dtos/Request/DebugRequest.cs b/Dtos/Request/DebugRequest.cs
new file mode 100644
index 0000000..b9b000c
--- /dev/null
+++ b/Dtos/Request/DebugRequest.cs
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Dtos.Request {
+    public class DebugRequest {
+        /// <summary>
+        /// 妯℃嫙 AGV 浼犻�淇″彿锛岀敤浜庢洿鏀逛换鍔$姸鎬�+        /// </summary>
+        public class UpdateTaskState {
+            /// <summary>
+            /// 浠诲姟ID
+            /// </summary>
+            public string TaskID { set; get; }
+            /// <summary>
+            /// AGV 灏忚溅鍙�+            /// </summary>
+            public string ForkliftNo { set; get; }
+            /// <summary>
+            /// AGV 涓嬩竴涓姸鎬�+            /// </summary>
+            public int NextState { set; get; }
+        }
+
+        public class CoverInfo {
+            public bool IsCover { set; get; } = true;
+        }
+    }
+}
diff --git a/Dtos/Request/ErpRequest.cs b/Dtos/Request/ErpRequest.cs
new file mode 100644
index 0000000..3947973
--- /dev/null
+++ b/Dtos/Request/ErpRequest.cs
@@ -0,0 +1,244 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Dtos.Request {
+    public class ErpRequest {
+        /// <summary>
+        /// 鍏ュ簱鏁版嵁鍚屾淇℃伅
+        /// </summary>
+        public class InboundDataSyncInfo {
+            /// <summary>
+            /// 搴撳瓨鏄庣粏锛堝垪琛級
+            /// </summary>
+            public List<StockTransaction> stockTransactions { get; set; }
+
+            /// <summary>
+            /// 鎬昏褰曟暟
+            /// </summary>
+            public string totalRecords { get; set; }
+
+            /// <summary>
+            /// 鏁版嵁鐢熸垚鏃堕棿鎴�+            /// </summary>
+            public string timestamp { get; set; }
+        }
+
+        /// <summary>
+        /// 搴撳瓨鏄庣粏淇℃伅
+        /// </summary>
+        public class StockTransaction {
+            /// <summary>
+            /// 鍌ㄤ綅鐮�+            /// </summary>
+            public string locationCode { get; set; }
+
+            /// <summary>
+            /// 搴撳瓨鏄庣粏浜ゆ槗鍙�+            /// </summary>
+            public string stockTransactionId { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡缂栫爜
+            /// </summary>
+            public string itemCode { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡鍚嶇О
+            /// </summary>
+            public string itemName { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡鐭弿杩�+            /// </summary>
+            public string itemShortDesc { get; set; }
+
+            /// <summary>
+            /// 搴撳瓨鏁伴噺
+            /// </summary>
+            public string stockQuantity { get; set; }
+
+            /// <summary>
+            /// 鍏ュ簱鏁伴噺
+            /// </summary>
+            public string inQuantity { get; set; }
+
+            /// <summary>
+            /// 搴撳瓨鎬讳环
+            /// </summary>
+            public string totalPrice { get; set; }
+
+            /// <summary>
+            /// 鍏ュ簱鏃堕棿
+            /// </summary>
+            public string stockInTime { get; set; }
+
+            /// <summary>
+            /// 淇濈鍛�+            /// </summary>
+            public string storeKeeper { get; set; }
+
+            /// <summary>
+            /// 浜х嚎閮ㄩ棬浠g爜
+            /// </summary>
+            public string lineCode { get; set; }
+
+            /// <summary>
+            /// 閫佽揣鍗曡鍙�+            /// </summary>
+            public string deliveryItemNo { get; set; }
+
+            /// <summary>
+            /// 渚涘簲鍟嗗悕绉�+            /// </summary>
+            public string supplierName { get; set; }
+
+            /// <summary>
+            /// 搴撳瓨璐d换浜哄鍚�+            /// </summary>
+            public string inventoryManager { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁1
+            /// </summary>
+            public string ext1 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁2
+            /// </summary>
+            public string ext2 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁3
+            /// </summary>
+            public string ext3 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁4
+            /// </summary>
+            public string ext4 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁5
+            /// </summary>
+            public string ext5 { get; set; }
+        }
+
+        /// <summary>
+        /// 鍑哄簱鍙戞枡鍚屾淇℃伅
+        /// </summary>
+        public class OutboundDataSyncInfo {
+            /// <summary>
+            /// 鍙戞枡璁板綍鏄庣粏鍒楄〃
+            /// </summary>
+            public List<MaterialIssue> materialIssues { get; set; }
+
+            /// <summary>
+            /// 鎬昏褰曟暟
+            /// </summary>
+            public string totalRecords { get; set; }
+
+            /// <summary>
+            /// 鏁版嵁鐢熸垚鏃堕棿鎴�+            /// </summary>
+            public string timestamp { get; set; }
+        }
+
+        /// <summary>
+        /// 鍙戞枡璁板綍鏄庣粏淇℃伅
+        /// </summary>
+        public class MaterialIssue {
+            /// <summary>
+            /// 鍌ㄤ綅鐮�+            /// </summary>
+            public string locationCode { get; set; }
+
+            /// <summary>
+            /// 棰嗙敤鍗曞彿
+            /// </summary>
+            public string withdrawalOrderNo { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡缂栫爜
+            /// </summary>
+            public string itemCode { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡鍚嶇О
+            /// </summary>
+            public string itemName { get; set; }
+
+            /// <summary>
+            /// 鐗╂枡鐭弿杩�+            /// </summary>
+            public string itemShortDesc { get; set; }
+
+            /// <summary>
+            /// 瀹炲彂鏁伴噺
+            /// </summary>
+            public string actualIssuedQty { get; set; }
+
+            /// <summary>
+            /// 瀹炲彂閲戦
+            /// </summary>
+            public string issuedAmount { get; set; }
+
+            /// <summary>
+            /// 渚涘簲鍟嗗悕绉�+            /// </summary>
+            public string supplierName { get; set; }
+
+            /// <summary>
+            /// 瀹炲彂浜�+            /// </summary>
+            public string issuer { get; set; }
+
+            /// <summary>
+            /// 鍙戞枡鏃ユ湡
+            /// </summary>
+            public string issueDate { get; set; }
+
+            /// <summary>
+            /// 淇濈鍛�+            /// </summary>
+            public string storeKeeper { get; set; }
+
+            /// <summary>
+            /// 浜х嚎閮ㄩ棬浠g爜
+            /// </summary>
+            public string lineCode { get; set; }
+
+            /// <summary>
+            /// 鎵规
+            /// </summary>
+            public string batchNo { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁1
+            /// </summary>
+            public string ext1 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁2
+            /// </summary>
+            public string ext2 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁3
+            /// </summary>
+            public string ext3 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁4
+            /// </summary>
+            public string ext4 { get; set; }
+
+            /// <summary>
+            /// 澶囩敤瀛楁5
+            /// </summary>
+            public string ext5 { get; set; }
+        }
+    }
+}
diff --git a/Dtos/Request/MoboxRequest.cs b/Dtos/Request/MoboxRequest.cs
index 4b910e6..ebadc95 100644
--- a/Dtos/Request/MoboxRequest.cs
+++ b/Dtos/Request/MoboxRequest.cs
@@ -30,7 +30,7 @@
         }
 
         #endregion
-        public class InWarehouseInfo {
+        public class InboundInfo {
             /// <summary>
             /// 璧风偣璐т綅
             /// </summary>
@@ -58,7 +58,7 @@
         /// <summary>
         /// 浜у搧閮ㄥ垎鍥炲簱淇℃伅
         /// </summary>
-        public class PartInWarehouseInfo {
+        public class PartInboundInfo {
             /// <summary>
             /// 璧风偣浣嶇疆
             /// </summary>
@@ -73,7 +73,7 @@
         /// <summary>
         /// 浜у搧閮ㄥ垎鍑哄簱淇℃伅
         /// </summary>
-        public class PartOutWarehouseInfo {
+        public class PartOutboundInfo {
             /// <summary>
             /// 璧风偣浣嶇疆
             /// </summary>
@@ -88,7 +88,7 @@
         /// <summary>
         /// 鐩樼偣鐞嗚揣鍑哄簱淇℃伅
         /// </summary>
-        public class CheckOutWarehouseInfo {
+        public class CheckOutboundInfo {
             /// <summary>
             /// 璧风偣浣嶇疆
             /// </summary>
@@ -103,7 +103,7 @@
         /// <summary>
         /// 鐩樼偣鐞嗚揣鍥炲簱淇℃伅
         /// </summary>
-        public class CheckInWarehouseInfo {
+        public class CheckInboundInfo {
             /// <summary>
             /// 璧风偣浣嶇疆
             /// </summary>
@@ -114,242 +114,6 @@
             /// </summary>
             public string endLoc { get; set; }
         }
-
-        // ERP -> AGV
-
-        /// <summary>
-        /// 鍏ュ簱鏁版嵁鍚屾淇℃伅
-        /// </summary>
-        public class InWarehouseDataSyncInfo {
-            /// <summary>
-            /// 搴撳瓨鏄庣粏锛堝垪琛級
-            /// </summary>
-            public List<StockTransaction> stockTransactions { get; set; }
-
-            /// <summary>
-            /// 鎬昏褰曟暟
-            /// </summary>
-            public string totalRecords { get; set; }
-
-            /// <summary>
-            /// 鏁版嵁鐢熸垚鏃堕棿鎴�-            /// </summary>
-            public string timestamp { get; set; }
-        }
-
-        /// <summary>
-        /// 搴撳瓨鏄庣粏淇℃伅
-        /// </summary>
-        public class StockTransaction {
-            /// <summary>
-            /// 鍌ㄤ綅鐮�-            /// </summary>
-            public string locationCode { get; set; }
-
-            /// <summary>
-            /// 搴撳瓨鏄庣粏浜ゆ槗鍙�-            /// </summary>
-            public string stockTransactionId { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡缂栫爜
-            /// </summary>
-            public string itemCode { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡鍚嶇О
-            /// </summary>
-            public string itemName { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡鐭弿杩�-            /// </summary>
-            public string itemShortDesc { get; set; }
-
-            /// <summary>
-            /// 搴撳瓨鏁伴噺
-            /// </summary>
-            public string stockQuantity { get; set; }
-
-            /// <summary>
-            /// 鍏ュ簱鏁伴噺
-            /// </summary>
-            public string inQuantity { get; set; }
-
-            /// <summary>
-            /// 搴撳瓨鎬讳环
-            /// </summary>
-            public string totalPrice { get; set; }
-
-            /// <summary>
-            /// 鍏ュ簱鏃堕棿
-            /// </summary>
-            public string stockInTime { get; set; }
-
-            /// <summary>
-            /// 淇濈鍛�-            /// </summary>
-            public string storeKeeper { get; set; }
-
-            /// <summary>
-            /// 浜х嚎閮ㄩ棬浠g爜
-            /// </summary>
-            public string lineCode { get; set; }
-
-            /// <summary>
-            /// 閫佽揣鍗曡鍙�-            /// </summary>
-            public string deliveryItemNo { get; set; }
-
-            /// <summary>
-            /// 渚涘簲鍟嗗悕绉�-            /// </summary>
-            public string supplierName { get; set; }
-
-            /// <summary>
-            /// 搴撳瓨璐d换浜哄鍚�-            /// </summary>
-            public string inventoryManager { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁1
-            /// </summary>
-            public string ext1 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁2
-            /// </summary>
-            public string ext2 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁3
-            /// </summary>
-            public string ext3 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁4
-            /// </summary>
-            public string ext4 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁5
-            /// </summary>
-            public string ext5 { get; set; }
-        }
-
-        /// <summary>
-        /// 鍑哄簱鍙戞枡鍚屾淇℃伅
-        /// </summary>
-        public class OutWarehouseDataSyncInfo {
-            /// <summary>
-            /// 鍙戞枡璁板綍鏄庣粏鍒楄〃
-            /// </summary>
-            public List<MaterialIssue> materialIssues { get; set; }
-
-            /// <summary>
-            /// 鎬昏褰曟暟
-            /// </summary>
-            public string totalRecords { get; set; }
-
-            /// <summary>
-            /// 鏁版嵁鐢熸垚鏃堕棿鎴�-            /// </summary>
-            public string timestamp { get; set; }
-        }
-
-        /// <summary>
-        /// 鍙戞枡璁板綍鏄庣粏淇℃伅
-        /// </summary>
-        public class MaterialIssue {
-            /// <summary>
-            /// 鍌ㄤ綅鐮�-            /// </summary>
-            public string locationCode { get; set; }
-
-            /// <summary>
-            /// 棰嗙敤鍗曞彿
-            /// </summary>
-            public string withdrawalOrderNo { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡缂栫爜
-            /// </summary>
-            public string itemCode { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡鍚嶇О
-            /// </summary>
-            public string itemName { get; set; }
-
-            /// <summary>
-            /// 鐗╂枡鐭弿杩�-            /// </summary>
-            public string itemShortDesc { get; set; }
-
-            /// <summary>
-            /// 瀹炲彂鏁伴噺
-            /// </summary>
-            public string actualIssuedQty { get; set; }
-
-            /// <summary>
-            /// 瀹炲彂閲戦
-            /// </summary>
-            public string issuedAmount { get; set; }
-
-            /// <summary>
-            /// 渚涘簲鍟嗗悕绉�-            /// </summary>
-            public string supplierName { get; set; }
-
-            /// <summary>
-            /// 瀹炲彂浜�-            /// </summary>
-            public string issuer { get; set; }
-
-            /// <summary>
-            /// 鍙戞枡鏃ユ湡
-            /// </summary>
-            public string issueDate { get; set; }
-
-            /// <summary>
-            /// 淇濈鍛�-            /// </summary>
-            public string storeKeeper { get; set; }
-
-            /// <summary>
-            /// 浜х嚎閮ㄩ棬浠g爜
-            /// </summary>
-            public string lineCode { get; set; }
-
-            /// <summary>
-            /// 鎵规
-            /// </summary>
-            public string batchNo { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁1
-            /// </summary>
-            public string ext1 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁2
-            /// </summary>
-            public string ext2 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁3
-            /// </summary>
-            public string ext3 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁4
-            /// </summary>
-            public string ext4 { get; set; }
-
-            /// <summary>
-            /// 澶囩敤瀛楁5
-            /// </summary>
-            public string ext5 { get; set; }
-        }
+        
     }
 }
diff --git a/Dtos/Response/AgvResponse.cs b/Dtos/Response/AgvResponse.cs
index 474dbce..2192704 100644
--- a/Dtos/Response/AgvResponse.cs
+++ b/Dtos/Response/AgvResponse.cs
@@ -14,5 +14,13 @@
             public string ResultMsg { get; set; }
         }
 
+        /// <summary>
+        /// 杩斿洖缁橤Z
+        /// </summary>
+        public class GzResult {
+            public int resultCode { get; set; }
+            public string msg { get; set; }
+            public int orderID { get; set; }
+        }
     }
 }
diff --git a/Dtos/Response/DebugResponse.cs b/Dtos/Response/DebugResponse.cs
new file mode 100644
index 0000000..c90ebfb
--- /dev/null
+++ b/Dtos/Response/DebugResponse.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.AgvResponse;
+
+namespace HH.WCS.Mobox3.AnGang.Dtos.Response {
+    public class DebugResponse {
+        /// <summary>
+        /// 
+        /// </summary>
+        public class ReturnResults {
+            public List<ReturnResult> ResultList { set; get; }
+        }
+    }
+}
diff --git a/Dtos/Response/ErpResponse.cs b/Dtos/Response/ErpResponse.cs
new file mode 100644
index 0000000..935d425
--- /dev/null
+++ b/Dtos/Response/ErpResponse.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Dtos.Response {
+    public class ErpResponse {
+        public class ErpResult {
+            /// <summary>
+            /// 鎺ュ彛鍙嶉鐮�+            /// </summary>
+            public int errCode { get; set; }
+            /// <summary>
+            /// 閿欒璇存槑
+            /// </summary>
+            public string errMsg { get; set; }
+        }
+
+        public static ErpResult BuildErpResult(int code, string message, bool printLog = true) {
+            if (printLog) {
+                LogHelper.Info(message);
+            }
+            return new ErpResult { errCode = code, errMsg = message };
+        }
+    }
+}
diff --git a/Dtos/Response/MoboxResponse.cs b/Dtos/Response/MoboxResponse.cs
index 84e4822..f1b6376 100644
--- a/Dtos/Response/MoboxResponse.cs
+++ b/Dtos/Response/MoboxResponse.cs
@@ -9,13 +9,20 @@
         /// </summary>
         public class SimpleResult {
             [JsonProperty("resultCode")]
-            public int Code { get; set; }
+            public int resultCode { get; set; }
 
             [JsonProperty("resultMsg")]
-            public string Message { get; set; }
+            public string resultMsg { get; set; }
 
             [JsonProperty("result")]
             public List<object> Results { get; set; } = new List<object>();
         }
+
+        public static SimpleResult BuildSimpleResult(int code, string message, bool pringLog = true) {
+            if (pringLog) {
+                LogHelper.Info(message);
+            }
+            return new SimpleResult { resultCode = code, resultMsg = message };
+        }
     }
 }
diff --git a/HH.WCS.Mobox3.AnGang.csproj b/HH.WCS.Mobox3.AnGang.csproj
index ac762ad..aa0ecba 100644
--- a/HH.WCS.Mobox3.AnGang.csproj
+++ b/HH.WCS.Mobox3.AnGang.csproj
@@ -104,6 +104,9 @@
     <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
       <HintPath>packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
     </Reference>
+    <Reference Include="CsvHelper, Version=33.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
+      <HintPath>packages\CsvHelper.33.0.1\lib\net462\CsvHelper.dll</HintPath>
+    </Reference>
     <Reference Include="EasyModbus, Version=5.6.0.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath>
     </Reference>
@@ -270,8 +273,16 @@
     <Compile Include="AppStart\SwaggerControllerDescProvider.cs" />
     <Compile Include="Devices\SnapDevice.cs" />
     <Compile Include="Devices\SnapManager.cs" />
+    <Compile Include="Dtos\Request\DebugRequest.cs" />
+    <Compile Include="Dtos\Request\ErpRequest.cs" />
+    <Compile Include="Dtos\Response\DebugResponse.cs" />
+    <Compile Include="Dtos\Response\ErpResponse.cs" />
+    <Compile Include="Helpers\AgvHelper.cs" />
     <Compile Include="Helpers\DbHelper.cs" />
-    <Compile Include="Helpers\ResultHelper.cs" />
+    <Compile Include="Helpers\PathHelper.cs" />
+    <Compile Include="Models\DebugModel.cs" />
+    <Compile Include="Models\TN_Inbound_Order.cs" />
+    <Compile Include="Models\TN_Outbound_Order.cs" />
     <Compile Include="ServiceCore\WMSCore.cs" />
     <Compile Include="Models\BaseModel.cs" />
     <Compile Include="Services\DebugService.cs" />
@@ -304,12 +315,13 @@
     <Compile Include="Dispatch\HostToAGV.cs" />
     <Compile Include="Helpers\TaskHelper.cs" />
     <Compile Include="Services\AgvService.cs" />
+    <Compile Include="Services\ErpService.cs" />
     <Compile Include="Services\MoboxService.cs" />
     <Compile Include="Helpers\LogHelper.cs" />
     <Compile Include="Helpers\ContainerHelper.cs" />
     <Compile Include="Helpers\LocationHelper.cs" />
     <Compile Include="Helpers\WMSHelper.cs" />
-    <Compile Include="Helpers\SYSHelper.cs" />
+    <Compile Include="Helpers\SysHelper.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="AppStart\Settings.cs" />
@@ -352,5 +364,8 @@
       <Name>NetSDKCS</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="debug\" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
diff --git a/Helpers/AgvHelper.cs b/Helpers/AgvHelper.cs
new file mode 100644
index 0000000..f4f41b6
--- /dev/null
+++ b/Helpers/AgvHelper.cs
@@ -0,0 +1,64 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Helpers {
+    public class AgvHelper {
+        /// <summary>
+        /// AGV 浠诲姟鐘舵�浼樺厛绾э細1->3->4->5->6->2
+        /// </summary>
+        private static readonly int[] _agvTaskStatePri = { 0, 1, 6, 2, 3, 4, 5 };
+
+        /// <summary>
+        /// AGV 鐘舵�鍙樺寲琛細1->3->4->5->6->2 | 0->0 | 2->0
+        /// </summary>
+        private static readonly int[] _agvNextState = new int[] { 0, 3, 0, 4, 5, 6, 2 };
+
+        /// <summary>
+        /// 鍒ゆ柇AGV鐘舵�鏄惁涓哄悎娉曠殑涓嬩釜鐘舵�锛堝寘鍚鏌ョ姸鎬佹槸鍚︿负浠诲姟鐘舵�锛�+        /// </summary>
+        /// <remarks>
+        /// 1. 鍓嶅悗鐘舵�鍙鏈変笉鍚堟硶閮戒細杩斿洖 <see langword="false"/><br/>
+        /// 2. nextState 鍙互涓�lastState 鐩稿悓
+        /// </remarks>
+        /// <param name="lastState"></param>
+        /// <param name="nextState"></param>
+        /// <returns></returns>
+        public static bool IsNextStateOk(int lastState, int nextState) {
+            var lastPri = GetPri(lastState);
+            var nextPri = GetPri(nextState);
+            return lastPri != 0 && nextPri != 0 && lastPri <= nextState;
+        }
+
+        /// <summary>
+        /// 鑾峰彇AGV褰撳墠鐘舵�鐨勪笅涓姸鎬侊細涓嶅悎娉曟垨涓�2(瀹屾垚) 鏃惰繑鍥�0
+        /// </summary>
+        /// <param name="curState"></param>
+        /// <returns></returns>
+        public static int GetNextState(int curState) {
+            if (!IsTaskState(curState)) return 0;
+            return _agvNextState[curState];
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇 AGV 鐘舵�鏄惁涓烘甯哥殑鎵ц浠诲姟鐘舵�锛�34562
+        /// </summary>
+        /// <param name="state"></param>
+        /// <returns></returns>
+        private static bool IsTaskState(int state) {
+            return state > 0 && state < 7;
+        }
+
+        /// <summary>
+        /// GetTaskStatePri锛氳幏鍙�AGV 浠诲姟鐘舵�鐨勪紭鍏堢骇锛堝寘鍚鏌ョ姸鎬佹槸鍚︿负浠诲姟鐘舵�锛�+        /// </summary>
+        /// <param name="state"></param>
+        /// <returns></returns>
+        private static int GetPri(int state) {
+            if (!IsTaskState(state)) { return 0; }
+            return _agvTaskStatePri[state];
+        }
+    }
+}
diff --git a/Helpers/LocationHelper.cs b/Helpers/LocationHelper.cs
index 27f7148..8102958 100644
--- a/Helpers/LocationHelper.cs
+++ b/Helpers/LocationHelper.cs
@@ -9,6 +9,7 @@
 using System.Threading.Tasks;
 using static HH.WCS.Mobox3.AnGang.Controllers.ApiModel;
 using HH.WCS.Mobox3.AnGang.Helpers;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.MoboxResponse;
 
 namespace HH.WCS.Mobox3.AnGang.Helper {
     public class LocationHelper
diff --git a/Helpers/PathHelper.cs b/Helpers/PathHelper.cs
new file mode 100644
index 0000000..d3deaab
--- /dev/null
+++ b/Helpers/PathHelper.cs
@@ -0,0 +1,22 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Helpers {
+    public class PathHelper {
+        /// <summary>
+        /// 椤圭洰鏂囦欢澶逛笌Debug/Release鏂囦欢鐨勭浉瀵硅矾寰勶紙绉佹湁甯搁噺锛�+        /// </summary>
+        const string RELATIVE_PATH = "../..";
+
+        /// <summary>
+        /// GetProjectDirectory锛氳幏鍙栭」鐩枃浠跺す璺緞
+        /// </summary>
+        public static string GetProjDir(string filepath = "./") {
+            return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RELATIVE_PATH, filepath));
+        }
+    }
+}
diff --git a/Helpers/ResultHelper.cs b/Helpers/ResultHelper.cs
deleted file mode 100644
index 59913b4..0000000
--- a/Helpers/ResultHelper.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using static HH.WCS.Mobox3.AnGang.Dtos.Response.MoboxResponse;
-
-namespace HH.WCS.Mobox3.AnGang.Helpers {
-    public class ResultHelper {
-        public static SimpleResult BuildSimpleResult(int code, string message, bool pringLog = true) {
-            if (pringLog) {
-                LogHelper.Info(message);
-            }
-            return new SimpleResult { Code = code, Message = message };
-        }
-    }
-}
diff --git a/Helpers/SYSHelper.cs b/Helpers/SYSHelper.cs
index 7953e73..1d75384 100644
--- a/Helpers/SYSHelper.cs
+++ b/Helpers/SYSHelper.cs
@@ -10,7 +10,7 @@
 
 namespace HH.WCS.Mobox3.AnGang.Helper
 {
-    internal class SYSHelper
+    internal class SysHelper
     {
         private static object locker = new object();
         internal static int GetSerialNumber(string snType, string prefix) {
diff --git a/Helpers/WCSHelper.cs b/Helpers/WCSHelper.cs
index d764a5f..e4a338b 100644
--- a/Helpers/WCSHelper.cs
+++ b/Helpers/WCSHelper.cs
@@ -11,7 +11,7 @@
 namespace HH.WCS.Mobox3.AnGang.Helper {
     internal class WCSHelper {
         internal static string GenerateTaskNo() {
-            var id = SYSHelper.GetSerialNumber("浠诲姟鍙�, "TN");
+            var id = SysHelper.GetSerialNumber("浠诲姟鍙�, "TN");
             var date = DateTime.Now.ToString("yyMMdd");
             return $"TN{date}{id.ToString().PadLeft(4, '0')}";
         }
diff --git a/Helpers/WMSHelper.cs b/Helpers/WMSHelper.cs
index 9e32606..3c13c21 100644
--- a/Helpers/WMSHelper.cs
+++ b/Helpers/WMSHelper.cs
@@ -12,6 +12,7 @@
 using System.Threading.Tasks;
 using static HH.WCS.Mobox3.AnGang.Controllers.ApiModel;
 using HH.WCS.Mobox3.AnGang.Helpers;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.MoboxResponse;
 
 namespace HH.WCS.Mobox3.AnGang.Helper
 {
diff --git a/Models/DebugModel.cs b/Models/DebugModel.cs
new file mode 100644
index 0000000..287dee9
--- /dev/null
+++ b/Models/DebugModel.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Models {
+    public class DebugModel {
+        public class LocCntrCg {
+            public string LocCode { get; set; }
+            public string LocArea { get; set; }
+            public string CntrCode { get; set; }
+            public string CntrType { get; set; }
+            public string ItemCode { get; set; }
+            public string BatchNo { get; set; }
+        }
+    }
+}
diff --git a/Models/TN_CG_Detail.cs b/Models/TN_CG_Detail.cs
index 62c383b..8557bc1 100644
--- a/Models/TN_CG_Detail.cs
+++ b/Models/TN_CG_Detail.cs
@@ -43,5 +43,7 @@
         /// 鍥剧墖閾炬帴
         /// </summary>
         public string S_IMG_URL { get; set; }
+
+
     }
 }
diff --git a/Models/TN_Inbound_Order.cs b/Models/TN_Inbound_Order.cs
new file mode 100644
index 0000000..fc5efc7
--- /dev/null
+++ b/Models/TN_Inbound_Order.cs
@@ -0,0 +1,79 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Models {
+    public class TN_Inbound_Order : BaseModel {
+        /// <summary>
+        /// 鍌ㄤ綅鐮�+        /// </summary>
+        public string S_LOCATION_CODE { get; set; }
+
+        /// <summary>
+        /// 搴撳瓨鏄庣粏浜ゆ槗鍙�+        /// </summary>
+        public string S_STOCK_TRANSACTION_ID { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string S_ITEM_CODE { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string S_ITEM_NAME { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鐭弿杩�+        /// </summary>
+        public string S_ITEM_SHORT_DESC { get; set; }
+
+        /// <summary>
+        /// 搴撳瓨鏁伴噺
+        /// </summary>
+        public string S_STOCK_QUANTITY { get; set; }
+
+        /// <summary>
+        /// 鍏ュ簱鏁伴噺
+        /// </summary>
+        public string S_IN_QUANTITY { get; set; }
+
+        /// <summary>
+        /// 搴撳瓨鎬讳环
+        /// </summary>
+        public string S_TOTAL_PRICE { get; set; }
+
+        /// <summary>
+        /// 鍏ュ簱鏃堕棿
+        /// </summary>
+        public string S_STOCK_IN_TIME { get; set; }
+
+        /// <summary>
+        /// 淇濈鍛�+        /// </summary>
+        public string S_STORE_KEEPER { get; set; }
+
+        /// <summary>
+        /// 浜х嚎閮ㄩ棬浠g爜
+        /// </summary>
+        public string S_LINE_CODE { get; set; }
+
+        /// <summary>
+        /// 閫佽揣鍗曡鍙�+        /// </summary>
+        public string S_DELIVERY_ITEM_NO { get; set; }
+
+        /// <summary>
+        /// 渚涘簲鍟嗗悕绉�+        /// </summary>
+        public string S_SUPPLIER_NAME { get; set; }
+
+        /// <summary>
+        /// 搴撳瓨璐d换浜哄鍚�+        /// </summary>
+        public string S_INVENTORY_MANAGER { get; set; }
+    }
+}
diff --git a/Models/TN_Loc_Container.cs b/Models/TN_Loc_Container.cs
index ff07b70..86332b2 100644
--- a/Models/TN_Loc_Container.cs
+++ b/Models/TN_Loc_Container.cs
@@ -10,6 +10,8 @@
         public string S_LOC_CODE { get; set; }
         public string S_CNTR_CODE { get; set; }
 
+        public string S_CNTR_TYPE { get; set; } = "";
+
 
         [Navigate(NavigateType.OneToMany, nameof(TN_CG_Detail.S_CNTR_CODE))]
         public List<TN_CG_Detail> CntrItemRels { get; set; }
diff --git a/Models/TN_Outbound_Order.cs b/Models/TN_Outbound_Order.cs
new file mode 100644
index 0000000..c090f21
--- /dev/null
+++ b/Models/TN_Outbound_Order.cs
@@ -0,0 +1,74 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HH.WCS.Mobox3.AnGang.Models {
+    public class TN_Outbound_Order : BaseModel {
+        /// <summary>
+        /// 鍌ㄤ綅鐮�+        /// </summary>
+        public string S_LOCATION_CODE { get; set; }
+
+        /// <summary>
+        /// 棰嗙敤鍗曞彿
+        /// </summary>
+        public string S_WITHDRAWAL_ORDER_NO { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string S_ITEM_CODE { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string S_ITEM_NAME { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鐭弿杩�+        /// </summary>
+        public string S_ITEM_SHORT_DESC { get; set; }
+
+        /// <summary>
+        /// 瀹炲彂鏁伴噺
+        /// </summary>
+        public string S_ACTUAL_ISSUED_QTY { get; set; }
+
+        /// <summary>
+        /// 瀹炲彂閲戦
+        /// </summary>
+        public string S_ISSUED_AMOUNT { get; set; }
+
+        /// <summary>
+        /// 渚涘簲鍟嗗悕绉�+        /// </summary>
+        public string S_SUPPLIER_NAME { get; set; }
+
+        /// <summary>
+        /// 瀹炲彂浜�+        /// </summary>
+        public string S_ISSUER { get; set; }
+
+        /// <summary>
+        /// 鍙戞枡鏃ユ湡
+        /// </summary>
+        public string S_ISSUE_DATE { get; set; }
+
+        /// <summary>
+        /// 淇濈鍛�+        /// </summary>
+        public string S_STORE_KEEPER { get; set; }
+
+        /// <summary>
+        /// 浜х嚎閮ㄩ棬浠g爜
+        /// </summary>
+        public string S_LINE_CODE { get; set; }
+
+        /// <summary>
+        /// 鎵规
+        /// </summary>
+        public string S_BATCH_NO { get; set; }
+    }
+}
diff --git a/Services/DebugService.cs b/Services/DebugService.cs
index fbbad8d..4374a10 100644
--- a/Services/DebugService.cs
+++ b/Services/DebugService.cs
@@ -1,30 +1,121 @@
-锘縰sing HH.WCS.Mobox3.AnGang.Models;
-using HH.WCS.Mobox3.AnGang.config;
-using System;
+锘縰sing System;
 using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
+using CsvHelper;
+using CsvHelper.Configuration;
+
+using HH.WCS.Mobox3.AnGang.Helper;
 using HH.WCS.Mobox3.AnGang.Helpers;
+using HH.WCS.Mobox3.AnGang.Models;
+using HH.WCS.Mobox3.AnGang.Services;
+
+using Newtonsoft.Json;
+
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.AgvRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.DebugRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.AgvResponse;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.DebugResponse;
+using static HH.WCS.Mobox3.AnGang.Models.DebugModel;
 
 namespace HH.WCS.Mobox3.AnGang.Debug {
     public class DebugService {
         /// <summary>
+        /// 妯℃嫙 AGV 澶氭鍥炴姤浠诲姟鐘舵�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public static ReturnResults AgvSeriesReports(UpdateTaskState model) {
+            var returnResults = new ReturnResults();
+            returnResults.ResultList = new List<ReturnResult>();
+
+            //if (!AgvHelper.IsTaskState(model.NextState)) {
+            //    return returnResults;
+            //}
+
+            var agvCurrentState = 1; // 濡傛灉娌℃湁鎵惧埌鏈�柊鐨�TaskAction锛岄粯璁ゅ綋鍓嶇姸鎬佷负 1(鎵ц)  
+
+            // 鏌ヨ TaskAction 琛ㄤ腑涓庡綋鍓嶄换鍔″彿鍖归厤鐨勬渶鏂拌褰�+            var db = DbHelper.GetDbClient();
+            var taskAction = db.Queryable<TN_Task_Action>()
+                .Where(a => a.S_TASK_CODE == model.TaskID)
+                .OrderBy(a => a.T_CREATE, SqlSugar.OrderByType.Desc).First();
+
+            if (taskAction != null) {
+                // 濡傛灉鏈夊尮閰嶏紝灏嗗綋鍓嶄换鍔$姸鎬佽缃负琛ㄥ崟涓殑鏈�柊鐘舵�
+                agvCurrentState = taskAction.N_ACTION_CODE;
+            }
+
+            if (!AgvHelper.IsNextStateOk(agvCurrentState, model.NextState)) {
+                LogHelper.Info($"Debug: AGV 鐘舵� '{model.NextState}' 涓嶆槸 '{agvCurrentState}' 鐨�鍚堟硶涓嬩竴鐘舵�");
+                return returnResults;
+            }
+
+            var agvTaskState = new AgvTaskState() {
+                task_no = model.TaskID,
+                forklift_no = model.ForkliftNo,
+            };
+
+            var result = new ReturnResult();
+
+            // 褰撳墠鐘舵�娌℃湁杈惧埌鏈�粓鐘舵�鏃讹紝寰幆鍔犲叆杩斿洖鍒楄〃
+            while (agvCurrentState != model.NextState) {
+                agvTaskState.state = agvCurrentState;
+                result = AgvService.OperateAgvTaskStatus(agvTaskState);
+                returnResults.ResultList.Add(result);
+                agvCurrentState = AgvHelper.GetNextState(agvCurrentState);
+            }
+
+            // 灏嗗惊鐜病鏈夊埌杈剧殑鏈�粓鐘舵�锛屼篃鍔犲叆杩斿洖鍒楄〃
+            agvTaskState.state = model.NextState;
+            result = AgvService.OperateAgvTaskStatus(agvTaskState);
+            returnResults.ResultList.Add(result);
+
+            return returnResults;
+        }
+
+        /// <summary>
         /// 鍒濆鏁版嵁搴撳缓绔�         /// </summary>
         /// <returns></returns>
-        public string CreateDatabase() {
+        public static string CreateDatabase(bool cover = true) {
             try {
                 var db = DbHelper.GetDbClient();
 
-                db.CodeFirst.InitTables<TN_CG_Detail>();
-                db.CodeFirst.InitTables<TN_WorkOrder>();
-                db.CodeFirst.InitTables<TN_CAR_IN>();
-                //db.CodeFirst.InitTables<SYSHelper.OI_SYS_MAXID>();
-                db.CodeFirst.InitTables<TN_Task_Action>();
-                db.CodeFirst.InitTables<TN_Task>();
-                db.CodeFirst.InitTables<TN_Location>();
-                db.CodeFirst.InitTables<TN_Loc_Container>();
+                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),
+
+                };
+
+                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($"鍙戠敓浜嗗紓甯�);
@@ -34,6 +125,113 @@
             return "鎴愬姛";
         }
 
+        public static string InsertLocCntrCg() {
+            string filePath = PathHelper.GetProjDir("./debug/loc_cntr_cg.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<LocCntrCg>();
+
+                using (var reader = new StreamReader(filePath))
+                using (var csv = new CsvReader(reader, configuration)) {
+                    // 璇诲彇璁板綍
+                    locCntrCgList = csv.GetRecords<LocCntrCg>().ToList();
+                }
+
+                using (var tran = db.UseTran()) {
+                    foreach (var locCntrCg in locCntrCgList) {
+                        LogHelper.Info("LogCntrCg锛� + JsonConvert.SerializeObject(locCntrCg));
+                        if (string.IsNullOrEmpty(locCntrCg.LocCode)) break;
+
+                        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 ?? ""
+                            };
+
+                            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)) {
+                            LogHelper.Info("瀹瑰櫒鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�);
+                            continue;
+                        }
+
+                        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,
+                                S_CNTR_TYPE = locCntrCg.CntrType ?? ""
+                            };
+
+                            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)) {
+                            LogHelper.Info("鐗╂枡鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�);
+                            continue;
+                        }
+
+                        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 "鎻掑叆鏁版嵁鎴愬姛";
+
+            }
+            catch (FileNotFoundException) {
+                return $"Error: File not found - {filePath}";
+            }
+            catch (Exception ex) {
+                return $"Error reading CSV file: {ex.Message}";
+            }
+        }
     }
 }
diff --git a/Services/ErpService.cs b/Services/ErpService.cs
new file mode 100644
index 0000000..1d6abec
--- /dev/null
+++ b/Services/ErpService.cs
@@ -0,0 +1,40 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using HH.WCS.Mobox3.AnGang.Helpers;
+using HH.WCS.Mobox3.AnGang.Models;
+
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.ErpRequest;
+using static HH.WCS.Mobox3.AnGang.Dtos.Response.ErpResponse;
+
+namespace HH.WCS.Mobox3.AnGang.Services {
+    public class ErpService {
+        public static ErpResult InboundDataSync(InboundDataSyncInfo model) {
+            var db = DbHelper.GetDbClient();
+
+            try {
+
+            }
+            catch (Exception ex) {
+                return BuildErpResult(1, ex.Message);
+            }
+            return BuildErpResult(0, null);
+        }
+
+        public static ErpResult OutboundDataSync(OutboundDataSyncInfo model) {
+            var db = DbHelper.GetDbClient();
+
+            try {
+
+
+            }
+            catch (Exception ex) {
+                return BuildErpResult(1, ex.Message);
+            }
+            return BuildErpResult(1, null);
+        }
+    }
+}
diff --git a/Services/MoboxService.cs b/Services/MoboxService.cs
index cf9255b..297c577 100644
--- a/Services/MoboxService.cs
+++ b/Services/MoboxService.cs
@@ -1,14 +1,16 @@
-锘縰sing HH.WCS.Mobox3.AnGang.AppStart;
-using HH.WCS.Mobox3.AnGang.config;
+锘縰sing System;
+
+using HH.WCS.Mobox3.AnGang.AppStart;
 using HH.WCS.Mobox3.AnGang.Consts;
 using HH.WCS.Mobox3.AnGang.Helper;
 using HH.WCS.Mobox3.AnGang.Helpers;
 using HH.WCS.Mobox3.AnGang.Models;
+
 using Newtonsoft.Json;
-using System;
+
+using static HH.WCS.Mobox3.AnGang.Dtos.Request.ErpRequest;
 using static HH.WCS.Mobox3.AnGang.Dtos.Request.MoboxRequest;
 using static HH.WCS.Mobox3.AnGang.Dtos.Response.MoboxResponse;
-using static HH.WCS.Mobox3.AnGang.Helpers.ResultHelper;
 
 namespace HH.WCS.Mobox3.AnGang.Services {
     public class MoboxService {
@@ -18,7 +20,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static SimpleResult InWarehouse(InWarehouseInfo model) {
+        internal static SimpleResult Inbound(InboundInfo model) {
             LogHelper.Info("瑙﹀彂API锛氫骇鍝佸叆搴�PDA)" + JsonConvert.SerializeObject(model), "API");
             var db = DbHelper.GetDbClient();
             var startLoc = new TN_Location();
@@ -157,7 +159,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static SimpleResult PartOutWarehouse(PartOutWarehouseInfo model) {
+        internal static SimpleResult PartOutbound(PartOutboundInfo model) {
             LogHelper.Info("瑙﹀彂API锛氫骇鍝侀儴鍒嗗嚭搴�WMS)" + JsonConvert.SerializeObject(model), "API");
             var db = DbHelper.GetDbClient();
 
@@ -207,7 +209,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static SimpleResult PartInWarehouse(PartInWarehouseInfo model) {
+        internal static SimpleResult PartInbound(PartInboundInfo model) {
             LogHelper.Info("瑙﹀彂API锛氫骇鍝侀儴鍒嗗洖搴�WMS)" + JsonConvert.SerializeObject(model), "API");
             var db = DbHelper.GetDbClient();
 
@@ -255,7 +257,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static SimpleResult CheckOutWarehouse(CheckOutWarehouseInfo model) {
+        internal static SimpleResult CheckOutbound(CheckOutboundInfo model) {
             LogHelper.Info("瑙﹀彂API锛氱洏鐐圭悊璐у嚭搴�WMS)" + JsonConvert.SerializeObject(model), "API");
             var db = DbHelper.GetDbClient();
 
@@ -303,7 +305,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static SimpleResult CheckInWarehouse(CheckInWarehouseInfo model) {
+        internal static SimpleResult CheckInbound(CheckInboundInfo model) {
             LogHelper.Info("瑙﹀彂API锛氱洏鐐圭悊璐у洖搴�WMS)" + JsonConvert.SerializeObject(model), "API");
             var db = DbHelper.GetDbClient();
 
@@ -344,24 +346,6 @@
             catch (Exception ex) {
                 return BuildSimpleResult(1, $"鍙戠敓浜嗗紓甯革細{ex.Message}");
             }
-        }
-
-        /// <summary>
-        /// 鍏ュ簱鏁版嵁鍚屾(ERP)
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        internal static SimpleResult InWarehouseDataSync(InWarehouseDataSyncInfo model) {
-            return BuildSimpleResult(0, "");
-        }
-
-        /// <summary>
-        /// 鍑哄簱鍙戞枡鍚屾(ERP)
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        internal static SimpleResult OutWarehouseDataSync(OutWarehouseDataSyncInfo model) {
-            return BuildSimpleResult(0, "");
         }
     }
 }
diff --git a/config/config.json b/config/config.json
index 1f43716..536fd88 100644
--- a/config/config.json
+++ b/config/config.json
@@ -1,5 +1,5 @@
 {
-    "WebApiUrl": "http://127.0.0.1:8901/",
+    "WebApiUrl": "http://127.0.0.1:8901",
     "RCSApiUrl": "http://127.0.0.1:6001",
     "NDCApiUrl": "http://127.0.0.1:5201/api/order/",
     "SqlServer": "Data Source=(local);Initial Catalog=AnGangTest;User ID=sa;Password=123456;",
diff --git a/packages.config b/packages.config
index 1a09f90..e06f506 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,7 @@
 锘�?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net462" />
+  <package id="CsvHelper" version="33.0.1" targetFramework="net462" />
   <package id="EasyModbusTCP" version="5.6.0" targetFramework="net461" />
   <package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" />
   <package id="Microsoft.AspNet.WebApi.Core" version="5.3.0" targetFramework="net462" />
@@ -8,6 +9,7 @@
   <package id="Microsoft.AspNet.WebApi.WebHost" version="5.3.0" targetFramework="net462" />
   <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
   <package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net462" />
+  <package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
   <package id="Microsoft.Extensions.Logging.Abstractions" version="3.1.32" targetFramework="net462" />
   <package id="Microsoft.Owin" version="4.2.2" targetFramework="net462" />
   <package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net462" />

--
Gitblit v1.9.1