Пример #1
0
        /// <summary>
        /// 推送运输记录给智能物流
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SendTransData(Action <string, eOutputType> output)
        {
            if (mysqlDber == null)
            {
                output("未在【小程序参数配置】模块中添加配置,唯一标识:数据同步智能物流接口,配置名称:接口地址", eOutputType.Error);
                return;
            }

            int    intervalValue = 7;
            string configValue   = commonDAO.GetAppletConfigString("数据同步智能物流接口", "数据上传时间间隔(天)");

            if (!string.IsNullOrWhiteSpace(configValue))
            {
                Int32.TryParse(configValue, out intervalValue);
            }
            DateTime startTime = DateTime.Now.AddDays(-intervalValue);

            DataTable dt = SelfDber.ExecuteDataTable(string.Format("select * from View_ZNWL_Transport where factArriveDate>=to_date('{0}','yyyy-MM-dd hh24:mi:ss')", startTime.ToString("yyyy-MM-dd HH:mm:ss")));

            if (dt == null || dt.Rows.Count <= 0)
            {
                return;
            }

            foreach (DataRow item in dt.Rows)
            {
                var entity = mysqlDber.Entity <WL_TransportInfo>(" where 检斤编号=@SerialNumber", new { SerialNumber = item["检斤编号"].ToString() });
                if (entity == null)
                {
                    #region 新增
                    entity        = new WL_TransportInfo();
                    entity.物流矿发编号 = item["物流矿发编号"].ToString();
                    entity.检斤编号   = item["检斤编号"].ToString();
                    entity.所属单位名称 = item["所属单位名称"].ToString();
                    entity.车牌号    = item["车牌号"].ToString();
                    entity.门禁编号   = item["门禁编号"].ToString();
                    entity.化验编号   = item["化验表编号"].ToString();

                    DateTime grossTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["重车时间"].ToString()) || !DateTime.TryParse(item["重车时间"].ToString(), out grossTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},毛重时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.重车时间 = DateTime.Parse(item["重车时间"].ToString());

                    DateTime skinTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["轻车时间"].ToString()) || !DateTime.TryParse(item["轻车时间"].ToString(), out skinTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},皮重时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.轻车时间 = DateTime.Parse(item["轻车时间"].ToString());
                    entity.物料编号 = item["煤种编号"].ToString();
                    entity.物料名称 = item["煤种名称"].ToString();

                    try
                    {
                        entity.毛重   = item["毛重"] != DBNull.Value ? Decimal.Parse(item["毛重"].ToString()) : 0;
                        entity.皮重   = item["皮重"] != DBNull.Value ? Decimal.Parse(item["皮重"].ToString()) : 0;
                        entity.净重   = item["净重"] != DBNull.Value ? Decimal.Parse(item["净重"].ToString()) : 0;
                        entity.矿发毛重 = item["矿发毛重"] != DBNull.Value ? Decimal.Parse(item["矿发毛重"].ToString()) : 0;
                        entity.矿发皮重 = item["矿发皮重"] != DBNull.Value ? Decimal.Parse(item["矿发皮重"].ToString()) : 0;
                        entity.矿发净重 = item["矿发净重"] != DBNull.Value ? Decimal.Parse(item["矿发净重"].ToString()) : 0;
                        entity.扣吨   = item["扣吨"] != DBNull.Value ? Decimal.Parse(item["扣吨"].ToString()) : 0;
                    }
                    catch
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},重量信息存在格式不正确,转换失败。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }



                    entity.检斤员名字 = item["检斤员名字"].ToString();
                    entity.重车衡号  = item["重车衡号"].ToString();
                    entity.轻车衡号  = item["轻车衡号"].ToString();
                    entity.煤场名称  = item["煤场名称"].ToString();
                    entity.发货方编号 = item["发货方编号"].ToString();
                    entity.发货方名称 = item["发货方名称"].ToString();
                    entity.承运商编号 = item["承运商编号"].ToString();
                    entity.承运商名称 = item["承运商名称"].ToString();
                    entity.矿点名称  = item["矿点名称"].ToString();
                    entity.采样表编号 = item["采样表编号"].ToString();

                    DateTime samplingTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["采样时间"].ToString()) || !DateTime.TryParse(item["采样时间"].ToString(), out skinTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},采样时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.采样时间  = DateTime.Parse(item["采样时间"].ToString());
                    entity.采样人   = item["采样人"].ToString();
                    entity.检斤备注  = item["检斤备注"].ToString();
                    entity.创建时间  = DateTime.Now;
                    entity.步完成   = 0;
                    entity.步完成时间 = DateTime.Now;

                    if (mysqlDber.Insert <WL_TransportInfo>(entity) > 0)
                    {
                        output("推送运输记录给智能物流成功,操作:新增,数据:" + Newtonsoft.Json.JsonConvert.SerializeObject(entity), eOutputType.Normal);
                    }

                    #endregion
                }
                else
                {
                    #region 修改
                    entity.物流矿发编号 = item["物流矿发编号"].ToString();
                    entity.检斤编号   = item["检斤编号"].ToString();
                    entity.所属单位名称 = item["所属单位名称"].ToString();
                    entity.车牌号    = item["车牌号"].ToString();
                    entity.门禁编号   = item["门禁编号"].ToString();
                    entity.化验编号   = item["化验表编号"].ToString();

                    DateTime grossTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["重车时间"].ToString()) || !DateTime.TryParse(item["重车时间"].ToString(), out grossTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},毛重时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.重车时间 = DateTime.Parse(item["重车时间"].ToString());

                    DateTime skinTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["轻车时间"].ToString()) || !DateTime.TryParse(item["轻车时间"].ToString(), out skinTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},皮重时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.轻车时间 = DateTime.Parse(item["轻车时间"].ToString());
                    entity.物料编号 = item["煤种编号"].ToString();
                    entity.物料名称 = item["煤种名称"].ToString();

                    try
                    {
                        entity.毛重   = item["毛重"] != DBNull.Value ? Decimal.Parse(item["毛重"].ToString()) : 0;
                        entity.皮重   = item["皮重"] != DBNull.Value ? Decimal.Parse(item["皮重"].ToString()) : 0;
                        entity.净重   = item["净重"] != DBNull.Value ? Decimal.Parse(item["净重"].ToString()) : 0;
                        entity.矿发毛重 = item["矿发毛重"] != DBNull.Value ? Decimal.Parse(item["矿发毛重"].ToString()) : 0;
                        entity.矿发皮重 = item["矿发皮重"] != DBNull.Value ? Decimal.Parse(item["矿发皮重"].ToString()) : 0;
                        entity.矿发净重 = item["矿发净重"] != DBNull.Value ? Decimal.Parse(item["矿发净重"].ToString()) : 0;
                        entity.扣吨   = item["扣吨"] != DBNull.Value ? Decimal.Parse(item["扣吨"].ToString()) : 0;
                    }
                    catch
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},重量信息存在格式不正确,转换失败。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }

                    entity.检斤员名字 = item["检斤员名字"].ToString();
                    entity.重车衡号  = item["重车衡号"].ToString();
                    entity.轻车衡号  = item["轻车衡号"].ToString();
                    entity.煤场名称  = item["煤场名称"].ToString();
                    entity.发货方编号 = item["发货方编号"].ToString();
                    entity.发货方名称 = item["发货方名称"].ToString();
                    entity.承运商编号 = item["承运商编号"].ToString();
                    entity.承运商名称 = item["承运商名称"].ToString();
                    entity.采样表编号 = item["采样表编号"].ToString();

                    DateTime samplingTime = DateTime.Now;
                    if (string.IsNullOrWhiteSpace(item["采样时间"].ToString()) || !DateTime.TryParse(item["采样时间"].ToString(), out skinTime))
                    {
                        output(string.Format("物流矿发编号:{0},车牌号:{1},采样时间格式不正确。", entity.物流矿发编号, entity.车牌号), eOutputType.Error);
                        continue;
                    }
                    entity.采样时间 = DateTime.Parse(item["采样时间"].ToString());
                    entity.采样人  = item["采样人"].ToString();
                    entity.检斤备注 = item["检斤备注"].ToString();
                    //entity.同步完成 = 0;
                    //entity.同步完成时间 = DateTime.Now;

                    if (mysqlDber.Update <WL_TransportInfo>(entity) > 0)
                    {
                        output("推送运输记录给智能物流成功,操作:更新,数据:" + Newtonsoft.Json.JsonConvert.SerializeObject(entity), eOutputType.Normal);
                    }
                    #endregion
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 生成路线偏离数据
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SaveToCarDeciationRoute(Action <string, eOutputType> output)
        {
            DeviateWarning warning = SelfDber.Entity <DeviateWarning>("where IsDeleted=0");

            if (warning == null)
            {
                output("未设置路线偏离预警距离!", eOutputType.Error);
                return;
            }
            if (warning.Distance <= 0)
            {
                output("设置路线偏离预警距离小于等于0,请正确设置!", eOutputType.Error);
                return;
            }

            //查询所有在途的车辆,然后根据运输记录中的实时位置去判断路线的偏离
            List <ShowEntity> list = GetInRouteCars();

            if (list == null || list.Count <= 0)
            {
                output("暂无在途车辆!", eOutputType.Warn);
                return;
            }
            foreach (var item in list)
            {
                if (string.IsNullOrWhiteSpace(item.ROUTEPOINTS))
                {
                    output(string.Format("车号:{0},运输记录ID:{1}对应的发车未设置线路!", item.CARNUMBER, item.ID), eOutputType.Error);
                    continue;
                }

                //如果车辆已报修并且未处理就不管了偏不偏移了
                DataTable dtIsRepair = SelfDber.ExecuteDataTable(String.Format("select count(1) from CMCSTBCARREPAIRINFO t where t.isdeleted=0 and t.repairstatus=0 and t.carid='{0}'", item.CarId));
                if (dtIsRepair != null && dtIsRepair.Rows.Count > 0 && dtIsRepair.Rows[0][0].ToString() != "0")//车辆去修理了就不算路线偏移
                {
                    continue;
                }

                double sslng = 0;
                double sslat = 0;
                double.TryParse(item.LONGITUDE, out sslng);
                double.TryParse(item.LATITUDE, out sslat);
                if (sslng <= 0 || sslat <= 0)
                {
                    output(string.Format("车号:{0},运输记录ID:{1}暂无实时位置!", item.CARNUMBER, item.ID), eOutputType.Error);
                    continue;
                }
                string[] lnglats = item.ROUTEPOINTS.Trim('|').Split('|');
                //循环点一个一个的计算
                List <double> minDistance = new List <double>();
                foreach (var lnglat in lnglats)
                {
                    minDistance.Add(GaodeHelper.GetTwoPointDistance(sslat, sslng, double.Parse(lnglat.Split(',')[1]), double.Parse(lnglat.Split(',')[0])));
                }
                //最近的距离偏离了就算偏离
                decimal          minDis = (decimal)Math.Round(minDistance.Min(), 2, MidpointRounding.AwayFromZero);
                DeviateErrorInfo entity = SelfDber.Entity <DeviateErrorInfo>(string.Format(" where TransportRecordId='{0}' and StartTime is not null and EndTime is null order by StartTime desc", item.ID));
                if (minDis >= warning.Distance)
                {
                    //偏离了
                    //首先判断存不存在有开始时间但是没有结束时间的数据,有就不管,没有则新增一条结束时间为空,开始时间为当前时间的数据,偏离距离取最小值
                    if (entity == null)
                    {
                        entity = new DeviateErrorInfo();
                        entity.TransportRecordId = item.ID;
                        entity.Distance          = minDis;
                        entity.StartTime         = DateTime.Now;
                        entity.Remark            = string.Format("货车:{0},在{1}偏离计划路线,偏离距离{2}米", item.CARNUMBER, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entity.Distance);
                        if (SelfDber.Insert(entity) > 0)
                        {
                            output(string.Format("车号:{0},运输记录ID:{1}发现路线偏离并记录,偏离距离:{2}!", item.CARNUMBER, item.ID, entity.Distance), eOutputType.Normal);
                            string updateSql = string.Format("update cmcstbbuyfueltransport t set t.ISDEVIATEEERR=1 where t.id='{0}'", item.ID);
                            SelfDber.Execute(updateSql);
                        }
                    }
                }
                else
                {
                    //没有偏离
                    //首先判断存不存在有开始时间但是没有结束时间的数据,有就将结束时间改为当前时间,没有就不管
                    if (entity != null)
                    {
                        entity.Distance = entity.Distance > minDis ? entity.Distance : minDis;
                        entity.EndTime  = DateTime.Now;
                        entity.Remark   = string.Format("货车:{0},在{1}偏离计划路线,于{2}回归计划路线,最大偏离距离{3}米", item.CARNUMBER, entity.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entity.Distance);
                        if (SelfDber.Update(entity) > 0)
                        {
                            output(string.Format("车号:{0},运输记录ID:{1}回归计划路线!", item.CARNUMBER, item.ID), eOutputType.Normal);
                            string updateSql = string.Format("update cmcstbbuyfueltransport t set t.ISDEVIATEEERR=1 where t.id='{0}'", item.ID);
                            SelfDber.Execute(updateSql);
                        }
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 同步集团数据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="thirdDber"></param>
        /// <param name="output"></param>
        private void DownLoadData(TableOrView entity, OracleDapperDber thirdDber, Action <string, eOutputType> output)
        {
            //同步集团数据
            string sbSearch = "select ";

            foreach (var item in entity.PropertySetDetails)
            {
                sbSearch += string.Format("{0},", item.Source);
            }

            sbSearch  = sbSearch.Trim(',');
            sbSearch += string.Format(" from {0} ", entity.Source);

            if (!string.IsNullOrWhiteSpace(entity.TimeIntervalProperty))
            {
                int    intervalValue = 7;
                string configValue   = commonDAO.GetAppletConfigString("数据同步智仁接口", "获取集团数据时间间隔(天)");
                if (!string.IsNullOrWhiteSpace(configValue))
                {
                    Int32.TryParse(configValue, out intervalValue);
                }
                DateTime startTime = DateTime.Now.AddDays(-intervalValue);

                sbSearch += string.Format(" where {0}>=to_date('{1}','yyyy-MM-dd hh24:mi:ss')", entity.TimeIntervalProperty, startTime.ToString("yyyy-MM-dd HH:mm:ss"));
            }

            DataTable dt = thirdDber.ExecuteDataTable(sbSearch);

            if (dt == null || dt.Rows.Count <= 0)
            {
                return;
            }

            Boolean ishavepk = entity.PropertySetDetails.Count(a => a.DesPrimaryKey != null && a.DesPrimaryKey.ToLower() == "true") > 0;

            foreach (DataRow item in dt.Rows)
            {
                //只有更新和新增操作
                string strChaXun = string.Format("select * from {0} where 1=1 ", entity.Destination);
                if (ishavepk)
                {
                    foreach (var pk in entity.PropertySetDetails.Where(a => a.DesPrimaryKey != null && a.DesPrimaryKey.ToLower() == "true"))
                    {
                        strChaXun += string.Format("and {0}='{1}' ", pk.Destination, item[pk.Source] == null ? "" : item[pk.Source].ToString());
                    }
                }
                else
                {
                    foreach (var pk in entity.PropertySetDetails)
                    {
                        strChaXun += string.Format("and {0}='{1}' ", pk.Destination, item[pk.Source] == null ? "" : item[pk.Source].ToString());
                    }
                }

                DataTable dtHaveData = SelfDber.ExecuteDataTable(strChaXun);
                if (dtHaveData == null || dtHaveData.Rows.Count <= 0)
                {
                    //新增
                    string insertSql = string.Format(@"insert into {0} (", entity.Destination);
                    string names     = "ID, CREATIONTIME, CREATORUSERID,LASTMODIFICATIONTIME,";
                    string values    = string.Format("'{0}', sysdate,1,sysdate,", Guid.NewGuid().ToString());

                    if (entity.Description == "矿点同步")
                    {
                        string code = commonDAO.GetMineNewChildCode("000");
                        if (!string.IsNullOrEmpty(code))
                        {
                            names  += "Code,";
                            values += "'" + code + "',";
                        }
                        names  += "Sort,";
                        values += commonDAO.GetMineSort() + ",";
                    }
                    else if (entity.Description == "煤种同步")
                    {
                        string code = commonDAO.GetFuelKindNewChildCode("000");
                        if (!string.IsNullOrEmpty(code))
                        {
                            names  += "Code,";
                            values += "'" + code + "',";
                        }
                        names  += "Sort,";
                        values += commonDAO.GetFuelKindSort() + ",";
                    }

                    if (!string.IsNullOrWhiteSpace(entity.IsSoftDelete) && entity.IsSoftDelete.ToLower() == "true")
                    {
                        names  += "ISDELETED,";
                        values += "0,";
                    }

                    if (!string.IsNullOrWhiteSpace(entity.TreeParentId))
                    {
                        names  += "parentid,";
                        values += string.Format("'{0}',", entity.TreeParentId);
                    }

                    foreach (var detail in entity.PropertySetDetails)
                    {
                        names  += string.Format("{0},", detail.Destination);
                        values += string.Format("'{0}',", item[detail.Source] == null ? "" : item[detail.Source].ToString());
                    }

                    if (!string.IsNullOrWhiteSpace(entity.IsHaveSyncTime) && entity.IsHaveSyncTime.ToLower() == "true")
                    {
                        names  += "SYNCTIME,";
                        values += "sysdate,";
                    }

                    insertSql += names.Trim(',') + ") values (" + values.Trim(',') + ")";
                    if (SelfDber.Execute(insertSql) > 0)
                    {
                        output(string.Format("接口取数【{0}】已同步,操作:新增", entity.Description), eOutputType.Normal);
                    }
                }
                else
                {
                    //更新
                    string updateSql = string.Format("update {0} set ", entity.Destination);

                    foreach (var detail in entity.PropertySetDetails)
                    {
                        updateSql += string.Format("{0}='{1}',", detail.Destination, item[detail.Source] == null ? "" : item[detail.Source].ToString());
                    }

                    if (!string.IsNullOrWhiteSpace(entity.IsHaveSyncTime) && entity.IsHaveSyncTime.ToLower() == "true")
                    {
                        updateSql += "SYNCTIME=sysdate,";
                    }

                    updateSql = updateSql.Trim(',') + string.Format(" where id='{0}'", dtHaveData.Rows[0]["ID"].ToString());
                    if (SelfDber.Execute(updateSql) > 0)
                    {
                        output(string.Format("接口取数【{0}】已同步,操作:更新", entity.Description), eOutputType.Normal);
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 生成车辆异常停留位置数据
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SaveToCarStopTime(Action <string, eOutputType> output, AbnormalStayWarning warning)
        {
            //查询所有在途的车辆,然后判断该车辆最近的两次经纬度是否在同一点
            List <ShowEntity> list = GetInRouteCars();

            if (list == null || list.Count <= 0)
            {
                output("暂无在途车辆!", eOutputType.Warn);
                return;
            }
            foreach (var item in list)
            {
                item.isStop = false;
                //如果车辆已报修并且未处理就不管了
                DataTable dtIsRepair = SelfDber.ExecuteDataTable(String.Format("select count(1) from CMCSTBCARREPAIRINFO t where t.isdeleted=0 and t.repairstatus=0 and t.carid='{0}'", item.CarId));
                if (dtIsRepair != null && dtIsRepair.Rows.Count > 0 && dtIsRepair.Rows[0][0].ToString() != "0")//车辆去修理了就不管
                {
                    continue;
                }

                //List<CarLongLatHistory> historyList = SelfDber.Entities<CarLongLatHistory>(string.Format(" where TransportRecordId='{0}' and CreationTime>=to_date('{1}','yyyy-mm-dd hh24:mi:ss') order by CreationTime desc", item.ID, DateTime.Now.AddMinutes(-(double)warning.StopTime)));
                List <CarLongLatHistory> historyList = SelfDber.Entities <CarLongLatHistory>(string.Format(" where TransportRecordId='{0}' and CreationTime>=to_date('{1}','yyyy-mm-dd hh24:mi:ss') order by CreationTime desc", item.ID, DateTime.Parse("2020-04-10 11:05:58").AddMinutes(-(double)warning.StopTime)));
                if (historyList.Count <= 1)
                {
                    continue;
                }

                historyList = historyList.OrderByDescending(a => a.CreationTime).ToList();
                var distance = GaodeHelper.GetTwoPointDistance((double)historyList.First().Latitude, (double)historyList.First().Longitude, (double)historyList.Last().Latitude, (double)historyList.Last().Longitude);
                if (distance <= 5)//距离在5米内默认没移动
                {
                    item.StopMintes = (historyList.First().CreationTime - historyList.Last().CreationTime).TotalMinutes;
                    item.LONGITUDE  = historyList.First().Longitude.ToString();
                    item.LATITUDE   = historyList.First().Latitude.ToString();
                    item.isStop     = true;
                }
            }

            foreach (var item in list)
            {
                StopErrorInfo entity = SelfDber.Entity <StopErrorInfo>(string.Format(" where TransportRecordId='{0}' and StartTime is not null and EndTime is null order by StartTime desc", item.ID));

                //同一批次其他的车没停,百分之几的车停了那停的车就算异常

                bool isPercent = (list.Count(a => a.MineSendId == item.MineSendId && a.isStop) < (list.Count(a => a.MineSendId == item.MineSendId) * warning.StopNumber) / 100m);

                if (item.isStop && entity == null && isPercent)
                {
                    entity = new StopErrorInfo();
                    entity.TransportRecordId = item.ID;
                    entity.StopPoint         = item.LONGITUDE + "," + item.LATITUDE;
                    string place = GaodeHelper.GetLocation(entity.StopPoint);
                    if (string.IsNullOrWhiteSpace(place))
                    {
                        continue;
                    }
                    entity.StopPlace = place;
                    entity.StopTime  = decimal.Parse(item.StopMintes.ToString("F0"));
                    entity.StopTime  = entity.StopTime > warning.StopTime ? entity.StopTime : warning.StopTime;
                    entity.StartTime = DateTime.Now;
                    entity.StopNum   = Math.Round((list.Count(a => a.MineSendId == item.MineSendId && a.isStop) / list.Count(a => a.MineSendId == item.MineSendId)) * 100m, 2, MidpointRounding.AwayFromZero);
                    entity.Remark    = string.Format("货车:{0},于{1}开始在{2}异常停留时间超过{3}分钟!", item.CARNUMBER, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entity.StopPlace, entity.StopTime);
                    if (SelfDber.Insert(entity) > 0)
                    {
                        output(entity.Remark, eOutputType.Normal);
                        string updateSql = string.Format("update cmcstbbuyfueltransport t set t.isstoperr=1 where t.id='{0}'", item.ID);
                        SelfDber.Execute(updateSql);
                    }
                }
                else if (entity != null)//如果没有异常停留需要将异常停留信息结束
                {
                    entity.EndTime  = DateTime.Now;
                    entity.StopTime = decimal.Parse((entity.StartTime - entity.EndTime).TotalMinutes.ToString("F0"));
                    entity.Remark   = string.Format("货车:{0},于{1}至{2}在{3}异常停留{4}分钟!", item.CARNUMBER, entity.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), entity.EndTime.ToString("yyyy-MM-dd HH:mm:ss"), entity.StopPlace, entity.StopTime);
                    if (SelfDber.Update(entity) > 0)
                    {
                        output(entity.Remark, eOutputType.Normal);
                        string updateSql = string.Format("update cmcstbbuyfueltransport t set t.isstoperr=1 where t.id='{0}'", item.ID);
                        SelfDber.Execute(updateSql);
                    }
                }
            }
        }