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);
        }
Beispiel #2
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);
            }
        }