| | |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | |
| | | var NGStation = "X01001003"; |
| | | if (name == "2åå
䏿åº") NGStation = "X02001003"; |
| | | if (name == "3åå
䏿åº") NGStation = "X03001002"; |
| | | #region MyRegion |
| | | //var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | |
| | | } |
| | | |
| | | station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN; |
| | | station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID; |
| | | station.quantity++; |
| | | if (station.quantity == 1) |
| | | { |
| | |
| | | station.heatNumber = Mes_Work.heatID; |
| | | station.tray_status = "StrogeTray"; |
| | | } |
| | | //else if (station.stationCode == NGStation) |
| | | //{ |
| | | // station.heatNumber = string.IsNullOrEmpty(station.heatNumber) ? Mes_Work.heatID : station.heatNumber + "," + Mes_Work.heatID; |
| | | //} |
| | | |
| | | var count = stationinfoRepository.Update(station, true); |
| | | if (count < 1) |
| | |
| | | var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client); |
| | | if (!Request) continue; |
| | | |
| | | var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读åè´§ä½å·ä¿¡æ¯ |
| | | if (Area != 0) continue; |
| | | //var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读åè´§ä½å·ä¿¡æ¯ |
| | | //if (Area != 0) continue; |
| | | |
| | | var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client); |
| | | #region è¯»åæ¡æ¶ä¿¡æ¯ |
| | | var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | |
| | | |
| | | var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); |
| | | |
| | | var NGStation = "X01001003"; |
| | | if (name == "2åå
䏿åº") NGStation = "X02001003"; |
| | | if (name == "3åå
䏿åº") NGStation = "X03001002"; |
| | | |
| | | |
| | | //foreach (var station in Stations) //ä»»ä½ä¸ä¸ªä¸æä½ä¸ºç©ºæç¦ç¨æ¶,é½ä¼åæ¢æ¡æ¶ |
| | | //{ |
| | |
| | | } |
| | | |
| | | 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); |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success(name + "ç³è¯·æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼{PartStatus}\næ¯å¦è¿å
¥ä¸æåºï¼{load_zone}", "PCS"); |
| | | if (load_zone) continue; |
| | |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == Work.workOrder |
| | | && x.heatNumber == Work.heatID) |
| | | .OrderByDescending(x => x.quantity) |
| | |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == Work.workOrder) |
| | | .OrderByDescending(x => x.quantity) |
| | | .FirstOrDefault(); |
| | |
| | | |
| | | if (Stationinfo != null) |
| | | { |
| | | #region æç车轮å å第å个æ¶ä¸åå¦å¤ä¸ä¸ªçå·çå
¥åºä»»å¡ |
| | | if (Stationinfo.quantity + 1 >= 4) |
| | | { |
| | | var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | //foreach (var stationinfo in stationinfos) |
| | | //{ |
| | | if (stationinfo != null) |
| | | agvtask(stationinfoRepository, stationinfo, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | //} |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) |
| | | //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) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | #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, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | | } |
| | | //else |
| | | //{ |
| | | // #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, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | // } |
| | | // #endregion |
| | | //} |
| | | |
| | | } |
| | | else if ((Int16)PartStatus == 2) |
| | |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault(); |
| | | //} |
| | | |
| | |
| | | if (Stationinfo != null) |
| | | { |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) |
| | | //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"; |
| | |
| | | //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum); |
| | | //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound"; |
| | | |
| | | if (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); |