From 81c361a3fab7d43fc14ad46777a18a1ab9215c06 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 21 11月 2024 17:57:46 +0800
Subject: [PATCH] 222

---
 SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs |  171 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 110 insertions(+), 61 deletions(-)

diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
index cf1e1d2..8d0dff3 100644
--- a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
@@ -92,56 +92,58 @@
         /// <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;
-                }
+            msg = "";
+            return false;
+            //try
+            //{
+            //    msg = "";
+            //    if (!CanSendTask(deviceId, out msg))
+            //    {
+            //        return false;
+            //    }
 
-                //杩欓噷鐗规畩杞崲涓�涓�
-                if (toPlace == ((int)EDevice.鍑哄簱鍙�1012).ToString())
-                {
-                    toPlace = ((int)EDevice.鎻愬崌鏈�1030).ToString();
-                }
+            //    //杩欓噷鐗规畩杞崲涓�涓�
+            //    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_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;
-                }
+            //    //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;
-                }
-              
+            //    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;
-            }
+
+            //    return true;
+            //}
+            //catch (Exception ex)
+            //{
+            //    msg = ex.Message;
+            //    Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, "鍙戦�佷换鍔″嚭鐜板紓甯�:" + ex.Message, ex);
+            //    return false;
+            //}
         }
 
 
@@ -179,18 +181,37 @@
 
 
         /// <summary>
-        /// 1015閲嶆柊鎵爜
+        /// 鍐欏叆榻愬缁撴灉
         /// </summary>
         /// <param name="deviceId"></param>
-        /// <param name="value"></param>
+        /// <param name="value">true:琛ㄧず 榻愬銆俧alse锛氫笉榻愬</param>
         /// <param name="msg"></param>
         /// <returns></returns>
-        public bool Write1015ReScan(int deviceId, bool value, out string msg)
+        public bool WriteQiTaoInfo(string stationCode, bool value, out string msg)
         {
             try
             {
                 msg = "";
-                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1015_ReScan, value, this.View.W_1015_ReScan);
+                var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+
+                var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_DataFinish, true, view_stationObj.W_DataFinish);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
+                    return false;
+                }
+                int i_result = 0;
+                if (value)
+                {
+                    i_result = 998;
+                }
+                else
+                {
+                    i_result = 999;
+                }
+                b2 = this.plcService.WriteValuePoint(stationObj.W_KittingInfo, i_result, view_stationObj.W_KittingInfo);
                 if (!b2.result)
                 {
                     msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
@@ -209,37 +230,65 @@
             }
         }
 
-        /// <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)
+        public bool WriteInStoreTaskInfo(string stationCode, string toPlaceNo, short length, short width, short height, out string msg)
         {
             try
             {
                 msg = "";
-                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1019_ReScan, value, this.View.W_1019_ReScan);
+                var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+
+                var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
+                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_DataFinish, true, view_stationObj.W_DataFinish);
                 if (!b2.result)
                 {
-                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐�  " + value + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
-                        this.DBBlockForWrite.W_1019_ReScan);
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 璇荤爜瑙f瀽瀹屾垚 " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
                     return false;
                 }
+
+                b2 = this.plcService.WriteValuePoint(stationObj.W_Destination_In, Convert.ToInt32(toPlaceNo), view_stationObj.W_Destination_In);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 搴撲綅鍙� " + toPlaceNo + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
+                    return false;
+                }
+
+                b2 = this.plcService.WriteValuePoint(stationObj.W_Length, length, view_stationObj.W_Length);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 闀垮害 " + length + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
+                    return false;
+                }
+                b2 = this.plcService.WriteValuePoint(stationObj.W_Width, width, view_stationObj.W_Width);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 瀹藉害 " + width + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                        this.DBBlockForWrite.W_1015_ReScan);
+                    return false;
+                }
+                b2 = this.plcService.WriteValuePoint(stationObj.W_Height, height, view_stationObj.W_Height);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 楂樺害 " + height + "澶辫触,杩斿洖缁撴灉:" + 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_1019_ReScan);
+                var logcontext = string.Format("WriteInStoreTaskInfo鍑虹幇寮傚父:" + JsonConvert.SerializeObject(ex),
+                        "");
                 Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
                 return false;
             }
         }
 
+
         /// <summary>
         ///  Station鐨勪换鍔″畬鎴怉CK璧嬪��
         /// </summary>

--
Gitblit v1.9.3