现场代码提交

master
CZ 2 months ago
parent cf3014927e
commit 729521f336

@ -73,6 +73,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
return selectPackDto;
}
//校验电池编码是否匹配
foreach (var binInfo in list)
{
var normalBinInfo = QueryByClause(i =>
@ -98,14 +99,6 @@ public class BinInfoRepository : BaseRepository<BinInfo>
}
}
/*list = list.Where(i => i.LastChargeFinishTime != null || new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes > swapFinishChargeTime).ToList();
if (list.Count <= 0)
{ selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOf3Minute;
return selectPackDto;
}*/
return selectPackDto;
}

@ -73,27 +73,27 @@ public class CommonMgr
{
List<BinInfo> upBin = machine.SwapOrderBatteryInfo.UpBinInfo;
List<BinInfo> inBin = machine.SwapOrderBatteryInfo.InBinInfo;
List<SwapOrderBattery> swapOrderBatteryList = new List<SwapOrderBattery>();
for (int i = 0; i < upBin.Count; i++)
{
SwapOrderBattery swapOrderBattery = new SwapOrderBattery()
{
SwapOrderSn = machine.SwapOrder.Sn,
UpBatterySoc = upBin[i].Soc,
UpBatteryNo = upBin[i].BatteryNo,
UpBatterySoe = upBin[i].Soe,
UpBatteryBinNo = int.Parse(upBin[i].No),
DownBatteryBinNo = int.Parse(inBin[i].No),
DownBatteryNo = inBin[i].BatteryNo,
DownBatterySoc = inBin[i].Soc,
DownBatterySoe = inBin[i].Soe,
CreatedTime = DateTime.Now
};
SwapOrderBattery swapOrderBattery = new SwapOrderBattery();
swapOrderBattery.SwapOrderSn = machine.SwapOrder.Sn;
swapOrderBattery.UpBatterySoc = upBin[i].Soc;
swapOrderBattery.UpBatteryNo = upBin[i].BatteryNo;
swapOrderBattery.UpBatterySoe = upBin[i].Soe;
swapOrderBattery.UpBatteryBinNo = int.Parse(upBin[i].No);
swapOrderBattery.DownBatteryBinNo = int.Parse(inBin[i].No);
swapOrderBattery.DownBatteryNo = "-1"; //inBin[i].BatteryNo;
swapOrderBattery.DownBatterySoc = -1; //inBin[i].Soc;
swapOrderBattery.DownBatterySoe = -1; //inBin[i].Soe;
swapOrderBattery.CreatedTime = DateTime.Now;
swapOrderBatteryList.Add(swapOrderBattery);
}
_swapOrderBatteryRepository.Insert(swapOrderBatteryList);
}
@ -176,7 +176,8 @@ public class CommonMgr
return orderBatteryInfo;
}
orderBatteryInfo.UpBinInfo=new List<BinInfo> { UpBin , UpBin2 };
orderBatteryInfo.UpBinInfo = new List<BinInfo> { UpBin, UpBin2 };
InBin(orderBatteryInfo, machine);
return orderBatteryInfo;
@ -191,15 +192,15 @@ public class CommonMgr
{
SelectPackDto selectPack =
_binInfoRepository.SelectPack(StaticStationInfo.SwapSoc, StaticStationInfo.SwapFinishChargeTime,
QueryMoveBinNo()[0],BatteryGroupRepository);
QueryMoveBinNo()[0], BatteryGroupRepository);
if (selectPack != null)
if (selectPack != null && selectPack.BinInfo != null)
{
//第二块电池信息去第一块电池编号+10
int no = Convert.ToInt32(selectPack.BinInfo.No) + 10;
BinInfo UpBin2 = _binInfoRepository.QueryByClause(i => i.No == no.ToString());
BinInfo UpBin = _binInfoRepository.QueryByClause(i => i.No == no.ToString());
orderBatteryInfo.UpBinInfo = new List<BinInfo>() { selectPack.BinInfo, UpBin2 };
orderBatteryInfo.UpBinInfo = new List<BinInfo>() { selectPack.BinInfo, UpBin };
orderBatteryInfo.CanSwap = selectPack.Info;
}
}
@ -248,6 +249,7 @@ public class CommonMgr
{
list = list.Where(i => i.No != value).ToList();
}
if (list.Count <= 0)
{
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
@ -256,9 +258,9 @@ public class CommonMgr
//第二块电池信息去第一块电池编号+10
int no = Convert.ToInt32(list[0].No) + 10;
BinInfo UpBin2 = _binInfoRepository.QueryByClause(i => i.No == no.ToString());
BinInfo UpBin = _binInfoRepository.QueryByClause(i => i.No == no.ToString());
orderBatteryInfo.InBinInfo = new List<BinInfo>() { list[0], UpBin2 };
orderBatteryInfo.InBinInfo = new List<BinInfo>() { list[0], UpBin };
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}

