From c862dd0756111a4264666f7e7636a5a062cce806 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期五, 19 四月 2024 09:11:56 +0800 Subject: [PATCH] 修改MES接口,优化托盘更换逻辑 --- 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs | 21 ++++ 代码管理/PCS/WCS_Client/src/api/http.js | 2 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs | 2 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs | 16 +++ 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 8 + 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs | 57 ++++++---- 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs | 10 + 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs | 7 + 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs | 5 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs | 37 ++++++ 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs | 7 代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs | 10 + 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs | 10 + 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs | 2 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | 1 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs | 13 + 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs | 55 ++++++++-- 代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json | 2 18 files changed, 205 insertions(+), 60 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" index 8ecd457..f6b7a14 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" @@ -12,7 +12,7 @@ let loadingInstance; let loadingStatus = false; if (process.env.NODE_ENV == 'development') { - axios.defaults.baseURL = 'http://127.0.0.1:8099/'; + axios.defaults.baseURL = 'http://192.168.12.101:8099/'; } else if (process.env.NODE_ENV == 'debug') { axios.defaults.baseURL = 'http://192.168.12.101:8099/'; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" index 3d36761..fda9f56 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" @@ -138,11 +138,19 @@ [Editable(true)] public string area { get; set; } /// <summary> - /// 宸ヤ綔浠ゅ彿 + /// 宸ュ崟缂栧彿 /// </summary> [Display(Name = "宸ュ崟缂栧彿")] [Column(TypeName = "nvarchar(40)")] [Editable(true)] public string jobID { get; set; } + + /// <summary> + /// 宸ヤ綔浠ゅ彿 + /// </summary> + [Display(Name = "宸ヤ綔浠ゅ彿")] + [Column(TypeName = "nvarchar(40)")] + [Editable(true)] + public string workOrder { get; set; } } } \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" index db7878e..3efdf48 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" @@ -832,8 +832,14 @@ #region 瑙﹀彂NG浠诲姟 var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); if (NG != null) - agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); + { + agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); + continue; + } + #endregion + + Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); } if (Stationinfo != null) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" index 90d8e64..4a65288 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" @@ -23,6 +23,7 @@ try { ExecuteJob(context, DoAction); + } catch { } return Task.CompletedTask; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" index a7325f0..3f299ad 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" @@ -264,32 +264,41 @@ continue; } - var EmptyStation = GetStation.EmptyPalletStation(area); + + #region 绌烘墭鍙犵洏 + var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); + var EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault(); + if (EmptyStation == null) + EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault(); + #endregion + + if (EmptyStation == null)//鏌ユ壘搴撳唴绌烘墭鐩� + EmptyStation = GetStation.EmptyPalletStation(area); #region 鏌ユ壘搴撳尯涓�绌烘墭鐩樼┖璐т綅 - // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.location_state != LocationStateEnum.Busy.ToString() && x.enable) - //.OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鏌ユ壘娌℃湁浠诲姟鐨勭┖鎵樼洏璐т綅 + // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.location_state != LocationStateEnum.Busy.ToString() && x.enable) + //.OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鏌ユ壘娌℃湁浠诲姟鐨勭┖鎵樼洏璐т綅 - // if (EmptyStation != null) - // { - // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.location_state.Contains("Busy")).Any()) - // { - // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.column != EmptyStation.column && x.location_state != LocationStateEnum.Busy.ToString() && x.enable).OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鎺掗櫎褰撳垪瀛樺湪浠诲姟鐨勮揣浣� - // } - // if (EmptyStation != null && EmptyStation.line == 2)//濡傛灉浠诲姟瀛樺湪绗簩琛�,鎺掓煡绗竴琛屾槸鍚︽湁璐� - // { - // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.line == 1 && x.location_state != LocationStateEnum.Empty.ToString()).Any()) EmptyStation = null; - // } - // } + // if (EmptyStation != null) + // { + // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.location_state.Contains("Busy")).Any()) + // { + // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.column != EmptyStation.column && x.location_state != LocationStateEnum.Busy.ToString() && x.enable).OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鎺掗櫎褰撳垪瀛樺湪浠诲姟鐨勮揣浣� + // } + // if (EmptyStation != null && EmptyStation.line == 2)//濡傛灉浠诲姟瀛樺湪绗簩琛�,鎺掓煡绗竴琛屾槸鍚︽湁璐� + // { + // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.line == 1 && x.location_state != LocationStateEnum.Empty.ToString()).Any()) EmptyStation = null; + // } + // } - // if (EmptyStation == null) - // { - // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Busy.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鏈�鍚庝竴涓揣浣嶆湁浠诲姟鍒欎笉鑳界敓鎴愬叆搴撲换鍔� - // if (EmptyStation != null) continue; - // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鎵炬渶澶栭潰娌″爢婊�5涓殑璐т綅 - // if (EmptyStation == null) - // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); - // } + // if (EmptyStation == null) + // { + // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Busy.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鏈�鍚庝竴涓揣浣嶆湁浠诲姟鍒欎笉鑳界敓鎴愬叆搴撲换鍔� + // if (EmptyStation != null) continue; + // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鎵炬渶澶栭潰娌″爢婊�5涓殑璐т綅 + // if (EmptyStation == null) + // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); + // } #endregion @@ -364,7 +373,7 @@ if (Station.location_state == LocationStateEnum.Stroge.ToString() && PalletSignal != 1) { Station.location_state = LocationStateEnum.Abnormal.ToString(); - Station.remark = "璐т綅鏈夎揣锛屽厜鐢垫娴嬫棤鎵樼洏"; + Station.remark = "鍏夌數妫�娴嬫棤鎵樼洏"; stationinfoRepository.Update(Station, true); client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS"); @@ -373,7 +382,7 @@ if (Station.location_state == LocationStateEnum.Empty.ToString() && (PalletSignal == 1 || MaterialSignal == 1))//绯荤粺璐т綅涓虹┖锛屽厜鐢垫娴嬫湁鏂� { Station.location_state = LocationStateEnum.Abnormal.ToString(); - Station.remark = "璐т綅鏃犺揣锛屽厜鐢垫娴嬫湁鏂�"; + Station.remark = "鍏夌數妫�娴嬫湁鏂�"; stationinfoRepository.Update(Station, true); client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ WriteDBLog.Error(name + "鎶ヨ", $"璐т綅缂栧彿锛歿Station.stationCode}锛涢敊璇俊鎭細{Station.remark}", "PCS"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" index 7a22c19..2a341b7 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" @@ -12,11 +12,34 @@ using WIDESEA_WCS.WCSClient; using WIDESEA_WMS.IRepositories; using WIDESEA_WMS.Repositories; +using static System.Collections.Specialized.BitVector32; namespace WIDESEA_WCS.JobsPart.Common { public class GetStation { + /// <summary> + /// 鎵惧彲鍏ュ簱绌烘墭浣� + /// </summary> + public static void EmptyStation() + { + try + { + VOLContext Context = new VOLContext(); + Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); + Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); + var Stations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList(); + foreach (var Station in Stations) + { + var area = Station.tray_type == "SmallTray" ? "11" : "10"; + } + } + catch (Exception ex) + { + + } + } + /// <summary> /// 鑾峰彇绌烘墭鐩樿揣浣� /// </summary> @@ -42,14 +65,18 @@ EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005001"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); if (EmptyStation != null) EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); - if (EmptyStation != null) - if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; + if (EmptyStation != null)//绌烘墭璐т綅涓嶄负绌哄垽鏂槸鍚﹀瓨鍦ㄥ叾浠栦换鍔� + if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; + //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; } #endregion + + #region 鏌ユ壘绌烘墭搴撳尯 if (EmptyStation == null) EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderBy(x => x.column).FirstOrDefault(); if (EmptyStation != null) - if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; + if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; + //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; if (EmptyStation != null) { var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃� @@ -65,6 +92,8 @@ WriteDBLog.Success("鏇存柊绌虹洏闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS"); } } + #endregion + } catch (Exception ex) { @@ -110,7 +139,7 @@ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); #region 鏌ユ壘绌烘墭鐩樺簱鍖� - if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) + if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any() && area != "10") { var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005001" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault(); if (EmptyStation != null) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" index 4f2348c..b1b9430 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" @@ -105,7 +105,7 @@ agv_toaddress = "", agv_userid = "绯荤粺", bindSN = stationinfo.bindSN, - jobID = Mes_Work.jobID, + jobID = Mes_Work.workOrder, agv_worktype = Convert.ToInt32(Mes_Work.processCode), agv_materbarcode = Mes_Work.materialCode, agv_Traytype = stationinfo.tray_type, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" index b3837d0..a89959d 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" @@ -57,9 +57,10 @@ VOLContext context = new VOLContext(); Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); - var stations = stationinfoRepository.Find(x => x.stationCode.Contains("X") && x.location_state == "Abnormal" /*LocationStateEnum.Abnormal.ToString()*/ && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray")).ToList(); + var stations = stationinfoRepository.Find(x => (x.stationCode.Contains("X")|| x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")) && x.location_state == "Abnormal" /*LocationStateEnum.Abnormal.ToString()*/ && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray") && x.enable).ToList(); foreach (var station in stations) { + if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue; var types = station.tray_type.Split('/'); var area = types[0] == "SmallTray" ? "11" : "10"; //鎵�1搴撳尯鐨勭┖鎵樹綅 @@ -93,6 +94,8 @@ agv_Traytype = types[0] }; agvtaskRepository.Add(agvtask, true); + station.location_state = LocationStateEnum.Busy.ToString(); + stationinfoRepository.Update(EmptyStation, true); EmptyStation.location_state = LocationStateEnum.Busy.ToString(); stationinfoRepository.Update(EmptyStation, true); WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" index 863e064..63ce234 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" @@ -43,7 +43,7 @@ if (task.agv_tasknum.Contains("_")) { string mainTaskNum = task.agv_tasknum.Split('_')[0]; - if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && (task.agv_taskstate == "Executing1" || task.agv_taskstate == "Complete1")).Any()) + if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && task.agv_taskstate != "Executing" && task.agv_taskstate != "Create").Any() || !agvtaskService.Find(x => x.agv_tasknum == mainTaskNum).Any()) GetStation.EmptyPalletStation(task); } else diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" index abb0244..45889b7 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" @@ -393,7 +393,21 @@ } return TargetLocation; } - + /// <summary> + /// 涓存椂浣跨敤 + /// </summary> + /// <param name="stationinfoRepository"></param> + /// <returns></returns> + public static dt_stationinfo GetEmptyLocation1(Idt_stationinfoRepository stationinfoRepository) + { + return stationinfoRepository.Find(x => x.line == 1 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "3").OrderBy(x => x.column).FirstOrDefault();//琛屽拰鍖哄煙闇�鍐欐 + } + /// <summary> + /// 鍘诲鍗� + /// </summary> + /// <param name="stationinfoRepository"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository) { dt_stationinfo TargetLocation = null; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" index 7899d68..2acacfb 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" @@ -16,7 +16,7 @@ "Connection": { "DBType": "MsSql", //MySql/MsSql/PgSql //鏁版嵁搴撶被鍨嬶紝濡傛灉浣跨敤鐨勬槸sqlserver姝ゅ搴旇缃负MsSql //sqlserver杩炴帴瀛楃涓睵@ssw0rd - "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;", + "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;", //mysql杩炴帴瀛楃涓�(鍗囩骇EFCore3.1鍒版椂宸插皢mysql杩炴帴瀛楃涓蹭慨鏀�,2019-12-20) // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;", diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs" index f47ad93..d7bfa9b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs" @@ -13,8 +13,27 @@ { public class detail { + /// <summary> + /// 杞﹁疆SN鍙� + /// </summary> + public string sn { get; set; } + /// <summary> + /// 宸ュ崟鍙� + /// </summary> + public string jobID { get; set; } + /// <summary> + /// 宸ュ崟绫诲瀷 (17-鏈哄姞宸� 28-妫�娴嬬嚎) + /// </summary> + public string processCode { get; set; } + } + + public class detail1 + { + /// <summary> + /// 杞﹁疆SN鍙� + /// </summary> public string sn { get; set; } } } - + } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs" index bce45cc..0e04c06 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs" @@ -11,11 +11,11 @@ /// <summary> /// 宸ュ崟缂栧彿 /// </summary> - public string JobID { get; set; } + public string WorkOrder { get; set; } /// <summary> /// 17-鏈哄姞宸� 28-妫�娴嬬嚎 /// </summary> - public string processCode { get; set; } + //public string processCode { get; set; } /// <summary> /// 杞﹁疆淇℃伅 @@ -42,5 +42,11 @@ /// </summary> public int? layerNo { get; set; } + /// <summary> + /// 鎿嶄綔鑰� + /// </summary> + public string Operator { get; set; } + + } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs" index 018e7ce..094418b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs" @@ -14,7 +14,7 @@ /// <summary> /// 杞﹁疆SN /// </summary> - public List<detail> details { get; set; } + public List<detail1> details { get; set; } /// <summary> /// 婧愬簱鎴垮悕绉� @@ -55,5 +55,10 @@ /// 鐩爣灞傚彿 /// </summary> public string toLayerNo { get; set;} + + /// <summary> + /// 鎿嶄綔鑰� + /// </summary> + public string Operator { get; set; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" index 3c3ca11..350879b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" @@ -136,11 +136,19 @@ [Editable(true)] public string area { get; set; } /// <summary> - /// 宸ュ崟缂栧彿/宸ヤ綔浠ゅ彿 + /// 宸ュ崟缂栧彿 /// </summary> [Display(Name = "宸ュ崟缂栧彿")] [Column(TypeName = "nvarchar(40)")] [Editable(true)] public string jobID { get; set; } + + /// <summary> + /// 宸ヤ綔浠ゅ彿 + /// </summary> + [Display(Name = "宸ヤ綔浠ゅ彿")] + [Column(TypeName = "nvarchar(40)")] + [Editable(true)] + public string workOrder { get; set; } } } \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" index d2a3af3..671fc19 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" @@ -116,7 +116,8 @@ Operator = "admin", stationCode = task.agv_toaddress, area = station.area, - jobID = mes_Work.workOrder, + jobID = mes_Work.jobID, + workOrder = mes_Work.workOrder, ID = Guid.NewGuid() }; inventorys.Add(inventory); @@ -171,7 +172,7 @@ ////绌烘墭浠诲姟闇�淇敼閫昏緫 if (station2.stationCode.Contains("X")) station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty; - else if (station2.area == "10" || station2.area == "11" || (station2.stationCode.Contains("C") && task.agv_tasktype == "TaskType_EmptyPallet")) //鍏ュ簱绌烘墭浠诲姟 + else if (station2.area == "10" || station2.area == "11" || (station2.stationCode.Contains("C") && task.agv_tasktype == "TaskType_EmptyPallet") || station2.stationCode.Contains("DD")) //鍏ュ簱绌烘墭浠诲姟 station2.quantity = station2.quantity + task.agv_qty; else station2.quantity = task.agv_qty; @@ -198,8 +199,12 @@ //else // station1.quantity = 0; #endregion - - if (station1.area == "10" || station1.area == "11" || (station1.stationCode.Contains("C") && task.agv_tasktype == "TaskType_EmptyPallet")) //鍑哄簱绌烘墭浠诲姟 + if (station1.stationCode.Contains("DD"))//鍙犵洏搴撲綅 + { + station1.quantity = station1.quantity - task.agv_qty; + station1.location_state = LocationStateEnum.Stroge.ToString(); + } + else if (station1.area == "10" || station1.area == "11" || (station1.stationCode.Contains("C") && task.agv_tasktype == "TaskType_EmptyPallet")) //鍑哄簱绌烘墭浠诲姟 { station1.location_state = LocationStateEnum.Stroge.ToString(); station1.quantity = station1.quantity - 1; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" index fc4e4b0..dddca41 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" @@ -1,13 +1,17 @@ 锘縰sing Confluent.Kafka; using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; +using OfficeOpenXml.FormulaParsing.Excel.Operators; using WIDESEA_Comm.LogInfo; using WIDESEA_Comm.MES_Info; using WIDESEA_Comm.MES_Info.Request; using WIDESEA_Common; +using WIDESEA_Core.EFDbContext; using WIDESEA_Core.FreeDB; using WIDESEA_Entity.DomainModels; using WIDESEA_Entity.ToAGV; +using WIDESEA_WMS.IRepositories; +using WIDESEA_WMS.Repositories; using static WIDESEA_Comm.MES_Info.BasicSN; namespace WIDESEA_WMS.Common.AGVTask @@ -34,24 +38,45 @@ { throw new Exception("鏃犱换鍔℃暟鎹�"); } - + VOLContext context = new VOLContext(); + IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() /*|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceOutbound.ToString()*/|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString()) { - foreach (var item in task.bindSN.Split(",")) + if(task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString()) { - detail detail = new detail(); - detail.sn = item; - list.Add(detail); + foreach (var item in task.bindSN.Split(",")) + { + var work = workinfoRepository.Find(x => x.SN == item && x.processCode == task.agv_worktype.ToString()).FirstOrDefault(); + detail detail = new detail(); + detail.sn = item; + detail.jobID = work.jobID; + detail.processCode = work.processCode; + list.Add(detail); + } } + else + { + foreach (var item in task.bindSN.Split(",")) + { + //var work = workinfoRepository.Find(x => x.SN == item && x.processCode == "28").FirstOrDefault(); + detail detail = new detail(); + detail.sn = item; + detail.jobID = task.jobID; + detail.processCode = task.agv_worktype.ToString(); + list.Add(detail); + } + } + agvInWarehousePara outWarehousePara = new agvInWarehousePara() { - JobID = task.jobID, + WorkOrder = task.jobID, zoneID = task.agv_fromaddress, - processCode = task.agv_worktype.ToString(), + //processCode = task.agv_worktype.ToString(), details = list, layerNo = 1, stackID = "1", warehouseName = "Agv搴�", + Operator="AGV鑷姩", }; obj = outWarehousePara; ActionName = "agvOutWarehouse";//AGV->MES杞﹁疆鍑哄簱 @@ -61,19 +86,23 @@ { foreach (var item in task.bindSN.Split(",")) { + var work = workinfoRepository.Find(x => x.SN == item && x.processCode == task.agv_worktype.ToString()).FirstOrDefault(); detail detail = new detail(); detail.sn = item; + detail.jobID = work.jobID; + detail.processCode = work.processCode; list.Add(detail); } agvInWarehousePara inWarehousePara = new agvInWarehousePara() { - JobID = task.jobID, + WorkOrder = task.jobID, zoneID = task.agv_toaddress, - processCode = task.agv_worktype.ToString(), + //processCode = task.agv_worktype.ToString(), details = list, layerNo = 1, stackID = "1", warehouseName = "Agv搴�", + Operator = "AGV鑷姩", }; obj = inWarehousePara; ActionName = "agvInWarehouse";//AGV->MES杞﹁疆鍏ュ簱 @@ -82,23 +111,25 @@ //else if (task.agv_tasktype == "Transfer") //绉诲簱鍖哄垎 搴撳唴绉诲簱 else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Carry.ToString()) //绉诲簱鍖哄垎 搴撳唴绉诲簱 { + List<detail1> list1 = new List<detail1>(); //杞﹁疆淇℃伅 foreach (var item in task.bindSN.Split(",")) { - detail detail = new detail(); + detail1 detail = new detail1(); detail.sn = item; - list.Add(detail); + list1.Add(detail); } agvMoveWarehousePara moveWarehousePara = new agvMoveWarehousePara() { fromZoneID = task.agv_fromaddress, toZoneID = task.agv_toaddress, - details = list, + details = list1, fromLayerNo = "1", fromStackID = "1", fromWarehouseName = "Agv搴�", toLayerNo = "1", toStackID = "1", toWarehouseName = "Agv搴�", + Operator = "AGV鑷姩", }; obj = moveWarehousePara; ActionName = "agvMoveWarehouse";//AGV->MES杞﹁疆绉诲簱 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" index ac501a2..abe942d 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" @@ -146,7 +146,8 @@ station.heatNumber = string.Empty; station.Number = string.Empty; } - station.tray_status = list.Count == 0 ? "EmptyTray" : "StrogeTray"; + station.tray_status = string.IsNullOrEmpty(station.stationType) ? "EmptyTray" : "StrogeTray"; + //station.tray_status = list.Count == 0 ? "EmptyTray" : "StrogeTray"; if (station.location_state == "Empty") { station.stationType = string.Empty; @@ -156,8 +157,8 @@ station.tray_status = string.Empty; station.bindSN = string.Empty; station.quantity = 0; - if (!station.stationCode.Contains("S") && !station.stationCode.Contains("X") && !station.stationCode.Contains("W01001004") && !station.stationCode.Contains("W01001005")) - station.tray_type = string.Empty; + //if (!station.stationCode.Contains("S") && !station.stationCode.Contains("X") && !station.stationCode.Contains("W01001004") && !station.stationCode.Contains("W01001005")) + // station.tray_type = string.Empty; } var count = _repository.Update(station, true); if (count > 0) -- Gitblit v1.9.3