调试测试修改 修改 插入不返回id

master
lxw 6 months ago
parent 59a7492a31
commit 471eade709

@ -13,4 +13,13 @@ public class DateUtils
DateTime endOfToday = startOfToday.AddDays(1).AddTicks(-1); DateTime endOfToday = startOfToday.AddDays(1).AddTicks(-1);
return dateTime >= startOfToday && dateTime <= endOfToday; return dateTime >= startOfToday && dateTime <= endOfToday;
} }
/// 获取明天的0.0.0
public static DateTime GetTomorrowFirst()
{
DateTime today = DateTime.Now; // 获取当前时间
DateTime tomorrow = today.Date.AddDays(1); // 获取明天的日期
return new DateTime(tomorrow.Year, tomorrow.Month, tomorrow.Day, 0, 0, 0); // 获取明天的0点
}
} }

@ -127,7 +127,7 @@ namespace Entity.Api.Resp
///// <summary> ///// <summary>
///// 换电电池 ///// 换电电池
///// </summary> ///// </summary>
//public List<SwapOrderBatteryResp> BatteryList{get;set;} public List<SwapOrderBatteryResp> BatteryList{get;set;}
/// <summary> /// <summary>
/// 换电小步 /// 换电小步

@ -44,7 +44,7 @@ public class InfoEnum
[Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr, [Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr,
[Info("车辆驶入","车辆驶入")] CarInInfo, [Info("车辆驶入","车辆驶入")] CarInInfo,
[Info("换电任务启动","换电任务启动")] StartSwapInfo,
} }

