代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob_a.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/OutboundTask_a.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/RestockHCJ_a.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
代码管理/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/VV_DispatchService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.Xml; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; @@ -407,7 +408,7 @@ WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ä¸ºç©º", "PCS"); continue; } //var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString(); var Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_SN); @@ -418,7 +419,7 @@ #endregion continue; } var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID); var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID && x.processCode == "17"); if (Head == null) { #region æ¥å¿è®°å½ @@ -600,23 +601,34 @@ if (Stationinfo == null) { #region 䏿使¡ä»¶ä¸å¹é ç´æ¥è§¦åå ¥åºä»»å¡ var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); foreach (var stationinfo in stationinfos) //var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); //foreach (var stationinfo in stationinfos) //{ // agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå 䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); //} #endregion #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, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå 䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); if (NG.stationType != mes_Head.drawingNo) agvtask(stationinfoRepository, NG, (wheel == null ? wheel1.e : wheel.e), "TaskType_OutsourceInbound"); } #endregion Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); #region 没æçå¯ç¨,触åå ¥åºä»»å¡ //if (Stationinfo == null) //{ // var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); // foreach (var stationinfo in stationinfos) // { // agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå 䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); // } //} if (Stationinfo == null) { var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); foreach (var stationinfo in stationinfos) { agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå 䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); } } #endregion #region MyRegion @@ -695,29 +707,31 @@ else if ((Int16)PartStatus == 2) { dt_stationinfo Stationinfo = null; if (mes_Detail.heatID != null) { Stationinfo = Stations .Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5 && x.stationType == mes_Head.drawingNo && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") && x.Number == mes_Detail.jobID && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); } else { Stationinfo = Stations .Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5 && x.stationType == mes_Head.drawingNo && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") && x.Number == mes_Detail.jobID).FirstOrDefault(); } //if (mes_Detail.heatID != null) //{ // Stationinfo = Stations //.Where(x => x.enable //&& x.stationCode == NGStation //&& x.location_state == LocationStateEnum.Stroge.ToString() //&& x.quantity < 5 //&& x.stationType == mes_Head.drawingNo //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") //&& x.Number == mes_Detail.jobID //&& x.heatNumber == mes_Detail.heatID).FirstOrDefault(); //} //else //{ //var tray_type = "SmallTray"; //if ((wheel == null ? wheel1.e : wheel.e) > 1100) tray_type = "LargeTray"; Stationinfo = Stations .Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5 && x.stationType == mes_Head.drawingNo && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault(); //} if (Stationinfo == null) { @@ -864,10 +878,19 @@ var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); if (task != null) return; var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == stationinfo.Number); var mes_Head = mes_HeadRepository.Find(x => x.jobID == stationinfo.Number).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") TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository); else if (tasktype == "TaskType_Inbound") @@ -895,7 +918,7 @@ agv_TrayStatus = stationinfo.tray_status }; agvtaskRepository.Add(agvtask, true); stationinfo.location_state = LocationStateEnum.Busy.ToString(); stationinfo.location_state = LocationStateEnum.InBusy.ToString(); stationinfoRepository.Update(stationinfo, true); TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); TargetLocation.stationType = agvtask.agv_materielid; ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs
@@ -36,7 +36,8 @@ //EmptyTrayTask.InEmptyTrayTask();åºå 空æä»»å¡ StationTask.CreateTask(); OutboundTask.CreateOutboundTask(); //OutboundTask.CreateOutboundTask(); OutboundTask_a.CreateOutboundTask(); ReplaceTray.ReplaceTrayTask(); RestockHCJ.HCJGetBarcode(); EmptyTrayTask.CreateEmptyTrayTask(); ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob_a.cs
ÎļþÒÑɾ³ý ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs
@@ -43,7 +43,7 @@ var area = task.agv_Traytype == "SmallTray" ? "11" : "10"; //æ¾1åºåºç空æä½ var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.location_state == "Stroge"/*LocationStateEnum.Stroge.ToString()*/ && x.enable) .OrderBy(x => x.line).OrderByDescending(x => x.column).FirstOrDefault(); .OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault(); #region ä¸ä¸ªåºååªè½æä¸ä¸ªç©ºæä»»å¡ //bool ok = false; @@ -55,6 +55,7 @@ #endregion if (EmptyStation == null) EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); if (EmptyStation == null) continue; #region åºå åå¨ä»»å¡å ç¨ if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) continue; ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs
@@ -79,36 +79,6 @@ //todo 寻æ¾å¯æ¾è´§å¤åæ¾è´§å° tasktype = "TaskType_OutsourceInbound"; TargetLocation = GetEmptyLocation(stationinfoRepository); #region MyRegion //if (TargetLocation != null) //{ // dt_agvtask agvtask = new dt_agvtask() // { // agv_fromaddress = item.stationCode, // agv_id = Guid.NewGuid(), // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), // agv_grade = 1, // agv_createtime = DateTime.Now, // agv_taskstate = "Create", // agv_materielid = item.stationType, // agv_qty = item.quantity, // agv_tasktype = "TaskType_OutsourceInbound", // agv_toaddress = TargetLocation.stationCode, // agv_userid = "ç³»ç»", // bindSN = item.bindSN, // agv_worktype = Convert.ToInt32(mesinfo.processCode), // agv_materbarcode = mesinfo.materialCode, // agv_Traytype = item.tray_type, // jobID = item.Number, // agv_TrayStatus = item.tray_status // }; // agvtaskRepository.Add(agvtask, true); // TargetLocation.location_state = LocationStateEnum.Busy.ToString(); // TargetLocation.stationType = agvtask.agv_materielid; // stationinfoRepository.Update(TargetLocation, true); //} #endregion } else ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/OutboundTask_a.cs
@@ -17,7 +17,7 @@ using static FreeSql.Internal.GlobalFilter; using static System.Collections.Specialized.BitVector32; namespace WIDESEA_WCS.JobsPart.Common.æ°æä»¶å¤¹ namespace WIDESEA_WCS.JobsPart.Common { public class OutboundTask_a { @@ -35,7 +35,7 @@ Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context); Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList(); var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList(); foreach (var mes_head in mes_heads) { #region æ ¹æ®å·¥ååè¡¨æ¥æ¾åºå @@ -48,9 +48,12 @@ var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); if (Station != null) { var stationinfos = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.quantity > 0 && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).ToList(); foreach (var stationinfo in stationinfos) var stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault(); if (stationinfo != null) { if (stationinfo.location_state == LocationStateEnum.OutBusy.ToString() || stationinfo.location_state != LocationStateEnum.Stroge.ToString()) continue; if (string.IsNullOrEmpty(stationinfo.bindSN)) { stationinfo.remark = "车轮SNå·ä¿¡æ¯å¼å¸¸"; @@ -68,75 +71,73 @@ } #region è´§ä½è½¦è½®å ¨é¨å å«å¨å·¥åå åä¸åä»»å¡ bool OK = false; //bool OK = false; foreach (var SN in lists) { OK = mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any(); } if (OK) { 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 = "Queue", agv_materielid = stationinfo.stationType, agv_qty = stationinfo.quantity, agv_tasktype = "TaskType_Outbound", agv_toaddress = "", agv_userid = "ç³»ç»", bindSN = stationinfo.bindSN, jobID = mes_head.jobID, agv_worktype = Convert.ToInt32(mes_head.processCode), agv_materbarcode = mes_head.materialCode, agv_Traytype = stationinfo.tray_type, agv_TrayStatus = stationinfo.tray_status }; stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); stationinfoRepository.Update(stationinfo, true); agvtaskRepository.Add(agvtask, true); WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); continue; } #endregion if (!mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN.Contains(SN)).Any()) return; #region è´§ä½è½¦è½®æä¸ä¸ªå å«å¨å·¥åå åä¸åä»»å¡ //foreach (var SN in lists) //{ // if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) // { // dt_agvtask agvtask = new dt_agvtask() // { // agv_fromaddress = stationinfo.stationCode, // agv_id = Guid.NewGuid(), // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), // agv_grade = 2, // agv_createtime = DateTime.Now, // agv_taskstate = "Queue", // agv_materielid = stationinfo.stationType, // agv_qty = stationinfo.quantity, // agv_tasktype = "TaskType_Outbound", // agv_toaddress = "", // agv_userid = "ç³»ç»", // bindSN = stationinfo.bindSN, // jobID = mes_head.jobID, // agv_worktype = Convert.ToInt32(mes_head.processCode), // agv_materbarcode = mes_head.materialCode, // agv_Traytype = stationinfo.tray_type, // agv_TrayStatus = stationinfo.tray_status // }; // stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); // stationinfoRepository.Update(stationinfo, true); // agvtaskRepository.Add(agvtask, true); // WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); // continue; // } //} } 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 = "Queue", agv_materielid = stationinfo.stationType, agv_qty = stationinfo.quantity, agv_tasktype = "TaskType_Outbound", agv_toaddress = "", agv_userid = "ç³»ç»", bindSN = stationinfo.bindSN, jobID = mes_head.jobID, agv_worktype = Convert.ToInt32(mes_head.processCode), agv_materbarcode = mes_head.materialCode, agv_Traytype = stationinfo.tray_type, agv_TrayStatus = stationinfo.tray_status }; stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); stationinfoRepository.Update(stationinfo, true); agvtaskRepository.Add(agvtask, true); WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); continue; #endregion } #region è´§ä½è½¦è½®æä¸ä¸ªå å«å¨å·¥åå åä¸åä»»å¡ //foreach (var SN in lists) //{ // if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) // { // dt_agvtask agvtask = new dt_agvtask() // { // agv_fromaddress = stationinfo.stationCode, // agv_id = Guid.NewGuid(), // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), // agv_grade = 2, // agv_createtime = DateTime.Now, // agv_taskstate = "Queue", // agv_materielid = stationinfo.stationType, // agv_qty = stationinfo.quantity, // agv_tasktype = "TaskType_Outbound", // agv_toaddress = "", // agv_userid = "ç³»ç»", // bindSN = stationinfo.bindSN, // jobID = mes_head.jobID, // agv_worktype = Convert.ToInt32(mes_head.processCode), // agv_materbarcode = mes_head.materialCode, // agv_Traytype = stationinfo.tray_type, // agv_TrayStatus = stationinfo.tray_status // }; // stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); // stationinfoRepository.Update(stationinfo, true); // agvtaskRepository.Add(agvtask, true); // WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); // continue; // } //} #endregion } } } ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/RestockHCJ_a.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,80 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using WIDESEA_Comm; using WIDESEA_Comm.LogInfo; using WIDESEA_Core.BaseProvider; using WIDESEA_Core.EFDbContext; using WIDESEA_Entity.DomainModels; using WIDESEA_WCS.IRepositories; using WIDESEA_WCS.Repositories; using WIDESEA_WCS.WCSClient; using WIDESEA_WMS.IRepositories; using WIDESEA_WMS.IServices; using WIDESEA_WMS.Repositories; namespace WIDESEA_WCS.JobsPart.Common { public class RestockHCJ_a { /// <summary> /// æ´æ°éåä»»å¡ /// </summary> public static void HCJGetBarcode() { try { VOLContext Context = new VOLContext(); Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); var tasks = agvtaskService.Find(x => x.agv_taskstate == "Queue").OrderBy(x => x.agv_createtime).ToList(); foreach (var task in tasks) { if (task.agv_tasktype == "TaskType_EmptyPallet")//空æä»»å¡ { if (task.agv_fromaddress == "") { var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "龿¡æº"); if (Pipeline_client == null) throw new Exception("龿¡æºè°åº¦æå¡æªå¼å¯ï¼"); if (!Pipeline_client.IsConnected) throw new Exception("ä¸é¾æ¡æºè¿æ¥è¶ æ¶ï¼"); var area = task.agv_Traytype == "SmallTray" ? "11" : "10"; #region æ¥æ¾ä¸åºåºç空æçåºä½ var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.enable).OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault(); if (EmptyStation == null) return; if (EmptyStation == null) EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderBy(x => x.line).OrderBy(x => x.column).FirstOrDefault(); #endregion } } else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//å¤ååºåºåº/ABåºåºåº { if (task.agv_toaddress == "") { var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.location_state == "Empty" && x.enable).ToList(); foreach (var EmptyStation in EmptyStations) { if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue; task.agv_taskstate = "Create"; task.agv_toaddress = EmptyStation.stationCode; EmptyStation.location_state = LocationStateEnum.Busy.ToString(); stationinfoRepository.Update(EmptyStation, true); agvtaskService.Update(task, true); WriteDBLog.Success("æ´æ°åºåºéåä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}", "PCS"); return; } } } } } catch (Exception ex) { WriteDBLog.Error("æ´æ°éåä»»å¡", $"é误信æ¯ï¼{ex.Message}", "PCS"); } } } } ´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/VV_DispatchService.cs
@@ -63,6 +63,8 @@ { if (!scheduler.IsRun()) { WIDESEA.Helper.GetToken(); var cooRes = CoonPLC(); var startRes = SrartScheduler(); if (startRes.Status)