分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-07 b920194aeb070ecc6babe74706710d2c15e2be28
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -34,6 +34,7 @@
        /// <param name="client"></param>
        public void QueryWheeldata(PLCClient client)
        {
            string namea = "";
            try
            {
                VOLContext Context = new VOLContext();
@@ -48,6 +49,7 @@
                List<string> names = new List<string>() { "1单元辊道下料查询车轮", "2单元辊道下料查询车轮", "3单元辊道下料查询车轮", "辊道上料查询车轮" };
                foreach (string name in names)
                {
                    namea = name;
                    var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList();
                    var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on").First(), client);
                    if ((byte)on == 1)
@@ -66,7 +68,8 @@
                            client.WriteByOrder("W_i_status", (byte)2, name);
                            client.WriteByOrder("R_oi_on", (byte)0, name);
                            #region æ—¥å¿—记录
                            WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单信息", "PCS");
                            //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单信息", "PCS");
                            WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单信息");
                            #endregion
                            continue;
                        }
@@ -107,7 +110,8 @@
                                client.WriteByOrder("W_i_status", (byte)2, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Error(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息", "PCS");
                                //WriteDBLog.Error(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息", "PCS");
                                WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息");
                                #endregion
                            }
                            else
@@ -124,7 +128,17 @@
                                client.WriteByOrder("W_i_parameter_h", geometry == null ? (float)geometry1.h : (float)geometry.h, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Success(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                //WriteDBLog.Success(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                //    $"a:{(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
                                //    $"b:{(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
                                //    $"c:{(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
                                //    $"d:{(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
                                //    $"e:{(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
                                //    $"f:{(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
                                //    $"g:{(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
                                //    $"h:{(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
                                //    $"R_oi_on:0", "PCS");
                                WriteLog.Write_Log(name, wp_id, "写入信息!", $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                    $"a:{(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
                                    $"b:{(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
                                    $"c:{(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
@@ -133,7 +147,7 @@
                                    $"f:{(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
                                    $"g:{(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
                                    $"h:{(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
                                    $"R_oi_on:0", "PCS");
                                    $"R_oi_on:0");
                                #endregion
                            }
                        }
@@ -146,7 +160,8 @@
                                client.WriteByOrder("W_i_status", (byte)2, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Error(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息", "PCS");
                                //WriteDBLog.Error(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息", "PCS");
                                WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息");
                                #endregion
                            }
                            else
@@ -162,7 +177,17 @@
                                client.WriteByOrder("W_i_parameter_h", geometry == null ? (float)geometry1.h : (float)geometry.h, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Success(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                //WriteDBLog.Success(name, $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                //    $"a:{(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
                                //    $"b:{(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
                                //    $"c:{(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
                                //    $"d:{(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
                                //    $"e:{(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
                                //    $"f:{(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
                                //    $"g:{(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
                                //    $"h:{(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
                                //    $"R_oi_on:0", "PCS");
                                WriteLog.Write_Log(name, wp_id, "写入信息!", $"读取桁架信息:\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\n" +
                                    $"a:{(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
                                    $"b:{(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
                                    $"c:{(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
@@ -171,7 +196,7 @@
                                    $"f:{(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
                                    $"g:{(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
                                    $"h:{(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
                                    $"R_oi_on:0", "PCS");
                                    $"R_oi_on:0");
                                #endregion
                            }
                        }
@@ -181,7 +206,8 @@
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("查询车轮数据", $"错误信息:{ex.Message}", "PCS");
                //WriteDBLog.Error("查询车轮数据", $"错误信息:{ex.Message}", "PCS");
                WriteLog.Write_Log(namea, namea + "报错", "错误信息!", $"错误信息:{ex.Message}");
            }
        }
        #endregion
