分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-03-14 73a926018601d9a5a5a3d3f4c051537f45a8eff4
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs
@@ -90,7 +90,7 @@
                //缓存架未启用禁止桁架进入
                foreach (var station in Stations)
                {
                    if (!station.enable)
                    if (!station.enable || station.location_state != LocationStateEnum.Stroge.ToString())
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                }
@@ -108,9 +108,14 @@
                    if (list.Count != Station.quantity)
                    {
                        Station.location_state = LocationStateEnum.Abnormal.ToString();
                        Station.remark = "车轮数量与SN号数量不一致";
                        stationinfoRepository.Update(Station, true);
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        throw new Exception("上料位车轮数量与SN号数量不一致,上料位编号:" + Station.stationCode);
                        #region æ—¥å¿—记录
                        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无
@@ -124,6 +129,11 @@
                        Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                        Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SN号
                        Gantry_client.WriteByOrder("W_RequestUnload", true, number);
                        #region æ—¥å¿—记录
                        WriteDBLog.Success("上料区申请", $"读取托盘光电信号:{PalletSignal}\n读取第一个车轮光电信号:{MaterialSignal}\n\n" +
                            $"写入桁架信息:\n区域货位号:{area}\n托盘上的第几个车轮:{SNS.Length}\n托盘类型:{1}\n车轮类型:{QueryMateriel(Station.stationType).TypeId}" +
                            $"\n车轮SN号:{SNS[SNS.Length - 1]}\nW_RequestUnload:true", "PCS");
                        #endregion
                    }
                    else
                    {
@@ -140,9 +150,12 @@
                        if (!Date_Vaild)//信息有误,记录日志
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = $"未查询到SN号:{SNS[SNS.Length - 1]}的订单";
                            stationinfoRepository.Update(Station, true);
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                            throw new Exception($"未查询到SN号:{SNS[SNS.Length - 1]}的订单,上料位编号:{Station.stationCode}");
                            //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;
                        }
                    }
                    var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹取完成
@@ -162,9 +175,16 @@
                        }
                        var count = stationinfoRepository.Update(Station, true);
                        if (count < 1)
                            throw new Exception($"上料位信息更新失败!上料位编号:{Station.stationCode}");
                        {
                            WriteDBLog.Error("取料完成", $"上料位信息更新失败!上料位编号:{Station.stationCode}", "PCS");
                            //throw new Exception($"上料位信息更新失败!上料位编号:{Station.stationCode}");
                            return;
                        }
                        Gantry_client.WriteByOrder("W_Storage_update", true, number);//货位状态更新
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        #region æ—¥å¿—记录
                        WriteDBLog.Success("取料完成", $"写入桁架信息:\n货位状态更新:{true}\nW_RequestUnload:{false}", "PCS");
                        #endregion
                        //finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);
                        //while (finished)
                        //{
@@ -176,6 +196,8 @@
                    //    Gantry_client.WriteByOrder("W_Storage_update", false, number);//货位状态更新
                }
                else
                    Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
            }
            catch (Exception ex)
            {
@@ -197,13 +219,13 @@
            return Newsn;
        }
        public static dt_geometry_data QueryMateriel(string type)
        {
        {
            VOLContext Context = new VOLContext();
            Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
            var materielinfo = dataRepository.FindFirst(x => x.Description == type);
            var materielinfo = dataRepository.Find(x => x.Description == type).OrderBy(x => x.TypeId).FirstOrDefault();
            return materielinfo;
        }
        public static string QueryMateriel(int  typeId)
        public static string QueryMateriel(int typeId)
        {
            VOLContext Context = new VOLContext();
            Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);