From ece80c5d44458eb482467ffafdff68fbc1e6dc94 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 25 12月 2024 09:50:01 +0800 Subject: [PATCH] 接口 多 并发模式 --- SDA/iWareSda/Devices/4-Station/StationService/StationService.cs | 328 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 317 insertions(+), 11 deletions(-) diff --git a/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs index 31e2d98..cd0b589 100644 --- a/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs +++ b/SDA/iWareSda/Devices/4-Station/StationService/StationService.cs @@ -1,5 +1,6 @@ 锘縰sing iWareCommon.Utils; using iWareModel; +using iWareSda.Model; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -12,6 +13,7 @@ namespace iWareSda { // 娉ㄦ剰: 浣跨敤鈥滈噸鏋勨�濊彍鍗曚笂鐨勨�滈噸鍛藉悕鈥濆懡浠わ紝鍙互鍚屾椂鏇存敼浠g爜鍜岄厤缃枃浠朵腑鐨勭被鍚嶁�淪tationService鈥濄�� + [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] public class StationService : IStationService { public SdaResEntity ClearAlarm(int deviceId) @@ -188,6 +190,22 @@ } var Station = (StationResult.resData as StationEntity).View; return Station; + } + + /// <summary> + /// 鑾峰彇褰撳墠姝e湪鎶ヨ鐨勬姤璀﹀垪琛� + /// </summary> + /// <param name="deviceId"></param> + /// <returns></returns> + public List<DeviceWarningInfo> GetWaringInfoList(int deviceId, List<WmsConfigDeviceWarning> configDeviceWarningList) + { + var StationResult = Station_CacheEntity.GetDeviceObj(deviceId); + if (!StationResult.result) + { + return null; + } + var waringList = (StationResult.resData as StationEntity).GetStationAlertDatas(configDeviceWarningList); + return waringList; } @@ -405,9 +423,41 @@ } } + /// <summary> + /// 鍐橮LC bool + /// </summary> + /// <param name="deviceId"></param> + /// <param name="dbAddress"></param> + /// <param name="value"></param> + /// <returns></returns> + public SdaResEntity WriteBoolPlcData(int deviceId, string dbAddress, 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.WriteBoolPlcData(dbAddress, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } /// <summary> - /// 鍐欏叆榻愬缁撴灉 + /// 鍐欏叆榻愬缁撴灉銆佽В鏋愮粨鏋� /// </summary> /// <param name="deviceId"></param> /// <param name="value"></param> @@ -476,7 +526,7 @@ /// <param name="deviceId"></param> /// <param name="value"></param> /// <returns></returns> - public SdaResEntity OutboundFinishConfirm(int deviceId, bool value, string stationCode) + public SdaResEntity OutboundFinishConfirm(int deviceId, bool value, string stationCode, bool isClearData) { SdaResEntity _SdaResEntity = new SdaResEntity(); try @@ -489,7 +539,74 @@ var Station = StationResult.resData as StationEntity; string msg = ""; - var result = Station.OutboundFinishConfirm(stationCode, value, out msg); + var result = Station.OutboundFinishConfirm(stationCode, value, out msg, isClearData); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + /// <summary> + /// 鍒囨崲妯″紡 + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <param name="stationCode"></param> + /// <returns></returns> + public SdaResEntity ChangeMode(int deviceId, int 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.ChangeMode(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + + /// <summary> + /// 鎵爜璁板綍娓呴櫎 + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <param name="stationCode"></param> + /// <returns></returns> + public SdaResEntity PartClear(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.PartClear(stationCode, value, out msg); _SdaResEntity.result = result; _SdaResEntity.resMsg = msg; return _SdaResEntity; @@ -539,7 +656,7 @@ /// <param name="deviceId"></param> /// <param name="value"></param> /// <returns></returns> - public SdaResEntity WritePalletizingTaskInfo(int deviceId, string stationCode,int taskID, bool isLast, short length, short width, short height,short rotate,short toplace,short placeX,short placeY) + public SdaResEntity WritePalletizingTaskInfo(int deviceId, string stationCode, int taskID, short length, short width, short height, short rotate, short toplace, short placeX, short placeY, short placeZ, short lastnum) { SdaResEntity _SdaResEntity = new SdaResEntity(); try @@ -552,7 +669,7 @@ var Station = StationResult.resData as StationEntity; string msg = ""; - var result = Station.WritePalletizingTaskInfo(stationCode, taskID,isLast, length, width, height,rotate,toplace,placeX,placeY,out msg); + var result = Station.WritePalletizingTaskInfo(stationCode, taskID, length, width, height, rotate, toplace, placeX, placeY, placeZ, lastnum, out msg); _SdaResEntity.result = result; _SdaResEntity.resMsg = msg; return _SdaResEntity; @@ -595,15 +712,15 @@ return _SdaResEntity; } } + /// <summary> - /// 鍐欏叆鍑哄簱浠诲姟淇℃伅 + /// 鍐欏叆鍚堝寘浠诲姟淇℃伅 /// </summary> /// <param name="deviceId"></param> - /// <param name="stationCode"></param> - /// <param name="sourcePlaceNo"></param> - /// <param name="outbound_TaskID"></param> + /// <param name="value"></param> /// <returns></returns> - public SdaResEntity WriteOutStoreTaskInfo(int deviceId, string stationCode, string sourcePlaceNo, int outbound_TaskID) + public SdaResEntity WriteSurroundTaskInfo(int deviceId, string stationCode, short taskID, short length, short width, + short cartonhigh, short cartonwidth, short placex, short placey, bool isNgFlag) { SdaResEntity _SdaResEntity = new SdaResEntity(); try @@ -616,7 +733,196 @@ var Station = StationResult.resData as StationEntity; string msg = ""; - var result = Station.WriteOutStoreTaskInfo(stationCode, sourcePlaceNo, out msg, outbound_TaskID); + var result = Station.WriteSurroundTaskInfo(stationCode, taskID, length, width, cartonhigh, cartonwidth, placex, placey, out msg, isNgFlag); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + /// <summary> + /// 鍚堝寘瀹屾垚宸茬‘璁� + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <returns></returns> + public SdaResEntity SetSurroundTaskFinishAck(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.WriteSurround_FinishACK(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + public SdaResEntity WriteStation_ACK(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.WriteStation_ACK(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + /// <summary> + /// 鍐欏叆 琛ユ澘宸ヤ綅鍏佽杩涙澘 + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <param name="stationCode"></param> + /// <returns></returns> + public SdaResEntity WriteStation_AllowIn(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.WriteStation_AllowIn(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + /// <summary> + /// 鍐欏叆NG鍖呮爣璁� + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <param name="stationCode"></param> + /// <returns></returns> + public SdaResEntity WriteStation_NgFlag(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.WriteStation_NgFlag(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + /// <summary> + /// 鍐欏叆 浜哄伐鏀捐 + /// </summary> + /// <param name="deviceId"></param> + /// <param name="value"></param> + /// <param name="stationCode"></param> + /// <returns></returns> + public SdaResEntity WriteStation_PersonAllow(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.WriteStation_PersonAllow(stationCode, value, out msg); + _SdaResEntity.result = result; + _SdaResEntity.resMsg = msg; + return _SdaResEntity; + } + catch (Exception ex) + { + _SdaResEntity.result = false; + _SdaResEntity.resMsg = ex.Message; + return _SdaResEntity; + } + } + + /// <summary> + /// 鍐欏叆鍑哄簱浠诲姟淇℃伅 + /// </summary> + /// <param name="deviceId"></param> + /// <param name="stationCode"></param> + /// <param name="sourcePlaceNo"></param> + /// <param name="outbound_TaskID"></param> + /// <returns></returns> + public SdaResEntity WriteOutStoreTaskInfo(bool isResetData, int deviceId, string stationCode, string sourcePlaceNo, int outbound_TaskID) + { + 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.WriteOutStoreTaskInfo(isResetData, stationCode, sourcePlaceNo, out msg, outbound_TaskID); _SdaResEntity.result = result; _SdaResEntity.resMsg = msg; return _SdaResEntity; -- Gitblit v1.9.3