Beispiel #1
0
        public long InsertPalettesAtAddresses(MachineTask completedMachineTask, ProductionNotification prodNotif)
        {
            PalletsAtAddress palletsAtAddress = new PalletsAtAddress
            {
                AddressId = 0,//
                ProductionNotificationId = completedMachineTask.ProductNotificationId,
                ProductId      = prodNotif.ProductId,
                DistanceToExit = 80000,
                AddressCode    = completedMachineTask.TargetAddress,
                PaletteBarcode = completedMachineTask.LoadInfo,
                BoxQuantity    = prodNotif.BoxQuantity,
                Lot            = prodNotif.Lot,
                EntryDate      = DateTime.Now,
                EntryReason    = "ProductionNotification",
                ReleaseDate    = null,
                ReleaseReason  = null,
                IsInside       = true
            };


            long identity;

            using (var conn = new SqlConnection(conStr))
            {
                conn.Open();
                identity = conn.Insert(palletsAtAddress);
                conn.Close();
            }
            return(identity);
        }
        public void CreateTaskForFirstRowPalette(MachineTask completedMachineTask)
        {
            MachineTask machineTask = new MachineTask
            {
                OrderDetailPalletId   = 0,//boş kalamalı
                ProductNotificationId = completedMachineTask.ProductNotificationId,
                TaskType      = (int)TaskType.ShINSERT,
                TaskBatch     = 0,
                Sequence      = 1,
                MachineCode   = null,
                SourceType    = AddressType.ADDRESS,
                SourceAddress = completedMachineTask.TargetAddress,
                LoadInfo      = completedMachineTask.LoadInfo,
                TargetType    = AddressType.ADDRESS,
                TargetAddress = completedMachineTask.TargetAddress,//aynı tüpteki içeri kaydırma işlemi
                AssignUser    = "******",
                AssignReason  = "STANDART",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null,
            };

            InsertMachineTask(machineTask);
        }
        public void CreateTaskForBufferPalette(MachineTask completedMachineTask)
        {
            MachineTask machineTask = new MachineTask
            {
                OrderDetailPalletId   = 0,//boş kalamalı
                ProductNotificationId = completedMachineTask.ProductNotificationId,
                TaskType      = (int)TaskType.BTA,
                TaskBatch     = 0,
                Sequence      = 1,
                MachineCode   = null,
                SourceType    = AddressType.BUFFER,
                SourceAddress = completedMachineTask.TargetAddress,
                LoadInfo      = completedMachineTask.LoadInfo,
                TargetType    = AddressType.ADDRESS,
                TargetAddress = "",//TODO:adres seç
                AssignUser    = "******",
                AssignReason  = "STANDART",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null,
            };

            InsertMachineTask(machineTask);
        }
Beispiel #4
0
        public void UpdatePalletsAtAddressWithShInsert(MachineTask completedMachineTask, int distance)
        {
            var paa = GetPalletsAtAddressByProductNotificationId(completedMachineTask.ProductNotificationId);

            paa.DistanceToExit = distance;
            UpdatePalletsAtAddress(paa);
        }
