/// <summary> /// 计算排序号 /// </summary> /// <param name="currentSeqNo"></param> /// <param name="statusPoints"></param> /// <param name="statusPointInfo"></param> /// <param name="intLesVehicleSeqStep"></param> /// <returns></returns> public long GetcurrentSeqNo(List <StatusPointInfo> statusPoints, StatusPointInfo statusPointInfo, int intLesVehicleSeqStep) { long currentSeqNo = 0; ///若本次采集点编号④对应的状态点代码②是该维度下状态点顺序号③最小的一个 if (statusPoints.Min(d => d.StatusPointSeq.GetValueOrDefault()) == statusPointInfo.StatusPointSeq.GetValueOrDefault()) { ///则根据当前该维度下最大的LES排序号⑬ ///系统配置步长作为本次的LES排序号⑬ currentSeqNo = new VehiclePointStatusDAL().GetMaxSeqNo( statusPointInfo.Plant, statusPointInfo.Workshop, statusPointInfo.StatusPointCode, statusPointInfo.AssemblyLine) + intLesVehicleSeqStep; } else { ///否则需要获取状态点代码①过点时间距离当前时间最近的前辆车以及状态点顺序③距离当前最近后辆车的LES排序号⑬ currentSeqNo = new VehiclePointStatusDAL().GetLastTimeSeqNo( statusPointInfo.Plant, statusPointInfo.Workshop, statusPointInfo.StatusPointCode, statusPointInfo.AssemblyLine); List <StatusPointInfo> statuses = statusPoints. Where(d => d.StatusPointSeq.GetValueOrDefault() < statusPointInfo.StatusPointSeq.GetValueOrDefault()). OrderByDescending(d => d.StatusPointSeq.GetValueOrDefault()). ToList(); long nextSeqNo = 0; foreach (var statuse in statuses) { nextSeqNo = new VehiclePointStatusDAL().GetLastTimeSeqNo( statuse.Plant, statuse.Workshop, statuse.StatusPointCode, statuse.AssemblyLine); if (nextSeqNo > 0) { break; } } ///求其平均值作为本次的LES排序号⑬ currentSeqNo += nextSeqNo == 0 ? 100 : nextSeqNo; currentSeqNo = nextSeqNo == 0 ? currentSeqNo : currentSeqNo / 2; } return(currentSeqNo); }
/// <summary> /// 在线替换 /// </summary> /// <param name="bomRepleaceConditionInfos"></param> /// <param name="loginUser"></param> public void OnlineReplacement(List <BomRepleaceConditionInfo> bomRepleaceConditionInfos, string loginUser) { if (bomRepleaceConditionInfos.Count == 0) { return; } ///生产订单 List <PullOrdersInfo> pullOrdersInfos = new PullOrdersDAL().GetList("" + " and [CHANGE_FLAG]=" + (int)ChangeFlagConstants.NotReplaced + "", string.Empty); if (pullOrdersInfos.Count == 0) { return; } ///车辆状态点信息集合 List <VehiclePointStatusInfo> vehiclePointStatusInfos = new VehiclePointStatusDAL().GetList("" + "and [ORDER_NO] in ('" + string.Join("','", bomRepleaceConditionInfos.Select(d => d.StartPorderCode).ToArray()) + "')", string.Empty); if (vehiclePointStatusInfos.Count == 0) { return; } ///状态点集合 List <StatusPointInfo> statusPointInfos = new StatusPointDAL().GetList("" + "[STATUS_POINT_CODE] in ('" + string.Join("','", vehiclePointStatusInfos.Select(d => d.StatusPointCode).ToArray()) + "')", string.Empty); if (statusPointInfos.Count == 0) { return; } ///时间窗(过点累计方式)零件类 List <TwdPartBoxInfo> twdPartBoxInfos = new TwdPartBoxDAL().GetList("" + " and [STATUS] =" + (int)BasicDataStatusConstants.Enable + " " + " and [REQUIREMENT_ACCUMULATE_MODE]=" + (int)RequirementAccumulateModeConstants.PassSpot + "" + " and [STATUS_POINT_CODE] in ('" + string.Join("','", statusPointInfos.Select(d => d.StatusPointCode).ToArray()) + "')", string.Empty); ///排序拉动方式 零件类 List <JisPartBoxInfo> jisPartBoxInfos = new JisPartBoxDAL().GetList("" + " and [STATUS] =" + (int)BasicDataStatusConstants.Enable + "" + " and [STATUS_POINT_CODE] in ('" + string.Join("','", statusPointInfos.Select(d => d.StatusPointCode).ToArray()) + "')", string.Empty); ///相应的物料拉动信息 List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogisticStandardInfos = new MaintainInhouseLogisticStandardDAL().GetList("" + " and [STATUS] =" + (int)BasicDataStatusConstants.Enable + "" + " (and [INHOUSE_PART_CLASS] in ('" + string.Join("','", twdPartBoxInfos.Select(d => d.PartBoxCode).ToArray()) + "')" + " or [INHOUSE_PART_CLASS] in ('" + string.Join("','", jisPartBoxInfos.Select(d => d.PartBoxCode).ToArray()) + "'))", string.Empty); if (maintainInhouseLogisticStandardInfos.Count == 0) { return; } foreach (BomRepleaceConditionInfo bomRepleaceConditionInfo in bomRepleaceConditionInfos) { ///有效时间内 if (!(bomRepleaceConditionInfo.ExecuteStartTime <= DateTime.Now) || !(DateTime.Now <= bomRepleaceConditionInfo.ExecuteEndTime)) { continue; } ///根据起始生产订单号,获取车辆状态点信息判断其是否在线,若未上线则不执行以下逻辑 PullOrdersInfo pullOrdersInfo = pullOrdersInfos.FirstOrDefault(d => d.OrderNo == bomRepleaceConditionInfo.StartPorderCode); if (pullOrdersInfo == null || pullOrdersInfo.OrderStatus != (int)OrderStatusConstants.AlreadOnline) { continue; } ///若已上线或已下线则需要根据其获取顺序号之后的所有在线生产订单,依次循环进行逻辑处理 TODO:已下线的逻辑? ///同一起始生产订单号可能出现在多条生产线的状态点上,以下为单生产订单处理逻辑 TODO:多条生产线的逻辑? ///已上线的生产订单: ///本生产订单对应的车辆状态点信息 List <VehiclePointStatusInfo> vehiclePointStatuss = vehiclePointStatusInfos.Where(d => d.OrderNo == pullOrdersInfo.OrderNo).ToList(); if (vehiclePointStatuss.Count == 0) { continue; } ///当前车辆最大状态点信息 VehiclePointStatusInfo vehiclePointStatusInfo = vehiclePointStatuss.Where(d => d.OrderNo == pullOrdersInfo.OrderNo).OrderByDescending(d => d.PassTime).FirstOrDefault(); if (vehiclePointStatusInfo == null) { continue; } ///当前顺序号之后的所有的车辆状态点信息 List <VehiclePointStatusInfo> vehiclePoints = vehiclePointStatusInfos.Where(d => d.SeqNo >= vehiclePointStatusInfo.SeqNo).ToList(); ///当前顺序号之后的所有在线生产订单 pullOrdersInfos = (from p in pullOrdersInfos join v in vehiclePoints on p.OrderNo equals v.OrderNo select p).Distinct().ToList(); ///依次循环进行逻辑处理 foreach (PullOrdersInfo pullOrder in pullOrdersInfos) { ///根据生产订单号获取其物料清单,作为后续匹配更改单的源数据 List <PullOrderBomInfo> pullOrderBomInfos = new PullOrderBomDAL().GetList("" + "and [ORDERFID]='" + pullOrdersInfo.Fid + "'", string.Empty); if (pullOrderBomInfos.Count == 0) { continue; } ///本生产订单对应的车辆状态点信息 List <VehiclePointStatusInfo> vehicles = vehiclePointStatusInfos.Where(d => d.OrderNo == pullOrdersInfo.OrderNo).ToList(); if (vehicles.Count == 0) { continue; } ///本产生订单对应的所有状态点信息 List <StatusPointInfo> statusPoints = statusPointInfos.Where(d => vehicles.Select(v => v.StatusPointCode).Contains(d.StatusPointCode)).ToList(); if (statusPoints.Count == 0) { continue; } ///已在线的生产订单在此时,需要根据所在状态点位置 VehiclePointStatusInfo vehiclePointStatus = vehiclePointStatusInfos.Where(d => d.OrderNo == pullOrder.OrderNo).OrderByDescending(d => d.PassTime).FirstOrDefault(); if (vehiclePointStatus == null) { continue; } StatusPointInfo statusPointInfo = statusPointInfos.FirstOrDefault(d => d.StatusPointCode == vehiclePointStatus.StatusPointCode); if (statusPointInfo == null) { continue; } ///将物料拉动的结果集分为三个部分,其一为未累计、其二为已累计未拉动、其三为已拉动 ///该生产订单对应的其后状态点 List <StatusPointInfo> notStatusPoints = statusPoints.Where(d => d.StatusPointSeq > statusPointInfo.StatusPointSeq).ToList(); ///该生产订单对应的状态点及之前的状态点 List <StatusPointInfo> yesStatusPoints = statusPoints.Where(d => d.StatusPointSeq <= statusPointInfo.StatusPointSeq).ToList(); ///其后的状态点 if (notStatusPoints.Count > 0) { ///其一为当前状态点位置之后的状态点对应的时间窗(过点累计方式)、排序拉动方式相应的物料拉动信息物料、供应商、工位 ///该逻辑获取的数据在此不做后续处理,但此逻辑请事先在程序中实现,将会到离队归队时使用 List <TwdPartBoxInfo> twdPartBoxs = twdPartBoxInfos.Where(d => notStatusPoints.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); List <JisPartBoxInfo> jisPartBoxs = jisPartBoxInfos.Where(d => notStatusPoints.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); ///零件类对应的物料拉动信息 if (twdPartBoxs.Count != 0 || jisPartBoxs.Count != 0) { ///生产订单的产线下的物料拉动信息 List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogisticStandards = maintainInhouseLogisticStandardInfos. Where(d => d.AssemblyLine == pullOrder.AssemblyLine).Where(d => (twdPartBoxs.Select(t => t.PartBoxCode).Contains(d.InhousePartClass)) || (jisPartBoxs.Select(j => j.PartBoxCode).Contains(d.InhousePartClass))).ToList(); if (maintainInhouseLogisticStandards.Count != 0) { ///拉动信息对应的Bom清单 List <PullOrderBomInfo> pullOrderBoms = pullOrderBomInfos.Where(d => maintainInhouseLogisticStandards.Select(m => m.PartNo).Contains(d.Zcomno) && maintainInhouseLogisticStandards.Select(m => m.SupplierNum).Contains(d.SupplierNum)).ToList(); } } } ///其二、其三目前没有较理想的方式区分开,暂时以已拉动处理、当前状态点位置之前包括该状态点位置对应的拉动方式相关物料拉动信息 if (yesStatusPoints.Count > 0) { List <TwdPartBoxInfo> twdPartBoxs = twdPartBoxInfos.Where(d => yesStatusPoints.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); List <JisPartBoxInfo> jisPartBoxs = jisPartBoxInfos.Where(d => yesStatusPoints.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); ///零件类对应的物料拉动信息 if (twdPartBoxs.Count != 0 || jisPartBoxs.Count != 0) { ///生产订单的产线下的物料拉动信息 List <MaintainInhouseLogisticStandardInfo> maintainInhouseLogisticStandards = maintainInhouseLogisticStandardInfos. Where(d => d.AssemblyLine == pullOrder.AssemblyLine).Where(d => (twdPartBoxs.Select(t => t.PartBoxCode).Contains(d.InhousePartClass)) || (jisPartBoxs.Select(j => j.PartBoxCode).Contains(d.InhousePartClass))).ToList(); maintainInhouseLogisticStandards = maintainInhouseLogisticStandards.Where(d => d.PartNo == bomRepleaceConditionInfo.OldPartNo).ToList(); ///根据已拉动的物料拉动信息,与替换条件中的旧物料号对比 ///若不存在于已拉动物料中,则只需要执行生产订单物料清单替换逻辑即可 ///否则需要进行新物料号的自动紧急拉动且生成旧物料号的余料退库单(退库地点为物料拉动信息中的来源库存地点) ///同时也需要执行生产订单物料清单替换逻辑 if (maintainInhouseLogisticStandards.Count > 0) { ///拉动信息对应的Bom清单 List <PullOrderBomInfo> pullOrderBoms = pullOrderBomInfos.Where(d => maintainInhouseLogisticStandards.Select(m => m.PartNo).Contains(d.Zcomno) && maintainInhouseLogisticStandards.Select(m => m.SupplierNum).Contains(d.SupplierNum)).ToList(); foreach (PullOrderBomInfo pullOrderBom in pullOrderBoms) { MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo = maintainInhouseLogisticStandards.FirstOrDefault(d => d.PartNo == pullOrderBom.Zcomno && d.SupplierNum == pullOrderBom.SupplierNum); if (maintainInhouseLogisticStandardInfo == null) { continue; } ///进行新物料号的自动紧急拉动 ///生成旧物料号的余料退库单(退库地点为物料拉动信息中的来源库存地点) } } new BomRepleaceConditionBLL().ReplacementCriteria(pullOrder, loginUser); } } } } }
/// <summary> /// 车辆过点信息处理 /// </summary> /// <param name="mesVehiclePointScanInfo"></param> /// <param name="scanPointInfos"></param> /// <param name="statusPointInfos"></param> /// <param name="intLesVehicleSeqStep"></param> /// <returns></returns> public string VehicleCrossingScanSql(MesVehiclePointScanInfo mesVehiclePointScanInfo, List <ScanPointInfo> scanPointInfos, List <StatusPointInfo> statusPointInfos, int intLesVehicleSeqStep, PullOrdersInfo pullOrdersInfo, List <PlantInfo> plantInfos) { ///sql StringBuilder stringBuilder = new StringBuilder(); ///根据采集点编号④ = MES扫描点③获取到唯一的扫描点代码①,此处需要匹配工厂编号① = 工厂④ PlantInfo plantInfo = plantInfos.Where(d => d.SapPlantCode == mesVehiclePointScanInfo.Enterprise).First(); ScanPointInfo scanPointInfo = scanPointInfos.Where(d => d.MesScanPointCode == mesVehiclePointScanInfo.UnitNo && d.Plant == plantInfo.Plant).FirstOrDefault(); if (scanPointInfo == null) { return(string.Empty); } ///并根据唯一的扫描点代码①=④从状态点表中获取对应的状态点集合 List <StatusPointInfo> statusPointByscanPointInfos = statusPointInfos.Where(d => d.ScanPointCode == scanPointInfo.ScanPointCode).ToList(); if (statusPointByscanPointInfos.Count == 0) { return(string.Empty); } ///处理状态点集合 foreach (StatusPointInfo statusPointInfo in statusPointByscanPointInfos) { ///当状态点数据中是否匹配生产线⑪=true时、需要根据计划订单号匹配生产订单⑥中对应的生产线、若是否匹配生产线⑪=false则无需进行匹配 string assemblyLine = statusPointInfo.AssemblyLineFixedFlag.GetValueOrDefault() ? statusPointInfo.AssemblyLine : string.Empty; ///车辆状态点信息 List <VehiclePointStatusInfo> vehiclePointStatusInfos = new VehiclePointStatusBLL().GetList("" + "[PLANT] = N'" + statusPointInfo.Plant + "' and " + "[WORKSHOP] = N'" + statusPointInfo.Workshop + "' and " + (string.IsNullOrEmpty(assemblyLine) ? string.Empty : "[ASSEMBLY_LINE] = N'" + assemblyLine + "' and ") + "[ORDER_NO] = N'" + mesVehiclePointScanInfo.DmsNo + "'", string.Empty); ///扫描点基础数据 List <StatusPointInfo> statusPoints = new StatusPointBLL().GetList("" + "[PLANT] = N'" + statusPointInfo.Plant + "' and " + (string.IsNullOrEmpty(assemblyLine) ? string.Empty : "[ASSEMBLY_LINE] = N'" + assemblyLine + "' and ") + "[WORKSHOP] = N'" + statusPointInfo.Workshop + "'", string.Empty); ///若没有数据则需要根据该维度获取状态点基础数据中对应的数据集合 ///并以此集合为基础将信息匹配完成后批量写入车辆状态点信息 long currentSeqNo = 0; #region 横向维度 if (vehiclePointStatusInfos.Count == 0) { ///首次批量插入一个生产订单在工厂⑨车间⑧或工厂⑨车间⑧生产线⑦维度范围内数据时 foreach (var statusPoint in statusPoints.OrderBy(d => d.StatusPointSeq.GetValueOrDefault()).ToList()) { ///StatusPointInfo ->VehiclePointStatusInfo VehiclePointStatusInfo pointStatusInfo = new VehiclePointStatusInfo(); ///ORDER_NO,生产订单号 pointStatusInfo.OrderNo = mesVehiclePointScanInfo.DmsNo; ///STATUS_POINT_CODE,状态点代码 pointStatusInfo.StatusPointCode = statusPoint.StatusPointCode; ///PLANT pointStatusInfo.Plant = statusPoint.Plant; ///Workshop pointStatusInfo.Workshop = statusPoint.Workshop; ///ASSEMBLY_LINE pointStatusInfo.AssemblyLine = statusPoint.AssemblyLine; ///SPJ pointStatusInfo.Spj = pullOrdersInfo.Spj; ///KNR pointStatusInfo.Knr = pullOrdersInfo.Knr; ///Schicht pointStatusInfo.Schicht = null; ///Shift pointStatusInfo.Shift = null; ///Vin pointStatusInfo.Vin = pullOrdersInfo.Vin; ///RunningNo pointStatusInfo.RunningNo = mesVehiclePointScanInfo.DmsSeq.ToString(); ///PassTime,过点时间 pointStatusInfo.PassTime = null; ///VehicleStatus,初始化 pointStatusInfo.VehicleStatus = (int)VehicleStatusTypeConstants.Initializtion; ///ProcessFlag pointStatusInfo.ProcessFlag = (int)ProcessFlagConstants.Untreated; ///SeqNo,LES序号 pointStatusInfo.SeqNo = GetcurrentSeqNo(statusPoints, statusPointInfo, intLesVehicleSeqStep); stringBuilder.AppendLine(VehiclePointStatusDAL.GetInsertSql(pointStatusInfo)); } ///LES排序号 currentSeqNo = GetcurrentSeqNo(statusPoints, statusPointInfo, intLesVehicleSeqStep); ///更新生产订单状态为已上线 stringBuilder.AppendFormat("update [LES].[TT_BAS_PULL_ORDERS] set " + "[ORDER_STATUS]=" + (int)OrderStatusConstants.AlreadOnline + "" + ",[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE() " + "where [ID] = " + pullOrdersInfo.Id + ";"); } ///若已存在数据则首先需要将本采集点编号④对应的状态点代码②数据的过点时间⑦=⑦、车辆状态⑨更新 ///车辆状态的更新目前已知的类型有初始化、正常过点、校验补入、车辆离队、车辆归队,需要枚举项VEHICLE_STATUS_TYPE支持 else { VehiclePointStatusInfo pointStatusInfo = vehiclePointStatusInfos.FirstOrDefault(d => d.StatusPointCode == statusPointInfo.StatusPointCode); if (pointStatusInfo == null) { continue; } ///当车辆离队时,更新LES排序号⑬为零,车辆归队时重新计算车辆所在位置对应的LES排序号⑬,规则依照之前逻辑 ///离队标记 bool leaveFlag = false; if (leaveFlag) { List <StatusPointInfo> statuses = statusPoints.Where(d => d.StatusPointSeq.GetValueOrDefault() >= statusPointInfo.StatusPointSeq.GetValueOrDefault()).ToList(); List <VehiclePointStatusInfo> infos = vehiclePointStatusInfos.Where(d => statuses.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); foreach (var info in infos) { stringBuilder.AppendLine("update [LES].[TT_BAS_VEHICLE_POINT_STATUS] " + "set [VEHICLE_STATUS] = " + (int)VehicleStatusTypeConstants.VehicleLeave + ",[SEQ_NO] = 0,[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE() " + "where [ID] = " + info.Id + ";"); } ///更新生产订单状态为已离队 stringBuilder.AppendFormat("update [LES].[TT_BAS_PULL_ORDERS] set " + "[ORDER_STATUS]=" + (int)OrderStatusConstants.Bryan + "" + ",[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE() " + "where [ID] = " + pullOrdersInfo.Id + ";"); continue; } ///车辆归队 if (pointStatusInfo.VehicleStatus == (int)VehicleStatusTypeConstants.VehicleLeave) { stringBuilder.AppendLine("update [LES].[TT_BAS_VEHICLE_POINT_STATUS] " + "set [PASS_TIME] = N'" + mesVehiclePointScanInfo.SendTime.GetValueOrDefault() + "'," + "[VEHICLE_STATUS] = " + (int)VehicleStatusTypeConstants.VehicleReturn + " ," + "[SEQ_NO] = " + GetcurrentSeqNo(statusPoints, statusPointInfo, intLesVehicleSeqStep) + ",[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE()" + "where [ID] = " + pointStatusInfo.Id + ";"); List <StatusPointInfo> statuses = statusPoints.Where(d => d.StatusPointSeq.GetValueOrDefault() > statusPointInfo.StatusPointSeq.GetValueOrDefault()).ToList(); List <VehiclePointStatusInfo> infos = vehiclePointStatusInfos.Where(d => statuses.Select(s => s.StatusPointCode).Contains(d.StatusPointCode)).ToList(); foreach (var info in infos) { stringBuilder.AppendLine("update [LES].[TT_BAS_VEHICLE_POINT_STATUS] " + "set [VEHICLE_STATUS] = " + (int)VehicleStatusTypeConstants.Initializtion + " ," + "[SEQ_NO] = " + GetcurrentSeqNo(statuses, statusPointInfo, intLesVehicleSeqStep) + " ,[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE()" + "where [ID] = " + info.Id + ";"); } ///更新生产订单状态为已归队 stringBuilder.AppendFormat("update [LES].[TT_BAS_PULL_ORDERS] set " + "[ORDER_STATUS]=" + (int)OrderStatusConstants.ComeBack + "" + ",[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE() " + "where [ID] = " + pullOrdersInfo.Id + ";"); } ///LES序号 currentSeqNo = pointStatusInfo.SeqNo.GetValueOrDefault(); DateTime currentTime = mesVehiclePointScanInfo.SendTime.GetValueOrDefault(); stringBuilder.AppendLine("update [LES].[TT_BAS_VEHICLE_POINT_STATUS] " + "set [PASS_TIME] = N'" + currentTime + "',[VEHICLE_STATUS] = " + (int)VehicleStatusTypeConstants.NormalPoint + " ,[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE()" + "where [ID] = " + pointStatusInfo.Id + ";"); ///对于状态点顺序在本次更新的车辆状态点信息之前的且车辆状态为初始化的数据需要更新其过点时间⑦、车辆状态⑨为校验补入 ///过点时间根据获取最近一条有过点时间⑦到本条车辆状态数据过点时间⑦的时间差按车辆状态⑨初始化的状态点数量平均分配计算赋值 List <VehiclePointStatusInfo> vehiclePointStatuses = vehiclePointStatusInfos. Where(d => d.VehicleStatus == (int)VehicleStatusTypeConstants.VehicleLeave && d.StatusPointCode != statusPointInfo.StatusPointCode). OrderByDescending(d => d.Id). ToList(); if (vehiclePointStatuses.Count == 0) { continue; } DateTime?lastTime = new VehiclePointStatusDAL().GetLastTime( statusPointInfo.Plant, statusPointInfo.Workshop, statusPointInfo.StatusPointCode, statusPointInfo.AssemblyLine); TimeSpan timeSpan = mesVehiclePointScanInfo.SendTime.GetValueOrDefault() - lastTime.GetValueOrDefault(); int deductionSecondsPer = Convert.ToInt32(timeSpan.TotalSeconds) / (vehiclePointStatuses.Count - 1); foreach (var vehiclePointStatuse in vehiclePointStatuses) { currentTime = currentTime.AddSeconds(0 - deductionSecondsPer); stringBuilder.AppendLine("update [LES].[TT_BAS_VEHICLE_POINT_STATUS] set " + "[PASS_TIME] = N'" + currentTime + "'," + "[VEHICLE_STATUS] = " + (int)VehicleStatusTypeConstants.CheckAndFill + ",[MODIFY_USER]='" + loginUser + "',[MODIFY_DATE]=GETDATE() " + "where [ID] = " + vehiclePointStatuse.Id + ";"); } ///TODO: ///当前过点类型为正常过点、车辆离队时触发以上逻辑 ///过点类型目前接口中未体现,后期需要增加,预先考虑逻辑放置位置,类型为车辆归队时只需更新本条记录即可 ///若接口中车辆归队与正常过点无法区分,则需要在车辆离队时将其状态标记在生产订单上,以便区别正常过点与车辆归队 } ///以上为横向维度(同生产订单号)的处理逻辑 #endregion ///以下为纵向维度(同状态点)的处理逻辑 stringBuilder.AppendFormat(LongitudinalDimension(statusPoints, statusPointInfo, mesVehiclePointScanInfo, assemblyLine, currentSeqNo)); } return(stringBuilder.ToString()); }