AlleeSDK 1.7

AlleeSDK 1.7

Bematech 维护。



  • 逻辑控制

AlleeSDK

AlleeSDK 通过 TCP-IP 通信点连接销售软件到 kitchenGo allee 软件。
此 SDK 只适用于 IOS 平台。

您可以在此处查看示例项目

安装

CocoaPods

可以使用 CocoaPods 在您的项目中添加 AlleeSDK,只需将以下行添加到您的 Podfile 文件中。

pod 'AlleeSDK'

子模块

否则,AlleeSDK 可作为子模块添加。

  1. 通过打开终端,然后在您的顶层项目目录中执行命令 git submodule add https://github.com/Bematechus/AlleeSDK 来将 AlleeSDK 添加为子模块
  2. 在终端中进入 AlleeSDK 文件夹,并执行命令 git submodule update --init --recursive
  3. 打开 AlleeSDK 文件夹,并将 AlleeSDK.xcodeproj 拖动到您的应用程序项目的文件导航器中。
  4. 在 Xcode 中,通过单击左侧边栏中的“Targets”标题下的蓝色项目图标来导航到目标配置窗口。
  5. 确保 AlleeSDK.framework 的部署目标与应用程序目标的部署目标相匹配。
  6. 在该窗口的顶部标签栏中,打开“General”面板。
  7. 展开“Embedded Binaries”组,并添加 AlleeSDK.framework。
  8. 在“Embedded Binaries”中单击 + 按钮,然后选择“Add Other...”,导航到“AlleeSDK/Frameworks”,并添加 BSocketHelper.framework。

使用说明

基本使用

要开始使用我们的AlleeSDK,您需要在AppDelegate中启动它。我需要STORE_KEY来完成

func application(_ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    ...
    AlleeSDK.shared.start(withStoreKey: "STORE_KEY")
    ...
    
    return true
}

Allee订单是通过一个AlleeOrder与任何AlleeItem和任何AlleeCondiment来完成的。
因此,我们首先需要创建调料

let condiment = AlleeCondiment()
condiment.id = UUID().uuidString
condiment.name = "Tomatoes"

然后我们可以创建我们的项目,并添加我们的调料

let item = AlleeItem()
item.id = UUID().uuidString
item.name = "Veggie Burger"
item.kDSStation = "1" // Target KDS preparation station
item.quantity = 3
item.condiments = condiments

我们还可以使用AlleeItemRecipe添加一个项目配方

let recipe = AlleeItemRecipe()
recipe.image = "https://bit.ly/2I9dkxH"
recipe.ingredients = ["1/2 medium yellow onion, chopped", "3/4 c. panko bread crumbs", "1 tomato, sliced"]
recipe.steps = ["In a food processor, pulse black beans, onion, and garlic until finely chopped.",
                "Transfer to a large bowl and combine with egg, 2 tablespoons mayo, and panko.",
                "In a large skillet over medium heat, heat oil.", 
                "Add patties and cook until golden and warmed through, about 5 minutes per side."]
                
item.itemRecipe = recipe

为了创建我们的订单,使用创建的项目

let order = AlleeOrder()
order.id = "1"
order.items = items

我们可以添加一个客户到订单,使用AlleeCustomer。所有客户数据都将被加密

let customer = AlleeCustomer()
customer.id = UUID().uuidString
customer.name = "NAME"
customer.phone = "PHONE"

order.customer = customer

现在我们需要将这个订单发送给KDS,我们将使用AlleeSDK.shared

AlleeSDK.shared.send(order: order) { (error) in
    if let error = error {
        print(error)

    } else {
        print("Order sent")
    }
}

订单准备状态

AlleeSDK为您的POS提供了订单状态的观察者。当某些订单状态发生变化时,它将自动触发,但您也可以手动请求。

在开始之前设置代理(OrdersBumpStatusDelegate

AlleeSDK.shared.ordersBumpStatusDelegate = self

并实现方法

func updated(ordersBumpStatus: [AlleeOrderBumpStatus]) {

}

如果您需要,可以手动请求订单状态(可选)

AlleeSDK.shared.requestOrdersStatus { (error) in
    if let error = error {
        print(error)
    }
}

注意:只有新的订单状态会被接收。

完整模型

尽管如此,如果您需要在订单中提供更多信息,请查看我们所有订单数据

AlleeOrder

var id: String? // Order ID
var posTerminal: Int // POS Terminal ID
var guestTable: String? // Table name
var serverName: String? // Server Name
var destination: String? // Destination (per exemple: Drive Thru, Diner, Delivery)
var userInfo: String? // Another information about customer
var orderMessages: [String]? // Custom messages
var transType: AlleeTransType = .insert // Type of transaction (insert, delete, update)
var orderType: OrderType = .regular // Order priority (regular, fire, rush)
var items: [AlleeItem]? // Order items
var customer: AlleeCustomer? // Order customer

AlleeItem

var id: String? // Item ID
var name: String? // Item Name
var buildCard: String? // A text or a link with steps to prepare the item
var trainingVideo: String? // A video link with steps to prepare the item
var preModifier: [String]? // Item custom messages
var preparationTime: NSNumber // How long time to prepare this item (in minutes)
var quantity: Int = 1 // Item quantity
var kDSStation: String? // Target KDS preparation station
var transType: AlleeTransType = .insert // Type of transaction (insert, delete, update)
var condiments: [AlleeCondiment]? // Item condiments
var summary: AlleeSummary? // Summary of this item
var itemRecipe: AlleeItemRecipe? // Recipe of this item
var itemType: ItemType = .regular // Item priority (regular, fire)
var category: String? // Item category

AlleeCondiment

var id: String? // Condiment ID
var name: String? // Condiment Name
var preModifier: [String]? // Condiment custom messages
var transType: AlleeTransType = .insert // Type of transaction (insert, delete, update)
var preparationTime: NSNumber // How long time to prepare this condiment (in minutes)

AlleeCustomer

var id: String? // Customer ID
var name: String? // Customer name
var phone: String? // Customer phone
var phone2: String? // Customer phone2
var address: String? // Customer address
var address2: String? // Customer address2
var city: String? // Customer City
var state: String? // Customer state
var zip: String? // Customer zip code
var country: String? // Customer country
var email: String? // Customer E-mail
var webmail: String? // Customer webmail 
var transType: AlleeTransType = .insert // Type of transaction (insert, delete, update)

AlleeSummary

var ingredientName: String? // Ingredient name
var ingredientQuantity: Int = 1 // Quantity of this ingredient

AlleeItemRecipe

var image: String? // Image URL
var ingredients: [String]? // List of ingredients
var steps: [String]? // List of steps
var transType: AlleeTransType = .insert // Type of transaction (insert, delete, update)