manageStockCountSystemMobile method
Future<List<StockCountSystem> >
manageStockCountSystemMobile(
- TaskAssignment taskassignment,
- String action
Implementation
Future<List<stockCount.StockCountSystem>> manageStockCountSystemMobile(tasksassign.TaskAssignment taskassignment,String action) async{
var api = await ExternalApiClassHelper.load('external_api');
var externalApi =tasks.ExternalApiClass(
externalWebApiToken: api?.externalWebApiToken ?? "",
externalWebApiTokenName: api?.externalWebApiTokenName ?? "",
licenseKey: api?.licenseKey ?? "",
licenseKeyId: api?.licenseKeyId ?? "",
employeeId: api?.employeeId ?? "",
);
var request = tasks.ManageStockCountSystemByMobileRequest(
externalApiClass: externalApi,
taskAssignment: tasks.TaskAssignment(
task: task_grpc. Task(
taskId: taskassignment.task!.taskId,
taskType: tasks.TaskType(
taskTypeId: taskassignment.task!.taskType.taskTypeId
)
),
),
action: action
);
final plainBytes = request.writeToBuffer();
final result = GrpcEncryptedHelper.encrypt(plainBytes);
final Uint8List iv = result["iv"]!;
final Uint8List cipherText = result["ciphertext"]!;
var response = await taskServiceClient.manageStockCountMobile(tasks.EncryptedMessage(iv: iv,ciphertext: cipherText));
final decryptedBytes = GrpcEncryptedHelper.decrypted(Uint8List.fromList(response.iv), Uint8List.fromList(response.ciphertext));
final responses = tasks. ManageStockCountSystemByMobileResponse.fromBuffer(decryptedBytes);
List<stockCount.StockCountSystem> stockcountList = [];
if(responses.success){
if(responses.stockCountSystem.isNotEmpty){
for(var s in responses.stockCountSystem){
stockcountList.add(stockCount.StockCountSystem(stockCountSystemId: s.stockCountId));
}
}
return stockcountList;
}
return stockcountList;
}