分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-06-26 4b7e6dd320649d5a03ebc7cf0ffa71864d555335
优化老PCS通信代码
已修改2个文件
27 ■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs
@@ -63,7 +63,7 @@
                        }
                    }
                    #region æ›¿æ¢è€PCS时使用
                    if (/*StackerDBItem.oi_on == 1*/true)
                    if (StackerDBItem.oi_on == 1)
                    {
                        if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}:SN号为空");
                        if (string.IsNullOrEmpty(StackerDBItem.o_online_time)) throw new Exception($"{StackerDBItem.Name}:上线时间为空");
@@ -87,7 +87,7 @@
                            info.trace_billetID = Work.billetID.ToString();
                        }
                        traceRepository.Add(info, true);
                        //client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                        client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                    }
                    #endregion
                }
@@ -155,7 +155,7 @@
                        }
                    }
                    #region æ›¿æ¢è€PCS时使用
                    if (/*StackerDBItem.oi_on == 1*/true)
                    if (StackerDBItem.oi_on == 1)
                    {
                        if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}:SN号为空");
                        var info = traceRepository.Find(x => x.trace_SN == StackerDBItem.o_wp_id).FirstOrDefault();
@@ -172,7 +172,7 @@
                            info.trace_mach_number = StackerDBItem.Name;
                            traceRepository.Update(info, x => new { x.trace_mach_start_time, x.trace_mach_finish_time, x.trace_operator, x.trace_shift, x.trace_mach_statu, x.trace_process, x.trace_mach_number }, true);
                        }
                        //client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                        client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                    }
                    #endregion
                }
@@ -228,7 +228,7 @@
                        }
                    }
                    #region æ›¿æ¢è€PCS时使用
                    if (/*StackerDBItem.oi_on == 1*/true)
                    if (StackerDBItem.oi_on == 1)
                    {
                        if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}:SN号为空");
                        var info = traceRepository.Find(x => x.trace_SN == StackerDBItem.o_wp_id).FirstOrDefault();
@@ -240,7 +240,7 @@
                            //info.trace_line_number = info.trace_line_number + StackerDBItem.Name;
                            traceRepository.Update(info, x => new { x.trace_offline_time, x.trace_direction }, true);
                        }
                        //client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                        client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//信号复位
                    }
                    #endregion
                }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs
@@ -1,4 +1,5 @@
using System;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -153,7 +154,7 @@
                        if (Convert.ToByte(oi_on) == 1)
                        {
                            var o_wp_id = DBExtension.Read(key.FirstOrDefault(x => x.name == "o_wp_id"), client);
                            if (string.IsNullOrEmpty(o_wp_id.ToString()))
                            if (!string.IsNullOrEmpty(o_wp_id.ToString()))
                            {
                                var Work = workinfoRepository.Find(x => x.SN == o_wp_id && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
                                if (Work == null)
@@ -162,11 +163,11 @@
                                    client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//申请复位
                                    throw new Exception($"{key.Key}未找到SN:{o_wp_id}的工单信息\n写入辊道信息:i_status:2,oi_on:0");
                                }
                                client.Write(key.FirstOrDefault(x => x.name == "i_job_id").dbAddress, Work.jobID);//工单编号
                                client.Write(key.FirstOrDefault(x => x.name == "i_heat_id").dbAddress, Work.heatID);//炉代号
                                client.Write(key.FirstOrDefault(x => x.name == "i_billet_id").dbAddress, Work.billetID.ToString());//钢坯号
                                client.Write(key.FirstOrDefault(x => x.name == "i_batch_id").dbAddress, Work.heatBatchID);//热处理批次
                                client.Write(key.FirstOrDefault(x => x.name == "i_drawing_id").dbAddress, Work.drawingNo);//图号
                                client.Write(key.FirstOrDefault(x => x.name == "i_job_id").dbAddress, Encoding.UTF8.GetBytes(Work.jobID));//工单编号
                                client.Write(key.FirstOrDefault(x => x.name == "i_heat_id").dbAddress, Encoding.UTF8.GetBytes(Work.heatID));//炉代号
                                client.Write(key.FirstOrDefault(x => x.name == "i_billet_id").dbAddress, Encoding.UTF8.GetBytes(Work.billetID.ToString()));//钢坯号
                                client.Write(key.FirstOrDefault(x => x.name == "i_batch_id").dbAddress, Encoding.UTF8.GetBytes(Work.heatBatchID));//热处理批次
                                client.Write(key.FirstOrDefault(x => x.name == "i_drawing_id").dbAddress, Encoding.UTF8.GetBytes(Work.drawingNo));//图号
                                client.Write(key.FirstOrDefault(x => x.name == "i_status").dbAddress, (byte)1);//状态
                                client.Write(key.FirstOrDefault(x => x.name == "oi_on").dbAddress, (byte)0);//申请复位
                                WriteLog.Write_Log(key.Key + "辊道", "贴标机", "SN号:" + o_wp_id.ToString(),