@ -796,11 +796,11 @@ public abstract class BaseRepository<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(T entity) public async Task<T> InsertAsync(T entity)
{ {
return await DbBaseClient return await DbBaseClient
.Insertable(entity) .Insertable(entity)
.ExecuteReturnIdentityAsync(); .ExecuteReturnEntityAsync();
} }
public async Task<T> InsertReturnEntityAsync(T entity) public async Task<T> InsertReturnEntityAsync(T entity)
{ {
@ -814,12 +814,12 @@ public abstract class BaseRepository<T> where T : class, new()
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <param name="insertColumns">插入的列</param> /// <param name="insertColumns">插入的列</param>
/// <returns></returns> /// <returns></returns>
public int Insert(T entity, Expression<Func<T, object>> insertColumns = null) public T Insert(T entity, Expression<Func<T, object>> insertColumns = null)
{ {
var insert = DbBaseClient.Insertable(entity); var insert = DbBaseClient.Insertable(entity);
if (insertColumns == null) if (insertColumns == null)
return insert.ExecuteReturnIdentity(); return insert.ExecuteReturnEntity();
return insert.InsertColumns(insertColumns).ExecuteReturnIdentity(); return insert.InsertColumns(insertColumns).ExecuteReturnEntity();
} }
/// <summary> /// <summary>
@ -828,12 +828,12 @@ public abstract class BaseRepository<T> where T : class, new()
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <param name="insertColumns">插入的列</param> /// <param name="insertColumns">插入的列</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(T entity, Expression<Func<T, object>> insertColumns = null) public async Task<T> InsertAsync(T entity, Expression<Func<T, object>> insertColumns = null)
{ {
var insert = DbBaseClient.Insertable(entity); var insert = DbBaseClient.Insertable(entity);
if (insertColumns == null) if (insertColumns == null)
return await insert.ExecuteReturnIdentityAsync(); return await insert.ExecuteReturnEntityAsync();
return await insert.InsertColumns(insertColumns).ExecuteReturnIdentityAsync(); return await insert.InsertColumns(insertColumns).ExecuteReturnEntityAsync();
} }
/// <summary> /// <summary>
@ -869,9 +869,10 @@ public abstract class BaseRepository<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体类</param> /// <param name="entity">实体类</param>
/// <returns></returns> /// <returns></returns>
public int Insert(List<T> entity) public bool Insert(List<T> entity)
{ {
return DbBaseClient.Insertable(entity.ToArray()).ExecuteReturnIdentity(); return DbBaseClient.Insertable(entity.ToArray()).ExecuteCommandIdentityIntoEntity();
;
} }
/// <summary> /// <summary>
@ -879,9 +880,9 @@ public abstract class BaseRepository<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体类</param> /// <param name="entity">实体类</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(List<T> entity) public async Task<bool> InsertAsync(List<T> entity)
{ {
return await DbBaseClient.Insertable(entity.ToArray()).ExecuteCommandAsync(); return await DbBaseClient.Insertable(entity.ToArray()).ExecuteCommandIdentityIntoEntityAsync();
} }
/// <summary> /// <summary>

@ -299,7 +299,7 @@ public class BaseServices<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(T entity) public async Task<T> InsertAsync(T entity)
{ {
return await BaseDal.InsertAsync(entity); return await BaseDal.InsertAsync(entity);
} }
@ -310,7 +310,7 @@ public class BaseServices<T> where T : class, new()
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <param name="insertColumns">插入的列</param> /// <param name="insertColumns">插入的列</param>
/// <returns></returns> /// <returns></returns>
public int Insert(T entity, Expression<Func<T, object>> insertColumns = null) public T Insert(T entity, Expression<Func<T, object>> insertColumns = null)
{ {
return BaseDal.Insert(entity, insertColumns); return BaseDal.Insert(entity, insertColumns);
} }
@ -321,7 +321,7 @@ public class BaseServices<T> where T : class, new()
/// <param name="entity">实体数据</param> /// <param name="entity">实体数据</param>
/// <param name="insertColumns">插入的列</param> /// <param name="insertColumns">插入的列</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(T entity, Expression<Func<T, object>> insertColumns = null) public async Task<T> InsertAsync(T entity, Expression<Func<T, object>> insertColumns = null)
{ {
return await BaseDal.InsertAsync(entity, insertColumns); return await BaseDal.InsertAsync(entity, insertColumns);
} }
@ -353,7 +353,7 @@ public class BaseServices<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体类</param> /// <param name="entity">实体类</param>
/// <returns></returns> /// <returns></returns>
public int Insert(List<T> entity) public bool Insert(List<T> entity)
{ {
return BaseDal.Insert(entity); return BaseDal.Insert(entity);
} }
@ -363,7 +363,7 @@ public class BaseServices<T> where T : class, new()
/// </summary> /// </summary>
/// <param name="entity">实体类</param> /// <param name="entity">实体类</param>
/// <returns></returns> /// <returns></returns>
public async Task<int> InsertAsync(List<T> entity) public async Task<bool> InsertAsync(List<T> entity)
{ {
return await BaseDal.InsertAsync(entity); return await BaseDal.InsertAsync(entity);
} }

@ -180,7 +180,7 @@ public class CarPrepareState : IState
/// <summary> /// <summary>
/// 检查tbox连接状态 /// 检查tbox连接状态
/// </summary> /// </summary
/// <returns></returns> /// <returns></returns>
public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine) public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine)
{ {

@ -41,13 +41,14 @@ public class DoSwappingState : IState
{ {
return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None);
} }
InvokeStatus holdOn = HoldOn(machine); InvokeStatus holdOn = HoldOn(machine);
if (holdOn != InvokeStatus.Done) if (holdOn != InvokeStatus.Done)
{ {
return SwappingStateMachine.ReturnWithInvokeErr(holdOn, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(holdOn, ExceptionReason.None);
} }
//查看通道状态 //查看通道状态
StateResult checkChannelStatus = CheckChannelStatus(machine); StateResult checkChannelStatus = CheckChannelStatus(machine);
if (checkChannelStatus != null) if (checkChannelStatus != null)
@ -89,8 +90,8 @@ public class DoSwappingState : IState
{ {
return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
} }
//航车回归安全位置 //航车回归安全位置
InvokeStatus toInvokeStatus = ToSafePosition(machine); InvokeStatus toInvokeStatus = ToSafePosition(machine);
if (toInvokeStatus != InvokeStatus.Done) if (toInvokeStatus != InvokeStatus.Done)
@ -121,7 +122,7 @@ public class DoSwappingState : IState
//查询车辆锁止状态 //查询车辆锁止状态
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No, var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
machine.SwapOrderBatteryInfo.UpBinInfo.No); machine.SwapOrderBatteryInfo.UpBinInfo.No);
//查詢當前任務狀態是否被更改 //查詢當前任務狀態是否被更改
var readPlcTaskStatus = PlcApi.ReadTaskStatus(1); var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
if (startSwapping && readPlcTaskStatus) if (startSwapping && readPlcTaskStatus)
@ -155,7 +156,7 @@ public class DoSwappingState : IState
bool holdOn = PlcApi.HoldOn(); bool holdOn = PlcApi.HoldOn();
if (holdOn) if (holdOn)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.StartSwapInfo);
machine.PlcHoldFlag = true; machine.PlcHoldFlag = true;
} }
} }
@ -177,13 +178,12 @@ public class DoSwappingState : IState
() => machine.UnOldBatteryFlag, () => () => machine.UnOldBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
int status = PlcApi.ReadPlcTaskStatus(); int status = PlcApi.ReadPlcTaskStatus();
//处理程序太快plc还没有初始值的状态 //处理程序太快plc还没有初始值的状态
if (status==1002 || status!=1003) if (status == 1002 || status != 1003)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
} }
else else
{ {
@ -195,7 +195,8 @@ public class DoSwappingState : IState
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
machine); machine);
} }
}, () => { }); }, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); }, false, () => { }, 10,
InvokeStatus.None);
} }
public InvokeStatus OldBatteryCarryIn(SwappingStateMachine machine) public InvokeStatus OldBatteryCarryIn(SwappingStateMachine machine)
@ -204,25 +205,25 @@ public class DoSwappingState : IState
() => machine.StorageOldBatteryFlag, () => () => machine.StorageOldBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoOldBatteryCarryIn.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoOldBatteryCarryIn.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn); var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus();
if (PlcApi.ReadPlcTaskStatus() == 1003) if (readPlcTaskStatus == 1003 || readPlcTaskStatus != 1004)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn);
} }
else else
{ {
machine.StorageOldBatteryFlag = true; machine.StorageOldBatteryFlag = true;
} }
machine.StorageOldBatteryFlag = PlcApi.ReadPlcTaskStatus() == 1004; machine.StorageOldBatteryFlag = readPlcTaskStatus == 1004;
if (machine.StorageOldBatteryFlag) if (machine.StorageOldBatteryFlag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
machine); machine);
} }
}, () => { }); }, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn); }, false, () => { }, 10,
InvokeStatus.None);
} }
public InvokeStatus NewBatteryCarryOut(SwappingStateMachine machine) public InvokeStatus NewBatteryCarryOut(SwappingStateMachine machine)
@ -231,22 +232,23 @@ public class DoSwappingState : IState
() => machine.OutNewBatteryFlag, () => () => machine.OutNewBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoNewBatteryCarryOut.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoNewBatteryCarryOut.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);
if (PlcApi.ReadPlcTaskStatus() == 1004) if (PlcApi.ReadPlcTaskStatus() == 1004)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);
} }
else else
{ {
machine.OutNewBatteryFlag = true; machine.OutNewBatteryFlag = true;
} }
if (machine.OutNewBatteryFlag) if (machine.OutNewBatteryFlag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
machine); machine);
} }
}, () => { }); }, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);}, false, () => { }, 10,
InvokeStatus.None);
} }
@ -256,10 +258,9 @@ public class DoSwappingState : IState
() => machine.InstallNewBatteryFlag, () => () => machine.InstallNewBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
if (PlcApi.ReadPlcTaskStatus() == 1005) if (PlcApi.ReadPlcTaskStatus() == 1005)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
} }
else else
{ {
@ -271,7 +272,11 @@ public class DoSwappingState : IState
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
machine); machine);
} }
}, () => { }); }, () =>
{
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
},false, () => { },
10,InvokeStatus.None);
} }
public InvokeStatus PackFinish(SwappingStateMachine machine) public InvokeStatus PackFinish(SwappingStateMachine machine)
@ -280,22 +285,23 @@ public class DoSwappingState : IState
() => machine.FinishNewBatteryFlag, () => () => machine.FinishNewBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPackFinish);
var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus(); var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus();
if (readPlcTaskStatus == 1006 || readPlcTaskStatus==1007 ) if (readPlcTaskStatus == 1006 || readPlcTaskStatus == 1007)
{ {
machine.FinishNewBatteryFlag = true; machine.FinishNewBatteryFlag = true;
machine.BusinessSwappingForCloudState = machine.BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.SwapFinish; InfoEnum.BusinessSwappingForCloudState.SwapFinish;
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
machine.BusinessSwappingStateUpdateTime = DateTime.Now; machine.BusinessSwappingStateUpdateTime = DateTime.Now;
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPackFinish);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
machine); machine);
} }
}, () => { }); }, () => { },false, () => { },
10,InvokeStatus.None);
} }
/// <summary> /// <summary>
/// 行车回归安全位置 /// 行车回归安全位置
/// </summary> /// </summary>
@ -307,19 +313,19 @@ public class DoSwappingState : IState
() => machine.ToSafePositionFlag, () => () => machine.ToSafePositionFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
if (PlcApi.ReadPlcTaskStatus() == 1007) if (PlcApi.ReadPlcTaskStatus() == 1007)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
machine.ToSafePositionFlag = true; machine.ToSafePositionFlag = true;
machine.BusinessSwappingStateUpdateTime = DateTime.Now; machine.BusinessSwappingStateUpdateTime = DateTime.Now;
machine.SwapStatus = 1; machine.SwapStatus = 1;
} }
}, () => { }); }, () => { });
} }
/// <summary> /// <summary>
/// 查看通道状态 /// 查看通道状态
/// :0无效值 /// :0无效值

