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); } }
private static string SelectRelatedAppropiriateAddress(ProductionNotification item) { AddressData addressData = new AddressData(); return(addressData.SelectRelatedAppropiriateAddress(item.ProductId)); }