| | |
| | | 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; |
| | |
| | | #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 æ¥å¿è®°å½ |
| | |
| | | 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) |
| | | { |
| | | agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | #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"); |
| | | // } |
| | | //} |
| | | #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) |
| | | { |
| | | 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"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region MyRegion |
| | |
| | | else if ((Int16)PartStatus == 2) |
| | | { |
| | | dt_stationinfo Stationinfo = null; |
| | | if (mes_Detail.heatID != 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 |
| | | //{ |
| | | //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.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(); |
| | | } |
| | | /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault(); |
| | | //} |
| | | |
| | | if (Stationinfo == null) |
| | | { |
| | |
| | | |
| | | 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") |
| | |
| | | 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; |