@ -153,6 +153,11 @@ public class SwapDoneState : IState
machine); machine);
} }
} }
}); }, () =>
{
SoundTool.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? (int)InfoEnum.SwapInfo.InfoCarLeave
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
}, false,() => { },10,InvokeStatus.None);
} }
} }

@ -235,7 +235,7 @@ public class SwappingStateMachine : IDisposable
ResetData(); ResetData();
//重置云平台下发的指令 //重置云平台下发的指令
CloudApi.ClearCarCanStartInfo(); // CloudApi.ClearCarCanStartInfo();
} }
public bool Cancel() public bool Cancel()
@ -270,28 +270,75 @@ public class SwappingStateMachine : IDisposable
private void ResetStep() private void ResetStep()
{ {
RadarInFlag = false; RadarInFlag = false;
BeginRfidReadFlag = false; BeginRfidReadFlag = false;
RfidReadFlag = false; RfidReadFlag = false;
CloudVelCheckFlag = false; CloudVelCheckFlag = false;
BoxConnectFlag = false; BoxConnectFlag = false;
BoxLocalCheckFlag = false; BoxLocalCheckFlag = false;
CloudTBoxFlag = false; CloudTBoxFlag = false;
SelectPackFlag = false; SelectPackFlag = false;
VehiclesInPlaceFlag = false; VehiclesInPlaceFlag = false;
DistributeSelectPackFlag = false; DistributeSelectPackFlag = false;
CloudCarCanStartFlag = false; CloudCarCanStartFlag = false;
VelUnlockFlag = false; VelUnlockFlag = false;
StartSwappingFlag = false; StartSwappingFlag = false;
PlcHoldFlag = false;
ChannelStatusOkFlag = false; ChannelStatusOkFlag = false;
VehiclesInPlace2Flag = false; VehiclesInPlace2Flag = false;
UnOldBatteryFlag = false; UnOldBatteryFlag = false;
StorageOldBatteryFlag = false; StorageOldBatteryFlag = false;
OutNewBatteryFlag = false; OutNewBatteryFlag = false;
InstallNewBatteryFlag = false; InstallNewBatteryFlag = false;
FinishNewBatteryFlag = false; FinishNewBatteryFlag = false;
ToSafePositionFlag = false;
VelLockFlag = false; VelLockFlag = false;
RadarOutFlag = false; RadarOutFlag = false;
PlcHoldFlag = false;
} }
//关于仓库锁定相关重置 //关于仓库锁定相关重置

