Пример #1
0
        public static void Simulate车辆作业(车辆作业 车辆作业)
        {
            if (!车辆作业.Track.HasValue)
                System.Console.WriteLine("There is no track.");

            var sql = new System.Data.SqlClient.SqlCommand("DELETE FROM 业务作业_监控状态 WHERE 车辆作业 = @车辆作业");
            sql.Parameters.AddWithValue("@车辆作业", 车辆作业.Id);
            Feng.Data.DbHelper.Instance.ExecuteNonQuery(sql);

            sql = new System.Data.SqlClient.SqlCommand("DELETE FROM 业务作业_作业异常情况 WHERE 车辆作业 = @车辆作业");
            sql.Parameters.AddWithValue("@车辆作业", 车辆作业.Id);
            Feng.Data.DbHelper.Instance.ExecuteNonQuery(sql);

            var trackId = 车辆作业.Track.Value;

            DBDataBuffer.Instance.LoadData();
            //NameValueMappingCollection.Instance.Reload();

            SimulateTrack(trackId, (trackPoint) =>
                {
                    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<车辆作业>())
                    {
                        bool b = m_作业监控Dao.更新作业监控状态(rep, 车辆作业, trackPoint);
                    }
                });
        }
Пример #2
0
        public static void Simulate车辆作业(车辆作业 车辆作业)
        {
            if (!车辆作业.Track.HasValue)
                System.Console.WriteLine("There is no track.");

            var sql = new System.Data.SqlClient.SqlCommand("DELETE FROM 业务作业_监控状态 WHERE 车辆作业 = @车辆作业");
            sql.Parameters.AddWithValue("@车辆作业", 车辆作业.ID);
            Feng.Data.DbHelper.Instance.ExecuteNonQuery(sql);

            sql = new System.Data.SqlClient.SqlCommand("DELETE FROM 业务作业_作业异常情况 WHERE 车辆作业 = @车辆作业");
            sql.Parameters.AddWithValue("@车辆作业", 车辆作业.ID);
            Feng.Data.DbHelper.Instance.ExecuteNonQuery(sql);

            var trackId = 车辆作业.Track.Value;

            DBDataBuffer.Instance.LoadData();
            //NameValueMappingCollection.Instance.Reload();

            SimulateTrack(trackId, (trackPoint) =>
                {
                    bool b = m_作业监控Dao.更新作业监控状态1(车辆作业, trackPoint);
                }, (wayPoint) =>
                {

                });
        }
Пример #3
0
        internal static int FillRowsRealTimes(车辆作业 clzy, List<Xceed.Grid.DataRow> rows)
        {
            int[] taskIdx = null;
            string[] importantAreas = null;
            string[] importantTaskStatus = null;
            string[] importantWorkStatus = null;
            ModelHelper.Get任务状态(clzy.专家任务, out taskIdx, out importantAreas, out importantTaskStatus, out importantWorkStatus);
            //int preIndex = 0;
            //if (preEntity != null && !string.IsNullOrEmpty(preEntity.作业地点))
            //{
            //    string[] ss = preEntity.作业地点.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            //    preIndex = ss.Length;
            //}

            int idx = 0;
            Xceed.Grid.DataRow row;
            using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<作业监控状态>())
            {
                IList<作业监控状态> list = rep.List<作业监控状态>("from 作业监控状态 where 车辆作业 = :车辆作业 AND ((作业状态 LIKE '%中%') AND 作业状态 NOT LIKE '%途中%')",
                                new Dictionary<string, object> { { "车辆作业", clzy } });

                foreach (var i in list)
                {
                    idx = Math.Min(idx, taskIdx.Length - 1);
                    row = rows[taskIdx[idx]]; //m_任务集合区.DataRows[taskIdx[idx]];

                    //if (i.作业状态 == importantWorkStatus[idx] + "中")
                    {
                        if (importantWorkStatus[idx] == "进港" || importantWorkStatus[idx] == "还箱")
                        {
                            TryFillCellDateTimeValue(row.Cells["还箱进港时间"], i.时间);
                        }
                        else if (importantWorkStatus[idx].EndsWith("提箱"))
                        {
                            TryFillCellDateTimeValue(row.Cells["提箱时间"], i.时间);
                        }
                        else if (importantWorkStatus[idx].EndsWith("装货"))
                        {
                            TryFillCellDateTimeValue(row.Cells["装货时间"], i.时间);
                        }
                        else if (importantWorkStatus[idx].EndsWith("卸货"))
                        {
                            TryFillCellDateTimeValue(row.Cells["卸货时间"], i.时间);
                        }
                        //else
                        //{
                        //    TryFillCellDateTimeValue(row.Cells[importantWorkStatus[idx] + "时间"], i.时间);
                        //}
                        idx++;
                    }
                }
            }

            idx = Math.Min(idx, taskIdx.Length - 1);
            return taskIdx[idx];
        }
