From 4ae62cd247a0d760a57601fc079e16f8d39e77f4 Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期一, 27 五月 2024 11:16:31 +0800 Subject: [PATCH] 大屏后端 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 134 ++++++++------------------------------------ 1 files changed, 25 insertions(+), 109 deletions(-) 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 c1ad6b1..714b1d9 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" @@ -496,7 +496,8 @@ var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault(); if (station != null) { - if (station.quantity >= 5) + if (station.quantity >= Mes_Work.stackNoRange) + //if (station.quantity >= 5) { Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ WriteLog.Write_Log(name + "鏀炬枡瀹屾垚鍑洪敊", Wheel_SN, "杞﹁疆鏁伴噺宸叉弧锛�", $"鍖哄煙鍙凤細{AreaNr}锛沑n杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛氬尯鍩熷彿杞﹁疆鏁伴噺宸叉弧锛�"); @@ -590,8 +591,6 @@ WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", "杞﹁疆SN鍙蜂负绌�", "", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}涓虹┖"); continue; } - - var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").FirstOrDefault(); if (Work == null) { @@ -600,22 +599,7 @@ WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", Wheel_id, "鏌ヨ鏈哄姞宸ュ伐鍗�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}鏈煡璇㈠埌宸ュ崟淇℃伅\n鍐欏叆妗佹灦淇℃伅锛歕n鏄惁鍏佽涓嬫枡锛歿false}"); continue; } - - #endregion - - - - #region MyRegion - //var currentAreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Are00aNr").First(), client); - //var currentAreaCode = PipelineJob.area_code(name); //鏍规嵁涓嬫枡鍙e崟鍏冨悕鑾峰彇鍖哄煙浠g爜 - //var currentStation = stationinfoRepository.FindFirst(x => x.area == currentAreaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == currentAreaNr.ToString()); - //if (!currentStation.enable || currentStation.location_state == LocationStateEnum.Empty.ToString()) - // client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆 - #endregion - - - var wheel = Pipeline.QueryMateriel(Work.drawingNo); var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo); @@ -640,6 +624,21 @@ } #endregion + #region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏 + foreach (var Stationinfo in Stations) + { + if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100) + { + client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆 + Stationinfo.location_state = LocationStateEnum.Trayswitching.ToString(); + Stationinfo.remark = "鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏"; + stationinfoRepository.Update(Stationinfo, x => new { x.location_state }, true); + } + } + #endregion + + Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); + var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client); @@ -659,7 +658,8 @@ .Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < 5 + && x.quantity < Work.stackNoRange + //&& x.quantity < 5 && x.stationType == Work.drawingNo && x.Number == Work.workOrder && x.heatNumber == Work.heatID) @@ -672,7 +672,8 @@ .Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < 5 + && x.quantity < Work.stackNoRange + //&& x.quantity < 5 && x.stationType == Work.drawingNo && x.Number == Work.workOrder) .OrderByDescending(x => x.quantity) @@ -701,25 +702,14 @@ #endregion #region 鎵樼洏杞﹁疆鍫嗗灈绗洓涓椂涓嬪彂鍙﹀涓�涓倝鍙风殑鍏ュ簱浠诲姟 - if (Stationinfo.quantity + 1 >= 4) + //if (Stationinfo.quantity + 1 >= 4) + if (Stationinfo.quantity + 1 >= Work.stackNoRange - 1) { var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); if (stationinfo != null) agvtask(stationinfoRepository, stationinfo, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); } - #endregion - - #region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏 - if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100) - { - client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆 - Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); - Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; - Stationinfo.remark = "鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏"; - stationinfoRepository.Update(Stationinfo, true); - continue; - } #endregion var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); @@ -812,7 +802,8 @@ dt_stationinfo Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < 5 + && x.quantity < Work.stackNoRange + //&& x.quantity < 5 && x.stationType == Work.drawingNo).FirstOrDefault(); if (Stationinfo == null) @@ -831,17 +822,6 @@ } if (Stationinfo != null) { - #region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏 - //if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) - if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100) - { - Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); - Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; - Stationinfo.remark = "鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏"; - stationinfoRepository.Update(Stationinfo, true); - continue; - } - #endregion var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), Pipeline_client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃� var MaterialSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), Pipeline_client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃� @@ -937,70 +917,6 @@ tasktype = "TaskType_OutsourceInbound"; AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, stationinfo, tasktype, Work); } - - #region MyRegion - /// <summary> - /// AGV浠诲姟 - /// </summary> - //public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype) - //{ - // VOLContext Context = new VOLContext(); - // Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); - // Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context); - - // var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); - // if (task != null) return; - // //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault(); - // //if (mes_Head == null) - // //{ - // // stationinfo.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟澶磋〃锛�"; - // // stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); - // // stationinfoRepository.Update(stationinfo, true); - // // return; - // //} - - // dt_stationinfo TargetLocation = null; - // //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum); - // //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound"; - - // if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area)) - // TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository); - // else if (tasktype == "TaskType_Inbound") - // TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo); - // //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo); - // if (TargetLocation != null) - // { - // dt_agvtask agvtask = new dt_agvtask() - // { - // agv_fromaddress = stationinfo.stationCode, - // agv_id = Guid.NewGuid(), - // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), - // agv_grade = 1, - // agv_createtime = DateTime.Now, - // agv_taskstate = "Create", - // agv_materielid = stationinfo.stationType, - // agv_qty = stationinfo.quantity, - // agv_tasktype = tasktype, - // agv_toaddress = TargetLocation.stationCode, - // agv_userid = "绯荤粺", - // bindSN = stationinfo.bindSN, - // agv_worktype = Convert.ToInt32(Work.processCode), - // agv_materbarcode = Work.materialCode, - // agv_Traytype = stationinfo.tray_type, - // jobID = stationinfo.Number, - // agv_TrayStatus = stationinfo.tray_status - // }; - // agvtaskRepository.Add(agvtask, true); - // stationinfo.location_state = LocationStateEnum.InBusy.ToString(); - // stationinfoRepository.Update(stationinfo, true); - // TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); - // TargetLocation.stationType = agvtask.agv_materielid; - // TargetLocation.heatNumber = stationinfo.heatNumber; - // TargetLocation.Number = agvtask.jobID; - // stationinfoRepository.Update(TargetLocation, true); - // } - //} - #endregion } } -- Gitblit v1.9.3