@ -115,10 +115,10 @@ public class MonitorService
{ {
SwapAndChargingCountResp chargingCountResp = new() SwapAndChargingCountResp chargingCountResp = new()
{ {
ChargeTodayCount = ChargeOrderRepository.GetCount(i => DateUtils.IsDateTimeToday(i.EndTime)), ChargeTodayCount = ChargeOrderRepository.GetCount(i => DateTime.Today<=i.EndTime && i.EndTime<= DateUtils.GetTomorrowFirst()),
ChargeTotalCount = ChargeOrderRepository.GetCount(i => i.EndTime != null), ChargeTotalCount = ChargeOrderRepository.GetCount(i => i.EndTime != null),
SwapTodayCount = SwapTodayCount =
SwapOrderRepository.GetCount(i => i.SwapResult != 0 && DateUtils.IsDateTimeToday(i.SwapEndTime)), SwapOrderRepository.GetCount(i => i.SwapResult != 0 && DateTime.Today<=i.SwapEndTime && i.SwapEndTime<= DateUtils.GetTomorrowFirst()),
SwapTotalCount = SwapOrderRepository.GetCount(i => i.SwapResult != 0), SwapTotalCount = SwapOrderRepository.GetCount(i => i.SwapResult != 0),
}; };
@ -135,7 +135,7 @@ public class MonitorService
{ {
//校验:出仓位 //校验:出仓位
BinInfo? removeBin = BinInfoRepository.QueryByClause(i => BinInfo? removeBin = BinInfoRepository.QueryByClause(i =>
i.No.Equals(removeBinNo) && i.ChargeStatus == 2 && i.Exists == 1 && i.AmtLock == 0); i.No.Equals(removeBinNo) && (i.ChargeStatus == 2 || i.ChargeStatus==4) && i.Exists == 1 && i.AmtLock == 0);
if (removeBin == null) if (removeBin == null)
{ {
@ -143,7 +143,7 @@ public class MonitorService
} }
BinInfo? putBin = BinInfoRepository.QueryByClause(i => BinInfo? putBin = BinInfoRepository.QueryByClause(i =>
i.No.Equals(putBinNo) && i.ChargeStatus == 2 && i.Exists == 0 && i.AmtLock == 0 && i.Status == 1); i.No.Equals(putBinNo) && (i.ChargeStatus == 2 || i.ChargeStatus==4) && i.Exists == 0 && i.AmtLock == 0 && i.Status == 1);
if (putBin == null) if (putBin == null)
{ {
return Result<bool>.Fail("入仓位状态有误"); return Result<bool>.Fail("入仓位状态有误");

@ -72,8 +72,8 @@ namespace Service.System.Dict
if (isExist != null) if (isExist != null)
return result = "字典类型已存在,名称或编码重复"; return result = "字典类型已存在,名称或编码重复";
var insert = await _sysDictTypeRep.InsertAsync(input.Adapt<SysDictType>()); SysDictType sysDictType = await _sysDictTypeRep.InsertAsync(input.Adapt<SysDictType>());
if (insert > 0) if (sysDictType.Id > 0)
return result = "添加字典类型成功"; return result = "添加字典类型成功";
else else
return result = "添加字典类型失败"; return result = "添加字典类型失败";

@ -91,8 +91,8 @@ namespace Service.System
var isExist = await _sysConfigRep.QueryByClauseAsync(u => u.Name == input.Name || u.Code == input.Code); var isExist = await _sysConfigRep.QueryByClauseAsync(u => u.Name == input.Name || u.Code == input.Code);
if (isExist != null) if (isExist != null)
result = "已存在同名或同编码参数配置"; result = "已存在同名或同编码参数配置";
int insertSesult = await _sysConfigRep.InsertAsync(input.Adapt<SysConfig>()); SysConfig insertAsync = await _sysConfigRep.InsertAsync(input.Adapt<SysConfig>());
if (insertSesult > 0) if (insertAsync.Id > 0)
result = "增加参数配置成功"; result = "增加参数配置成功";
return result; return result;

@ -43,20 +43,20 @@ public class SwapOrderController : ControllerBase
//电池不要了 //电池不要了
////查询订单电池数据 ////查询订单电池数据
//List< SwapOrderBattery> batteryList = swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn)); List< SwapOrderBattery> batteryList = swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
////映射 //映射
//var config = new MapperConfiguration(cfg => cfg.CreateMap<SwapOrderBatteryResp,SwapOrderBattery > ().ReverseMap()); var config = new MapperConfiguration(cfg => cfg.CreateMap<SwapOrderBatteryResp,SwapOrderBattery > ().ReverseMap());
//IMapper mapper = config.CreateMapper(); IMapper mapper = config.CreateMapper();
//List<SwapOrderBatteryResp> swapOrderBattery = mapper.Map<List<SwapOrderBatteryResp>>(batteryList); List<SwapOrderBatteryResp> swapOrderBattery = mapper.Map<List<SwapOrderBatteryResp>>(batteryList);
////将电池数据添加到换电订单数据中 //将电池数据添加到换电订单数据中
//for (int i = 0; i < swapOrderResp.Rows.Count; i++) for (int i = 0; i < swapOrderResp.Rows.Count; i++)
//{ {
// swapOrderResp.Rows[i].BatteryList = new List<SwapOrderBatteryResp>(); swapOrderResp.Rows[i].BatteryList = new List<SwapOrderBatteryResp>();
// swapOrderResp.Rows[i].BatteryList.AddRange(swapOrderBattery.Where(battery => battery.SwapOrderSn == swapOrderResp.Rows[i].Sn).ToList()); swapOrderResp.Rows[i].BatteryList.AddRange(swapOrderBattery.Where(battery => battery.SwapOrderSn == swapOrderResp.Rows[i].Sn).ToList());
//} }
//查询订单步序数据 //查询订单步序数据
var stepList = swapOrderStepService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn)); var stepList = swapOrderStepService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));

@ -60,25 +60,25 @@ public class GenController : ControllerBase
[HttpGet("test115")] [HttpGet("test115")]
public void Test115() public void Test115()
{ {
/*_batteryGroupRepository.Insert(new List<BatteryGroup>() var group = new BatteryGroup()
{ {
new BatteryGroup() BatteryNo = "1",
{ Group = 1,
BatteryNo = "1", };
Group = 1, var batteryGroup = new BatteryGroup()
}, {
new BatteryGroup() BatteryNo = "2",
{ Group = 2,
BatteryNo = "2", };
Group = 2, var groups = new List<BatteryGroup>() { group, batteryGroup };
}, _batteryGroupRepository.Insert(groups );
});*/ BatteryGroup batteryGroups = _batteryGroupRepository.QueryByClause(i => i.Group == 1);
BatteryGroup batteryGroups = _batteryGroupRepository.QueryByClause(i=>i.Group==1); /*
/*BatteryGroup batteryGroup = batteryGroups[0]; /*BatteryGroup batteryGroup = batteryGroups[0];
_batteryGroupRepository.Delete(batteryGroup); _batteryGroupRepository.Delete(batteryGroup);
BatteryGroup batteryGroup1 = batteryGroups[1]; BatteryGroup batteryGroup1 = batteryGroups[1];
batteryGroup1.Group = 3; batteryGroup1.Group = 3;
_batteryGroupRepository.Update(batteryGroup1);*/ _batteryGroupRepository.Update(batteryGroup1);#1#
if (batteryGroups == null) if (batteryGroups == null)
{ {
@ -88,6 +88,7 @@ public class GenController : ControllerBase
{ {
Console.WriteLine(); Console.WriteLine();
} }
*/
Console.WriteLine("测试完毕"); Console.WriteLine("测试完毕");
} }

Loading…
Cancel
Save