@ -119,7 +119,7 @@ public class CarCtrlState : IState
if (resultHeartBeatMsg?.HighVoltage != 2)
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxEnergyDown);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxEnergyDown);
}
if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag)

@ -126,8 +126,8 @@ public class DoSwappingState : IState
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.HoldOn);
//读取任务状态
var taskPrepare = PlcApi.ReadTaskStatus(2);
if (taskPrepare)
/*var taskPrepare = PlcApi.ReadTaskStatus(2);
if (taskPrepare)*/
{
bool holdOn = PlcApi.HoldOn();
if (holdOn)

@ -137,7 +137,6 @@ public class SwapDoneState : IState
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar);
}, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
, 10, InvokeStatus.None);
@ -217,7 +216,6 @@ public class SwapDoneState : IState
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxDown);
}, false, () => { }
, 10, InvokeStatus.None);
@ -248,7 +246,6 @@ public class SwapDoneState : IState
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoTboxEnergyUp);
}, false, () => { }
, 5, InvokeStatus.None);

@ -35,8 +35,8 @@ public class SwapOrderMgr
List<SwapOrderBattery> batterys =
_swapOrderBatteryRepository.QueryListByClause(i =>
swapOrderSn.Contains(i.SwapOrderSn) && i.DownBatteryNo != null && i.DownBatteryNo!="-1"
&& i.DownBatterySoc!=-1 && i.DownBatterySoc!=null);
swapOrderSn.Contains(i.SwapOrderSn) && i.DownBatteryNo != null && i.DownBatteryNo != "-1"
&& i.DownBatterySoc != -1 && i.DownBatterySoc != null);
if (batterys.Count <= 0)
{
@ -60,12 +60,13 @@ public class SwapOrderMgr
continue;
}
if (null == swapOrderBattery.DownBatteryNo || "-1".Equals(swapOrderBattery.DownBatteryNo))
{
continue;
}
if (null == swapOrderBattery.DownBatterySoc || -1==swapOrderBattery.DownBatterySoc)
if (null == swapOrderBattery.DownBatterySoc || -1 == swapOrderBattery.DownBatterySoc)
{
continue;
}
@ -78,25 +79,22 @@ public class SwapOrderMgr
var count = _swapOrderRepository.GetCount(i =>
i.SwapResult == 1 && i.SwapEndTime >= DateTime.Today && i.SwapEndTime < swapOrder.SwapEndTime);
swapOrderReportClouds.TryGetValue(swapOrder.Id, out SwapOrderReportCloud value);
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, count++, swapOrderBattery, uploadType,value);
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, count++, swapOrderBattery, uploadType, value);
if (uploadSwapOrder == 0)
{
swapOrder.CloudReportStatus = 1;
updateDbOrder.Add(swapOrder);
// value.CloudReportStatus = 1000;
// value.CloudReportStatus = 1000;
value.UploadTime = DateTime.Now;
}
else
{
//当 cloudReportStatus >=100 就不需要上传了
value.CloudReportStatus++;
}
updateDbCloudReport.Add(value);
}
if (updateDbOrder.Count > 0)

@ -34,6 +34,12 @@ public class UpdateDownBatteryInfoTask : ITask
return 1000 * 2;
}
/// <summary>
/// 更新换下电池包及上辅源
/// 逻辑
/// 查最新一条换电订单看里面soc电池编码以及在位状态
/// 如果订单中soc电池编码都为负数并且仓位电池数据都在就可以更新了
/// </summary>
public void Handle()
{

Loading…
Cancel
Save