Example #1
0
        private static void CreateChargeTasks(MachinesDTO communicationMachine, Shuttle shuttle)
        {
            var asrs        = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_OUT);
            var taskBatch   = machineTasksData.GetNewTaskBatch();
            var chrgAddress = addressData.GetAvailableChargeAddress();

            MachineTask opt1 = new MachineTask //asrs shuttle taşıma
            {
                OrderDetailPalletId   = 0,
                ProductNotificationId = 0,
                TaskType      = (int)TaskType.ShCHRG,
                TaskBatch     = taskBatch,
                Sequence      = 1,
                MachineCode   = asrs.Code,
                SourceType    = AddressType.ADDRESS,
                SourceAddress = shuttle.LastAddress,
                LoadInfo      = shuttle.Code,
                TargetType    = AddressType.ADDRESS,
                TargetAddress = chrgAddress,
                AssignUser    = "******",
                AssignReason  = "Charge",
                AssignTime    = DateTime.Now,
                StartTime     = null,
                EndTime       = null,
                SentFlag      = false,
                IsCompleted   = false,
                ErrorCode     = null
            };

            machineTasksData.InsertMachineTaskBatch(new List <MachineTask> {
                opt1
            });
        }
        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);
            }
        }