From 5d523171b8bc7db46ca76b11640dbfcb0120ce84 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 02 10月 2024 09:55:24 +0800
Subject: [PATCH] 2

---
 SDA/iWareModel/EnumType/EDevice/Rgv/EStationState.cs               |   17 
 SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForWrite.cs    |  121 ++
 SDA/iWareModel/EnumType/EDevice/Rgv/EStationMode.cs                |   16 
 SDA/iWareSda/Devices/4-Station/StationService/StationService.cs    |  576 ++++++++++++
 SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDB2Obj.cs        |  213 ++++
 SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs   |  138 +++
 SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs       |  779 ++++++++++++++++
 SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs          |  385 ++++++++
 SDA/iWareSda/Devices/4-Station/StationModel/StationView.cs         |   43 
 SDA/iWareSda/Devices/4-Station/StationModel/Station_CacheEntity.cs |  314 ++++++
 SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForRead.cs     |  106 ++
 11 files changed, 2,708 insertions(+), 0 deletions(-)

diff --git a/SDA/iWareModel/EnumType/EDevice/Rgv/EStationMode.cs b/SDA/iWareModel/EnumType/EDevice/Rgv/EStationMode.cs
new file mode 100644
index 0000000..a6092bc
--- /dev/null
+++ b/SDA/iWareModel/EnumType/EDevice/Rgv/EStationMode.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace iWareModel
+{
+    public enum EStationMode
+    {
+        鍏虫満妯″紡 = 0,
+        鎵嬪姩妯″紡 = 1,
+        鑷姩寰呮満妯″紡 = 2,
+        鑷姩杩愯妯″紡 = 3,
+    }
+}
diff --git a/SDA/iWareModel/EnumType/EDevice/Rgv/EStationState.cs b/SDA/iWareModel/EnumType/EDevice/Rgv/EStationState.cs
new file mode 100644
index 0000000..a982b90
--- /dev/null
+++ b/SDA/iWareModel/EnumType/EDevice/Rgv/EStationState.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace iWareModel
+{
+    public enum EStationState
+    {
+        //绌洪棽 = 0,
+        //浠诲姟涓� = 1,
+        //[EditBy shaocx,2022-05-11]
+        浠诲姟涓� = 0,
+        绌洪棽 = 1
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs
new file mode 100644
index 0000000..102bea2
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvComm.cs
@@ -0,0 +1,385 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace iWareSda.Devices._3_Station.StationModel
+{
+
+    #region 鍐�
+
+    public class StationDB2ObjForWriteComm
+    {
+        /// <summary>
+        /// 绔欑偣缂栧彿
+        /// </summary>
+        [Description("绔欑偣缂栧彿")]
+        public string StationCode { get; set; }
+
+        /// <summary>
+        /// 璇荤爜鏁版嵁瑙f瀽瀹屾垚
+        /// </summary>
+        [Description("璇荤爜鏁版嵁瑙f瀽瀹屾垚")]
+        public bool W_DataFinish { get; set; }
+
+        /// <summary>
+        /// 榻愬淇℃伅锛�998榻愬锛�999寮傚父鍑哄簱锛�
+        /// </summary>
+        [Description("榻愬淇℃伅锛�998榻愬锛�999寮傚父鍑哄簱锛�")]
+        public string W_KittingInfo { get; set; }
+
+        /// <summary>
+        /// 鍒嗛厤鏀炬枡搴撲綅鍙�
+        /// </summary>
+        [Description("鍒嗛厤鏀炬枡搴撲綅鍙�")]
+        public string W_Destination_In { get; set; }
+
+        /// <summary>
+        /// 浠诲姟鍙�
+        /// </summary>
+        [Description("浠诲姟鍙�")]
+        public string W_TaskID { get; set; }
+
+
+        /// <summary>
+        /// 鏉ユ枡闀垮害
+        /// </summary>
+        [Description("鏉ユ枡闀垮害")]
+        public string W_Length { get; set; }
+
+        /// <summary>
+        /// 鏉ユ枡瀹藉害
+        /// </summary>
+        [Description("鏉ユ枡瀹藉害")]
+        public string W_Width { get; set; }
+
+
+        /// <summary>
+        /// 鏉ユ枡楂樺害
+        /// </summary>
+        [Description("鏉ユ枡楂樺害")]
+        public string W_Height { get; set; }
+
+        /// <summary>
+        /// 璇锋眰鍑哄簱
+        /// </summary>
+        [Description("璇锋眰鍑哄簱")]
+        public bool W_ReqOut { get; set; }
+
+        /// <summary>
+        /// 鍒嗛厤鍑哄簱搴撲綅鍙�
+        /// </summary>
+        [Description("鍒嗛厤鍑哄簱搴撲綅鍙�")]
+        public string W_Destination_Out { get; set; }
+
+        /// <summary>
+        /// 鏄惁鏃嬭浆
+        /// </summary>
+        [Description("鏄惁鏃嬭浆")]
+        public bool W_IsRotate { get; set; }
+
+
+
+        /// <summary>
+        /// 鍖呬欢闀�
+        /// </summary>
+        [Description("鍖呬欢闀�")]
+        public string W_PackageLength { get; set; }
+
+        /// <summary>
+        /// 鍖呬欢瀹�
+        /// </summary>
+        [Description("鍖呬欢瀹�")]
+        public string W_PackageWidth { get; set; }
+
+
+        /// <summary>
+        /// 绾哥楂�
+        /// </summary>
+        [Description("绾哥楂�")]
+        public string W_CartonHeight { get; set; }
+
+        /// <summary>
+        /// 绾哥瀹�
+        /// </summary>
+        [Description("绾哥瀹�")]
+        public string W_CartonWidth { get; set; }
+
+        /// <summary>
+        /// 鏀炬枡X鍋忕Щ
+        /// </summary>
+        [Description("鏀炬枡X鍋忕Щ")]
+        public string W_X_Offset { get; set; }
+
+        /// <summary>
+        /// 鏀炬枡Y鍋忕Щ
+        /// </summary>
+        [Description("鏀炬枡Y鍋忕Щ")]
+        public string W_Y_Offset { get; set; }
+    }
+
+    /// <summary>
+    /// 姣忎釜绔欑偣鐨勫啓鏁版嵁
+    /// </summary>
+    public class StationDBForWriteComm
+    {
+        /// <summary>
+        /// 绔欑偣缂栧彿
+        /// </summary>
+        [Description("绔欑偣缂栧彿")]
+        public string StationCode { get; set; }
+
+        /// <summary>
+        /// 璇荤爜鏁版嵁瑙f瀽瀹屾垚
+        /// </summary>
+        [Description("璇荤爜鏁版嵁瑙f瀽瀹屾垚")]
+        public string W_DataFinish { get; set; }
+
+        /// <summary>
+        /// 榻愬淇℃伅锛�998榻愬锛�999寮傚父鍑哄簱锛�
+        /// </summary>
+        [Description("榻愬淇℃伅锛�998榻愬锛�999寮傚父鍑哄簱锛�")]
+        public string W_KittingInfo { get; set; }
+
+        /// <summary>
+        /// 鍒嗛厤鏀炬枡搴撲綅鍙�
+        /// </summary>
+        [Description("鍒嗛厤鏀炬枡搴撲綅鍙�")]
+        public string W_Destination_In { get; set; }
+
+        /// <summary>
+        /// 浠诲姟鍙�
+        /// </summary>
+        [Description("浠诲姟鍙�")]
+        public string W_TaskID { get; set; }
+
+
+        /// <summary>
+        /// 鏉ユ枡闀垮害
+        /// </summary>
+        [Description("鏉ユ枡闀垮害")]
+        public string W_Length { get; set; }
+
+        /// <summary>
+        /// 鏉ユ枡瀹藉害
+        /// </summary>
+        [Description("鏉ユ枡瀹藉害")]
+        public string W_Width { get; set; }
+
+
+        /// <summary>
+        /// 鏉ユ枡楂樺害
+        /// </summary>
+        [Description("鏉ユ枡楂樺害")]
+        public string W_Height { get; set; }
+
+        /// <summary>
+        /// 璇锋眰鍑哄簱
+        /// </summary>
+        [Description("璇锋眰鍑哄簱")]
+        public string W_ReqOut { get; set; }
+
+        /// <summary>
+        /// 鍒嗛厤鍑哄簱搴撲綅鍙�
+        /// </summary>
+        [Description("鍒嗛厤鍑哄簱搴撲綅鍙�")]
+        public string W_Destination_Out { get; set; }
+
+        /// <summary>
+        /// 鏄惁鏃嬭浆
+        /// </summary>
+        [Description("鏄惁鏃嬭浆")]
+        public string W_IsRotate { get; set; }
+
+
+
+        /// <summary>
+        /// 鍖呬欢闀�
+        /// </summary>
+        [Description("鍖呬欢闀�")]
+        public string W_PackageLength { get; set; }
+
+        /// <summary>
+        /// 鍖呬欢瀹�
+        /// </summary>
+        [Description("鍖呬欢瀹�")]
+        public string W_PackageWidth { get; set; }
+
+
+        /// <summary>
+        /// 绾哥楂�
+        /// </summary>
+        [Description("绾哥楂�")]
+        public string W_CartonHeight { get; set; }
+
+        /// <summary>
+        /// 绾哥瀹�
+        /// </summary>
+        [Description("绾哥瀹�")]
+        public string W_CartonWidth { get; set; }
+
+        /// <summary>
+        /// 鏀炬枡X鍋忕Щ
+        /// </summary>
+        [Description("鏀炬枡X鍋忕Щ")]
+        public string W_X_Offset { get; set; }
+
+        /// <summary>
+        /// 鏀炬枡Y鍋忕Щ
+        /// </summary>
+        [Description("鏀炬枡Y鍋忕Щ")]
+        public string W_Y_Offset { get; set; }
+
+    }
+
+    #endregion
+
+    /// <summary>
+    /// 姣忎釜绔欑偣鐨勮鏁版嵁
+    /// </summary>
+    public class StationDB2ObjForReadComm
+    {
+        /// <summary>
+        /// 绔欑偣缂栧彿
+        /// </summary>
+        [Description("绔欑偣缂栧彿")]
+        public string StationCode { get; set; }
+
+        /// <summary>
+        /// 璇锋眰瑙f瀽璇荤爜鏁版嵁
+        /// </summary>
+        [Description("璇锋眰瑙f瀽璇荤爜鏁版嵁")]
+        public bool R_ReqParseData { get; set; }
+
+        /// <summary>
+        /// 璇荤爜鍣ㄨ鐮佺粨鏋�
+        /// </summary>
+        [Description("璇荤爜鍣ㄨ鐮佺粨鏋�")]
+        public String R_ReadCodeResult { get; set; }
+
+        /// <summary>
+        /// 鏀跺埌浠诲姟涓嬪彂鍙嶉
+        /// </summary>
+        [Description("鏀跺埌浠诲姟涓嬪彂鍙嶉")]
+        public bool R_ACK { get; set; }
+
+        /// <summary>
+        /// 妯″紡
+        /// </summary>
+        [Description("妯″紡")]
+        public short R_Model { get; set; }
+
+        /// <summary>
+        /// 杩愯鐘舵��
+        /// </summary>
+        [Description("杩愯鐘舵��")]
+        public short R_State { get; set; }
+
+        /// <summary>
+        /// 鎶ヨ浠g爜
+        /// </summary>
+        [Description("鎶ヨ浠g爜")]
+        public short R_AlarmCode { get; set; }
+
+        /// <summary>
+        /// 鎶ヨ浠g爜鍐呭锛岄潪DB鍧楀唴瀹�
+        /// </summary>
+        [Description("鎶ヨ浠g爜鍐呭锛岄潪DB鍧楀唴瀹�")]
+        public string R_AlarmCodeMsg { get; set; }
+
+        /// <summary>
+        /// 褰撳墠鐩爣鍦板潃
+        /// </summary>
+        [Description("褰撳墠鐩爣鍦板潃")]
+        public short R_Destination { get; set; }
+
+        /// <summary>
+        /// 璐у舰
+        /// </summary>
+        [Description("璐у舰")]
+        public short R_Shape { get; set; }
+
+        /// <summary>
+        /// 褰撳墠浠诲姟鍙�
+        /// </summary>
+        [Description("褰撳墠浠诲姟鍙�")]
+        public int R_TaskID { get; set; }
+    }
+
+    public class StationDBForReadComm
+    {
+        /// <summary>
+        /// 绔欑偣缂栧彿
+        /// </summary>
+        [Description("绔欑偣缂栧彿")]
+        public string StationCode { get; set; }
+
+        /// <summary>
+        /// 璇锋眰瑙f瀽璇荤爜鏁版嵁
+        /// </summary>
+        [Description("璇锋眰瑙f瀽璇荤爜鏁版嵁")]
+        public string R_ReqParseData { get; set; }
+
+        /// <summary>
+        /// 璇荤爜鍣ㄨ鐮佺粨鏋�
+        /// </summary>
+        [Description("璇荤爜鍣ㄨ鐮佺粨鏋�")]
+        public String R_ReadCodeResult { get; set; }
+
+        /// <summary>
+        /// 鍏夌數1鐘舵��
+        /// </summary>
+        [Description("鍏夌數1鐘舵��")]
+        public string R_PH_1 { get; set; }
+
+        /// <summary>
+        /// 鍏夌數2鐘舵��
+        /// </summary>
+        [Description("鍏夌數2鐘舵��")]
+        public string R_PH_2 { get; set; }
+
+        /// <summary>
+        /// 鏀跺埌浠诲姟涓嬪彂鍙嶉
+        /// </summary>
+        [Description("鏀跺埌浠诲姟涓嬪彂鍙嶉")]
+        public string R_ACK { get; set; }
+
+        /// <summary>
+        /// 妯″紡
+        /// </summary>
+        [Description("妯″紡")]
+        public string R_Model { get; set; }
+
+        /// <summary>
+        /// 杩愯鐘舵��
+        /// </summary>
+        [Description("杩愯鐘舵��")]
+        public string R_State { get; set; }
+
+        /// <summary>
+        /// 鎶ヨ浠g爜
+        /// </summary>
+        [Description("鎶ヨ浠g爜")]
+        public string R_AlarmCode { get; set; }
+
+        /// <summary>
+        /// 褰撳墠鐩爣鍦板潃
+        /// </summary>
+        [Description("褰撳墠鐩爣鍦板潃")]
+        public string R_Destination { get; set; }
+
+        /// <summary>
+        /// 澶栧舰妫�娴�
+        /// </summary>
+        [Description("澶栧舰妫�娴�")]
+        public string R_Shape { get; set; }
+
+        /// <summary>
+        /// 褰撳墠浠诲姟鍙�
+        /// </summary>
+        [Description("褰撳墠浠诲姟鍙�")]
+        public string R_TaskID { get; set; }
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDB2Obj.cs b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDB2Obj.cs
new file mode 100644
index 0000000..9b76bd8
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDB2Obj.cs
@@ -0,0 +1,213 @@
+锘�
+using iWareSda.Devices._3_Station.StationModel;
+using System.Collections.Generic;
+using System.ComponentModel;
+namespace iWareSda
+{
+    /// <summary>
+    /// Station灞曠ず瀹炰綋绫�
+    /// </summary>
+    public class StationDB2Obj
+    {
+
+        #region 鍐欏叆鐨凷tation淇℃伅
+        /// <summary>
+        /// 蹇冭烦
+        /// </summary>
+        [Description("蹇冭烦")]
+        public bool W_HandShake { get; set; }
+
+        /// <summary>
+        /// 1015閲嶆柊鎵爜锛屽啓涓簍rue琛ㄧず閲嶆柊鎵爜锛屽啓涓篺alse锛岃〃绀哄叧闂噸鏂版壂鐮併�傚綋wcs璇诲埌鍊煎悗锛屽氨鍐欎负false
+        /// </summary>
+        [Description("1015閲嶆柊鎵爜")]
+        public bool W_1015_ReScan { get; set; }
+
+        /// <summary>
+        /// 1019閲嶆柊鎵爜锛屽啓涓簍rue琛ㄧず閲嶆柊鎵爜锛屽啓涓篺alse锛岃〃绀哄叧闂噸鏂版壂鐮併�傚綋wcs璇诲埌鍊煎悗锛屽氨鍐欎负false
+        /// </summary>
+        [Description("1019閲嶆柊鎵爜")]
+        public bool W_1019_ReScan { get; set; }
+
+        /// <summary>
+        /// Station_瀹屾垚ACK
+        /// </summary>
+        [Description("Station_瀹屾垚ACK")]
+        public bool W_Station_FinishACK { get; set; }
+
+        /// <summary>
+        /// 1002鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1002鎵弿澶辫触淇″彿")]
+        public bool W_1002_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1004鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1004鎵弿澶辫触淇″彿")]
+        public bool W_1004_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1006鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1006鎵弿澶辫触淇″彿")]
+        public bool W_1006_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1007鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1007鎵弿澶辫触淇″彿")]
+        public bool W_1007_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1002鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1002鎵弿鎴愬姛淇″彿")]
+        public bool W_1002_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1004鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1004鎵弿鎴愬姛淇″彿")]
+        public bool W_1004_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1006鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1006鎵弿鎴愬姛淇″彿")]
+        public bool W_1006_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1007鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1007鎵弿鎴愬姛淇″彿")]
+        public bool W_1007_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑鍨嬪彿 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑鍨嬪彿")]
+        public string W_Out_MaterialModel { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑璁㈣揣鍙� 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑璁㈣揣鍙�")]
+        public string W_Out_OrderNo { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑缂栧彿 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑缂栧彿")]
+        public string W_Out_SerialNumber { get; set; }
+
+
+        #region 鍐欑殑绔欑偣
+
+        public List<StationDB2ObjForWriteComm> W_StationForWriteCommList { get; set; }
+
+        #endregion
+
+
+       
+        #endregion
+
+        #region 璇诲彇鍒扮殑Station淇℃伅
+        /// <summary>
+        /// 蹇冭烦
+        /// </summary>
+        [Description("蹇冭烦")]
+        public int R_HandShake { get; set; }
+        /// <summary>
+        /// Station缂栧彿
+        /// </summary>
+        [Description("Station缂栧彿")]
+        public string R_StationNo { get; set; }
+
+
+        /// <summary>
+        /// 1015鎵爜
+        /// </summary>
+        [Description("1015鎵爜")]
+        public string R_1015_Scan { get; set; }
+
+        /// <summary>
+        /// 1019鎵爜
+        /// </summary>
+        [Description("1019鎵爜")]
+        public string R_1019_Scan { get; set; }
+
+        /// <summary>
+        /// 1019鍙戝姩鏈虹殑鎵爜
+        /// </summary>
+        [Description("1019鍙戝姩鏈虹殑鎵爜")]
+        public string R_1019_CargoNoScan { get; set; }
+
+        /// <summary>
+        /// 1002鎵爜
+        /// </summary>
+        [Description("1002鎵爜")]
+        public string R_1002_Scan { get; set; }
+
+        /// <summary>
+        /// 1004鎵爜
+        /// </summary>
+        [Description("1004鎵爜")]
+        public string R_1004_Scan { get; set; }
+
+        /// <summary>
+        /// 1006鎵爜
+        /// </summary>
+        [Description("1006鎵爜")]
+        public string R_1006_Scan { get; set; }
+
+
+        /// <summary>
+        /// 1007鎵爜
+        /// </summary>
+        [Description("1007鎵爜")]
+        public string R_1007_Scan { get; set; }
+
+        /// <summary>
+        /// 1009鐨�1灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�1灞傛娴嬪厜鐢�")]
+        public bool R_1009_High1 { get; set; }
+
+        /// <summary>
+        /// 1009鐨�2灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�2灞傛娴嬪厜鐢�")]
+        public bool R_1009_High2 { get; set; }
+
+        /// <summary>
+        /// 1009鐨�3灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�3灞傛娴嬪厜鐢�")]
+        public bool R_1009_High3 { get; set; }
+
+
+        /// <summary>
+        /// Station浠诲姟瀹屾垚
+        /// </summary>
+        [Description("Station浠诲姟瀹屾垚")]
+        public bool R_Station_Finish { get; set; }
+
+
+        /// <summary>
+        /// Station褰撳墠鍧愭爣
+        /// </summary>
+        [Description("Station褰撳墠鍧愭爣")]
+        public int R_Station_Coordinate { get; set; }
+
+        #region 璇荤殑绔欑偣
+
+        public List<StationDB2ObjForReadComm> R_StationForReadCommList { get; set; }
+
+        #endregion
+
+        
+
+        #endregion
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForRead.cs b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForRead.cs
new file mode 100644
index 0000000..3b76f37
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForRead.cs
@@ -0,0 +1,106 @@
+锘縰sing iWareSda.Devices._3_Station.StationModel;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace iWareSda
+{
+    //Station鍦板潃绫�
+    public class StationDBForRead
+    {
+        #region 璇诲彇鍒扮殑Station淇℃伅
+        /// <summary>
+        /// 蹇冭烦
+        /// </summary>
+        [Description("蹇冭烦")]
+        public string R_HandShake { get; set; }
+
+
+        /// <summary>
+        /// 1015鎵爜
+        /// </summary>
+        [Description("1015鎵爜")]
+        public string R_1015_Scan { get; set; }
+
+        /// <summary>
+        /// 1019鎵爜
+        /// </summary>
+        [Description("1019鎵爜")]
+        public string R_1019_Scan { get; set; }
+
+        /// <summary>
+        /// 1019鍙戝姩鏈虹殑鎵爜
+        /// </summary>
+        [Description("1019鍙戝姩鏈虹殑鎵爜")]
+        public string R_1019_CargoNoScan { get; set; }
+
+        /// <summary>
+        /// 1002鎵爜
+        /// </summary>
+        [Description("1002鎵爜")]
+        public string R_1002_Scan { get; set; }
+
+        /// <summary>
+        /// 1004鎵爜
+        /// </summary>
+        [Description("1004鎵爜")]
+        public string R_1004_Scan { get; set; }
+
+        /// <summary>
+        /// 1006鎵爜
+        /// </summary>
+        [Description("1006鎵爜")]
+        public string R_1006_Scan { get; set; }
+
+
+        /// <summary>
+        /// 1007鎵爜
+        /// </summary>
+        [Description("1007鎵爜")]
+        public string R_1007_Scan { get; set; }
+
+        /// <summary>
+        /// 1009鐨�1灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�1灞傛娴嬪厜鐢�")]
+        public string R_1009_High1 { get; set; }
+
+        /// <summary>
+        /// 1009鐨�2灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�2灞傛娴嬪厜鐢�")]
+        public string R_1009_High2 { get; set; }
+
+        /// <summary>
+        /// 1009鐨�3灞傛娴嬪厜鐢�
+        /// </summary>
+        [Description("1009鐨�3灞傛娴嬪厜鐢�")]
+        public string R_1009_High3 { get; set; }
+
+        /// <summary>
+        /// Station浠诲姟瀹屾垚
+        /// </summary>
+        [Description("Station浠诲姟瀹屾垚")]
+        public string R_Station_Finish { get; set; }
+
+
+        /// <summary>
+        /// Station褰撳墠鍧愭爣
+        /// </summary>
+        [Description("Station褰撳墠鍧愭爣")]
+        public string R_Station_Coordinate { get; set; }
+
+        #region 璇荤殑绔欑偣
+
+        public List<StationDBForReadComm> R_StationForReadCommList { get; set; }
+
+        #endregion
+
+        
+
+        #endregion
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForWrite.cs b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForWrite.cs
new file mode 100644
index 0000000..2c463ce
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/DB/RgvDBForWrite.cs
@@ -0,0 +1,121 @@
+锘縰sing iWareSda.Devices._3_Station.StationModel;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace iWareSda
+{
+    //Station鍦板潃绫�
+    public class StationDBForWrite
+    {
+
+        #region 鍐欏叆鐨凷tation淇℃伅
+        /// <summary>
+        /// 蹇冭烦
+        /// </summary>
+        [Description("蹇冭烦")]
+        public string W_HandShake { get; set; }
+
+        /// <summary>
+        /// 1015閲嶆柊鎵爜锛屽啓涓簍rue琛ㄧず閲嶆柊鎵爜锛屽啓涓篺alse锛岃〃绀哄叧闂噸鏂版壂鐮併�傚綋wcs璇诲埌鍊煎悗锛屽氨鍐欎负false
+        /// </summary>
+        [Description("1015閲嶆柊鎵爜")]
+        public string W_1015_ReScan { get; set; }
+
+        /// <summary>
+        /// 1019閲嶆柊鎵爜锛屽啓涓簍rue琛ㄧず閲嶆柊鎵爜锛屽啓涓篺alse锛岃〃绀哄叧闂噸鏂版壂鐮併�傚綋wcs璇诲埌鍊煎悗锛屽氨鍐欎负false
+        /// </summary>
+        [Description("1019閲嶆柊鎵爜")]
+        public string W_1019_ReScan { get; set; }
+
+        /// <summary>
+        /// Station_瀹屾垚ACK
+        /// </summary>
+        [Description("Station_瀹屾垚ACK")]
+        public string W_Station_FinishACK { get; set; }
+
+
+        /// <summary>
+        /// 1002鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1002鎵弿澶辫触淇″彿")]
+        public string W_1002_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1004鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1004鎵弿澶辫触淇″彿")]
+        public string W_1004_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1006鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1006鎵弿澶辫触淇″彿")]
+        public string W_1006_ScanFailACK { get; set; }
+
+        /// <summary>
+        /// 1007鎵弿澶辫触淇″彿
+        /// </summary>
+        [Description("1007鎵弿澶辫触淇″彿")]
+        public string W_1007_ScanFailACK { get; set; }
+
+
+        /// <summary>
+        /// 1002鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1002鎵弿鎴愬姛淇″彿")]
+        public string W_1002_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1004鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1004鎵弿鎴愬姛淇″彿")]
+        public string W_1004_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1006鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1006鎵弿鎴愬姛淇″彿")]
+        public string W_1006_ScanSuccessACK { get; set; }
+
+        /// <summary>
+        /// 1007鎵弿鎴愬姛淇″彿
+        /// </summary>
+        [Description("1007鎵弿鎴愬姛淇″彿")]
+        public string W_1007_ScanSuccessACK { get; set; }
+
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑鍨嬪彿 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑鍨嬪彿")]
+        public string W_Out_MaterialModel { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑璁㈣揣鍙� 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑璁㈣揣鍙�")]
+        public string W_Out_OrderNo { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙戝姩鏈虹殑缂栧彿 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        [Description("鍑哄簱鍙戝姩鏈虹殑缂栧彿")]
+        public string W_Out_SerialNumber { get; set; }
+
+
+
+
+        #region 鍐欑殑绔欑偣
+
+        public List<StationDBForWriteComm> W_StationForWriteCommList { get; set; }
+
+        #endregion
+
+
+        #endregion
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
new file mode 100644
index 0000000..cf1e1d2
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
@@ -0,0 +1,779 @@
+锘�
+
+using iWareSda.Common;
+using System.Linq;
+using iWareModel;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using iWareCommon.Utils;
+using iWareCommon.Common.Globle;
+using iWareCommon;
+using iWareSda.Devices._3_Station.StationModel;
+using Newtonsoft.Json;
+using iWareSda.Model;
+
+
+namespace iWareSda
+{
+    public class StationEntity : IDevice
+    {
+        public StationEntity()
+        {
+
+        }
+
+        #region OPC鐩稿叧
+
+        /// <summary>
+        /// 鍐欑殑DB鍧�
+        /// </summary>
+        public StationDBForWrite DBBlockForWrite { get; set; }
+
+        /// <summary>
+        /// 璇荤殑DB鍧�
+        /// </summary>
+        public StationDBForRead DBBlockForRead { get; set; }
+
+        /// <summary>
+        /// 璇诲彇PLC瀹炰緥
+        /// </summary>
+        public PLCService plcService { get; set; }
+
+        /// <summary>
+        /// 瑙嗗浘瀵硅薄
+        /// </summary>
+        public StationView View { get; set; }
+
+
+        #endregion
+
+
+        /// <summary>
+        /// 鍒濆鍖栨暟鎹�
+        /// </summary>
+        public void InitData()
+        {
+
+
+        }
+        public StationEntity(string srmName, int deviceId, StationDBForWrite _dbBlockForWrite, StationDBForRead _dbBlockForRead, PLCService _plcService)
+        {
+            this.View = new StationView();
+            this.View.DeviceName = srmName;
+            this.View.DeviceId = deviceId;
+
+            //闆嗗悎璧嬪�煎垵濮嬪寲
+            this.View.R_StationForReadCommList = new List<StationDB2ObjForReadComm>();
+            this.View.W_StationForWriteCommList = new List<StationDB2ObjForWriteComm>();
+            for (int i = 0; i < WareSdaStruct.StationStationList.Count; i++)
+            {
+                this.View.R_StationForReadCommList.Add(new StationDB2ObjForReadComm() { StationCode = WareSdaStruct.StationStationList[i] });
+                this.View.W_StationForWriteCommList.Add(new StationDB2ObjForWriteComm() { StationCode = WareSdaStruct.StationStationList[i] });
+            }
+
+            plcService = _plcService;
+            DBBlockForWrite = _dbBlockForWrite;
+            DBBlockForRead = _dbBlockForRead;
+        }
+
+
+        #region 涓�у寲鏂规硶
+
+        /// <summary>
+        /// Station浠诲姟鍙戦��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="sourcePlce"></param>
+        /// <param name="toPlace"></param>
+        /// <param name="taskType"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool SendTask(int deviceId, int taskId, string sourcePlce, string toPlace, out string msg)
+        {
+            try
+            {
+                msg = "";
+                if (!CanSendTask(deviceId, out msg))
+                {
+                    return false;
+                }
+
+                //杩欓噷鐗规畩杞崲涓�涓�
+                if (toPlace == ((int)EDevice.鍑哄簱鍙�1012).ToString())
+                {
+                    toPlace = ((int)EDevice.鎻愬崌鏈�1030).ToString();
+                }
+
+
+                StationDBForWriteComm w_db_source = this.DBBlockForWrite.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == sourcePlce);
+                StationDB2ObjForWriteComm w_dbObj_source = this.View.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == sourcePlce);
+
+                //StationDBForWriteComm w_db_to = this.DBBlockForWrite.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == toPlace);
+                //StationDB2ObjForWriteComm w_dbObj_to = this.View.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == toPlace);
+                //濡傛灉ACK涓簍rue锛岃〃绀轰笉鑳藉彂浠诲姟
+                var readObj = this.View.R_StationForReadCommList.FirstOrDefault(x => x.StationCode == sourcePlce);
+                if (readObj.R_ACK == true)
+                {
+                    msg = "ACK涓篢RUE锛屼笉鍏佽鍙戜换鍔�";
+                    return false;
+                }
+
+                MessageModel b2 = null;
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation{0},璧风偣{1}鍙戦�佷换鍔2},鍐欏叆鐩爣绔欑偣{3}澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName, sourcePlce, taskId, toPlace);
+                    return false;
+                }
+                b2 = this.plcService.WriteValuePoint(w_db_source.W_TaskID, Convert.ToInt32(taskId), w_dbObj_source.W_TaskID);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation{0},璧风偣{1}锛岀洰鏍囩偣{2},鍐欏叆浠诲姟鍙穥3}澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName, sourcePlce, toPlace, taskId);
+                    return false;
+                }
+              
+
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, "鍙戦�佷换鍔″嚭鐜板紓甯�:" + ex.Message, ex);
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 浠诲姟涓嬪彂纭(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool WriteStp(int deviceId, string stationCode, bool value, out string msg)
+        {
+            try
+            {
+                msg = "";
+                StationDBForWriteComm w_db = this.DBBlockForWrite.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == stationCode);
+                StationDB2ObjForWriteComm w_dbObj = this.View.W_StationForWriteCommList.FirstOrDefault(x => x.StationCode == stationCode);
+                MessageModel b2 = null;
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation{0},绔欑偣鍙穥1}鍐� 浠诲姟涓嬪彂纭(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛� " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.View.DeviceName, stationCode);
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("鍚慡tation{0},绔欑偣鍙穥1}鍐� 浠诲姟涓嬪彂纭(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛� " + true + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        deviceId, stationCode);
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 1015閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool Write1015ReScan(int deviceId, bool value, out string msg)
+        {
+            try
+            {
+                msg = "";
+                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1015_ReScan, value, this.View.W_1015_ReScan);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("鍚慡tation鍦板潃{0}  " + value + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        this.DBBlockForWrite.W_1015_ReScan);
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 1019閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool Write1019ReScan(int deviceId, bool value, out string msg)
+        {
+            try
+            {
+                msg = "";
+                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1019_ReScan, value, this.View.W_1019_ReScan);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1019_ReScan);
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("鍚慡tation鍦板潃{0}  " + value + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        this.DBBlockForWrite.W_1019_ReScan);
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+        /// <summary>
+        ///  Station鐨勪换鍔″畬鎴怉CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool WriteStation_FinishACK(int deviceId, bool value, int plcTaskId, out string msg)
+        {
+            try
+            {
+                msg = "";
+                Thread.Sleep(1000);//鍋滅暀2绉�
+                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_Station_FinishACK, value, this.View.W_Station_FinishACK);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_Station_FinishACK);
+                    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                    return false;
+                }
+                //閲嶆柊鍐嶈鍙栵紝鍒ゆ柇鏄惁鍐欏叆姝g‘锛屽鏋滃啓鍏ヤ笉姝g‘锛屽氨璁や负澶辫触 銆怑ditby shaocx,2023-04-03銆�
+                Thread.Sleep(1000);//鍋滅暀3绉�
+                bool finishStation = (bool)this.plcService.ReadValuePoint(this.DBBlockForRead.R_Station_Finish, typeof(bool));
+                bool finisAck = (bool)this.plcService.ReadValuePoint(this.DBBlockForWrite.W_Station_FinishACK, typeof(bool));
+                if (finisAck == false && finishStation == true)
+                {
+                    this.plcService.WriteValuePoint(this.DBBlockForWrite.W_Station_FinishACK, value, this.View.W_Station_FinishACK);//閲嶅彂涓�娆� 20230503 鐜嬮摦
+                    Thread.Sleep(1000);//鍋滅暀2绉�
+                    finishStation = (bool)this.plcService.ReadValuePoint(this.DBBlockForRead.R_Station_Finish, typeof(bool));
+                    finisAck = (bool)this.plcService.ReadValuePoint(this.DBBlockForWrite.W_Station_FinishACK, typeof(bool));
+                    if (finisAck == false && finishStation == true)
+                    {
+
+                        msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,SDA杩斿洖缁撴灉:true锛屼絾鏄疭DA鍐嶆璇诲彇PLC鐨勫湴鍧�鏃讹紝鑾峰彇鐨勭粨鏋滄槸FALSE锛屽嵆璁ゅ畾涓哄啓鍏ュけ璐�",
+                                            this.DBBlockForWrite.W_Station_FinishACK);
+                        Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                        return false;
+                    }
+
+
+                }
+
+                Log4NetHelper.WriteInfoLog(Station_CacheEntity.curLogType, "鍐欏叆W_Station_FinishACK锛�" + this.DBBlockForWrite.W_Station_FinishACK + "锛夊�间负" + value + "鎴愬姛锛佸洜涓篜LC浠诲姟鍙�:" + plcTaskId);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("鍚慡tation鍦板潃{0}  " + value + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        this.DBBlockForWrite.W_Station_FinishACK);
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        ///  鍥涗釜鍏ュ簱鍙f壂鎻忛獙璇丄CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool WriteScanValidateACK(bool isReset, int deviceId, string stationCode, bool value, int plcTaskId, out string msg)
+        {
+            msg = "";
+            MessageModel b2 = null;
+            string address_fail = "";
+            string address_success = "";
+            try
+            {
+                switch (stationCode)
+                {
+                    case "1002":
+                        address_fail = this.DBBlockForWrite.W_1002_ScanFailACK;
+                        address_success = this.DBBlockForWrite.W_1002_ScanSuccessACK;
+                        break;
+                    case "1004":
+                        address_fail = this.DBBlockForWrite.W_1004_ScanFailACK;
+                        address_success = this.DBBlockForWrite.W_1004_ScanSuccessACK;
+                        break;
+                    case "1006":
+                        address_fail = this.DBBlockForWrite.W_1006_ScanFailACK;
+                        address_success = this.DBBlockForWrite.W_1006_ScanSuccessACK;
+                        break;
+                    case "1007":
+                        address_fail = this.DBBlockForWrite.W_1007_ScanFailACK;
+                        address_success = this.DBBlockForWrite.W_1007_ScanSuccessACK;
+                        break;
+                    default:
+                        throw new Exception("涓嶆敮鎸佺殑绔欑偣");
+                }
+                if (isReset)
+                {//鏄噸缃�
+                    b2 = this.plcService.WriteValuePoint(address_success, false, this.View.W_1002_ScanSuccessACK);
+                    if (!b2.result)
+                    {
+                        msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + false + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                           address_success);
+                        Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                        return false;
+                    }
+                    b2 = this.plcService.WriteValuePoint(address_fail, false, this.View.W_1002_ScanFailACK);
+                    if (!b2.result)
+                    {
+                        msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + false + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                           address_fail);
+                        Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                        return false;
+                    }
+                }
+                else
+                {//涓嶆槸閲嶇疆
+                    if (value)
+                    {//琛ㄧず鎵弿楠岃瘉閫氳繃
+                        b2 = this.plcService.WriteValuePoint(address_success, true, this.View.W_1002_ScanSuccessACK);
+                        if (!b2.result)
+                        {
+                            msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                               address_success);
+                            Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                            return false;
+                        }
+                    }
+                    else
+                    {//琛ㄧず鎵弿楠岃瘉涓嶉�氳繃
+                        b2 = this.plcService.WriteValuePoint(address_fail, true, this.View.W_1002_ScanFailACK);
+                        if (!b2.result)
+                        {
+                            msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                               address_fail);
+                            Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                            return false;
+                        }
+                    }
+                }
+
+                Log4NetHelper.WriteInfoLog(Station_CacheEntity.curLogType, "WriteScanFailACK鏂规硶锛屽啓鍏� 鍥涗釜鍏ュ簱鍙f壂鎻忓け璐CK璧嬪�� ScanFailACK锛�" + address_fail + "锛夊�间负" + value + "鎴愬姛锛佸洜涓篜LC浠诲姟鍙�:" + plcTaskId + ",isReset:" + isReset);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = string.Format("WriteScanFailACK鏂规硶锛屽悜Station鍦板潃{0}  " + value + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                       address_fail);
+                if (value)
+                {
+                    logcontext = string.Format("WriteScanFailACK鏂规硶锛屽悜Station鍦板潃{0}  " + value + "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                       address_success);
+                }
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 鍙栨秷鎶ヨ
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool ClearAlarm(int deviceId, out string msg)
+        {
+            msg = "";
+            return true;
+            //try
+            //{
+            //    msg = "";
+            //    var dbNumber = Station_CacheEntity.W_DBHeader;
+            //    MessageModel b2 = this.plcService.WriteValuePoint( this.DBBlockForWrite.W_Reset, true, this.View.W_Reset);
+            //    if (!b2.result)
+            //    {
+            //        msg = string.Format("鍚慡tation{0}鍐欏叆璁惧澶嶄綅" + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName);
+            //        return false;
+            //    }
+            //    return true;
+            //}
+            //catch (Exception ex)
+            //{
+            //    msg = ex.Message;
+            //    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, "鍙栨秷鎶ヨ鍑虹幇寮傚父:" + ex.Message, ex);
+            //    return false;
+            //}
+        }
+
+        /// <summary>
+        /// 浠诲姟鍒犻櫎
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool DeleteTask(int deviceId, int taskId, out string msg)
+        {
+            msg = "";
+            return true;
+            //try
+            //{
+            //    msg = "";
+            //    if (this.View.R_TaskNo != taskId)
+            //    {
+            //        msg = string.Format("Station褰撳墠闈炴墽琛宼askId={0}鐨勪换鍔�", taskId);
+            //        return false;
+            //    }
+            //    var dbNumber = Station_CacheEntity.W_DBHeader;
+            //    MessageModel b2 = this.plcService.WriteValuePoint( this.DBBlockForWrite.W_TaskNo, taskId, this.View.W_TaskNo);
+            //    if (!b2.result)
+            //    {
+            //        msg = string.Format("鍚慡tation{0}鍐欏叆浠诲姟鍙�" + taskId + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName);
+            //        return false;
+            //    }
+            //    b2 = this.plcService.WriteValuePoint( this.DBBlockForWrite.W_Reset, 1, this.View.W_Reset);
+            //    if (!b2.result)
+            //    {
+            //        msg = string.Format("鍚慡tation{0}鍐欏叆璁惧澶嶄綅" + 1 + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName);
+            //        return false;
+            //    }
+            //    return true;
+            //}
+            //catch (Exception ex)
+            //{
+            //    msg = ex.Message;
+            //    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, "浠诲姟鍒犻櫎鍑虹幇寮傚父:" + ex.Message, ex);
+            //    return false;
+            //}
+        }
+
+        /// <summary>
+        /// 鎬ュ仠
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool EmergencyStop(int deviceId, string stationCode, out string msg)
+        {
+            msg = "";
+            return true;
+            //try
+            //{
+            //    msg = "";
+            //    var dbNumber = Station_CacheEntity.W_DBHeader;
+            //    MessageModel b2 = this.plcService.WriteValuePoint( this.DBBlockForWrite.W_StationForWriteCommList.Find(x => x.StationCode == stationCode)., 1, this.View.W_EStop);
+            //    if (!b2.result)
+            //    {
+            //        msg = string.Format("鍚慡tation{0}鍐欏叆鎬ュ仠" + 1 + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName);
+            //        return false;
+            //    }
+            //    return true;
+            //}
+            //catch (Exception ex)
+            //{
+            //    msg = ex.Message;
+            //    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, "鎬ュ仠鍑虹幇寮傚父:" + ex.Message, ex);
+            //    return false;
+            //}
+        }
+
+        /// <summary>
+        /// 鏄惁鍙互鍙戦�佷换鍔�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskType"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool CanSendTask(int deviceId, out string msg)
+        {
+            msg = "";
+            //妯℃嫙
+            //if (!this.View.IsConnected)
+            //{
+            //    msg = "宸茬绾�";
+            //    return false;
+            //}
+            //if (this.View.R_Mode != (int)EStationMode.杩炴満鑷姩妯″紡)
+            //{
+            //    msg = "褰撳墠闈炶嚜鍔ㄦā寮�";
+            //    return false;
+            //}
+            //if (this.View.R_State != (int)EStationState.绌洪棽)
+            //{
+            //    msg = "璁惧鐘舵�侀潪绌洪棽锛屾棤娉曟墽琛屽叾浠栦换鍔�";
+            //    return false;
+            //}
+            return true;
+        }
+
+        /// <summary>
+        /// Station鏄惁鏄嚜鍔ㄥ緟鏈烘ā寮�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool StationIsAutoAwaitMode(string stationCode, out string msg)
+        {
+            msg = "";
+            var readData = this.View.R_StationForReadCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+            if (readData.R_Model != (int)EStationMode.鑷姩寰呮満妯″紡)
+            {
+                EStationMode mode = (EStationMode)Enum.Parse(typeof(EStationMode), readData.R_Model.ToString());
+                msg = "绔欑偣" + stationCode + " 褰撳墠妯″紡鏄痆" + mode.ToString() + "],闈炶嚜鍔ㄥ緟鏈烘ā寮�";
+                return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// Station鏄惁鏄嚜鍔ㄦā寮�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool StationIsAuto(string stationCode, out string msg)
+        {
+            msg = "";
+            var readData = this.View.R_StationForReadCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+            if (readData.R_Model != (int)EStationMode.鑷姩寰呮満妯″紡 && readData.R_Model != (int)EStationMode.鑷姩杩愯妯″紡)
+            {
+                EStationMode mode = (EStationMode)Enum.Parse(typeof(EStationMode), readData.R_Model.ToString());
+                msg = "绔欑偣" + stationCode + " 褰撳墠妯″紡鏄痆" + mode.ToString() + "],闈炶嚜鍔ㄥ緟鏈烘ā寮忔垨鑷姩杩愯妯″紡";
+                return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// Station鏄惁鏄┖闂茬姸鎬�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool StationIsStateFree(string stationCode, out string msg)
+        {
+            msg = "";
+            var readData = this.View.R_StationForReadCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+            if (readData.R_State != (int)EStationState.绌洪棽)
+            {
+                EStationMode mode = (EStationMode)Enum.Parse(typeof(EStationMode), readData.R_Model.ToString());
+                msg = "绔欑偣" + stationCode + " 褰撳墠鐘舵�佹槸[" + mode.ToString() + "],闈炵┖闂�";
+                return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        ///  鍙戝姩鏈哄嚭搴擄紝缁欒タ娓疨LC鍙戦�佸彂鍔ㄦ満鏁版嵁 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool WriteStation_XigangGetDataForOut(int deviceId, string value__Out_MaterialModel,
+            string value_Out_OrderNo,
+            string value_Out_SerialNumber,
+            int plcTaskId, out string msg)
+        {
+            try
+            {
+                msg = "";
+                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_Out_MaterialModel, value__Out_MaterialModel, this.View.W_Out_MaterialModel);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value__Out_MaterialModel + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_Out_MaterialModel);
+                    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                    return false;
+                }
+                b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_Out_OrderNo, value_Out_OrderNo, this.View.W_Out_OrderNo);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value_Out_OrderNo + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_Out_OrderNo);
+                    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                    return false;
+                }
+                b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_Out_SerialNumber, value_Out_SerialNumber, this.View.W_Out_SerialNumber);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value_Out_SerialNumber + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_Out_SerialNumber);
+                    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, msg, null);
+                    return false;
+                }
+
+
+                Log4NetHelper.WriteInfoLog(Station_CacheEntity.curLogType, $"鍐欏叆 鍙戝姩鏈哄嚭搴擄紝缁欒タ娓疨LC鍙戦�佸彂鍔ㄦ満鏁版嵁鎴愬姛锛佷换鍔″彿{plcTaskId},鏈哄瀷{value__Out_MaterialModel}锛岃璐у彿{value_Out_OrderNo},缂栧彿{value_Out_SerialNumber}" + plcTaskId);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                var logcontext = $"浠诲姟鍙穥plcTaskId},鏈哄瀷{value__Out_MaterialModel}锛岃璐у彿{value_Out_OrderNo},缂栧彿{value_Out_SerialNumber},鍐欏叆 鍙戝姩鏈哄嚭搴擄紝缁欒タ娓疨LC鍙戦�佸彂鍔ㄦ満鏁版嵁鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex);
+                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
+                return false;
+            }
+        }
+
+        #endregion
+
+        public void SetPropertyValueForRead()
+        {
+            var r_dbBlock = this.DBBlockForRead;
+            SdaHelper.SetPropertyValueForDB<StationDBForRead, StationView>(r_dbBlock, this.View, this.plcService, "");
+            //鐗规畩澶勭悊List闆嗗悎
+            foreach (var item in r_dbBlock.R_StationForReadCommList)
+            {
+                StationDB2ObjForReadComm StationDB2ObjForReadComm = this.View.R_StationForReadCommList.Where(x => x.StationCode == item.StationCode).First();
+                SdaHelper.SetPropertyValueForDB<StationDBForReadComm, StationDB2ObjForReadComm>(item, StationDB2ObjForReadComm, this.plcService, "");
+            }
+            //杩欓噷鐗规畩澶勭悊 璇诲彇鐨勫彂鍔ㄦ満鐮� 
+            this.View.R_1019_CargoNoScan = GetNewCategoryNo(this.View.R_1019_CargoNoScan);
+        }
+
+
+        public void SetPropertyValueForWrite()
+        {
+            var w_dbBlock = this.DBBlockForWrite;
+            SdaHelper.SetPropertyValueForDB<StationDBForWrite, StationView>(w_dbBlock, this.View, this.plcService, "");
+            //鐗规畩澶勭悊List闆嗗悎
+            foreach (var item in w_dbBlock.W_StationForWriteCommList)
+            {
+                StationDB2ObjForWriteComm StationDB2ObjForWriteComm = this.View.W_StationForWriteCommList.Where(x => x.StationCode == item.StationCode).First();
+                SdaHelper.SetPropertyValueForDB<StationDBForWriteComm, StationDB2ObjForWriteComm>(item, StationDB2ObjForWriteComm, this.plcService, "");
+            }
+        }
+
+        /// <summary>
+        /// 鏄惁鏈夊績璺�
+        /// </summary>
+        /// <returns></returns>
+        public bool IsHaveHeatBeat()
+        {
+            try
+            {
+                var r_dbBlock = this.DBBlockForRead;
+                short value = Convert.ToInt16(this.plcService.ReadValuePoint(r_dbBlock.R_HandShake, typeof(short)));
+                //绾﹀畾 绛夊緟2绉�
+                Thread.Sleep(2000);
+                short value_next = Convert.ToInt16(this.plcService.ReadValuePoint(r_dbBlock.R_HandShake, typeof(short)));
+                if (value == value_next)
+                {//娌℃湁蹇冭烦
+                    return false;
+                }
+                else
+                {//鏈夊績璺�
+                    return true;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        #region 鑾峰彇褰撳墠鎶ヨ淇℃伅
+
+
+        /// <summary>
+        /// 鑾峰彇Station褰撳墠鎶ヨ淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public List<DeviceWarningInfo> GetStationAlertDatas()
+        {
+            List<DeviceWarningInfo> db_warningList = new List<DeviceWarningInfo>();
+            try
+            {
+                string _dbValue;
+                var isHasAlert = false;
+                IDictionary<string, string> StationAlertDict = new Dictionary<string, string>();
+                StationAlertDict = WareSdaStruct.StationAlertDict;
+                foreach (var item in StationAlertDict)
+                {
+                    _dbValue = item.Key;
+                    isHasAlert = Convert.ToBoolean(this.plcService.ReadValuePoint(Station_CacheEntity.R_DBHeader_Station_Alert, item.Key, typeof(bool)));
+                    if (isHasAlert)
+                    {
+                        db_warningList.Add(new DeviceWarningInfo()
+                        {
+                            Address = item.Key,
+                            Code = item.Key,
+                            Context = item.Value.Trim()
+                        });
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return db_warningList;
+        }
+
+        /// <summary>
+        /// 鑾峰彇杈撻�佺嚎褰撳墠鎶ヨ淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public List<DeviceWarningInfo> GetLineAlertDatas()
+        {
+            List<DeviceWarningInfo> db_warningList = new List<DeviceWarningInfo>();
+            try
+            {
+                IDictionary<string, string> srmAlertDict = new Dictionary<string, string>();
+                foreach (var item in this.View.R_StationForReadCommList)
+                {
+                    if (item.R_AlarmCode > 0)
+                    {
+                        item.R_AlarmCodeMsg = WareSdaStruct.StationAlertDict[item.R_AlarmCode.ToString()];
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return db_warningList;
+        }
+
+
+        #endregion
+
+        /// <summary>
+        /// 鐗规畩澶勭悊涓� 璇诲彇鐨勫彂鍔ㄦ満鐮�
+        /// </summary>
+        /// <param name="orgCategoryNo"></param>
+        /// <returns></returns>
+        private string GetNewCategoryNo(string orgCategoryNo)
+        {
+            Log4NetHelper.WriteInfoLog(Station_CacheEntity.curLogType, "璇诲彇鐨勫彂鍔ㄦ満鐮�,鍘熷璇诲彇鐨勫��:" + orgCategoryNo);
+            //濡傛灉鏈� $R鍐呭锛屽氨鏇挎崲涓虹┖
+            var repStr = "$R";
+            if (!string.IsNullOrEmpty(orgCategoryNo) && orgCategoryNo.IndexOf(repStr) > -1)
+            {
+                orgCategoryNo = orgCategoryNo.Replace(repStr, "");
+            }
+            Log4NetHelper.WriteInfoLog(Station_CacheEntity.curLogType, "璇诲彇鐨勫彂鍔ㄦ満鐮�,鏇挎崲鍚庣殑鍊�:" + orgCategoryNo);
+            return orgCategoryNo;
+        }
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationView.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationView.cs
new file mode 100644
index 0000000..75318ff
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationView.cs
@@ -0,0 +1,43 @@
+锘�
+using iWareSda.Model;
+using System.Collections.Generic;
+using System.ComponentModel;
+namespace iWareSda
+{
+    /// <summary>
+    /// Station灞曠ず瀹炰綋绫�
+    /// </summary>
+    public class StationView : StationDB2Obj
+    {
+        /// <summary>
+        /// 璁惧鍚嶇О
+        /// </summary>
+        [Description("璁惧鍚嶇О")]
+        public string DeviceName { get; set; }
+        /// <summary>
+        /// 璁惧缂栧彿
+        /// </summary>
+        [Description("璁惧缂栧彿")]
+        public int DeviceId { get; set; }
+
+        /// <summary>
+        /// 鏄惁宸茬粡杩炴帴
+        /// </summary>
+        [Description("鏄惁宸茬粡杩炴帴")]
+        public bool IsConnected { get; set; }
+
+
+        /// <summary>
+        /// 杈撻�佺嚎鎶ヨDB闆嗗悎
+        /// </summary>
+        [Description("鎶ヨDB闆嗗悎")]
+        public List<DeviceWarningInfo> R_Line_WarningDBList { get; set; }
+
+        /// <summary>
+        /// Station鎶ヨDB闆嗗悎
+        /// </summary>
+        [Description("Station鎶ヨDB闆嗗悎")]
+        public List<DeviceWarningInfo> R_Station_WarningDBList { get; set; }
+
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/Station_CacheEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/Station_CacheEntity.cs
new file mode 100644
index 0000000..81fb0af
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/Station_CacheEntity.cs
@@ -0,0 +1,314 @@
+锘縰sing iWareCommon.Utils;
+using iWareModel;
+using iWareSda.Devices._3_Station.StationModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace iWareSda
+{
+    /// <summary>
+    /// Station瀹炰綋绫�
+    /// </summary>
+    public static class Station_CacheEntity
+    {
+        public static LogType curLogType = LogType.StationSdaService;
+
+        #region Station1
+
+        /// <summary>
+        /// 鍐欏叆DB
+        /// </summary>
+        public static string W_DBHeaderWithSeparate = "610" + WareSdaStruct.PLCDBADDRESS_SEPARATE;
+        /// <summary>
+        /// 璇诲彇DB
+        /// </summary>
+        public static string R_DBHeaderWithSeparate = "600" + WareSdaStruct.PLCDBADDRESS_SEPARATE;
+
+        /// <summary>
+        /// 璇诲彇DB(鎵爜)
+        /// </summary>
+        public static string R_DBHeader_ScanWithSeparate = "80" + WareSdaStruct.PLCDBADDRESS_SEPARATE;
+
+        /// <summary>
+        /// 璇诲彇DB(鎶ヨ涓撶敤)
+        /// </summary>
+        public static string R_DBHeader_Alert = "91" + WareSdaStruct.PLCDBADDRESS_SEPARATE;
+
+        /// <summary>
+        /// 璇诲彇DB(Station鎶ヨ涓撶敤)
+        /// </summary>
+        public static string R_DBHeader_Station_Alert = "1090";
+
+
+        /// <summary>
+        /// 瑗挎腐鏂归噰闆嗗嚭搴撳彂鍔ㄦ満鏁版嵁锛屽啓鍏B 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        public static string W_DBHeaderForXigangGetDataWithSeparate = "3" + WareSdaStruct.PLCDBADDRESS_SEPARATE;
+
+        private static StationDBForWrite _dbBlockForWrite = SetW_StationForWriteCommList();
+
+
+        private static StationDBForRead _dbBlockForRead = SetR_StationForWriteCommList();
+
+
+        private static HslCommunicationParam hslCommunicationParam = new HslCommunicationParam()
+        {
+            cpu = WareSdaStruct.Station_SiemensPLCS,
+            ip = WareSdaStruct.Station_Address,
+            rack = WareSdaStruct.Station_Rack,
+            slot = WareSdaStruct.Station_Slot,
+            port = WareSdaStruct.Station_Port
+        };
+        private static SS7Param s7Param = new SS7Param()
+        {
+            cpu = WareSdaStruct.Station_PLC_CpuType,
+            ip = WareSdaStruct.Station_Address,
+            rack = WareSdaStruct.Station_Rack,
+            slot = WareSdaStruct.Station_Slot,
+        };
+        private static PLCService PLCService = PLCFactory.GetOPCService(WareSdaStruct.System_PlcServiceTypeEnum, s7Param, hslCommunicationParam);
+        private static StationEntity Station = new StationEntity("Station", (int)EDevice.Station, _dbBlockForWrite, _dbBlockForRead, PLCService);
+
+        #endregion
+
+        private static List<StationEntity> _deviceObjList = null;
+        private static object objLock = new object();
+
+        /// <summary>
+        /// 鐢熸垚璁惧瀹炰綋绫�
+        /// </summary>
+        public static List<StationEntity> DeviceObjs
+        {
+            get
+            {
+                if (_deviceObjList == null)
+                {
+                    lock (objLock)
+                    {
+                        if (_deviceObjList == null)
+                        {
+                            _deviceObjList = new List<StationEntity>();
+                            _deviceObjList.Add(Station);
+                        }
+                    }
+                }
+                return Station_CacheEntity._deviceObjList;
+            }
+            set { Station_CacheEntity._deviceObjList = value; }
+        }
+
+        private static T GetDeviceObj<T>(int deviceId)
+        {
+            var device = Station_CacheEntity.DeviceObjs.FirstOrDefault(x => x.View.DeviceId == deviceId);
+            return (T)(Object)device;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇璁惧瀵硅薄
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        public static SdaResEntity GetDeviceObj(int deviceId)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            StationEntity Station = Station_CacheEntity.GetDeviceObj<StationEntity>(deviceId);
+            if (Station == null)
+            {
+                return SdaResEntity.Failure("娌℃湁鎵惧埌Station璁惧");
+            }
+            return SdaResEntity.Success("鎴愬姛", Station);
+        }
+
+
+        /// <summary>
+        /// 鍐欏叆鍦板潃闆嗗悎璧嬪��
+        /// </summary>
+        /// <param name="_dbBlockForWrite"></param>
+        /// <param name="_dbBlockForRead"></param>
+        private static StationDBForWrite SetW_StationForWriteCommList()
+        {
+            StationDBForWrite _dbBlockForWrite = new StationDBForWrite()
+            {
+                //TODO:杩欓噷鍐欓厤缃殑DB鍦板潃
+                #region 鍐欏叆
+                W_HandShake = W_DBHeaderWithSeparate + "0.0",
+                W_1015_ReScan = R_DBHeader_ScanWithSeparate + "302.0", //1015浣嶇疆閲嶆柊鎵爜 銆怑ditBy shaocx,2022-05-02銆�
+                W_1019_ReScan = R_DBHeader_ScanWithSeparate + "368.0", //1019浣嶇疆閲嶆柊鎵爜锛� 銆怑ditBy shaocx,2022-05-02銆�
+                W_Station_FinishACK = W_DBHeaderWithSeparate + "146.0",
+
+                W_1002_ScanFailACK = R_DBHeader_ScanWithSeparate + "66.1",
+                W_1004_ScanFailACK = R_DBHeader_ScanWithSeparate + "126.1",
+                W_1006_ScanFailACK = R_DBHeader_ScanWithSeparate + "186.1",
+                W_1007_ScanFailACK = R_DBHeader_ScanWithSeparate + "246.1",
+
+                W_1002_ScanSuccessACK = R_DBHeader_ScanWithSeparate + "66.0",
+                W_1004_ScanSuccessACK = R_DBHeader_ScanWithSeparate + "126.0",
+                W_1006_ScanSuccessACK = R_DBHeader_ScanWithSeparate + "186.0",
+                W_1007_ScanSuccessACK = R_DBHeader_ScanWithSeparate + "246.0",
+
+                W_Out_MaterialModel = W_DBHeaderForXigangGetDataWithSeparate + "0.0",
+                W_Out_OrderNo = W_DBHeaderForXigangGetDataWithSeparate + "18.0",
+                W_Out_SerialNumber = W_DBHeaderForXigangGetDataWithSeparate + "36.0",
+                #endregion
+            };
+
+            //鍐欏叆鍦板潃
+            _dbBlockForWrite.W_StationForWriteCommList = new List<StationDBForWriteComm>();
+
+            _dbBlockForWrite.W_StationForWriteCommList.Add(new StationDBForWriteComm() { StationCode = "1001", W_TaskID = W_DBHeaderWithSeparate + "6.0" });
+            _dbBlockForWrite.W_StationForWriteCommList.Add(new StationDBForWriteComm() { StationCode = "1002", W_TaskID = W_DBHeaderWithSeparate + "14.0" });
+            _dbBlockForWrite.W_StationForWriteCommList.Add(new StationDBForWriteComm() { StationCode = "1003", W_TaskID = W_DBHeaderWithSeparate + "22.0" });
+
+
+
+            return _dbBlockForWrite;
+        }
+
+        ///// <summary>
+        ///// 璇诲彇鍦板潃闆嗗悎璧嬪��
+        ///// </summary>
+        ///// <param name="_dbBlockForWrite"></param>
+        ///// <param name="_dbBlockForRead"></param>
+        //private static StationDBForWrite SetW_StationForWriteCommList2()
+        //{
+        //    StationDBForWrite _dbBlockForRead = new StationDBForWrite()
+        //    {
+        //        //TODO:杩欓噷鍐欓厤缃殑DB鍦板潃
+        //        #region 璇诲彇
+        //        W_HandShake = "0.0",
+
+        //        #endregion
+        //    };
+
+        //    //璇诲彇鍦板潃
+        //    double default_STP = 2.0;
+        //    double default_Destination = 4.0;
+        //    double default_TaskID = 6.0;
+
+        //    int addValue = 16;
+        //    _dbBlockForRead.W_StationForWriteCommList = new List<StationDBForWriteComm>();
+        //    for (int i = 0; i < WareSdaStruct.StationStationList.Count; i++)
+        //    {
+        //        var stationCode = WareSdaStruct.StationStationList[i];
+        //        if (i > 0)
+        //        {
+        //            default_STP += addValue;
+        //            default_Destination += addValue;
+        //            default_TaskID += addValue;
+        //        }
+        //        _dbBlockForRead.W_StationForWriteCommList.Add(new StationDBForWriteComm()
+        //        {
+        //            StationCode = stationCode,
+        //            W_STP = default_STP.ToString("0.0"),
+        //            W_Destination = default_Destination.ToString("0.0"),
+        //            W_TaskID = default_TaskID.ToString("0.0"),
+        //        });
+
+        //    }
+
+        //    return _dbBlockForRead;
+
+        //}
+
+        /// <summary>
+        /// 璇诲彇鍦板潃闆嗗悎璧嬪��
+        /// </summary>
+        /// <param name="_dbBlockForWrite"></param>
+        /// <param name="_dbBlockForRead"></param>
+        private static StationDBForRead SetR_StationForWriteCommList()
+        {
+            StationDBForRead _dbBlockForRead = new StationDBForRead()
+            {
+                //TODO:杩欓噷鍐欓厤缃殑DB鍦板潃
+                #region 璇诲彇
+                R_HandShake = R_DBHeaderWithSeparate + "0.0",
+
+                //娉ㄦ剰锛氳繖閲岀敤鐨勬壂鎻忕殑鍦板潃鍧�
+                R_1015_Scan = R_DBHeader_ScanWithSeparate + "48.0",
+                R_1019_Scan = R_DBHeader_ScanWithSeparate + "356.0",
+                R_1019_CargoNoScan = R_DBHeader_ScanWithSeparate + "378.0",
+                R_1002_Scan = R_DBHeader_ScanWithSeparate + "108.0",
+                R_1004_Scan = R_DBHeader_ScanWithSeparate + "168.0",
+                R_1006_Scan = R_DBHeader_ScanWithSeparate + "228.0",
+                R_1007_Scan = R_DBHeader_ScanWithSeparate + "288.0",
+                R_1009_High1 = R_DBHeader_ScanWithSeparate + "300.0",
+                R_1009_High2 = R_DBHeader_ScanWithSeparate + "300.1",
+                R_1009_High3 = R_DBHeader_ScanWithSeparate + "300.2",
+
+                R_Station_Finish = R_DBHeaderWithSeparate + "349.0",
+
+                R_Station_Coordinate = R_DBHeader_ScanWithSeparate + "304.0"
+
+                #endregion
+            };
+
+            //璇诲彇鍦板潃
+            double default_PH_1 = 2.0;
+            double default_PH_2 = 2.1;
+            double default_ACK = 2.2;
+            double default_Model = 4.0;
+            double default_State = 6.0;
+            double default_AlarmCode = 8.0;
+            double default_Destination = 10.0;
+            double default_Shape = 12.0;
+            double default_TaskID = 14.0;
+            int addValue = 16;
+            _dbBlockForRead.R_StationForReadCommList = new List<StationDBForReadComm>();
+            for (int i = 0; i < WareSdaStruct.StationStationList.Count; i++)
+            {
+                var stationCode = WareSdaStruct.StationStationList[i];
+                if (stationCode == "1019")
+                {
+                    _dbBlockForRead.R_StationForReadCommList.Add(new StationDBForReadComm()
+                    {
+                        StationCode = stationCode,
+                        R_PH_1 = R_DBHeaderWithSeparate + "350.0",
+                        R_PH_2 = R_DBHeaderWithSeparate + "350.1",
+                        R_ACK = R_DBHeaderWithSeparate + "350.2",
+                        R_Model = R_DBHeaderWithSeparate + ("352.0"),
+                        R_State = R_DBHeaderWithSeparate + ("354.0"),
+                        R_AlarmCode = R_DBHeaderWithSeparate + ("356.0"),
+                        R_Destination = R_DBHeaderWithSeparate + ("358.0"),
+                        R_Shape = R_DBHeaderWithSeparate + ("360.0"),
+                        R_TaskID = R_DBHeaderWithSeparate + ("362.0")
+                    });
+                }
+                else
+                {
+                    if (i > 0)
+                    {
+                        default_PH_1 += addValue;
+                        default_PH_2 += addValue;
+                        default_ACK += addValue;
+                        default_Model += addValue;
+                        default_State += addValue;
+                        default_AlarmCode += addValue;
+                        default_Destination += addValue;
+                        default_Shape += addValue;
+                        default_TaskID += addValue;
+                    }
+                    _dbBlockForRead.R_StationForReadCommList.Add(new StationDBForReadComm()
+                    {
+                        StationCode = stationCode,
+                        R_PH_1 = R_DBHeaderWithSeparate + default_PH_1.ToString("0.0"),
+                        R_PH_2 = R_DBHeaderWithSeparate + default_PH_2.ToString("0.0")
+                        ,
+                        R_ACK = R_DBHeaderWithSeparate + default_ACK.ToString("0.0"),
+                        R_Model = R_DBHeaderWithSeparate + default_Model.ToString("0.0"),
+                        R_State = R_DBHeaderWithSeparate + default_State.ToString("0.0"),
+                        R_AlarmCode = R_DBHeaderWithSeparate + default_AlarmCode.ToString("0.0"),
+                        R_Destination = R_DBHeaderWithSeparate + default_Destination.ToString("0.0"),
+                        R_Shape = R_DBHeaderWithSeparate + default_Shape.ToString("0.0"),
+                        R_TaskID = R_DBHeaderWithSeparate + default_TaskID.ToString("0.0")
+                    });
+                }
+            }
+
+            return _dbBlockForRead;
+
+        }
+
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs b/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs
new file mode 100644
index 0000000..29ac693
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationService/IStationService.cs
@@ -0,0 +1,138 @@
+锘縰sing iWareModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.Text;
+
+namespace iWareSda
+{
+    // 娉ㄦ剰: 浣跨敤鈥滈噸鏋勨�濊彍鍗曚笂鐨勨�滈噸鍛藉悕鈥濆懡浠わ紝鍙互鍚屾椂鏇存敼浠g爜鍜岄厤缃枃浠朵腑鐨勬帴鍙e悕鈥淚StationService鈥濄��
+    [ServiceContract]
+    public interface IStationService
+    {
+        /// <summary>
+        /// 瑙h
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity ClearAlarm(int deviceId);
+
+        /// <summary>
+        /// 涓嬪彂Station浠诲姟
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="sourcePlce"></param>
+        /// <param name="toPlace"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity SendStationTask(int deviceId, int taskId, string sourcePlce, string toPlace);
+
+        /// <summary>
+        /// 浠诲姟涓嬪彂纭(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="stationCode"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity WriteStp(int deviceId, bool value, string stationCode);
+
+
+        [OperationContract]
+        StationView GetStationInfo(int deviceId);
+
+        [OperationContract]
+        SdaResEntity IsTaskFinish(int deviceId, int taskId);
+
+        [OperationContract]
+        SdaResEntity DeleteStationTask(int deviceId, int taskId);
+
+        ///// <summary>
+        ///// Station鎬ュ仠
+        ///// </summary>
+        ///// <param name="deviceId"></param>
+        ///// <returns></returns>
+        //[OperationContract]
+        //SdaResEntity EmergencyStop(int deviceId);
+
+        /// <summary>
+        /// Station鏄惁鏄嚜鍔ㄦā寮�
+        /// </summary>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity IsStationAuto(int deviceId, string stationCode);
+
+        /// <summary>
+        /// 鍒ゆ柇Station鏄惁鍙敤锛屾槸鍚﹀彲浠ュ彂閫佹柊浠诲姟缁橲tation
+        /// </summary>
+        /// <param name="srmId"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity IsAllowSendTask(bool isNeedValidateRealSourceAndToPlace, int deviceId, string stationCode, string toStationCode, bool isStationTask);
+
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁鏈夊績璺�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity IsHaveHeatBeat(int deviceId);
+
+        /// <summary>
+        /// 1015閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity Write1015ReScan(int deviceId, bool value);
+
+        /// <summary>
+        /// 1019閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity Write1019ReScan(int deviceId, bool value);
+
+        /// <summary>
+        /// Station鐨勪换鍔″畬鎴怉CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity WriteStation_FinishACK(int deviceId, bool value, int plcTaskId);
+
+        /// <summary>
+        /// 鍥涗釜鍏ュ簱鍙f壂鎻忛獙璇丄CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity WriteScanValidateACK(bool isReset, int deviceId, string stationCode, bool value, int plcTaskId);
+
+        /// <summary>
+        /// 鍙戝姩鏈哄嚭搴擄紝缁欒タ娓疨LC鍙戦�佸彂鍔ㄦ満鏁版嵁 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value__Out_MaterialModel"></param>
+        /// <param name="value_Out_OrderNo"></param>
+        /// <param name="value_Out_SerialNumber"></param>
+        /// <param name="plcTaskId"></param>
+        /// <returns></returns>
+        [OperationContract]
+        SdaResEntity WriteStation_XigangGetDataForOut(int deviceId, string value__Out_MaterialModel,
+           string value_Out_OrderNo,
+           string value_Out_SerialNumber,
+           int plcTaskId);
+
+    }
+}
diff --git a/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs
new file mode 100644
index 0000000..403d284
--- /dev/null
+++ b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs
@@ -0,0 +1,576 @@
+锘縰sing iWareCommon.Utils;
+using iWareModel;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.Text;
+
+
+namespace iWareSda
+{
+    // 娉ㄦ剰: 浣跨敤鈥滈噸鏋勨�濊彍鍗曚笂鐨勨�滈噸鍛藉悕鈥濆懡浠わ紝鍙互鍚屾椂鏇存敼浠g爜鍜岄厤缃枃浠朵腑鐨勭被鍚嶁�淪tationService鈥濄��
+    public class StationService : IStationService
+    {
+        public SdaResEntity ClearAlarm(int deviceId)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+                string msg;
+                var result = Station.ClearAlarm(deviceId, out msg);
+                Log4NetHelper.WriteInfoLog(LogType.StationSdaService, "涓嬪彂deviceId=" + deviceId + "鐨凷tation娑堣鎸囦护" + (result ? "鎴愬姛" : "澶辫触") + "鍘熷洜锛�" + msg);
+                sdaResult.result = result;
+                sdaResult.resMsg = msg;
+                return sdaResult;
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                return sdaResult;
+            }
+        }
+
+
+        /// <summary>
+        /// 涓嬪彂Station浠诲姟
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskId"></param>
+        /// <param name="sourcePlce"></param>
+        /// <param name="toPlace"></param>
+        /// <param name="pallType"></param>
+        /// <returns></returns>
+        public SdaResEntity SendStationTask(int deviceId, int taskId, string sourcePlce, string toPlace)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                //濡傛灉STP涓篢RUE锛岃〃绀轰笉鑳藉彂浠诲姟
+
+
+                string msg;
+                var result = Station.SendTask(deviceId, taskId, sourcePlce, toPlace, out msg);
+                Log4NetHelper.WriteInfoLog(LogType.StationSdaService, "涓嬪彂deviceId=" + deviceId + ",taskId=" + taskId + ",fromPlace=" +
+                    sourcePlce + ",toPlace=" + toPlace + "鐨凷tation浠诲姟" + (result ? "鎴愬姛" : "澶辫触") + "鍘熷洜锛�" + msg);
+
+                sdaResult.result = result;
+                sdaResult.resMsg = msg;
+                return sdaResult;
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                return sdaResult;
+            }
+        }
+
+        /// <summary>
+        /// 浠诲姟涓嬪彂纭(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="stationCode"></param>
+        /// <returns></returns>
+        public SdaResEntity WriteStp(int deviceId, bool value, string stationCode)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.WriteStp(deviceId, stationCode, value, out msg);
+                Log4NetHelper.WriteInfoLog(LogType.StationSdaService,
+                    "涓嬪彂deviceId=" + deviceId + "锛岀珯鐐瑰彿=" + stationCode + "鐨勪换鍔′笅鍙戠‘璁�(鏀跺埌PLC鍙嶉鍚嶹CS娓呴櫎锛夋寚浠�" + (result ? "鎴愬姛" : "澶辫触") + "鍘熷洜锛�" + msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+        public SdaResEntity DeleteStationTask(int deviceId, int taskId)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+                string msg = "";
+                var result = Station.DeleteTask(deviceId, taskId, out msg);
+                Log4NetHelper.WriteInfoLog(LogType.StationSdaService, "涓嬪彂deviceId = " + deviceId + "鐨勫垹闄tation浠诲姟鎸囦护" + (result ? "鎴愬姛" : "澶辫触") + "鍘熷洜锛�" + msg);
+                sdaResult.result = result;
+                sdaResult.resMsg = msg;
+                return sdaResult;
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                return sdaResult;
+            }
+        }
+
+        ///// <summary>
+        ///// Station鎬ュ仠
+        ///// </summary>
+        ///// <param name="deviceId"></param>
+        ///// <returns></returns>
+        //public SdaResEntity EmergencyStop(int deviceId)
+        //{
+        //    SdaResEntity sdaResult = new SdaResEntity();
+        //    try
+        //    {
+        //        var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+        //        if (!StationResult.result)
+        //        {
+        //            return StationResult;
+        //        }
+        //        var Station = StationResult.resData as StationEntity;
+
+        //        string msg = "";
+        //        var result = Station.EmergencyStop(deviceId, out msg);
+        //        Log4NetHelper.WriteInfoLog(LogType.StationSdaService, "涓嬪彂deviceId = " + deviceId + "鐨勬�ュ仠浠诲姟鎸囦护" + (result ? "鎴愬姛" : "澶辫触") + "鍘熷洜锛�" + msg);
+        //        sdaResult.result = result;
+        //        sdaResult.resMsg = msg;
+        //        return sdaResult;
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        sdaResult.result = false;
+        //        sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+        //        return sdaResult;
+        //    }
+        //}
+
+        /// <summary>
+        /// 鑾峰彇鏁翠釜Station瀵硅薄
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        public StationView GetStationInfo(int deviceId)
+        {
+            var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+            if (!StationResult.result)
+            {
+                return null;
+            }
+            var Station = (StationResult.resData as StationEntity).View;
+            return Station;
+        }
+
+
+        /// <summary>
+        /// Station浠诲姟鏄惁瀹屾垚
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="taskId"></param>
+        /// <returns></returns>
+        public SdaResEntity IsTaskFinish(int deviceId, int taskId)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                var stationCode = "";
+                var readData = Station.View.R_StationForReadCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+
+                sdaResult.result = readData.R_TaskID == taskId && Station.View.R_Station_Finish;
+                sdaResult.resMsg = "鎴愬姛";
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                return sdaResult;
+            }
+            return sdaResult;
+        }
+
+
+
+
+        /// <summary>
+        /// Station鏄惁鏄嚜鍔ㄦā寮�
+        /// </summary>
+        /// <returns></returns>
+        public SdaResEntity IsStationAuto(int deviceId, string stationCode)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                var msg = "";
+                var result = Station.StationIsAuto(stationCode, out msg);
+                if (!StationResult.result)
+                {
+                    sdaResult.result = false;
+                    sdaResult.resMsg = msg;
+                    return StationResult;
+                }
+
+
+                sdaResult.result = true;
+
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                Log4NetHelper.WriteErrorLog(LogType.StationSdaService, "鍒ゆ柇Station鏄惁鏄嚜鍔ㄦā寮忓嚭鐜板紓甯�,ex:" + JsonConvert.SerializeObject(ex), ex);
+            }
+            return sdaResult;
+        }
+
+        /// <summary>
+        /// Station鏄惁鏄嚜鍔ㄥ緟鏈烘ā寮�
+        /// </summary>
+        /// <returns></returns>
+        public SdaResEntity StationIsAutoAwaitMode(int deviceId, string stationCode)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                var msg = "";
+                var result = Station.StationIsAutoAwaitMode(stationCode, out msg);
+                if (!StationResult.result)
+                {
+                    sdaResult.result = false;
+                    sdaResult.resMsg = msg;
+                    return StationResult;
+                }
+
+
+                sdaResult.result = true;
+
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = JsonConvert.SerializeObject(ex);
+                Log4NetHelper.WriteErrorLog(LogType.StationSdaService, "鍒ゆ柇Station鏄惁鏄嚜鍔ㄥ緟鏈烘ā寮忓嚭鐜板紓甯�,ex:" + JsonConvert.SerializeObject(ex), ex);
+            }
+            return sdaResult;
+        }
+
+
+        /// <summary>
+        /// 鍒ゆ柇Station鏄惁鍙敤锛屾槸鍚﹀彲浠ュ彂閫佹柊浠诲姟缁橲tation
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="sourceStationCode"></param>
+        /// <param name="toStationCode"></param>
+        /// <param name="isStationTask">鏄惁鏄秹鍙婂埌Station鐨勪换鍔�</param>
+        /// <returns></returns>
+        public SdaResEntity IsAllowSendTask(bool isNeedValidateRealSourceAndToPlace, int deviceId, string sourceStationCode, string toStationCode, bool isStationTask)
+        {
+            var msg = "";
+            SdaResEntity sdaResult = new SdaResEntity();
+            try
+            {
+
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+                var result = false;
+                if (isNeedValidateRealSourceAndToPlace)
+                {
+                    //鍒ゆ柇璧风偣鏄惁鏄嚜鍔ㄥ緟鏈烘ā寮�
+                    result = Station.StationIsAutoAwaitMode(sourceStationCode, out msg);
+                    if (!result)
+                    {
+                        sdaResult.result = false;
+                        sdaResult.resMsg = msg;
+                        return sdaResult;
+                    }
+                    //鍒ゆ柇璧风偣鏄惁鏄┖闂茬姸鎬�
+                    result = Station.StationIsStateFree(sourceStationCode, out msg);
+                    if (!result)
+                    {
+                        sdaResult.result = false;
+                        sdaResult.resMsg = msg;
+                        return sdaResult;
+                    }
+                }
+
+
+                if (isNeedValidateRealSourceAndToPlace)
+                {
+                    //鍒ゆ柇鐩爣鐐规槸鍚︽槸鑷姩妯″紡
+                    result = Station.StationIsAuto(toStationCode, out msg);
+                    if (!result)
+                    {
+                        sdaResult.result = false;
+                        sdaResult.resMsg = msg;
+                        return sdaResult;
+                    }
+                }
+
+                sdaResult.result = true;
+                return sdaResult;
+            }
+            catch (Exception ex)
+            {
+                sdaResult.result = false;
+                sdaResult.resMsg = "鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex);
+                return sdaResult;
+            }
+        }
+
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁鏈夊績璺�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        public SdaResEntity IsHaveHeatBeat(int deviceId)
+        {
+            SdaResEntity sdaResult = new SdaResEntity();
+            string msg;
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                var result = Station.IsHaveHeatBeat();
+
+                sdaResult.result = true;
+                sdaResult.resData = result;
+                return sdaResult;
+
+            }
+            catch (Exception ex)
+            {
+                msg = "楠岃瘉鏄惁鏈夊績璺冲嚭鐜板紓甯�:" + ex.Message;
+                sdaResult.result = false;
+                sdaResult.resMsg = msg;
+                return sdaResult;
+            }
+        }
+
+
+        /// <summary>
+        /// 1015閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public SdaResEntity Write1015ReScan(int deviceId, bool value)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.Write1015ReScan(deviceId, value, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+        /// <summary>
+        /// 1019閲嶆柊鎵爜
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public SdaResEntity Write1019ReScan(int deviceId, bool value)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.Write1019ReScan(deviceId, value, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+        /// <summary>
+        /// Station鐨勪换鍔″畬鎴怉CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public SdaResEntity WriteStation_FinishACK(int deviceId, bool value, int plcTaskId)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.WriteStation_FinishACK(deviceId, value, plcTaskId, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+
+        /// <summary>
+        /// 鍥涗釜鍏ュ簱鍙f壂鎻忛獙璇丄CK璧嬪��
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public SdaResEntity WriteScanValidateACK(bool isReset, int deviceId, string stationCode, bool value, int plcTaskId)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.WriteScanValidateACK(isReset, deviceId, stationCode, value, plcTaskId, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+
+        /// <summary>
+        /// 鍙戝姩鏈哄嚭搴擄紝缁欒タ娓疨LC鍙戦�佸彂鍔ㄦ満鏁版嵁 銆怑ditby shaocx,2023-07-23銆�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="value__Out_MaterialModel"></param>
+        /// <param name="value_Out_OrderNo"></param>
+        /// <param name="value_Out_SerialNumber"></param>
+        /// <param name="plcTaskId"></param>
+        /// <returns></returns>
+        public SdaResEntity WriteStation_XigangGetDataForOut(int deviceId, string value__Out_MaterialModel,
+            string value_Out_OrderNo,
+            string value_Out_SerialNumber,
+            int plcTaskId)
+        {
+            SdaResEntity _SdaResEntity = new SdaResEntity();
+            try
+            {
+                var StationResult = Station_CacheEntity.GetDeviceObj(deviceId);
+                if (!StationResult.result)
+                {
+                    return StationResult;
+                }
+                var Station = StationResult.resData as StationEntity;
+
+                string msg = "";
+                var result = Station.WriteStation_XigangGetDataForOut(deviceId, value__Out_MaterialModel, value_Out_OrderNo, value_Out_SerialNumber, plcTaskId, out msg);
+                _SdaResEntity.result = result;
+                _SdaResEntity.resMsg = msg;
+                return _SdaResEntity;
+            }
+            catch (Exception ex)
+            {
+                _SdaResEntity.result = false;
+                _SdaResEntity.resMsg = ex.Message;
+                return _SdaResEntity;
+            }
+        }
+    }
+}

--
Gitblit v1.9.3