Пример #4
0
        public 电子作业单(车辆作业 clzy)
        {
            System.Diagnostics.Debug.Assert(clzy != null, "电子作业单车辆作业不能为空");

            InitializeComponent();
            m_clzy = clzy;

            m_cm = AssociateDataControlsInControlManager(new Control[] {
                pnl作业号, pnl作业路线, pnl车牌号, pnl驾驶员, pnl任务性质, pnl开始时间, pnl疏港期限, pnl进港还箱期限, pnl备注,pnl车载Id号},
                "实时监控_车辆作业_电子作业单");

            m_作业流程 = base.AssociateBoundGrid(pnl作业流程, "实时监控_车辆作业_电子作业单_作业流程");
        }
Пример #5
0
        public 承运时间要求详情(车辆作业 clzy)
        {
            System.Diagnostics.Debug.Assert(clzy != null, "承运时间要求详情车辆作业不能为空");

            InitializeComponent();
            m_clzy = clzy;

            m_dm = new DisplayManager<车辆作业>(null);
            AssociateDataControls(new Control[] {
                pnl作业号, pnl车主, pnl车牌号, pnl驾驶员, pnl驾驶员联系方式, pnl车主联系方式
                }, m_dm, "实时监控_车辆作业_承运时间要求详情");

            m_任务集合区 = base.AssociateBoundGrid(pnl任务集合, "实时监控_车辆作业_承运时间要求详情_任务") as DataUnboundGrid;
        }
Пример #6
0
        public void 新作业异常(车辆作业 车辆作业, string 异常情况, string 异常参数, DateTime 时间)
        {
            using (IRepository rep = this.GenerateRepository())
            {
                try
                {
                    rep.BeginTransaction();

                    新作业异常(rep, 车辆作业, 异常情况, 异常参数, 时间);

                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                    throw;
                }
            }
        }
Пример #7
0
        public Route GetDefaultRoute(车辆作业 clzy)
        {
            string key = clzy.专家任务.任务性质.ToString() + ";" + clzy.专家任务.起始途径终止地;

            using (IRepository rep = this.GenerateRepository())
            {
                var list = rep.List <Route>("from Route where RouteKey = :key", new Dictionary <string, object> {
                    { "key", key }
                });
                if (list.Count > 0)
                {
                    return(list[0]);
                }
                else
                {
                    return(null);
                }
                //return rep.Get<Route>("ID420路线");
            }
        }
Пример #8
0
        public void 更新作业监控状态2(IRepository rep, 车辆作业 车辆作业, DateTime 时间, string importantAreaId, string state)
        {
            if (!车辆作业.开始时间.HasValue)
            {
                return;
            }

            //车辆作业.最新作业状态 = rep.Get<最新作业状态>(车辆作业.最新作业状态.Id);
            rep.Refresh(车辆作业.最新作业状态);

            string importantAreaName = Feng.Utils.NameValueControlHelper.GetMultiString("人员单位_装卸货地_全部", importantAreaId);

            作业监控状态 entity = new 作业监控状态();

            entity.IsActive = true;
            entity.车辆作业     = 车辆作业;
            entity.时间       = 时间;
            entity.车辆重要区域   = string.IsNullOrEmpty(importantAreaName) ? null : importantAreaName;

            更新作业监控状态(rep, entity, 车辆作业.最新作业状态, importantAreaId, state);
            base.Save(rep, entity);

            Update最新状态(车辆作业, entity);
        }
