Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuLiKu
| | |
| | | //{ |
| | | // Type type = typeof(); |
| | | //} |
| | | |
| | | |
| | | // 封装检查逻辑 |
| | | private bool DeviceProtocolExists(int DeviceID, string DeviceChildCode, decimal DeviceProOffset) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.DeviceId == DeviceID && x.DeviceChildCode == DeviceChildCode && x.DeviceProOffset == DeviceProOffset) != null; |
| | | } |
| | | |
| | | // 封装对象创建逻辑 |
| | | private Dt_DeviceProtocol CreateDeviceProtocol(int DeviceID, string DeviceChildCode, decimal DeviceProOffset, int additionalOffset, string dataType, int dataLength, string paramName) |
| | | { |
| | | decimal DeviceProOffsets = DeviceProOffset + additionalOffset; |
| | | return new Dt_DeviceProtocol |
| | | { |
| | | DeviceId = DeviceID, |
| | | DeviceChildCode = DeviceChildCode, |
| | | DeviceProDataBlock = "DB1000", |
| | | DeviceProOffset = DeviceProOffsets, |
| | | DeviceProDataLength = dataLength, |
| | | DeviceProDataType = dataType, |
| | | DeviceProParamName = paramName, |
| | | DeviceProParamType = "DeviceCommand", |
| | | DeviceProParamDes = "1", |
| | | DeviceProRemark = "", |
| | | Creater = "admin", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | } |
| | | |
| | | public WebResponseContent AddDeviceProtocol(int DeviceID, string DeviceChildCode, decimal DeviceProOffset) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (DeviceProtocolExists(DeviceID, DeviceChildCode, DeviceProOffset)) |
| | | { |
| | | throw new InvalidOperationException("已存在该节点明细"); |
| | | } |
| | | |
| | | var protocols = new List<Dt_DeviceProtocol> |
| | | { |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 0, "int", 1, "ConveyorLineTargetAddress"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 2, "int", 1, "ConveyorLineTaskNum"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 6, "string", 25, "ConveyorLineBarcode"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 34, "int", 1, "Reserve1"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 36, "int", 1, "Reserve2"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 38, "int", 1, "Reserve3"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 40, "byte", 1, "InteractiveSignal"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 42, "int", 1, "HasPallet"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 44, "int", 1, "ConveyorLineAlarm"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 46, "int", 1, "ResponState"), |
| | | CreateDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset, 48, "int", 1, "Reserve5") |
| | | |
| | | }; |
| | | var result=BaseDal.AddData(protocols); |
| | | return content.OK(data:result); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="fileInput">文件</param> |
| | | /// <returns>返回读取结果,成功返回数据,失败返回错误信息</returns> |
| | | WebResponseContent GetImportData(List<IFormFile> fileInput); |
| | | WebResponseContent AddDeviceProtocol(int DeviceID, string DeviceChildCode, decimal DeviceProOffset); |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Autofac.Core; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEAWCS_Core; |
| | |
| | | { |
| | | return Service.GetImportData(fileInput); |
| | | } |
| | | |
| | | [HttpPost, Route("AddDeviceProtocol"), AllowAnonymous] |
| | | public WebResponseContent AddDeviceProtocol(int DeviceID,string DeviceChildCode, decimal DeviceProOffset) |
| | | { |
| | | |
| | | return Service.AddDeviceProtocol(DeviceID, DeviceChildCode, DeviceProOffset); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine("分容空托盘入口在途数量>缓存数量"); |
| | | ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】在途数量>缓存数量"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine("分容空托盘入口有盘"); |
| | | ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】有盘"); |
| | | } |
| | | } |
| | | } |