From 4b7e6dd320649d5a03ebc7cf0ffa71864d555335 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 26 六月 2024 15:24:21 +0800
Subject: [PATCH] 优化老PCS通信代码

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs |   12 ++++++------
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs |   15 ++++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs"
index 3e45f4c..a1ab343 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/Wheel_info_trace.cs"
@@ -63,7 +63,7 @@
                         }
                     }
                     #region 鏇挎崲鑰丳CS鏃朵娇鐢�
-                    if (/*StackerDBItem.oi_on == 1*/true)
+                    if (StackerDBItem.oi_on == 1)
                     {
                         if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}锛歋N鍙蜂负绌�");
                         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 鏇挎崲鑰丳CS鏃朵娇鐢�
-                    if (/*StackerDBItem.oi_on == 1*/true)
+                    if (StackerDBItem.oi_on == 1)
                     {
                         if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}锛歋N鍙蜂负绌�");
                         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 鏇挎崲鑰丳CS鏃朵娇鐢�
-                    if (/*StackerDBItem.oi_on == 1*/true)
+                    if (StackerDBItem.oi_on == 1)
                     {
                         if (string.IsNullOrEmpty(StackerDBItem.o_wp_id)) throw new Exception($"{StackerDBItem.Name}锛歋N鍙蜂负绌�");
                         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
                 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs"
index 5cdec05..bd97e3f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/info_interaction.cs"
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing 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}鏈壘鍒癝N锛歿o_wp_id}鐨勫伐鍗曚俊鎭痋n鍐欏叆杈婇亾淇℃伅锛歩_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(),

--
Gitblit v1.9.3