| | |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Core.Extensions; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); |
| | | |
| | | #region 䏿使¯å¦ä¸ºç©ºç¶æåæ¥ç»æ¡æ¶ |
| | | foreach (var station in Stations) |
| | | { |
| | | client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name); |
| | | } |
| | | #endregion |
| | | |
| | | if (finished && !updatefinished) |
| | | { |
| | |
| | | throw new Exception($"{station.stationCode}å·²åå¨è½¦è½®SNå·ï¼{Wheel_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.stationType = Mes_Work.drawingNo; |
| | | station.Number = Mes_Work.workOrder; |
| | | station.heatNumber = Mes_Work.heatID; |
| | | station.tray_status = "StrogeTray"; |
| | | } |
| | | |
| | | var count = stationinfoRepository.Update(station, true); |
| | | if (count < 1) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{station.stationCode}"); |
| | | |
| | | #region æ¸
ç©ºç»æ¡æ¶çä¸æä¿¡æ¯ |
| | | client.WriteByOrder("W_IndexNr", (Int16)0, name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)0, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | |
| | | // $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_Storage_updateï¼{true}\nW_Enabl_Loadï¼{false}", "PCS"); |
| | | #endregion |
| | | |
| | | #region è´§ä½ç¶ææ´æ° |
| | | 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.stationType = Mes_Work.drawingNo; |
| | | station.Number = Mes_Work.workOrder; |
| | | station.heatNumber = Mes_Work.heatID; |
| | | station.tray_status = "StrogeTray"; |
| | | } |
| | | station.remark = ""; |
| | | var count = stationinfoRepository.Update(station, true); |
| | | if (count < 1) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{station.stationCode}"); |
| | | #endregion |
| | | |
| | | |
| | | #region ä¿®æ¹å·¥åç¶æ |
| | | var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN); |
| | | Detail.Status = "ä¸çº¿"; |
| | |
| | | throw new Exception($"å·¥ååè¡¨ä¿¡æ¯æ´æ°å¤±è´¥ï¼è½¦è½®SNå·ï¼{Detail.SN}"); |
| | | var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID); |
| | | Head.finishNum = Head.finishNum + 1; |
| | | if (Head.finishNum == Head.quantity) Head.FinishTime = DateTime.Now; |
| | | count = mes_HeadRepository.Update(Head, true); |
| | | if (count < 1) |
| | | throw new Exception($"å·¥åå¤´è¡¨ä¿¡æ¯æ´æ°å¤±è´¥ï¼å·¥åå·ï¼{Head.jobID}"); |
| | |
| | | } |
| | | } |
| | | |
| | | var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); |
| | | |
| | | #region 䏿使¯å¦ä¸ºç©ºç¶æåæ¥ç»æ¡æ¶ |
| | | foreach (var station in Stations) |
| | | { |
| | | client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name); |
| | | } |
| | | #endregion |
| | | |
| | | 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; |
| | | |
| | | #region è¯»åæ¡æ¶ä¿¡æ¯ |
| | | var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | //WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥åä¿¡æ¯", "PCS"); |
| | | WriteLog.Write_Log(name + "ç³è¯·æ¾æå¼å¸¸", Wheel_id, "æ¥è¯¢æºå 工工å", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_id}æªæ¥è¯¢å°å·¥åä¿¡æ¯\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\næ¯å¦å
è®¸ä¸æï¼{false}"); |
| | | continue; |
| | | } |
| | | |
| | | |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | var wheel = Pipeline.QueryMateriel(Work.drawingNo); |
| | | var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo); |
| | | if (wheel == null && wheel1 == null) |
| | |
| | | #endregion |
| | | continue; |
| | | } |
| | | |
| | | #region æ¢å¾å·,䏿å£å
¶ä»å¾å·æçå
¨é¨å
¥åº |
| | | var stations = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).ToList(); |
| | | foreach (var station in stations) |
| | | { |
| | | if (station.stationCode == NGStation || name == "3åå
䏿åº") |
| | | agvtask(stationinfoRepository, station, Work, "TaskType_OutsourceInbound"); |
| | | else |
| | | agvtask(stationinfoRepository, station, Work, "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | | |
| | | var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | |
| | |
| | | if (Stationinfo == null) |
| | | { |
| | | #region 触åNGä»»å¡ |
| | | var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.Number != Work.workOrder && x.quantity > 0).FirstOrDefault(); |
| | | if (NG != null) |
| | | { |
| | | if (NG.stationType != Work.drawingNo || NG.Number != Work.workOrder) |
| | | agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); |
| | | } |
| | | agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); |
| | | #endregion |
| | | |
| | | Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | |
| | | { |
| | | |
| | | #region æ¢ç±»åç´æ¥å
¥åº |
| | | var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault(); |
| | | if (stationinfo1 != null) |
| | | agvtask(stationinfoRepository, stationinfo1, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | //var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault(); |
| | | //if (stationinfo1 != null) |
| | | // agvtask(stationinfoRepository, stationinfo1, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | #endregion |
| | | |
| | | #region æç车轮å å第å个æ¶ä¸åå¦å¤ä¸ä¸ªçå·çå
¥åºä»»å¡ |
| | |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | Stationinfo.remark = "æ¡æ¶ä¸æ"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | #region æ¥å¿è®°å½ |
| | | //WriteDBLog.Success(name + "å
è®¸æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼OK" +$"\n读åæçå
çµä¿¡å·ï¼{PalletSignal}" + |
| | | // $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\n䏿ä½å·ï¼{area}\n第å 个车轮ï¼{(Stationinfo.quantity + 1)}\næçç±»åï¼1\nW_Enabl_Loadï¼true", "PCS"); |
| | |
| | | #region 没æçå¯ç¨,触åå
¥åºä»»å¡ |
| | | if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault(); |
| | | var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault(); |
| | | agvtask(stationinfoRepository, station, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | |
| | | 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(); |
| | |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | Stationinfo.remark = "æ¡æ¶ä¸æ"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | #region æ¥å¿è®°å½ |
| | | //WriteDBLog.Success(name + "å
è®¸æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼NG" +$"\n读åæçå
çµä¿¡å·ï¼{PalletSignal}" + |
| | | // $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\n䏿ä½å·ï¼{area}\n第å 个车轮ï¼{(Stationinfo.quantity + 1)}\næçç±»åï¼1\nW_Enabl_Loadï¼true", "PCS"); |
| | |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context); |
| | | Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault(); |
| | | var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); |
| | | if (task != null) return; |
| | | if (!string.IsNullOrEmpty(Work.area)) |