Ejemplo n.º 1
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);
            }
        }