Пример #9
0
 public 实时监控开始(车辆作业 clzy)
 {
     InitializeComponent();
     m_clzy = clzy;
 }
Пример #10
0
        public bool 更新作业监控状态1(车辆作业 车辆作业, TrackPoint gpsData)
        {
            if (!车辆作业.开始时间.HasValue)
            {
                return(false);
            }

            if (gpsData == null)
            {
                return(false);
            }

            MapHelper.ChangeRepository(MapHelper.MapType.普通区域);
            var areaName   = MapHelper.GetAreaFromGpsData(gpsData);
            var streetName = MapHelper.GetRoadFromGpsData(gpsData);

            if (!string.IsNullOrEmpty(areaName))
            {
                using (IRepository rep = this.GenerateRepository())
                {
                    try
                    {
                        rep.BeginTransaction();

                        rep.Refresh(车辆作业.最新作业状态);

                        作业监控状态 newEntity = new 作业监控状态();
                        newEntity.IsActive = true;
                        newEntity.车辆作业     = 车辆作业;
                        newEntity.时间       = gpsData.GpsTime;
                        newEntity.车辆区域     = areaName;
                        newEntity.车辆道路     = streetName;
                        newEntity.GpsData  = gpsData.ID;

                        //作业地点, 作业状态, 任务进程
                        MapHelper.ChangeRepository(MapHelper.MapType.重要地点);
                        string importantAreaName = MapHelper.GetAreaFromGpsData(gpsData);
                        string importantRoadName = MapHelper.GetRoadFromGpsData(gpsData);

                        newEntity.车辆重要区域 = string.IsNullOrEmpty(importantAreaName) ? null : importantAreaName;
                        newEntity.车辆规划道路 = string.IsNullOrEmpty(importantRoadName) ? null : importantRoadName;

                        string importantAreaId = (string)Feng.Utils.NameValueControlHelper.GetMultiValue("人员单位_装卸货地_全部", importantAreaName);
                        更新作业监控状态(rep, newEntity, 车辆作业.最新作业状态, importantAreaId, null);

                        var preEntity = 车辆作业.最新作业状态;
                        if (preEntity == null || newEntity.作业地点 != preEntity.作业地点)
                        {
                            // add waypoint
                            WayPoint wayPoint = new WayPoint(gpsData);
                            wayPoint.Track  = gpsData.Track;
                            wayPoint.Action = importantAreaName + "," + newEntity.作业状态;
                            (new WayPointDao()).Save(rep, wayPoint);

                            var t = Get预计动作时间(importantAreaName, newEntity.作业状态);
                            if (t.HasValue)
                            {
                                newEntity.预计到达时间 = System.DateTime.Now.Add(t.Value);
                            }
                        }
                        else
                        {
                            if (车辆作业.Track.HasValue)
                            {
                                var track = rep.Get <Track>(车辆作业.Track.Value);
                                if (track != null && track.Route != null)
                                {
                                    var t = Get预计到达时间(track);
                                    if (t.HasValue)
                                    {
                                        newEntity.预计到达时间 = System.DateTime.Now.Add(t.Value);
                                    }
                                }
                            }
                        }

                        检查车辆行驶异常(rep, newEntity, importantRoadName, importantAreaName, gpsData.GpsTime);

                        base.Save(rep, newEntity);

                        rep.CommitTransaction();
                        Update最新状态(车辆作业, newEntity);

                        return(true);
                    }
                    catch (Exception)
                    {
                        rep.RollbackTransaction();
                        throw;
                    }
                }
            }
            return(true);
        }
        public 实时监控异常处理动态任务追加(车辆作业 clzy)
        {
            InitializeComponent();

            m_clzy = clzy;
        }
 public 实时监控经过地名时间(车辆作业 clzy, string areas)
 {
     InitializeComponent();
     m_clzy = clzy;
     m_areas = areas.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); ;
 }