| | |
| | | |
| | | ///æ¥æ¾ä¸æåºçè´§ä½ |
| | | var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//æ ¹æ®æ¶é´å
åæåº |
| | | //ç¼åæ¶æªå¯ç¨ç¦æ¢æ¡æ¶è¿å
¥ |
| | | //foreach (var station in Stations) |
| | | //{ |
| | | // if (!station.enable || station.location_state != LocationStateEnum.Stroge.ToString()) |
| | | // Gantry_client.WriteByOrder("W_RequestUnload", false, number);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | //} |
| | | |
| | | var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault(); |
| | | if (Station != null) |
| | |
| | | WriteDBLog.Error("䏿åº", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_RequestUnloadï¼false\n\n{Station.stationCode}车轮æ°éä¸SNå·æ°éä¸ä¸è´", "PCS"); |
| | | #endregion |
| | | return; |
| | | //throw new Exception("䏿ä½è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ï¼ä¸æä½ç¼å·ï¼" + Station.stationCode); |
| | | } |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList(); |
| | | var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读åæçä¿¡å·:1:æ,2æ |
| | |
| | | Station.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Station.remark = $"æªæ¥è¯¢å°SNå·ï¼{SNS[SNS.Length - 1]}ç订å"; |
| | | stationinfoRepository.Update(Station, true); |
| | | //throw new Exception($"æªæ¥è¯¢å°SNå·ï¼{SNS[SNS.Length - 1]}ç订åï¼ä¸æä½ç¼å·ï¼{Station.stationCode}"); |
| | | WriteDBLog.Error("䏿åºä¿¡æ¯æ¥è¯¢", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_RequestUnloadï¼false\n\n{Station.stationCode}æªæ¥è¯¢å°SNå·ï¼{SNS[SNS.Length - 1]}ç订å", "PCS"); |
| | | return; |
| | | } |
| | |
| | | if (Station.quantity <= 0) |
| | | { |
| | | Station.stationType = string.Empty; |
| | | //Station.location_state = LocationStateEnum.Empty.ToString(); |
| | | Station.Number = string.Empty; |
| | | Station.heatNumber = string.Empty; |
| | | Station.tray_status = "EmptyTray"; |
| | |
| | | if (count < 1) |
| | | { |
| | | WriteDBLog.Error("åæå®æ", $"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{Station.stationCode}", "PCS"); |
| | | //throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{Station.stationCode}"); |
| | | return; |
| | | } |
| | | |
| | |
| | | Gantry_client.WriteByOrder("W_IndexNr", (Int16)0, number);//æçä¸ç第å 个车轮 |
| | | Gantry_client.WriteByOrder("W_Storage_Type", (Int16)0, number); //æçç±»å1-横æ¾;2-ç«æ¾ |
| | | Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)0, number);//车轮类å |
| | | //Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SNå· |
| | | #endregion |
| | | |
| | | Gantry_client.WriteByOrder("W_Storage_update", true, number);//è´§ä½ç¶ææ´æ° |
| | |
| | | catch (Exception ex) |
| | | { |
| | | WriteDBLog.Error("䏿åº", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | //WritePCSLog.LogAdd(requestin.AreaNr.ToString(), respone.success == 1 ? "æå " : "失败", "WMS", "AGV", json, JsonConvert.SerializeObject(respone), remark, "æ£æµçº¿ä¸æåº", ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" }; |
| | | foreach (var stationCode in stationCodes) |
| | | { |
| | | if (agvtaskService.Find(x => x.agv_fromaddress == stationCode || x.agv_toaddress == stationCode).Any()) |
| | | if (agvtaskService.Find(x => x.agv_fromaddress == stationCode /*|| x.agv_toaddress == stationCode*/).Any()) |
| | | continue; |
| | | var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault(); |
| | | if (station == null) continue; |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == stationCode).ToList(); |
| | | var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读åæçä¿¡å·:1:æ,2æ |
| | | var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//读åè´§ç©ä¿¡å·:1:æ,2æ |
| | | var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault(); |
| | | if (station == null) continue; |
| | | if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true)) |
| | | { |
| | | var area = station.tray_type == "SmallTray" ? "11" : "10"; |
| | |
| | | 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();//æ¥æ¾æ²¡æä»»å¡ç空æçè´§ä½ |
| | | |
| | | // 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(); |
| | | // } |
| | | |
| | | #endregion |
| | | |
| | | if (EmptyStation != null) |
| | | { |