|
|
@ -36,15 +36,15 @@ public class MonitorService
|
|
|
|
public PlcTaskMgr PlcTaskMgr { get; set; }
|
|
|
|
public PlcTaskMgr PlcTaskMgr { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public MoveBinRecordRepository MoveBinRecordRepository { get; set; }
|
|
|
|
public MoveBinRecordRepository MoveBinRecordRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DisplayName("获取移仓分页")]
|
|
|
|
[DisplayName("获取移仓分页")]
|
|
|
|
public async Task<PageResult<MoveBinRecord>> Page(PageMoveBinRecordReq input)
|
|
|
|
public async Task<PageResult<MoveBinRecord>> Page(PageMoveBinRecordReq input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RefAsync<int> total = 0;
|
|
|
|
RefAsync<int> total = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var items = await MoveBinRecordRepository.QueryPageAsync(
|
|
|
|
var items = await MoveBinRecordRepository.QueryPageAsync(
|
|
|
|
entity => true,
|
|
|
|
entity => true,
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBatterySoc), u => u.UpBatterySoc.Equals(input.UpBatterySoc.Trim()),
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBatterySoc), u => u.UpBatterySoc.Equals(input.UpBatterySoc.Trim()),
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBinNo), u => u.UpBinNo.Equals(input.UpBinNo.Trim()),
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBinNo), u => u.UpBinNo.Equals(input.UpBinNo.Trim()),
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBatteryNo), u => u.UpBatteryNo.Equals(input.UpBatteryNo.Trim()),
|
|
|
|
!string.IsNullOrWhiteSpace(input.UpBatteryNo), u => u.UpBatteryNo.Equals(input.UpBatteryNo.Trim()),
|
|
|
@ -57,21 +57,22 @@ public class MonitorService
|
|
|
|
Rows = items,
|
|
|
|
Rows = items,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<string> Add(AddMoveBinRecordReq input)
|
|
|
|
public async Task<string> Add(AddMoveBinRecordReq input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string result = "";
|
|
|
|
string result = "";
|
|
|
|
|
|
|
|
|
|
|
|
MoveBinRecord moveBinRecord = await MoveBinRecordRepository.InsertAsync(input);
|
|
|
|
MoveBinRecord moveBinRecord = await MoveBinRecordRepository.InsertAsync(input);
|
|
|
|
|
|
|
|
|
|
|
|
return "新增id:" + moveBinRecord.Id;
|
|
|
|
return "新增id:" + moveBinRecord.Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req)
|
|
|
|
public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return await MoveBinRecordRepository.UpdateAsync(Req);
|
|
|
|
return await MoveBinRecordRepository.UpdateAsync(Req);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public virtual async Task<bool> Delete(DeleteMoveBinRecordReq input)
|
|
|
|
public virtual async Task<bool> Delete(DeleteMoveBinRecordReq input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var user = await MoveBinRecordRepository.QueryByClauseAsync(u => u.Id == input.Id);
|
|
|
|
var user = await MoveBinRecordRepository.QueryByClauseAsync(u => u.Id == input.Id);
|
|
|
@ -79,21 +80,22 @@ public class MonitorService
|
|
|
|
throw new ArgumentException($"不存在");
|
|
|
|
throw new ArgumentException($"不存在");
|
|
|
|
return await MoveBinRecordRepository.DeleteAsync(user);
|
|
|
|
return await MoveBinRecordRepository.DeleteAsync(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
|
|
|
|
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var configBinInfo =
|
|
|
|
var configBinInfo =
|
|
|
|
new MapperConfiguration(cfg => cfg.CreateMap<StepModel, SwappingStateInfoResp>().ReverseMap());
|
|
|
|
new MapperConfiguration(cfg => cfg.CreateMap<StepModel, SwappingStateInfoResp>().ReverseMap());
|
|
|
|
IMapper mapperBinInfo = configBinInfo.CreateMapper();
|
|
|
|
IMapper mapperBinInfo = configBinInfo.CreateMapper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SwappingStateInfoResp> stateInfoList = new List<SwappingStateInfoResp>();
|
|
|
|
List<SwappingStateInfoResp> stateInfoList = new List<SwappingStateInfoResp>();
|
|
|
|
ConcurrentDictionary<string, StepModel> dictionary = StationSoftMgr.SwappingStateMachine.StepModel;
|
|
|
|
ConcurrentDictionary<string, StepModel> dictionary = StationSoftMgr.SwappingStateMachine.StepModel;
|
|
|
|
stateInfoList = dictionary.Values
|
|
|
|
stateInfoList = dictionary.Values
|
|
|
|
.OrderBy(model => model.StepNo)
|
|
|
|
.OrderBy(model => model.StepNo)
|
|
|
|
.Select(model => mapperBinInfo.Map<SwappingStateInfoResp>(model))
|
|
|
|
.Select(model => mapperBinInfo.Map<SwappingStateInfoResp>(model))
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
|
|
|
|
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
|
|
|
|
|
|
|
|
|
|
|
|
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
|
|
|
|
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
|
|
|
@ -274,7 +276,7 @@ public class MonitorService
|
|
|
|
Type = type,
|
|
|
|
Type = type,
|
|
|
|
CreatedTime = DateTime.Now
|
|
|
|
CreatedTime = DateTime.Now
|
|
|
|
};
|
|
|
|
};
|
|
|
|
moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord);
|
|
|
|
moveBinRecord = MoveBinRecordRepository.Insert(moveBinRecord);
|
|
|
|
|
|
|
|
|
|
|
|
result = PlcMgr.HoldOn();
|
|
|
|
result = PlcMgr.HoldOn();
|
|
|
|
if (!result)
|
|
|
|
if (!result)
|
|
|
@ -299,6 +301,7 @@ public class MonitorService
|
|
|
|
MoveBinRecordRepository.Update(moveBinRecord);
|
|
|
|
MoveBinRecordRepository.Update(moveBinRecord);
|
|
|
|
return Result<bool>.Fail();
|
|
|
|
return Result<bool>.Fail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Log.Info($"move battery success update moveBin={JsonConvert.SerializeObject(moveBinRecord)}");
|
|
|
|
Log.Info($"move battery success update moveBin={JsonConvert.SerializeObject(moveBinRecord)}");
|
|
|
|
|
|
|
|
|
|
|
|
//如果是缓存仓 更新缓存仓的数据
|
|
|
|
//如果是缓存仓 更新缓存仓的数据
|
|
|
@ -315,14 +318,12 @@ public class MonitorService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (removeBin.CacheBinFlag == 1)
|
|
|
|
removeBin.Exists = 0;
|
|
|
|
{
|
|
|
|
removeBin.BatteryNo = "-1";
|
|
|
|
removeBin.Exists = 0;
|
|
|
|
removeBin.Soc = -1;
|
|
|
|
removeBin.BatteryNo = "-1";
|
|
|
|
removeBin.Soe = -1;
|
|
|
|
removeBin.Soc = -1;
|
|
|
|
removeBin.Soh = -1;
|
|
|
|
removeBin.Soe = -1;
|
|
|
|
|
|
|
|
removeBin.Soh = -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeBin.BatteryEnterSeq = 0;
|
|
|
|
removeBin.BatteryEnterSeq = 0;
|
|
|
|
BinInfoRepository.Update(removeBin);
|
|
|
|
BinInfoRepository.Update(removeBin);
|
|
|
@ -336,10 +337,10 @@ public class MonitorService
|
|
|
|
Log.Error($"move battery fail e={e.Message}");
|
|
|
|
Log.Error($"move battery fail e={e.Message}");
|
|
|
|
if (moveBinRecord != null)
|
|
|
|
if (moveBinRecord != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
moveBinRecord.Status = 3;
|
|
|
|
moveBinRecord.Status = 3;
|
|
|
|
MoveBinRecordRepository.Update(moveBinRecord);
|
|
|
|
MoveBinRecordRepository.Update(moveBinRecord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlcMgr.PlcClient?.ResetTaskNo();
|
|
|
|
PlcMgr.PlcClient?.ResetTaskNo();
|
|
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Fail();
|
|
|
|
return Result<bool>.Fail();
|
|
|
@ -358,4 +359,4 @@ public class MonitorService
|
|
|
|
|
|
|
|
|
|
|
|
return Result<List<BinInfoResp>>.Success(mapperBinInfo.Map<List<BinInfoResp>>(queryListByClause));
|
|
|
|
return Result<List<BinInfoResp>>.Success(mapperBinInfo.Map<List<BinInfoResp>>(queryListByClause));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|