| | |
| | | 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é误信æ¯ï¼åºåå·è½¦è½®æ°é已满ï¼"); |
| | |
| | | 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) |
| | | { |
| | |
| | | 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); //æ ¹æ®ä¸æå£åå
åè·ååºå代ç |
| | | //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);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | var wheel = Pipeline.QueryMateriel(Work.drawingNo); |
| | | var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo); |
| | |
| | | } |
| | | #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);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | 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); |
| | |
| | | .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) |
| | |
| | | .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) |
| | |
| | | #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);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | 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(); |
| | |
| | | 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) |
| | |
| | | } |
| | | 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æ |
| | |
| | | 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 |
| | | |
| | | } |
| | | } |