postDirectGateOpenEvent method

void postDirectGateOpenEvent()

Implementation

void postDirectGateOpenEvent() async {
  isLoading(true);
  final Map<String, dynamic> params = {
    'Wbid': selectWeighingKata.value?.value ?? 0,
    'IsOpen': true,
    'EqCode': currentSelectedGate.value == 1 ? 'BBI' : 'BBO',
    'VehicalIn': true,
    'ModuleId': 1,
    'UserId': GetIt.I<StorageUtils>().getUserId(),
    'IsManualOpen': true,
    'Remark': narrationController.text
  };

  try {
    final response = await _apiService
        .postData(AppUrls.postDirectGateOpenEvent, data: params);
    if (response.statusCode == 200) {
      final int messageType = response.data['MessageType'];
      if (messageType == 2) {
        AppUtils.showSnackBar(response.data['DisplayMessage']);
        clearGateOpen();
      }
    }
    isLoading(false);
  } catch (e) {
    print(e);
  } finally {
    isLoading(false);
  }
}