internal static void DoEntrySideJobs(MachinesDTO senderMachine)
        {
            //simule ok
            easyModbusCommunication = new EasyModbusCommunication(senderMachine.IpAddress, 502);
            easyModbusCommunication.WriteToPLC(0, new int[] { 100 });//plcden ye done göndermesi için
            //


            var rd = ReadAsrsPLC(senderMachine);
            var id = easyModbusCommunication.ConvertRegistersToInt(new int[] { rd.MW202, rd.MW203 });


            if (id > 0 && rd.MW200 == (int)Plc_Task.DONESUCCESSFULLY)
            {
                log.Info(id);


                var incomingTask = machineTasksData.GetMachineTaskById(id);
                var prodNotif    = productionNotificationData.GetProductionNotificationById(incomingTask.ProductNotificationId);

                if (!incomingTask.IsCompleted)
                {
                    if (incomingTask.TaskType == (int)TaskType.CTA)
                    {
                        palletsAtAddressesData.InsertPalettesAtAddresses(incomingTask, prodNotif);
                        addressData.AddressesChangeFirstRowInfo(incomingTask.TargetAddress, false, incomingTask.EndTime, Location.WH_IN);
                        machineTasksData.CreateTaskForFirstRowPalette(incomingTask);
                    }
                    else if (incomingTask.TaskType == (int)TaskType.CTB)
                    {
                        buffersData.UpdateBufferWithPalette(incomingTask); //buffer transaction logu tablosu oluşturup tutulmalı mı?
                        machineTasksData.CreateTaskForBufferPalette(incomingTask);
                    }
                    else if (incomingTask.TaskType == (int)TaskType.BTA) //TODO:check
                    {
                        buffersData.UpdateBufferWithOutPalette(incomingTask);
                        palletsAtAddressesData.InsertPalettesAtAddresses(incomingTask, prodNotif);
                        addressData.AddressesChangeFirstRowInfo(incomingTask.TargetAddress, false, incomingTask.EndTime, Location.WH_IN);
                        machineTasksData.CreateTaskForFirstRowPalette(incomingTask);
                    }

                    machineTasksData.UpdateMachineTaskWithPlcCompletedById(id);
                }


                //task ata
                AssignTask(senderMachine);
            }
            else if (rd.MW200 == (int)Plc_Task.DONEWITHERROR) // hata kontrolu
            {
                //yarım iş??
            }
        }
Esempio n. 2
0
        internal static void DoShuttleJobs(MachinesDTO senderMachine)
        {
            //simule ok
            easyModbusCommunication = new EasyModbusCommunication(senderMachine.IpAddress, 502);
            easyModbusCommunication.WriteToPLC(0, new int[] { 100, 0 });//plcden ye done göndermesi için
            //


            var rd = ReadShuttlePLC(senderMachine);
            var id = easyModbusCommunication.ConvertRegistersToInt(new int[] { rd.MW202, rd.MW203 });

            if (id > 0 && rd.MW200 == (int)Plc_Task.DONESUCCESSFULLY)
            {
                int distance = 0;

                var incomingTask = machineTasksData.GetMachineTaskById(id);

                if (incomingTask.IsCompleted == false)
                {
                    if (incomingTask.TaskType == (int)TaskType.ShOPT)
                    {
                        //Tüpteki paletlerin bilgileri distancetoexit bilgileri entry date e göre güncelle isinside true olanlar
                        palletsAtAddressesData.OptimizationUpdatePalletsAtAddresses(incomingTask.TargetAddress);

                        machineTasksData.UpdateMachineTaskWithPlcCompletedById(id);
                    }
                    else if (incomingTask.TaskType == (int)TaskType.ShINSERT) //asrs koyduktan sonra oluşacak
                    {
                        //asrs koyduğunda oluştu burda güncellenmeli
                        //Tüp ağzındaki paleti palletsataddressde güncelle(distance to exit),
                        palletsAtAddressesData.UpdatePalletsAtAddressWithShInsert(incomingTask, distance);

                        //adrsin tüp agzı bilgisini güncelle boş olarak
                        addressData.AddressesChangeFirstRowInfo(incomingTask.TargetAddress, true, null, Location.WH_IN);


                        machineTasksData.UpdateMachineTaskWithPlcCompletedById(id);
                    }
                    else if (incomingTask.TaskType == (int)TaskType.ShTAKEOUT) //orderdetail a göre veye asrs buraya mekik taşıdıktan sonra oluşacak??
                    {
                        //Tüp içindeki en öndeki paleti palletsataddressde güncelle(sadece distance bilgisi  ),
                        palletsAtAddressesData.UpdatePalletsAtAddressWithShTakeOut(incomingTask);

                        //adresin tüp agzı bilgisini güncelle dolu olarak
                        addressData.AddressesChangeFirstRowInfo(incomingTask.TargetAddress, false, DateTime.Now, Location.WH_OUT);

                        machineTasksData.UpdateMachineTaskWithPlcCompletedById(id);
                    }
                    else if (incomingTask.TaskType == (int)TaskType.ShATA)
                    {
                        //asrs de bu adım asrs için var burada shuttle için yapması gereken birşey olup olmadığı kontrol edilebilir
                        //
                        machineTasksData.UpdateMachineTaskWithPlcCompletedById(id);
                    }
                    else
                    {
                        //hata logu vs try catch
                    }
                }

                AssignTask(senderMachine, rd);
            }
        }