| | |
| | | //"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串", |
| | | //"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle 库连接字符串 |
| | | "ConnectionString": "Server=10.26.200.29;Database=WCS_JC34;User Id=sa;Password=boxline@2016;", // SqlServer 库连接字符串 |
| | | //"ConnectionString": "Server=192.168.62.200;Database=WCS_JC34;User Id=sa;Password=sql2019;", // SqlServer 库连接字符串 |
| | | |
| | | |
| | | //"SlaveConnectionConfigs": [ // 读写分离/主从 |
| | |
| | | { |
| | | private readonly SqlSugarRepository<WcsPlc> _wcsPlcRep; |
| | | private readonly SysCacheService _sysCacheService; |
| | | private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); |
| | | public WcsPlcService(SqlSugarRepository<WcsPlc> wcsPlcRep, SysCacheService sysCacheService) |
| | | { |
| | | _wcsPlcRep = wcsPlcRep; |
| | |
| | | var modService = new { PLCTaskAction.boRunningState, PLCTaskAction.boOffline, PLCTaskAction.boRefresh, PLCTaskAction.boDemo, PLCTaskAction.boDrumReversal, PLCTaskAction.boOutLock, PLCTaskAction.boEnterLock }; |
| | | return new { listPlc, modService }; |
| | | } |
| | | |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "GetCarDL")] |
| | | [DisplayName("获取穿梭车电量")] |
| | | public async Task<dynamic> GetCarDL() |
| | | { |
| | | var listPlc = await _wcsPlcRep.AsQueryable() |
| | | .Where(s => s.Type == PLCTypeEnum.ShuttleCar) |
| | | .ToListAsync(); |
| | | |
| | | List<Dictionary<string, string>> _dicList = new List<Dictionary<string, string>>(); |
| | | foreach (var modPlc in listPlc) |
| | | { |
| | | var modbus = new ModbusUtil(modPlc); |
| | | var listPlcDevice = _db.Queryable<WcsDevice>().First(s => s.PlcId == modPlc.Id); |
| | | var (result, value) = modbus.GetDBValue(listPlcDevice.PosType, listPlcDevice.PlcPos); |
| | | if (result.IsSucceed) |
| | | { |
| | | var listPlcStation = _db.Queryable<WcsPosition>().Where(s => s.DeviceId == modPlc.Id).ToList(); |
| | | var modCarDl = listPlcStation.FirstOrDefault(s => s.Text == "电池电量"); |
| | | var (resultDl, valueDl) = modbus.GetDBValue(modCarDl.PosType, modCarDl.PlcPos); |
| | | if (resultDl.IsSucceed) |
| | | { |
| | | Dictionary<string, string> _dic = new Dictionary<string, string>(); |
| | | _dic.Add(modPlc.Text, valueDl); |
| | | |
| | | _dicList.Add(_dic); |
| | | } |
| | | } |
| | | } |
| | | return new { _dicList }; |
| | | } |
| | | /// <summary> |
| | | /// 获取位置信息 |
| | | /// </summary> |
| | |
| | | WriteInfo = '/api/wcsDevice/WriteInfo', |
| | | WriteTaskInfo = '/api/wcsDevice/WriteTaskInfo', |
| | | WriteStartStop = '/api/wcsDevice/WriteStartStop', |
| | | GetCarDL = '/api/wcsPLC/GetCarDL', |
| | | } |
| | | // 增加设备信息 |
| | | export const WriteLocationInfo = (params?: any) => |
| | |
| | | data: params, |
| | | }); |
| | | |
| | | export const GetCarDL = () => |
| | | request({ |
| | | url: Api.GetCarDL, |
| | | method: 'get', |
| | | data: {}, |
| | | }); |
| | | |
| | | |
| | | // 增加设备信息 |
| | | export const addWcsDevice = (params?: any) => |
| | | request({ |
| | |
| | | <el-collapse-item title="仓库一层" name="1"> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <el-text style="margin-right: 15px;">1号穿梭车</el-text> |
| | | <el-text style="margin-right: 15px;">电量:{{carDL1}}</el-text> |
| | | <el-button @click="write('ShuttleCar', '1', '41093', '1')">复位</el-button> |
| | | <el-button @click="write('ShuttleCar', '1', '41096', '1')">正向寻码</el-button> |
| | | <el-button @click="write('ShuttleCar', '1', '41096', '2')">反向寻码</el-button> |
| | | |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <el-text style="margin-right: 15px;">2号穿梭车</el-text> |
| | | <el-text style="margin-right: 15px;">电量:{{carDL2}}</el-text> |
| | | <el-button @click="write('ShuttleCar', '2', '41093', '1')">复位</el-button> |
| | | <el-button @click="write('ShuttleCar', '2', '41096', '1')">正向寻码</el-button> |
| | | <el-button @click="write('ShuttleCar', '2', '41096', '2')">反向寻码</el-button> |
| | | <el-button @click="write('ShuttleCar', '2', '41096', '2')">反向寻码</el-button> |
| | | </el-card> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | |
| | | |
| | | import { ref, reactive, onMounted } from 'vue'; |
| | | import { listStatus, listPosition } from '/@/api/wcs/wcsPlc'; |
| | | import { WriteStartStop } from '/@/api/wcs/wcsDevice'; |
| | | import { WriteStartStop,GetCarDL } from '/@/api/wcs/wcsDevice'; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | const carDL1= ref<any>({}); |
| | | carDL1.value="获取中.."; |
| | | const carDL2= ref<any>({}); |
| | | carDL2.value="获取中.."; |
| | | const activeNames = ref(['1']) |
| | | const activeNames2 = ref(['2']) |
| | | const state = ref<any>({}); |
| | | const handleQuery = async () => { |
| | | var resCar = await GetCarDL(); |
| | | if (resCar.data.result._dicList && resCar.data.result._dicList.length > 0) { |
| | | resCar.data.result._dicList.forEach(car => { |
| | | const name = Object.keys(car)[0]; |
| | | if(name=="穿梭车1"){ |
| | | carDL1.value=car[name]+"%"; |
| | | } |
| | | if(name=="穿梭车2"){ |
| | | carDL2.value=car[name]+"%"; |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | handleQuery(); |
| | | |
| | | |
| | | const write = async (type: string, no: string, layer: string, FuncName: string) => { |
| | | |
| | |
| | | Layer: layer, |
| | | FuncName: FuncName |
| | | }; |
| | | |
| | | var res = await WriteStartStop(data); |
| | | console.log(res.data.result); |
| | | // ElMessage.success(res.data.result); |