From b8510ca5d1e56ef78cd27c45b6bd65a2c13f6b27 Mon Sep 17 00:00:00 2001 From: yanjinhui <3306209981@qq.com> Date: 星期一, 17 三月 2025 15:12:34 +0800 Subject: [PATCH] 代码优化 --- 项目代码/WIDESEAWCS_Server 正式/SerialPortService/SerialPortService.cs | 37 ++++++++++++++++++------------------- 1 files changed, 18 insertions(+), 19 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/SerialPortService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/SerialPortService.cs" index 7ef37ba..ff94dff 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/SerialPortService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/SerialPortService.cs" @@ -1,4 +1,4 @@ -锘縰sing System; +锘�/*using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; @@ -12,34 +12,31 @@ using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Model.Models.SerialPort; + + namespace WIDESEA_SerialPortService { public class SerialPortService : ServiceBase<Dt_TorqueOp, ISerialPortRepository>, ISerialPortService { - private SerialPortTestService _serialPortTestService; // 涓插彛鏈嶅姟 + //private SerialPortTestJob _SerialPortTestJob; // 涓插彛鏈嶅姟 public SerialPortService(ISerialPortRepository BaseDal) : base(BaseDal) { + //_SerialPortTestJob = new SerialPortTestJob("COM3", this); - _serialPortTestService = new SerialPortTestService("COM3"); } public WebResponseContent AddSerialPort(Dt_TorqueOp TorqueOp) { WebResponseContent content = new WebResponseContent(); - BaseDal.Db.Insertable(TorqueOp).ExecuteCommand(); + //BaseDal.Db.Insertable(TorqueOp).ExecuteCommand(); + + BaseDal.AddData(TorqueOp); + + + content = WebResponseContent.Instance.OK("鎴愬姛"); return content; } - //// 鍚姩涓插彛閫氫俊 - //public WebResponseContent StartSerialPortCom() - //{ - // WebResponseContent content = new WebResponseContent(); - - // // 鎵撳紑涓插彛骞跺紑濮嬪彂閫佹暟鎹� - // _serialPortTestService.OpenSerialPort(); - - // return content; - //} // 鍚姩涓插彛閫氫俊 public void StartSerialPortCom() @@ -47,7 +44,7 @@ //WebResponseContent content = new WebResponseContent(); // 鎵撳紑涓插彛骞跺紑濮嬪彂閫佹暟鎹� - _serialPortTestService.OpenSerialPort(); + //_SerialPortTestJob.OpenSerialPort(); //return content; } @@ -58,18 +55,20 @@ public void StopSerialPortCom() { //WebResponseContent content = new WebResponseContent(); - _serialPortTestService.CloseSerialPort(); // 鍏抽棴涓插彛 - //return content; + //_SerialPortTestJob.CloseSerialPort(); // 鍏抽棴涓插彛 + // return content; } public List<string> GetSerialPortCom() { - - return _serialPortTestService.GetReceivedData(); + + //return _serialPortTestService.GetReceivedData(); + return null; } } } +*/ \ No newline at end of file -- Gitblit v1.9.3