现场代码提交

master
CZ 2 months ago
parent cf3014927e
commit 729521f336

@ -73,6 +73,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
return selectPackDto; return selectPackDto;
} }
//校验电池编码是否匹配
foreach (var binInfo in list) foreach (var binInfo in list)
{ {
var normalBinInfo = QueryByClause(i => 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; return selectPackDto;
} }

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

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

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

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

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

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

Loading…
Cancel
Save