我有一个库存表,我想使用材料名称更新数量。请提出更新查询。
final ParseQuery<ParseObject> query = ParseQuery.getQuery("Stock");
query.whereEqualTo("material_name",materialname);
query.getInBackground(materialname, new GetCallback<ParseObject>() {
@Override
public void done(ParseObject object, ParseException e) {
if(e==null) {
String previous_quantity= object.getString("material_quantity");
Integer total=Integer.parseInt(previous_quantity)+Integer.parseInt(quantity_material);
object.put("material_quantity",total.toString());
object.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
}
});
}
else
{
Log.e("Error",e.getLocalizedMessage());
Toast.makeText(Addmaterial_activity.this,"Error"+e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
}
}
});