From 32c1762ad84bf66d4b57041fcf53c53f0e37ee2c Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Sat, 1 Jun 2013 15:20:45 +0100 Subject: [PATCH] Add ScheduleParameters class --- haxe/ItemScheduler.hx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index f8bfc0a..5cb2682 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -1,5 +1,40 @@ import php.Lib; +typedef Detail = { + id : String, + quantity : Int, + position : Int, +} + +class ScheduleParameters { + var row_id : String; + var row_ids : Array; + var rowDetails: Hash; + function new(rawData : Dynamic) { + var data = php.Lib.objectOfAssociativeArray(rawData); + row_id = data.row_id; + row_ids = data.row_ids; + + rowDetails = new Hash(); + $type(rowDetails); + + var position = 1; + for(id in row_ids) { + rowDetails.set(id, { + id: id + ,quantity: null + ,position: position++ + }); + } + } + + public function position(id: String) : Int { + return rowDetails.get(id).position; + + } +} + + class ItemScheduler { var stock_id:String; var startLocation:String; @@ -183,6 +218,7 @@ class ItemScheduler { function purcharseOrders() { } + } -- 2.30.2