From ee4b91745630afdc875983794d0ee54a7fb6a4a8 Mon Sep 17 00:00:00 2001 From: pulg <plg@Haninfo> Date: 星期五, 13 六月 2025 17:40:54 +0800 Subject: [PATCH] 1 --- HH.WCS.QingXiNongfu/wms/TaskHelper.cs | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 42 insertions(+), 12 deletions(-) diff --git a/HH.WCS.QingXiNongfu/wms/TaskHelper.cs b/HH.WCS.QingXiNongfu/wms/TaskHelper.cs index cfb02d7..8a74ab1 100644 --- a/HH.WCS.QingXiNongfu/wms/TaskHelper.cs +++ b/HH.WCS.QingXiNongfu/wms/TaskHelper.cs @@ -82,7 +82,7 @@ var db = new SqlHelper<WMSTask>().GetInstance(); return db.Queryable<WMSTask>().Where(a => a.S_TYPE.Trim() == taskType).ToList(); } - internal static bool CreateTask(string no, string from, string to, string taskType, int pri, string cntrInfo, int cntrCount = 1, int startLayer = 1, int endLayer = 1, string note = "", bool lockLoc = false) + internal static bool CreateTask(string no, string from, string to, string taskType, int pri, string cntrInfo, int cntrCount = 1, int startLayer = 1, int endLayer = 1, string note = "", bool lockLoc = false, string TwoEndLoc = "") { var fromLoc = LocationHelper.GetLoc(from); var endLoc = LocationHelper.GetLoc(to); @@ -97,6 +97,17 @@ return false; } } + else if (endLoc.S_AREA_CODE == "YWLWJJB") + { + //鏌ヨ浠诲姟琛� 瑕佹眰鏄彧鑳界敓鎴愪袱涓换鍔�璧风偣搴撳尯涓篩WLWJJB hh_plg 2025骞�鏈�鏃� + List<string> TaskState = new List<string>() { "瀹屾垚", "鍙栨秷" }; + var TaskListNum = LocationHelper.GetList<WMSTask>(x => x.S_END_LAREA == "YWLWJJB" && !TaskState.Contains(x.S_B_STATE)); + if (TaskListNum.Count() >= 2) + { + LogHelper.Info($"CreateTransport- CreateTask Error" + $"缁堢偣搴撳尯涓篩WLWJJB 鍒欐渶澶氬彧鑳界敓鎴愪袱涓换鍔�); + return false; + } + } if (!taskType.Contains("娓呮邯绾哥")) { if (fromLoc == null || endLoc == null) @@ -104,10 +115,13 @@ LogHelper.Info($"CreateTransport- CreateTask Error" + $"璧风偣鎴栫粓鐐硅揣浣嶆暟鎹畁ull"); return false; } - if (fromLoc.S_LOCK_STATE.Trim() != "鏃� || endLoc.S_LOCK_STATE.Trim() != "鏃�) + if (fromLoc.S_AREA_CODE != "YWLWJJB") { - LogHelper.Info($"CreateTransport- CreateTask Error" + $"璧风偣 {fromLoc.S_LOCK_STATE}鎴栫粓鐐箋endLoc.S_LOCK_STATE}鐘舵�涓嶄负 鏃�"); - return false; + if (fromLoc.S_LOCK_STATE.Trim() != "鏃� || endLoc.S_LOCK_STATE.Trim() != "鏃�) + { + LogHelper.Info($"CreateTransport- CreateTask Error" + $"璧风偣 {fromLoc.S_LOCK_STATE}鎴栫粓鐐箋endLoc.S_LOCK_STATE}鐘舵�涓嶄负 鏃�"); + return false; + } } } WMSTask wmsTask = new WMSTask() @@ -122,6 +136,7 @@ S_SRC_NO = no, N_PRIORITY = pri, S_NOTE = note, + S_TWO_END_LOC = TwoEndLoc, S_WORK_MODE = "agv", S_B_STATE = "鏈墽琛�, S_CNTRS = cntrInfo, @@ -218,9 +233,26 @@ task.T_END_TIME = DateTime.Now; db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE, it.T_END_TIME }).ExecuteCommand(); } - if (task.S_END_LOC == "YWLWJJB") + + //plg 2025骞�鏈�3鏃�10:42:24 + if (task.S_END_LAREA == "YWLWJJB" && task.S_START_LAREA != "YWLRGDD") { - var b = TaskProcess.CreateTransport(task.S_SRC_NO, task.S_END_LOC, task.S_NOTE, "鍘熺墿鏂欐惉杩�绾哥", task.S_CNTRS.Split(',').ToList(), task.N_START_LAYER, 1, task.N_CNTR_COUNT, task.N_PRIORITY); + var model = db.Queryable<Location>().Where(a => a.S_LOC_CODE == task.S_TWO_END_LOC).First(); + //鍏堣В閿佺粓鐐�鍦ㄩ攣瀹�+ db.Ado.BeginTran(); + try + { + model.S_LOCK_STATE = "鏃�; + var res = db.Updateable(model).UpdateColumns(it => new { it.S_LOCK_STATE }).ExecuteCommand() > 0; + LogHelper.Info(task.S_TWO_END_LOC + "LockLoc:閿佺粨鏋� + res); + db.Ado.CommitTran(); + } + catch (Exception ex) + { + db.Ado.RollbackTran(); + LogHelper.Info("CreateTask 澶辫触 " + ex.Message); + } + var b = TaskProcess.CreateTransport(task.S_SRC_NO, task.S_END_LOC, task.S_TWO_END_LOC, "鍘熺墿鏂欐惉杩�绾哥", task.S_CNTRS.Split(',').ToList(), task.N_START_LAYER, 1, task.N_CNTR_COUNT, task.N_PRIORITY); } } internal static void Fail(WMSTask task) @@ -269,12 +301,10 @@ LogHelper.Info(wmsTask.S_START_LOC + "LockLoc:閿佺粨鏋� + res); model = db.Queryable<Location>().Where(a => a.S_LOC_CODE == wmsTask.S_END_LOC).First(); - if (wmsTask.S_START_LOC != "YWLWJJB") - { - model.S_LOCK_STATE = "鍏ュ簱閿�; - res = db.Updateable(model).UpdateColumns(it => new { it.S_LOCK_STATE }).ExecuteCommand() > 0; - LogHelper.Info(wmsTask.S_END_LOC + "LockLoc:閿佺粨鏋� + res); - } + model.S_LOCK_STATE = "鍏ュ簱閿�; + res = db.Updateable(model).UpdateColumns(it => new { it.S_LOCK_STATE }).ExecuteCommand() > 0; + LogHelper.Info(wmsTask.S_END_LOC + "LockLoc:閿佺粨鏋� + res); + } db.Insertable(wmsTask).ExecuteCommand(); db.Ado.CommitTran(); -- Gitblit v1.9.1