| | |
| | | using iWareCommon.Utils; |
| | | using iWareModel; |
| | | using iWareSda.Model; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | namespace iWareSda |
| | | { |
| | | // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“StationService”。 |
| | | [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] |
| | | public class StationService : IStationService |
| | | { |
| | | public SdaResEntity ClearAlarm(int deviceId) |
| | |
| | | } |
| | | var Station = (StationResult.resData as StationEntity).View; |
| | | return Station; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取当前正在报警的报警列表 |
| | | /// </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; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写PLC 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> |
| | | /// 扫码记录清除 |
| | | /// </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; |
| | | } |
| | | 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 WriteSurroundTaskInfo(int deviceId, string stationCode, short taskID, short length, short width, short cartonhigh, short cartonwidth, short placex, short placey) |
| | | 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 |
| | |
| | | var Station = StationResult.resData as StationEntity; |
| | | |
| | | string msg = ""; |
| | | var result = Station.WriteSurroundTaskInfo(stationCode, taskID, length, width, cartonhigh, cartonwidth, placex, placey, out msg); |
| | | var result = Station.WriteSurroundTaskInfo(stationCode, taskID, length, width, cartonhigh, cartonwidth, placex, placey, out msg, isNgFlag); |
| | | _SdaResEntity.result = result; |
| | | _SdaResEntity.resMsg = msg; |
| | | return _SdaResEntity; |
| | |
| | | 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> |