Beispiel #5
0
        public void UpdatePalletsAtAddressWithShTakeOut(MachineTask completedMachineTask)
        {
            //completedMachineTask.loadinfo e göre seçip distance 0 olarak güncellenebilir
            var paa = GetPalletsAtAddressByPaletteBarcode(completedMachineTask.LoadInfo);

            paa.DistanceToExit = 0;
            UpdatePalletsAtAddress(paa);
        }
        private static void CreateTasksForShuttleRelocation(string code)
        {
            var     asrs    = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_OUT); //çıkış tarafındaki asrs taşıma işiyle ilgili
            Shuttle shuttle = shuttlesData.GetMoveableShuttleByAddress(code);

            //shuttle ın taşınma konumuna gitmesi için
            MachineTask machineTaskShuttle = new MachineTask
            {
                OrderDetailPalletId   = 0, //boş kalamalı
                ProductNotificationId = 0, //boş kalamalı
                TaskType      = (int)TaskType.ShATA,
                TaskBatch     = 0,
                Sequence      = 1,
                MachineCode   = shuttle.Code,
                SourceType    = AddressType.ADDRESS,
                SourceAddress = shuttle.LastAddress,
                LoadInfo      = "",
                TargetType    = AddressType.ADDRESS,
                TargetAddress = shuttle.LastAddress, //aynı adreste tüp ağzına gitmesi için
                AssignUser    = "******",
                AssignReason  = "STANDART",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null,
            };

            //asrs shuttle alması için
            MachineTask machineTaskASRS = new MachineTask
            {
                OrderDetailPalletId   = 0, //boş kalamalı
                ProductNotificationId = 0, //boş kalamalı
                TaskType      = (int)TaskType.ShATA,
                TaskBatch     = 0,
                Sequence      = 2,
                MachineCode   = asrs.Code,
                SourceType    = AddressType.ADDRESS,
                SourceAddress = "shuttle ın olduğu adress",
                LoadInfo      = shuttle.Code,
                TargetType    = AddressType.ADDRESS,
                TargetAddress = code,
                AssignUser    = "******",
                AssignReason  = "STANDART",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null,
            };

            //insert movement tasks
            tasksData.InsertMachineTask(machineTaskShuttle);
            tasksData.InsertMachineTask(machineTaskASRS);
        }
 public void UpdateTask(MachineTask task)
 {
     using (var conn = new SqlConnection(conStr))
     {
         conn.Open();
         conn.Update <MachineTask>(task);
         conn.Close();
     }
 }
        public void BeginAddTask(WorkPathModel shapeModel)
        {
            MachineTask task = new MachineTask(shapeModel.Shape, ActiveKnifeTool);

            shapeModel.PathChanged += OnPathChanged;

            TaskModel.ThePath      = shapeModel;
            TaskModel.CurrentTask  = task;
            TaskModel.TheKnifeTool = new KnifeToolModel(ActiveKnifeTool);

            OnModelChanged(EnumModelType.MT_Task, EnumDataChange.DC_ADD);
        }
        public long InsertMachineTask(MachineTask task)
        {
            long identity;

            using (var conn = new SqlConnection(conStr))
            {
                conn.Open();
                identity = conn.Insert(task);
                conn.Close();
            }
            return(identity);
        }
        void BeginEditTask(MachineTask ts)
        {
            propertyBrowser.Children.Clear();

            PathUIDef UIDef = m_UIFactory.FindUI(ts.Path.GetType());

            if (UIDef != null)
            {
                m_ModelView.BeginEditTask(ts, UIDef.CreateShapeModel(ts.Path));
                CreateTaskUI(UIDef.CreateUI(), UIDef.Title, UIMode.UM_Edit);
            }
        }
        public void BeginEditTask(MachineTask task, WorkPathModel shapeModel)
        {
            ActiveKnifeTool = task.Tool;

            shapeModel.PathChanged += OnPathChanged;

            TaskModel.ThePath      = shapeModel;
            TaskModel.CurrentTask  = task;
            TaskModel.TheKnifeTool = new KnifeToolModel(ActiveKnifeTool);

            KnifeShape.UpdateKnifeTool(ActiveKnifeTool);

            OnModelChanged(EnumModelType.MT_Task, EnumDataChange.DC_MODIFIED);
        }
