换电仓位数据更新,移仓仓位数据更新

zw
lxw 6 months ago
parent 22a4c94027
commit 4f3877e683

@ -165,8 +165,10 @@ public class CommonMgr
{ {
List<BinInfo> list = List<BinInfo> list =
_binInfoRepository.QueryListByClause(i => _binInfoRepository.QueryListByClause(i =>
i.CacheBinFlag==0 &&
i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock
&& i.Exists == 0); && i.Exists == 0);
if (list.Count <= 0) if (list.Count <= 0)
{ {
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin; orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
@ -208,5 +210,28 @@ public class CommonMgr
} }
/// <summary>
/// 换电成功关于binInfo表的处理
/// </summary>
public void UpdateBinInfoForSwapSuccess(SwappingStateMachine machine)
{
SwapOrderBatteryInfo? machineSwapOrderBatteryInfo = machine.SwapOrderBatteryInfo;
if (machineSwapOrderBatteryInfo != null)
{
var inBinInfo = machineSwapOrderBatteryInfo.InBinInfo;
inBinInfo.Soc = -1;
inBinInfo.Soe = -1;
inBinInfo.BatteryNo = "-1";
_binInfoRepository.Update(inBinInfo);
var upBinInfo = machineSwapOrderBatteryInfo.UpBinInfo;
upBinInfo.Soc = -1;
upBinInfo.Soe = -1;
upBinInfo.BatteryNo = "-1";
_binInfoRepository.Update(upBinInfo);
}
}
} }

@ -13,5 +13,8 @@ public class SwapOrderBatteryInfo
public InfoEnum.SelectBinStatusInfo CanSwap; public InfoEnum.SelectBinStatusInfo CanSwap;
public BinInfo UpBinInfo; public BinInfo UpBinInfo;
/// <summary>
/// downBinNo
/// </summary>
public BinInfo InBinInfo; public BinInfo InBinInfo;
} }

@ -175,7 +175,9 @@ public class DoSwappingState : IState
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
if (PlcApi.ReadPlcTaskStatus() == 1002) int status = PlcApi.ReadPlcTaskStatus();
//处理程序太快plc还没有初始值的状态
if (status==1002 || status!=1003)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
} }
@ -184,8 +186,6 @@ public class DoSwappingState : IState
machine.UnOldBatteryFlag = true; machine.UnOldBatteryFlag = true;
} }
if (machine.UnOldBatteryFlag) if (machine.UnOldBatteryFlag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,

@ -56,6 +56,9 @@ public class SwapDoneState : IState
return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None);
} }
//换电成功关于bininfo表的更新
_CommonMgr.UpdateBinInfoForSwapSuccess(machine);
return new StateResult() return new StateResult()
{ {
SwappingState = SwappingState.StationReady SwappingState = SwappingState.StationReady
@ -111,7 +114,6 @@ public class SwapDoneState : IState
return Invoker.Invoke("wait exist radar", 1000, 5, machine.IsCanceled, return Invoker.Invoke("wait exist radar", 1000, 5, machine.IsCanceled,
() => machine.RadarOutFlag, () => () => machine.RadarOutFlag, () =>
{ {
//TODO::邏輯更改
if (!PlcApi.ExitRadar()) if (!PlcApi.ExitRadar())
{ {
_log.Info("exist radar false"); _log.Info("exist radar false");

@ -113,7 +113,6 @@ public class MonitorService
public Result<SwapAndChargingCountResp> SwapAndChargingCount() public Result<SwapAndChargingCountResp> SwapAndChargingCount()
{ {
SwapAndChargingCountResp chargingCountResp = new() SwapAndChargingCountResp chargingCountResp = new()
{ {
ChargeTodayCount = ChargeOrderRepository.GetCount(i => DateUtils.IsDateTimeToday(i.EndTime)), ChargeTodayCount = ChargeOrderRepository.GetCount(i => DateUtils.IsDateTimeToday(i.EndTime)),
@ -157,18 +156,30 @@ public class MonitorService
} }
//如果是缓存仓 更新缓存仓的数据 //如果是缓存仓 更新缓存仓的数据
if (putBinNo == 1) if (putBin.CacheBinFlag == 1)
{ {
putBin.Exists = 1; putBin.Exists = 1;
putBin.BatteryNo = removeBin.BatteryNo;
putBin.Soc = removeBin.Soc; putBin.Soc = removeBin.Soc;
putBin.Soe = removeBin.Soe; putBin.Soe = removeBin.Soe;
putBin.Soh = removeBin.Soh; putBin.Soh = removeBin.Soh;
BinInfoRepository.Update(putBin); BinInfoRepository.Update(putBin);
} }
if (removeBin.CacheBinFlag == 1)
{
removeBin.Exists = 0;
removeBin.BatteryNo = "-1";
removeBin.Soc = -1;
removeBin.Soe = -1;
removeBin.Soh = -1;
BinInfoRepository.Update(removeBin);
}
return Result<bool>.Success(); return Result<bool>.Success();
} }
public Result<List<BinInfoResp>> GetChargeBinOption() public Result<List<BinInfoResp>> GetChargeBinOption()
{ {
List<BinInfo> queryListByClause = BinInfoRepository.Query(); List<BinInfo> queryListByClause = BinInfoRepository.Query();

@ -1,6 +1,6 @@
{ {
"Version": 1, "Version": 1,
"Hash": "LS9utnIO5mfHvtDI6/Yvv5jVnmRGtwfQUGBjyueTZQE=", "Hash": "kIfehZk8TWWy62IgCKeVJMphEP8JJ0AGeTvs9NqLTfU=",
"Source": "WebStarter", "Source": "WebStarter",
"BasePath": "_content/WebStarter", "BasePath": "_content/WebStarter",
"Mode": "Default", "Mode": "Default",
@ -10,17 +10,17 @@
{ {
"Name": "WebStarter\\wwwroot", "Name": "WebStarter\\wwwroot",
"Source": "WebStarter", "Source": "WebStarter",
"ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter", "BasePath": "_content/WebStarter",
"Pattern": "**" "Pattern": "**"
} }
], ],
"Assets": [ "Assets": [
{ {
"Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240523\\0.jpg", "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240523\\0.jpg",
"SourceId": "WebStarter", "SourceId": "WebStarter",
"SourceType": "Discovered", "SourceType": "Discovered",
"ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter", "BasePath": "_content/WebStarter",
"RelativePath": "20240523/0.jpg", "RelativePath": "20240523/0.jpg",
"AssetKind": "All", "AssetKind": "All",
@ -36,10 +36,10 @@
"OriginalItemSpec": "wwwroot\\20240523\\0.jpg" "OriginalItemSpec": "wwwroot\\20240523\\0.jpg"
}, },
{ {
"Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240524\\0.jpg", "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.jpg",
"SourceId": "WebStarter", "SourceId": "WebStarter",
"SourceType": "Discovered", "SourceType": "Discovered",
"ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter", "BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.jpg", "RelativePath": "20240524/0.jpg",
"AssetKind": "All", "AssetKind": "All",
@ -55,10 +55,10 @@
"OriginalItemSpec": "wwwroot\\20240524\\0.jpg" "OriginalItemSpec": "wwwroot\\20240524\\0.jpg"
}, },
{ {
"Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240524\\0.png", "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.png",
"SourceId": "WebStarter", "SourceId": "WebStarter",
"SourceType": "Discovered", "SourceType": "Discovered",
"ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter", "BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.png", "RelativePath": "20240524/0.png",
"AssetKind": "All", "AssetKind": "All",

Loading…
Cancel
Save