From de8cd5585ba690902333cf4ce9aa5dbc7eb9acf6 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期三, 28 五月 2025 17:29:33 +0800 Subject: [PATCH] 根据业务重构库区,增加记录表,开始ERP下发反馈逻辑开发 --- api/DebugController.cs | 205 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 178 insertions(+), 27 deletions(-) diff --git a/api/DebugController.cs b/api/DebugController.cs index 2a5c8bd..0a242b0 100644 --- a/api/DebugController.cs +++ b/api/DebugController.cs @@ -3,6 +3,7 @@ using System.Runtime.ConstrainedExecution; using System.Web.Http; +using HH.WCS.Mobox3.DSZSH.core; using HH.WCS.Mobox3.DSZSH.models; using HH.WCS.Mobox3.DSZSH.util; @@ -18,15 +19,45 @@ public class DebugController : ApiController { /// <summary> - /// 妯℃嫙 AGV 澶氭鍥炴姤浠诲姟鐘舵� + /// AGV鐘舵�涓�敭鍥炴姤134562 /// </summary> /// <param name="model">瀹瑰櫒鍙�/param> /// <returns></returns> [HttpPost] - [Route("AgvSeriesReports")] - public ReturnResults AgvSeriesReports(UpdateTaskState model) - { - return new ReturnResults(); + [Route("AGVSeriesReports")] + public ReturnResults AGVSeriesReports(UpdateTaskState model) { + var agvTaskState = new AgvTaskState() { + task_no = model.TaskID, + forklift_no = model.ForkliftNo, + state = 1 + }; + ReturnResults returnResult = new ReturnResults(); + returnResult.ResultList = new List<ReturnResult>(); + + var temp1 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp1); + + agvTaskState.state = 3; + var temp3 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp3); + + agvTaskState.state = 4; + var temp4 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp4); + + agvTaskState.state = 5; + var temp5 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp5); + + agvTaskState.state = 6; + var temp6 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp6); + + agvTaskState.state = 2; + var temp2 = WCSCore.OperateAgvTaskStatus(agvTaskState); + returnResult.ResultList.Add(temp2); + + return returnResult; } /// <summary> @@ -35,9 +66,11 @@ /// <returns></returns> [HttpPost] [Route("CreateDatabase")] - public string CreateDatabase(CoverInfo model) { - var cover = model.IsCover; + public string CreateDatabase(FalseOk model) { try { + if (model.JumpOut) { + return "璺冲嚭"; + } var db = new SqlHelper<object>().GetInstance(); var entityTypes = new Type[] { @@ -51,41 +84,92 @@ //typeof(SysHelper.OI_SYS_MAXID), //typeof(TN_Inbound_Order), - typeof(TN_Check_Detail), + //typeof(TN_Check_Detail), //typeof(TN_Check_Order), //typeof(TN_CNTR_ITEM), //typeof(TN_Outbound_Detail), //typeof(TN_Outbound_Order), //typeof(TN_Shift_Order), //typeof(TN_Shift_Detail) + + //typeof(TN_Container_Item), }; - 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 areaNameList = new List<string>(); + //foreach (var area in Settings.Areas) { + // areaNameList.AddRange(area.Codes); + //} - // 鍒涘缓鏂拌〃 - db.CodeFirst.InitTables(entityTypes); + //var locationList = new List<TN_Location>(); + //foreach (var area in areaNameList) { + // int i = 0; + // int j = 0; + // int k = 0; - //db.CodeFirst.BackupTable().InitTables(entityTypes); - } - else { - db.CodeFirst.InitTables(entityTypes); - } + // if (area == "KXHJQ" || area == "MTHJQ" || area == "MXHJQ") { + // for (i = 1; i <= 4; i++) { + // for (j = 1; j <= 5; j++) { + // for (k = 1; k <= 3; k++) { + // locationList.Add(new TN_Location() { + // N_ROW = i, + // N_COL = j, + // N_LAYER = k, + // S_AREA_CODE = area, + // S_CODE = $"{area}-{i.ToString().PadLeft(2, '0')}-{j.ToString().PadLeft(2, '0')}" + + // $"-{k.ToString().PadLeft(2, '0')}" + // }); + // } + // } + // } + // continue; + // } - tran.CommitTran(); - } + // if (area == "BZQ") { + // for (i = 1; i <= 2; i++) { + // for (j = 1; j <= 2; j++) { + // locationList.Add(new TN_Location() { + // N_ROW = i, + // N_COL = j, + // S_AREA_CODE = area, + // S_CODE = $"{area}-{i.ToString().PadLeft(2, '0')}-{j.ToString().PadLeft(2, '0')}" + // }); + // } + // } + // continue; + // } + + // i = 1; + // for (j = 1; j <= 5; j++) { + // locationList.Add(new TN_Location() { + // N_ROW = i, + // N_COL = j, + // S_AREA_CODE = area, + // S_CODE = $"{area}-{i.ToString().PadLeft(2, '0')}-{j.ToString().PadLeft(2, '0')}" + // }); + // } + + + //} + + + + //using (var tran = db.Ado.UseTran()) { + // //db.CodeFirst.InitTables(entityTypes); + // if (db.Insertable<TN_Location>(locationList).ExecuteCommand() <= 0) { + // tran.RollbackTran(); + // return "澶辫触"; + // } + + // tran.CommitTran(); + + + //} } catch (Exception ex) { LogHelper.Info($"鍙戠敓浜嗗紓甯�); return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message; } - return "鎴愬姛"; } @@ -172,6 +256,68 @@ return $"Error reading CSV file: {ex.Message}"; } } + + /// <summary> + /// DEBUG锛氭牴鎹鍣ㄧ墿鏂欎俊鎭〃锛屾彃鍏ュ鍣ㄧ墿鏂欑櫥璁颁俊鎭〃 + /// </summary> + /// <returns></returns> + [HttpPost] + [Route("InsertContainerItemByCgDetail")] + public string InsertContainerItemByCgDetail(FalseOk _) { + var db = new SqlHelper<object>().GetInstance(); + try { + var cgDetailList = db.Queryable<TN_CG_Detail>().ToList(); + var cntrItemList = new List<TN_Container_Item>(); + foreach (var cgDetail in cgDetailList) { + if (db.Queryable<TN_Container_Item>().Where(i => i.S_CNTR_CODE == cgDetail.S_CNTR_CODE).Any()) { + continue; + } + + cntrItemList.Add(new TN_Container_Item { + S_CNTR_CODE = cgDetail.S_CNTR_CODE, + S_ITEM_CODE = cgDetail.S_ITEM_CODE, + }); + } + + if (db.Insertable<TN_Container_Item>(cntrItemList).ExecuteCommand() <= 0) { + return "鎻掑叆澶辫触"; + } + + return "鎻掑叆鎴愬姛"; + } + catch (Exception ex) { + + LogHelper.InfoEx(ex); + return ex.Message; + } + } + + /// <summary> + /// DEBUG锛氭牴鎹鍣ㄧ墿鏂欎俊鎭〃锛屾彃鍏ュ鍣ㄧ墿鏂欑櫥璁颁俊鎭〃 + /// </summary> + /// <returns></returns> + [HttpPost] + [Route("InsertContainerItem")] + public string InsertContainerItem(InsertCntrItemInfo cgDetail) { + var db = new SqlHelper<object>().GetInstance(); + try { + var cntrItem = new TN_Container_Item { + S_CNTR_CODE = cgDetail.Cntr, + S_ITEM_CODE = cgDetail.Item, + }; + + if (db.Insertable<TN_Container_Item>(cntrItem).ExecuteCommand() <= 0) { + return "鎻掑叆澶辫触"; + } + + return "鎻掑叆鎴愬姛"; + } + catch (Exception ex) { + + LogHelper.InfoEx(ex); + return ex.Message; + } + } } /// <summary> @@ -192,8 +338,13 @@ public int NextState { set; get; } } - public class CoverInfo { - public bool IsCover { set; get; } = false; + public class FalseOk { + public bool JumpOut { set; get; } = true; + } + + public class InsertCntrItemInfo { + public string Cntr { set; get; } + public string Item { set; get; } } /// <summary> -- Gitblit v1.9.1