@@ -193,6 +219,7 @@
        /// <param name="client"></param>
        public void QueryOrder(PLCClient client)
        {
            string namea = "";
            try
            {
                VOLContext Context = new VOLContext();
@@ -208,6 +235,7 @@
                List<string> names = new List<string>() { "1单元辊道下料查询订单", "2单元辊道下料查询订单", "3单元辊道下料查询订单", "辊道上料查询订单" };
                foreach (string name in names)
                {
                    namea = name;
                    var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList();
                    var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on").First(), client);
                    //var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on" && x.plcdetail_number == name).First(), client);
@@ -217,10 +245,11 @@
                        var wp_id = client.ReadByOrder<string>("R_o_wp_id", name);
                        if (string.IsNullOrEmpty(wp_id))
                        {
                            #region æ—¥å¿—记录
                            client.WriteByOrder("W_i_status", (byte)2, name);
                            client.WriteByOrder("R_oi_on", (byte)0, name);
                            WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n车轮SN号为空", "PCS");
                            #region æ—¥å¿—记录
                            //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n车轮SN号为空", "PCS");
                            WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n车轮SN号为空");
                            #endregion
                            continue;
                        }
@@ -232,7 +261,8 @@
                            client.WriteByOrder("W_i_status", (byte)2, name);
                            client.WriteByOrder("R_oi_on", (byte)0, name);
                            #region æ—¥å¿—记录
                            WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单详情", "PCS");
                            //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单详情", "PCS");
                            WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到工单详情");
                            #endregion
                            continue;
                        }
@@ -270,7 +300,8 @@
                                client.WriteByOrder("W_i_status", (byte)4, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:4\nR_oi_on:0\n\n手动入库模式未选择库区", "PCS");
                                //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:4\nR_oi_on:0\n\n手动入库模式未选择库区", "PCS");
                                WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n\n写入桁架信息:\nW_i_status:4\nR_oi_on:0\n\n手动入库模式未选择库区");
                                #endregion
                                continue;
                            }
@@ -283,7 +314,8 @@
                                client.WriteByOrder("W_i_status", (byte)2, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息", "PCS");
                                //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息", "PCS");
                                WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到机加工车轮信息");
                                #endregion
                                continue;
                            }
@@ -306,10 +338,14 @@
                                //}
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Success(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" +
                                WriteLog.Write_Log(name, wp_id, "写入信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" +
                                    $"\nW_i_job_id:{Mes_Work.jobID}\nW_i_drawing_id:{Mes_Work.drawingNo}\nW_i_heat_id:{Mes_Work.heatID}\nW_i_batch_id:{Mes_Work.heatBatchID}" +
                                    $"\nW_i_skip_op_SJ1:{(name == "3单元辊道下料查询订单" ? true : mes_Head.skip_op_1)}\nW_i_skip_op_SJ2:{(name == "3单元辊道下料查询订单" ? true : mes_Head.skip_op_2)}" +
                                    $"\nW_i_skip_op_LT:{mes_Head.skip_op_3}\nR_oi_on:0", "PCS");
                                    $"\nW_i_skip_op_LT:{mes_Head.skip_op_3}\nR_oi_on:0");
                                //WriteDBLog.Success(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" +
                                //    $"\nW_i_job_id:{Mes_Work.jobID}\nW_i_drawing_id:{Mes_Work.drawingNo}\nW_i_heat_id:{Mes_Work.heatID}\nW_i_batch_id:{Mes_Work.heatBatchID}" +
                                //    $"\nW_i_skip_op_SJ1:{(name == "3单元辊道下料查询订单" ? true : mes_Head.skip_op_1)}\nW_i_skip_op_SJ2:{(name == "3单元辊道下料查询订单" ? true : mes_Head.skip_op_2)}" +
                                //    $"\nW_i_skip_op_LT:{mes_Head.skip_op_3}\nR_oi_on:0", "PCS");
                                #endregion
                            }
                        }
@@ -323,7 +359,8 @@
                                client.WriteByOrder("W_i_status", (byte)2, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息", "PCS");
                                //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息", "PCS");
                                WriteLog.Write_Log(name, wp_id, "错误信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:2\nR_oi_on:0\n\n未查询到检测线车轮信息");
                                #endregion
                                continue;
                            }
@@ -338,8 +375,10 @@
                                client.WriteByOrder("W_i_batch_id", Mes_Work.heatBatchID, name);
                                client.WriteByOrder("R_oi_on", (byte)0, name);
                                #region æ—¥å¿—记录
                                WriteDBLog.Success(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\nW_i_job_id:{Mes_Work.jobID}" +
                                    $"\nW_i_drawing_id:{mes_Head.drawingNo}\nW_i_heat_id:{Mes_Work.heatID}\nW_i_batch_id:{Mes_Work.heatBatchID}\nR_oi_on:0", "PCS");
                                WriteLog.Write_Log(name, wp_id, "写入信息!", $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\nW_i_job_id:{Mes_Work.jobID}" +
                                    $"\nW_i_drawing_id:{mes_Head.drawingNo}\nW_i_heat_id:{Mes_Work.heatID}\nW_i_batch_id:{Mes_Work.heatBatchID}\nR_oi_on:0");
                                //WriteDBLog.Success(name, $"读取桁架信息:\n车轮SN:{wp_id}\n轮型ID:{wp_type}\n\n写入桁架信息:\nW_i_status:1" + $"\nW_i_job_id:{Mes_Work.jobID}" +
                                //    $"\nW_i_drawing_id:{mes_Head.drawingNo}\nW_i_heat_id:{Mes_Work.heatID}\nW_i_batch_id:{Mes_Work.heatBatchID}\nR_oi_on:0", "PCS");
                                #endregion
                            }
                        }
@@ -348,7 +387,8 @@
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("查询车轮订单", $"错误信息:{ex.Message}", "PCS");
                //WriteDBLog.Error("查询车轮订单", $"错误信息:{ex.Message}", "PCS");
                WriteLog.Write_Log(namea, namea + "报错", "错误信息!", $"错误信息:{ex.Message}");
            }
        }
        #endregion
@@ -449,7 +489,7 @@
                            #region åˆ¤æ–­åŒºåŸŸå·æ˜¯å¦ä¸€è‡´
                            var area = client.ReadByOrder<Int16>("place_prog", name);//放料完成的区域号
                            if (AreaNr != area)
                            {
                                Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警