分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-25 8554717a7abbe2889ae1d835857661dc8b91aa68
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -590,8 +590,6 @@
                            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)
                        {
@@ -600,22 +598,7 @@
                            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);
@@ -639,6 +622,21 @@
                                agvtask(stationinfoRepository, station, Work, "TaskType_Inbound");
                        }
                        #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
@@ -708,18 +706,6 @@
                                        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();
@@ -831,17 +817,6 @@
                            }
                            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æ—