Beispiel #12
0
        private static TimeSpan CalculateTime(MachineTask task)
        {
            AddressData addressData   = new AddressData();
            var         dist          = addressData.GetDistanceToRefPoint(task.SourceAddress, task.TargetAddress);
            var         totalDistance =
                Math.Abs(dist[0] - dist[1])//source - target -
                - Convert.ToDouble(lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "ACCELERATION").MeasureValue)
                - Convert.ToDouble(lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "DECELERATION").MeasureValue);

            var      velocity = lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "MOVEMENT").MeasureValue;//1 saniyede kat ettiği mesafe
            TimeSpan timeSpan = TimeSpan.FromSeconds(totalDistance / Convert.ToDouble(velocity));

            return(timeSpan);
        }
        private void projectBrowser_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            TreeNodeItem item = this.projectBrowser.SelectedItem as TreeNodeItem;

            if (item == null)
            {
                return;
            }

            MachineTask task = item.Tag as MachineTask;

            if (task != null)
            {
                BeginEditTask(task);
            }
        }
        public void UpdateShuttleLastAddressAndStatus(MachineTask completedMachineTask)
        {
            var shuttle = GetShuttleByCode(completedMachineTask.LoadInfo); //taşınan mekik code u burda yazmalı

            shuttle.LastUpdateDate = DateTime.Now;
            shuttle.LastUptadeUser = "******";
            shuttle.LastAddress    = completedMachineTask.TargetAddress;
            shuttle.Status         = SysStatus.READY.ToString(); //TODO:kontrollü yazılmalı

            //shuttle.Assignment = DetermineAssigment();
            //shuttle.Assignment = completedMachineTask.TaskType == (int)TaskType.ShCHRG ? ShuttleAssign.CHARGE :
            //    completedMachineTask.TaskType == (int)TaskType.ShATA ? ShuttleAssign.IO : ShuttleAssign.OPTIMIZATION; //TODO:kontrollü yazılmalı


            UpdateShuttle(shuttle);
        }
Beispiel #15
0
        private static void UpdateAddressData(MachineTask task)
        {
            switch (task.TargetType)
            {
            case "ADDRESS":
                AddressData addressData = new AddressData();
                //addressData.AddressesChangeFirstRowInfo(task.TargetAddress, false, task.EndTime);
                break;

            case "BUFFER":
                BuffersData buffersData = new BuffersData();
                buffersData.ChangeBufferLoadInfo(task.TargetAddress, false, task.LoadInfo);
                break;

            default:
                break;
            }
        }
        public bool UpdateBufferWithPalette(MachineTask completedMachineTask)
        {
            log.Debug($"UpdateBufferWithPalette, completedMachineTask.TargetAddress: {completedMachineTask.TargetAddress}");

            Buffer buffer = GetBufferByCode(completedMachineTask.TargetAddress); //load

            buffer.IsEmpty         = false;
            buffer.LastPaletteInfo = completedMachineTask.LoadInfo;

            bool done;

            using (var conn = new SqlConnection(conStr))
            {
                conn.Open();
                done = conn.Update(buffer);
                conn.Close();
            }
            return(done);
        }
Beispiel #17
0
        private static void UpdateTaskData(MachineTask task)
        {
            MachineTasksData td = new MachineTasksData();

            td.UpdateTask(task);
        }
