From 60735779c303c2dd10feea45d7fd761103b225e0 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周四, 21 11月 2024 15:03:38 +0800 Subject: [PATCH] 2222 --- SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs | 83 ++++++++++++++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs index cf1e1d2..fadb236 100644 --- a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs +++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs @@ -132,7 +132,7 @@ msg = string.Format("鍚慡tation{0},璧风偣{1}锛岀洰鏍囩偣{2},鍐欏叆浠诲姟鍙穥3}澶辫触,杩斿洖缁撴灉:" + b2.resMsg, this.View.DeviceName, sourcePlce, toPlace, taskId); return false; } - + return true; } @@ -179,18 +179,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 +228,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