Beispiel #18
0
        private static void CheckNeedShuttleAddressesAndCreateTaskForIt(MachinesDTO communicationMachine)
        {
            //sp_GetNeedShuttleAddresses_sel
            var list = addressData.GetNeedShuttleAddresses();

            //TODO: eğer atanmış iş varsa aynı adrese yenisini atamamlı


            if (list.Count > 0)
            {
                var shuttle = shuttlesData.GetShuttleByCode(communicationMachine.Code);
                var asrs    = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_OUT); //çıkış tarafındaki asrs taşıma işiyle ilgili

                var         taskBatch          = machineTasksData.GetNewTaskBatch();
                MachineTask machineTaskShuttle = new MachineTask
                {
                    OrderDetailPalletId   = 0,
                    ProductNotificationId = 0,
                    TaskType      = (int)TaskType.ShATA, //tüp başına gitmesi için gerekli komutu buradan alabilir?
                    TaskBatch     = taskBatch,
                    Sequence      = 1,
                    MachineCode   = communicationMachine.Code,
                    SourceType    = AddressType.ADDRESS,
                    SourceAddress = shuttle.LastAddress,
                    LoadInfo      = "",
                    TargetType    = AddressType.ADDRESS,
                    TargetAddress = shuttle.LastAddress, //list[0].Code,
                    AssignUser    = "******",
                    AssignReason  = "ShuttleNeed",
                    AssignTime    = DateTime.Now,
                    StartTime     = null,
                    EndTime       = null,
                    SentFlag      = false,
                    IsCompleted   = false,
                    ErrorCode     = null
                };

                MachineTask machineTaskAsrs = new MachineTask
                {
                    OrderDetailPalletId   = 0,
                    ProductNotificationId = 0,
                    TaskType      = (int)TaskType.ShATA, //tüp başına gitmesi için gerekli komutu buradan alabilir?
                    TaskBatch     = taskBatch,
                    Sequence      = 2,
                    MachineCode   = asrs.Code,
                    SourceType    = AddressType.ADDRESS,
                    SourceAddress = shuttle.LastAddress,
                    LoadInfo      = shuttle.Code,
                    TargetType    = AddressType.ADDRESS,
                    TargetAddress = list[0].Code, //gideceği adres
                    AssignUser    = "******",
                    AssignReason  = "ShuttleNeed",
                    AssignTime    = DateTime.Now,
                    StartTime     = null,
                    EndTime       = null,
                    SentFlag      = false,
                    IsCompleted   = false,
                    ErrorCode     = null
                };

                machineTasksData.InsertMachineTask(machineTaskShuttle);
                machineTasksData.InsertMachineTask(machineTaskAsrs);
            }
        }
        public static void CreateTaskForPalette(string barcode, MachinesDTO communicationMachine, long pnId)
        {
            var asrs = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_IN);

            Product product   = productsData.GetProductByBarcode(barcode);
            var     target    = SelectTarget(product.Id);
            var     taskBatch = tasksData.GetNewTaskBatch();

            MachineTask machineTask = new MachineTask
            {
                OrderDetailPalletId   = 0,//boş kalamalı
                ProductNotificationId = (int)pnId,
                TaskType = target.Item1 == AddressType.ADDRESS ? (int)TaskType.CTA :
                           target.Item1 == AddressType.BUFFER ? (int)TaskType.CTB :
                           0, //address type göre task type belirlendi 0 olma durumunda hata var demektir
                TaskBatch     = taskBatch,
                Sequence      = 1,
                MachineCode   = asrs.Code,
                SourceType    = communicationMachine.Type,
                SourceAddress = communicationMachine.Code, //conveyorden alıyor conveyore konum bigileri eklemek gerekebilir
                LoadInfo      = barcode,
                TargetType    = target.Item1,
                TargetAddress = target.Item2,
                AssignUser    = "******",
                AssignReason  = "STANDART",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null,
            };

            //insert task
            tasksData.InsertMachineTask(machineTask);


            //daha sonra icra edilmek üzere palet buffera taşındıysa batch ve sequence ayarlayarak
            //buffer dan address e taşıma task ı oluştur
            if (target.Item1 == AddressType.BUFFER)
            {
                MachineTask machineTaskBTA = new MachineTask
                {
                    OrderDetailPalletId   = 0,//boş kalamalı
                    ProductNotificationId = (int)pnId,
                    TaskType      = (int)TaskType.BTA,
                    TaskBatch     = taskBatch,
                    Sequence      = 2,
                    MachineCode   = asrs.Code,
                    SourceType    = AddressType.BUFFER,
                    SourceAddress = target.Item2,
                    LoadInfo      = barcode,
                    TargetType    = AddressType.ADDRESS,
                    TargetAddress = addressData.SelectRelatedAppropiriateAddress(product.Id),  //TODO: mutlaka adres seçilmesi sağlanacak. yeni method yazılmalı
                    AssignUser    = "******",
                    AssignReason  = "STANDART",
                    AssignTime    = DateTime.Now,
                    StartTime     = null,
                    EndTime       = null,
                    SentFlag      = false,
                    IsCompleted   = false,
                    ErrorCode     = null,
                };
                tasksData.InsertMachineTask(machineTaskBTA);
            }
        }